Skip to content

Commit

Permalink
Build against system GLEW if available
Browse files Browse the repository at this point in the history
  • Loading branch information
linkmauve committed Oct 6, 2018
1 parent 1de24a2 commit bdfd99e
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,23 @@ if (APPLE OR UNIX OR (WIN32 AND (${BONZOMATIC_WINDOWS_FLAVOR} MATCHES "GLFW")))

##############################################################################
# GLEW
set(GLEW_SRCS
${CMAKE_SOURCE_DIR}/external/glew/glew.c
)
add_library(bzc_glew STATIC ${GLEW_SRCS})
target_include_directories(bzc_glew PUBLIC ${CMAKE_SOURCE_DIR}/external/glew)
target_compile_definitions(bzc_glew PUBLIC -DGLEW_STATIC)
if (MSVC)
target_compile_options(bzc_glew PUBLIC "$<$<CONFIG:Release>:/MT>")
pkg_check_modules(GLEW glew)
if (GLEW_FOUND)
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${GLEW_INCLUDES})
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} ${GLEW_LIBRARIES})
else ()
set(GLEW_SRCS
${CMAKE_SOURCE_DIR}/external/glew/glew.c
)
add_library(bzc_glew STATIC ${GLEW_SRCS})
target_include_directories(bzc_glew PUBLIC ${CMAKE_SOURCE_DIR}/external/glew)
target_compile_definitions(bzc_glew PUBLIC -DGLEW_STATIC)
if (MSVC)
target_compile_options(bzc_glew PUBLIC "$<$<CONFIG:Release>:/MT>")
endif ()
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/glew)
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_glew)
endif ()
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} ${CMAKE_SOURCE_DIR}/external/glew)
set(BZC_PROJECT_LIBS ${BZC_PROJECT_LIBS} bzc_glew)
else ()
# for windows, use DirectX
set(BZC_PROJECT_INCLUDES ${BZC_PROJECT_INCLUDES} $ENV{DXSDK_DIR}/Include)
Expand Down

0 comments on commit bdfd99e

Please sign in to comment.