2013-05-24 14:58:38 +00:00
|
|
|
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
|
|
|
|
PROJECT( "glew" )
|
|
|
|
|
|
|
|
SET( SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src )
|
|
|
|
SET( INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include )
|
2013-05-25 13:26:51 +00:00
|
|
|
SET( RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build )
|
2013-05-24 14:58:38 +00:00
|
|
|
|
2014-08-09 18:03:09 +00:00
|
|
|
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
|
|
|
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
|
|
|
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin )
|
2013-05-24 14:58:38 +00:00
|
|
|
|
2015-10-07 05:23:34 +00:00
|
|
|
OPTION( glew-cmake_BUILD_SHARED "Build the shared glew library" ON )
|
|
|
|
OPTION( glew-cmake_BUILD_STATIC "Build the static glew library" ON )
|
2015-10-07 05:21:05 +00:00
|
|
|
OPTION( glew-cmake_BUILD_SINGLE_CONTEXT "Build the single context glew library" ON )
|
|
|
|
OPTION( glew-cmake_BUILD_MULTI_CONTEXT "Build the multi context glew library" ON )
|
2014-04-22 19:55:22 +00:00
|
|
|
|
2013-05-24 14:58:38 +00:00
|
|
|
|
2013-05-25 13:26:51 +00:00
|
|
|
SET( LIBGLEW_SRCS ${SRC_DIR}/glew.c )
|
|
|
|
|
|
|
|
IF( WIN32 )
|
2014-02-26 23:05:11 +00:00
|
|
|
ADD_DEFINITIONS( -DWIN32_MEAN_AND_LEAN -DVC_EXTRALEAN -DGLEW_BUILD -D_CRT_SECURE_NO_WARNINGS )
|
2013-05-25 13:26:51 +00:00
|
|
|
ENDIF( )
|
|
|
|
|
2014-08-16 17:05:12 +00:00
|
|
|
IF( MSVC )
|
2013-05-25 13:26:51 +00:00
|
|
|
LIST( APPEND LIBGLEW_SRCS ${RC_DIR}/glew.rc )
|
|
|
|
ENDIF( )
|
|
|
|
|
2013-05-24 14:58:38 +00:00
|
|
|
IF( NOT USE_GLU )
|
|
|
|
ADD_DEFINITIONS( -DGLEW_NO_GLU )
|
|
|
|
ENDIF( )
|
|
|
|
|
2013-08-31 14:40:43 +00:00
|
|
|
IF( WIN32 )
|
|
|
|
SET( GL_LIBRARY opengl32 )
|
|
|
|
ELSEIF( APPLE )
|
|
|
|
FIND_LIBRARY( GL_LIBRARY OpenGL )
|
2014-08-29 13:45:52 +00:00
|
|
|
FIND_LIBRARY( AGL_LIBRARY AGL )
|
|
|
|
SET( PLATFORM_SPECIFIC_LIBRARIES ${AGL_LIBRARY} )
|
2013-08-31 14:40:43 +00:00
|
|
|
ELSE( )
|
2014-08-29 13:45:52 +00:00
|
|
|
SET( GL_LIBRARY GL )
|
|
|
|
SET( PLATFORM_SPECIFIC_LIBRARIES X11 dl Xext )
|
2013-08-31 14:40:43 +00:00
|
|
|
ENDIF( )
|
|
|
|
|
2014-04-22 19:55:22 +00:00
|
|
|
IF ( glew-cmake_BUILD_STATIC )
|
2015-10-07 05:21:05 +00:00
|
|
|
IF ( glew-cmake_BUILD_SINGLE_CONTEXT )
|
|
|
|
ADD_LIBRARY( libglew_static STATIC ${LIBGLEW_SRCS} )
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES( libglew_static PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_NAME "glew"
|
|
|
|
DEBUG_POSTFIX d )
|
2017-03-02 15:48:35 +00:00
|
|
|
TARGET_INCLUDE_DIRECTORIES( libglew_static PUBLIC ${INCLUDE_DIR} )
|
2015-10-07 05:21:05 +00:00
|
|
|
TARGET_LINK_LIBRARIES( libglew_static ${GL_LIBRARY} ${PLATFORM_SPECIFIC_LIBRARIES} )
|
2019-04-09 21:22:16 +00:00
|
|
|
INSTALL( TARGETS libglew_static ARCHIVE DESTINATION lib )
|
2015-10-07 05:21:05 +00:00
|
|
|
ENDIF ( )
|
|
|
|
|
|
|
|
IF ( glew-cmake_BUILD_MULTI_CONTEXT )
|
|
|
|
ADD_LIBRARY( libglewmx_static STATIC ${LIBGLEW_SRCS} )
|
2014-08-29 13:52:36 +00:00
|
|
|
|
2015-10-07 05:21:05 +00:00
|
|
|
SET_TARGET_PROPERTIES( libglewmx_static PROPERTIES
|
|
|
|
ARCHIVE_OUTPUT_NAME "glewmx"
|
|
|
|
DEBUG_POSTFIX d )
|
|
|
|
TARGET_COMPILE_DEFINITIONS( libglewmx_static INTERFACE GLEW_MX)
|
2017-03-02 15:48:35 +00:00
|
|
|
TARGET_INCLUDE_DIRECTORIES( libglewmx_static PUBLIC ${INCLUDE_DIR} )
|
2015-10-07 05:21:05 +00:00
|
|
|
TARGET_LINK_LIBRARIES( libglewmx_static ${GL_LIBRARY} ${PLATFORM_SPECIFIC_LIBRARIES} )
|
2019-04-09 21:22:16 +00:00
|
|
|
INSTALL( TARGETS libglewmx_static ARCHIVE DESTINATION lib )
|
2015-10-07 05:21:05 +00:00
|
|
|
ENDIF ( )
|
2014-04-22 19:55:22 +00:00
|
|
|
ENDIF ( )
|
2013-05-24 14:58:38 +00:00
|
|
|
|
2014-04-22 19:55:22 +00:00
|
|
|
IF ( glew-cmake_BUILD_SHARED )
|
2015-10-07 05:21:05 +00:00
|
|
|
IF ( glew-cmake_BUILD_SINGLE_CONTEXT )
|
|
|
|
ADD_LIBRARY( libglew_shared SHARED ${LIBGLEW_SRCS} )
|
2014-08-29 13:52:36 +00:00
|
|
|
|
2015-10-07 05:21:05 +00:00
|
|
|
SET_TARGET_PROPERTIES( libglew_shared PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_NAME "glew"
|
|
|
|
LIBRARY_OUTPUT_NAME "glew"
|
|
|
|
DEBUG_POSTFIX d )
|
|
|
|
|
2017-03-02 15:48:35 +00:00
|
|
|
TARGET_INCLUDE_DIRECTORIES( libglew_shared PUBLIC ${INCLUDE_DIR} )
|
2015-10-07 05:21:05 +00:00
|
|
|
TARGET_LINK_LIBRARIES( libglew_shared ${GL_LIBRARY} ${PLATFORM_SPECIFIC_LIBRARIES} )
|
2019-04-09 21:59:48 +00:00
|
|
|
INSTALL( TARGETS libglew_shared ARCHIVE DESTINATION lib
|
2019-04-29 01:36:35 +00:00
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
RUNTIME DESTINATION bin )
|
2015-10-07 05:21:05 +00:00
|
|
|
ENDIF ( )
|
|
|
|
|
|
|
|
IF ( glew-cmake_BUILD_MULTI_CONTEXT )
|
|
|
|
ADD_LIBRARY( libglewmx_shared SHARED ${LIBGLEW_SRCS} )
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES( libglewmx_shared PROPERTIES
|
|
|
|
RUNTIME_OUTPUT_NAME "glewmx"
|
|
|
|
LIBRARY_OUTPUT_NAME "glewmx"
|
|
|
|
DEBUG_POSTFIX d )
|
2014-04-22 19:55:22 +00:00
|
|
|
|
2017-03-02 15:48:35 +00:00
|
|
|
TARGET_COMPILE_DEFINITIONS( libglewmx_shared INTERFACE GLEW_MX)
|
|
|
|
TARGET_INCLUDE_DIRECTORIES( libglewmx_shared PUBLIC ${INCLUDE_DIR} )
|
2015-10-07 05:21:05 +00:00
|
|
|
TARGET_LINK_LIBRARIES( libglewmx_shared ${GL_LIBRARY} ${PLATFORM_SPECIFIC_LIBRARIES} )
|
2019-04-09 21:59:48 +00:00
|
|
|
INSTALL( TARGETS libglewmx_shared ARCHIVE DESTINATION lib
|
2019-04-29 01:36:35 +00:00
|
|
|
LIBRARY DESTINATION lib
|
|
|
|
RUNTIME DESTINATION bin )
|
2015-10-07 05:21:05 +00:00
|
|
|
ENDIF ( )
|
2014-04-22 19:55:22 +00:00
|
|
|
ENDIF ( )
|
2013-08-31 14:40:43 +00:00
|
|
|
|
2014-08-13 07:50:43 +00:00
|
|
|
FILE( GLOB PUBLIC_HEADERS "include/GL/*.h" )
|
|
|
|
INSTALL( FILES ${PUBLIC_HEADERS} DESTINATION include/GL/ )
|
2014-08-11 21:56:04 +00:00
|
|
|
|
2013-05-25 05:34:35 +00:00
|
|
|
IF( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR} AND NOT ONLY_LIBS )
|
2013-05-25 13:26:51 +00:00
|
|
|
SET( GLEWINFO_SRCS ${SRC_DIR}/glewinfo.c )
|
|
|
|
SET( VISUALINFO_SRCS ${SRC_DIR}/visualinfo.c )
|
|
|
|
IF( MSVS )
|
|
|
|
LIST( APPEND GLEWINFO_SRCS ${RC_DIR}/glewinfo.rc )
|
|
|
|
LIST( APPEND VISUALINFO_SRCS ${RC_DIR}/visualinfo.rc )
|
|
|
|
ENDIF( )
|
2014-04-22 19:55:22 +00:00
|
|
|
|
2013-05-25 13:26:51 +00:00
|
|
|
ADD_EXECUTABLE( glewinfo ${GLEWINFO_SRCS} )
|
|
|
|
ADD_EXECUTABLE( visualinfo ${VISUALINFO_SRCS} )
|
2013-05-24 14:58:38 +00:00
|
|
|
|
2014-04-22 19:55:22 +00:00
|
|
|
IF ( glew-cmake_BUILD_STATIC )
|
2014-08-29 13:43:24 +00:00
|
|
|
TARGET_LINK_LIBRARIES( glewinfo libglew_static )
|
|
|
|
TARGET_LINK_LIBRARIES( visualinfo libglew_static )
|
|
|
|
ELSE ( )
|
|
|
|
TARGET_LINK_LIBRARIES( glewinfo libglew_shared )
|
|
|
|
TARGET_LINK_LIBRARIES( visualinfo libglew_shared )
|
2014-04-22 19:55:22 +00:00
|
|
|
ENDIF ( )
|
2014-08-11 21:56:04 +00:00
|
|
|
|
2014-08-13 07:49:51 +00:00
|
|
|
INSTALL( TARGETS glewinfo visualinfo DESTINATION bin )
|
2013-05-24 14:58:38 +00:00
|
|
|
ENDIF( )
|