Windows support

* some definitions
* rc file (except VS11)
This commit is contained in:
Gyu-sun Youm 2013-05-25 22:26:51 +09:00
parent 0c0532c7c6
commit e080154dc4

View File

@ -3,6 +3,7 @@ PROJECT( "glew" )
SET( SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src ) SET( SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src )
SET( INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include ) SET( INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include )
SET( RC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib ) SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib ) SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib )
@ -10,23 +11,41 @@ SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin )
INCLUDE_DIRECTORIES( ${INCLUDE_DIR} ) INCLUDE_DIRECTORIES( ${INCLUDE_DIR} )
SET( LIBGLEW_SRCS ${SRC_DIR}/glew.c )
IF( WIN32 )
ADD_DEFINITIONS( -DWIN32_MEAN_AND_LEAN -DVC_EXTRALEAN -DGLEW_BUILD )
ENDIF( )
# MSVC11
IF( MSVC AND NOT MSVC11 )
LIST( APPEND LIBGLEW_SRCS ${RC_DIR}/glew.rc )
ENDIF( )
IF( NOT USE_GLU ) IF( NOT USE_GLU )
ADD_DEFINITIONS( -DGLEW_NO_GLU ) ADD_DEFINITIONS( -DGLEW_NO_GLU )
ENDIF( ) ENDIF( )
ADD_LIBRARY( libglew_static STATIC ${SRC_DIR}/glew.c ) ADD_LIBRARY( libglew_static STATIC ${LIBGLEW_SRCS} )
ADD_LIBRARY( libglew_shared SHARED ${SRC_DIR}/glew.c ) ADD_LIBRARY( libglew_shared SHARED ${LIBGLEW_SRCS} )
SET_PROPERTY( TARGET libglew_static PROPERTY ARCHIVE_OUTPUT_NAME "libglew" ) SET_PROPERTY( TARGET libglew_static PROPERTY ARCHIVE_OUTPUT_NAME "libglew" )
IF( WIN32 ) IF( WIN32 )
SET_PROPERTY( TARGET libglew_shared PROPERTY RUNTIME_OUTPUT_NAME "glew" ) SET_PROPERTY( TARGET libglew_shared PROPERTY RUNTIME_OUTPUT_NAME "glew" )
TARGET_LINK_LIBRARIES( libglew_shared opengl32 )
ELSE( ) ELSE( )
SET_PROPERTY( TARGET libglew_shared PROPERTY LIBRARY_OUTPUT_NAME "libglew" ) SET_PROPERTY( TARGET libglew_shared PROPERTY LIBRARY_OUTPUT_NAME "libglew" )
ENDIF( ) ENDIF( )
IF( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR} AND NOT ONLY_LIBS ) IF( ${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR} AND NOT ONLY_LIBS )
ADD_EXECUTABLE( glewinfo ${SRC_DIR}/glewinfo.c ) SET( GLEWINFO_SRCS ${SRC_DIR}/glewinfo.c )
ADD_EXECUTABLE( visualinfo ${SRC_DIR}/visualinfo.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( )
ADD_EXECUTABLE( glewinfo ${GLEWINFO_SRCS} )
ADD_EXECUTABLE( visualinfo ${VISUALINFO_SRCS} )
IF( UNIX ) IF( UNIX )
SET( GL_LIBRARY GL ) SET( GL_LIBRARY GL )