X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=CMakeLists.txt;h=c39f2befc1c6a6c762c71f22e09d6a703300df1b;hb=f2582ac6c7d21fb7f96818f7c4f21d14f43cfa4d;hp=bf773547fca9d73a0ef52d295b55116cf9ca2e7a;hpb=1ae540a1277e34572b9cbf92065bab52ede1f0f7;p=freeglut diff --git a/CMakeLists.txt b/CMakeLists.txt index bf77354..c39f2be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,8 @@ SET(FREEGLUT_SRCS IF(WIN32) LIST(APPEND FREEGLUT_SRCS + src/Common/xparsegeometry_repl.c + src/Common/xparsegeometry_repl.h src/mswin/freeglut_cursor_mswin.c src/mswin/freeglut_display_mswin.c src/mswin/freeglut_ext_mswin.c @@ -85,9 +87,13 @@ OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON) OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON) FIND_PACKAGE(OpenGL REQUIRED) -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include ${OPENGL_INCLUDE_DIR}) +INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR}) LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) -LIST(APPEND LIBS m) + +# lib m for math, not needed on windows +IF (NOT WIN32) + LIST(APPEND LIBS m) +ENDIF() IF(WIN32) MESSAGE(WARNING "Insecure CRT warnings hidden (might want to fix these)") @@ -123,12 +129,14 @@ CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) CHECK_INCLUDE_FILES(errno.h HAVE_ERRNO_H) CHECK_INCLUDE_FILES(usbhid.h HAVE_USBHID_H) CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) +CHECK_FUNCTION_EXISTS(vfprintf HAVE_VFPRINTF) +CHECK_FUNCTION_EXISTS(_doprnt HAVE_DOPRNT) # The generated config.h is placed in the project's build directory, just to # ensure that all CMake-generated files are kept away from the main source tree. # As a result, the build directory must to be added to the include path list. CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h) -INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) +INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) ADD_DEFINITIONS(-DHAVE_CONFIG_H) # by default, at least on UNIX, we want to build both @@ -141,6 +149,7 @@ ENDIF() IF(WIN32) + LIST(APPEND LIBS winmm) IF(BUILD_SHARED_LIBS) LIST(APPEND FREEGLUT_SRCS src/Common/freeglutdll.def freeglut.rc) # XXX I assume that if we want both shared and static this one is appropriate @@ -150,14 +159,20 @@ IF(WIN32) ENDIF() ELSE() # on UNIX we need to make sure: - # - all shared libraries must have a soname/version + # - all shared libraries must have a soname/version (see + # http://sourceware.org/autobook/autobook/autobook_91.html#SEC91) # - the output library should be named glut so it'll be linkable with -lglut # - the shared library should link to the dependency libraries so that the user # won't have to link them explicitly (they shouldn't have to know that we depend # on Xrandr or Xxf86vm) SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME glut) SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME glut) - TARGET_LINK_LIBRARIES(freeglut ${LIBS}) +ENDIF() +IF(BUILD_SHARED_LIBS) + TARGET_LINK_LIBRARIES(freeglut ${LIBS}) +ENDIF() +IF(BUILD_STATIC_LIBS) + TARGET_LINK_LIBRARIES(freeglut_static ${LIBS}) ENDIF() IF(BUILD_SHARED_LIBS) @@ -174,17 +189,22 @@ INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL) option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON ) SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS}) -LIST(APPEND DEMO_LIBS m) +# lib m for math, not needed on windows +IF (NOT WIN32) + LIST(APPEND DEMO_LIBS m) +ENDIF() MACRO(ADD_DEMO name) - if( FREEGLUT_BUILD_DEMOS ) - ADD_EXECUTABLE(${name} ${ARGN}) - IF(BUILD_SHARED_LIBS) - TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut) - ELSE() - TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut_static) - ENDIF() - endif() + IF( FREEGLUT_BUILD_DEMOS ) + IF(BUILD_SHARED_LIBS) + ADD_EXECUTABLE(${name} ${ARGN}) + TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut) + ENDIF() + IF(BUILD_STATIC_LIBS) + ADD_EXECUTABLE(${name}_static ${ARGN}) + TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static) + ENDIF() + ENDIF() ENDMACRO() ADD_DEMO(CallbackMaker progs/demos/CallbackMaker/CallbackMaker.c) @@ -199,5 +219,4 @@ ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c progs/demos/spaceball/vmath.c progs/demos/spaceball/vmath.h) ADD_DEMO(subwin progs/demos/subwin/subwin.c) - - +ADD_DEMO(timer progs/demos/timer/timer.c)