X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;ds=sidebyside;f=CMakeLists.txt;h=2277d70ef0f9a807b5f59a28b7116b167122fd4e;hb=89b2d18e3747f0190bcb3dd5ccb48c7b8d186e48;hp=39febb22e97af8417b8362fc9cdcd75997122c04;hpb=0e653a9d94fec583f7a4172b721c1c599e06cbc8;p=freeglut diff --git a/CMakeLists.txt b/CMakeLists.txt index 39febb2..2277d70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) # platforms, such as Linux, the shared libraries are put in # CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead. # Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all -# platforms (unless +# platforms. SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) @@ -97,7 +97,8 @@ IF(WIN32) ${CMAKE_BINARY_DIR}/freeglut.rc # generated below from freeglut.rc.in ) IF (MSVC AND NOT CMAKE_CL_64) - # .def file only for 32bit Windows builds + # .def file only for 32bit Windows builds (TODO: MSVC only right + # now, needed for any other Windows platform?) LIST(APPEND FREEGLUT_SRCS ${CMAKE_BINARY_DIR}/freeglutdll.def # generated below from src/freeglutdll.def.in ) @@ -145,6 +146,7 @@ ELSE() src/x11/fg_internal_x11_glx.h src/x11/fg_display_x11_glx.c src/x11/fg_state_x11_glx.c + src/x11/fg_state_x11_glx.h src/x11/fg_window_x11_glx.c src/x11/fg_window_x11_glx.h ) @@ -169,7 +171,7 @@ ENDIF() # For OpenGL ES (GLES): # - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly # bootstrap headers inclusion in freeglut_std.h; these constants -# also need to be defined in client applications (e.g through +# also need to be defined in client applications (e.g. through # pkg-config), but use GLES constants directly for all other needs # - define GLES version-specific library IF(FREEGLUT_GLES2) @@ -186,7 +188,10 @@ ENDIF() # lib m for math, not needed on windows IF (NOT WIN32) + # For compilation: LIST(APPEND LIBS m) + # For CHECK_FUNCTION_EXISTS: + LIST(APPEND CMAKE_REQUIRED_LIBRARIES m) ENDIF() IF(WIN32) @@ -202,7 +207,8 @@ IF(CMAKE_COMPILER_IS_GNUCC) ENDIF() ENDIF(CMAKE_COMPILER_IS_GNUCC) -if(UNIX AND NOT ANDROID) +INCLUDE(CheckIncludeFiles) +IF(UNIX AND NOT ANDROID) FIND_PACKAGE(X11 REQUIRED) LIST(APPEND LIBS ${X11_LIBRARIES}) IF(X11_Xrandr_FOUND) @@ -217,9 +223,17 @@ if(UNIX AND NOT ANDROID) ENDIF() LIST(APPEND LIBS ${X11_Xxf86vm_LIB}) ENDIF() + IF(X11_Xinput_FOUND) + CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H) + LIST(APPEND LIBS ${X11_Xinput_LIB}) + ENDIF() +ENDIF() +IF(ANDROID) + # -landroid for ANativeWindow + # -llog for native Android logging + LIST(APPEND LIBS android log) ENDIF() -INCLUDE(CheckIncludeFiles) INCLUDE(CheckFunctionExists) INCLUDE(CheckTypeSize) CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H) @@ -231,6 +245,9 @@ CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H) 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(sinf HAVE_SINF) +CHECK_FUNCTION_EXISTS(cosf HAVE_COSF) +CHECK_FUNCTION_EXISTS(sqrtf HAVE_SQRTF) CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY) CHECK_FUNCTION_EXISTS(vfprintf HAVE_VFPRINTF) CHECK_FUNCTION_EXISTS(_doprnt HAVE_DOPRNT) @@ -246,16 +263,15 @@ CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H) IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H)) IF (MSVC) - # Some old Microsoft VC don't support unsigned long long, but all we - # care about support unsigned __int64, so test for presence of that - # type + # Some old Microsoft VC releases don't support unsigned long + # long, but all we care about is support for unsigned __int64 on + # MSVC, so test for presence of that type CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY) ELSEIF() CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY) ENDIF() ENDIF() - # 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. @@ -300,6 +316,11 @@ ELSE() # http://sourceware.org/autobook/autobook/autobook_91.html#SEC91 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html # Current: -version-info 12:0:9 -> 3.9.0 + # Note: most platforms now prefer the latter major.minor.revision form + # (e.g. FreeBSD, cf. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8765), + # or special-cased FreeGLUT long ago (e.g. .so.4 on OpenBSD), so + # the lack of support for current:revision:age in CMake should + # not be a problem. # - 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 @@ -372,6 +393,7 @@ ADD_DEMO(Fractals_random progs/demos/Fractals_random/fractals_random.c) ADD_DEMO(Lorenz progs/demos/Lorenz/lorenz.c) ADD_DEMO(One progs/demos/One/one.c) ADD_DEMO(Resizer progs/demos/Resizer/Resizer.cpp) +ADD_DEMO(multi-touch progs/demos/multi-touch/multi-touch.c) ADD_DEMO(shapes progs/demos/shapes/shapes.c) ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c) ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c @@ -380,24 +402,7 @@ ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c ADD_DEMO(subwin progs/demos/subwin/subwin.c) ADD_DEMO(timer progs/demos/timer/timer.c) -# finally, if any demos are built, copy needed files to output directory -# (currently, thats just the input file for the Fractals demo) -IF(FREEGLUT_BUILD_DEMOS) - # 1) copy fractals.dat from freeglut/progs/demos/Fractals - IF(BUILD_SHARED_LIBS) - SET(Frac_target Fractals) - ELSE() - SET(Frac_target Fractals_static) - ENDIF() - GET_TARGET_PROPERTY(DEMO_OUTPUT_DIRECTORY ${Frac_target} RUNTIME_OUTPUT_DIRECTORY) - ADD_CUSTOM_COMMAND( - TARGET ${Frac_target} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy - ${PROJECT_SOURCE_DIR}/progs/demos/Fractals/fractals.dat - ${DEMO_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} - ) -ENDIF() + # pkg-config support, to install at $(libdir)/pkgconfig # Define static build dependencies