# 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)
${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
)
# 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)
# 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)
# hide insecure CRT warnings, common practice
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
+ IF(MSVC)
+ SET( CMAKE_DEBUG_POSTFIX "d" )
+ ENDIF(MSVC)
+
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC)
ENDIF()
ENDIF(CMAKE_COMPILER_IS_GNUCC)
+INCLUDE(CheckIncludeFiles)
IF(UNIX AND NOT ANDROID)
FIND_PACKAGE(X11 REQUIRED)
LIST(APPEND LIBS ${X11_LIBRARIES})
ENDIF()
LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
ENDIF()
+ IF(X11_Xinput_FOUND)
+ # Needed for multi-touch:
+ 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
LIST(APPEND LIBS android log)
ENDIF()
-INCLUDE(CheckIncludeFiles)
INCLUDE(CheckFunctionExists)
INCLUDE(CheckTypeSize)
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_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.
# 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
IF(BUILD_SHARED_LIBS)
ADD_EXECUTABLE(${name} ${ARGN})
TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
+ IF(WIN32 AND MSVC)
+ SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
+ ENDIF()
ENDIF()
IF(BUILD_STATIC_LIBS)
ADD_EXECUTABLE(${name}_static ${ARGN})
TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
SET_TARGET_PROPERTIES(${name}_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
+ IF(WIN32 AND MSVC)
+ SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
+ ENDIF()
ENDIF()
ENDIF()
ENDMACRO()
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(shapes progs/demos/shapes/shapes.c)
+ADD_DEMO(multi-touch progs/demos/multi-touch/multi-touch.c)
+ADD_DEMO(shapes progs/demos/shapes/shapes.c
+ progs/demos/shapes/glmatrix.h
+ progs/demos/shapes/glmatrix.c)
ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c)
-ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c
- progs/demos/spaceball/vmath.c
- progs/demos/spaceball/vmath.h)
+IF(UNIX)
+ ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c
+ progs/demos/spaceball/vmath.c
+ progs/demos/spaceball/vmath.h)
+ENDIF()
ADD_DEMO(subwin progs/demos/subwin/subwin.c)
ADD_DEMO(timer progs/demos/timer/timer.c)
+
+
# pkg-config support, to install at $(libdir)/pkgconfig
# Define static build dependencies
IF(WIN32)