1 CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR)
4 # for multiarch LIBDIR support (requires cmake>=2.8.8)
5 INCLUDE(GNUInstallDirs)
7 # NOTE: On Windows and Cygwin, the dll's are placed in the
8 # CMAKE_RUNTIME_OUTPUT_DIRECTORY, while their corresponding import
9 # libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY. On other
10 # platforms, such as Linux, the shared libraries are put in
11 # CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.
12 # Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all
14 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
15 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
16 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
18 # setup version numbers
19 # XXX: Update these for each release!
23 set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
25 # Update fg_version.h to match the versions number here in cmake
26 CONFIGURE_FILE(src/fg_version.h.in src/fg_version.h)
28 # shared lib version numbers (XXX: change before release)
29 set(SO_MAJOR 3) # increment on backwards incompatible API/ABI changes
30 set(SO_MINOR 11) # increment on backwards compatible API additions
31 set(SO_REV 1) # increment if only internal changes happened between releases
33 # FREEGLUT_BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
34 # re-declare it here so it will show up in the GUI.
35 # by default, we want to build both
36 OPTION(FREEGLUT_BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
37 OPTION(FREEGLUT_BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
39 # option for whether warnings and errors should be printed
40 OPTION(FREEGLUT_PRINT_ERRORS "Lib prints errors to stderr" ON)
41 #MARK_AS_ADVANCED(FREEGLUT_PRINT_ERRORS)
42 OPTION(FREEGLUT_PRINT_WARNINGS "Lib prints warnings to stderr" ON)
43 #MARK_AS_ADVANCED(FREEGLUT_PRINT_WARNINGS)
45 # option to also copy .pdb files to install directory when executing
48 OPTION(INSTALL_PDB "Also install .pdb files" ON)
55 OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" ON)
57 OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
60 # option to build either as "glut" (ON) or "freeglut" (OFF)
62 OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" OFF)
64 OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
69 OPTION(FREEGLUT_WAYLAND "Use Wayland (no X11)" OFF)
75 include/GL/freeglut_ucall.h
76 include/GL/freeglut_ext.h
77 include/GL/freeglut_std.h
79 IF(FREEGLUT_REPLACE_GLUT)
80 LIST(APPEND FREEGLUT_HEADERS
98 src/fg_callback_macros.h
99 src/fg_input_devices.c
106 src/fg_stroke_mono_roman.c
107 src/fg_stroke_roman.c
114 # TODO: OpenGL ES requires a compatible version of these files:
115 IF(NOT FREEGLUT_GLES)
116 LIST(APPEND FREEGLUT_SRCS
121 LIST(APPEND FREEGLUT_SRCS
127 LIST(APPEND FREEGLUT_SRCS
128 src/mswin/fg_cursor_mswin.c
129 src/mswin/fg_display_mswin.c
130 src/mswin/fg_ext_mswin.c
131 src/mswin/fg_gamemode_mswin.c
132 src/mswin/fg_init_mswin.c
133 src/mswin/fg_internal_mswin.h
134 src/mswin/fg_input_devices_mswin.c
135 src/mswin/fg_joystick_mswin.c
136 src/mswin/fg_main_mswin.c
137 src/mswin/fg_menu_mswin.c
138 src/mswin/fg_spaceball_mswin.c
139 src/mswin/fg_state_mswin.c
140 src/mswin/fg_structure_mswin.c
141 src/mswin/fg_window_mswin.c
142 ${CMAKE_BINARY_DIR}/freeglut.rc # generated below from freeglut.rc.in
144 IF (MSVC AND NOT CMAKE_CL_64)
145 # .def file only for 32bit Windows builds (TODO: MSVC only right
146 # now, needed for any other Windows platform?)
147 LIST(APPEND FREEGLUT_SRCS
148 ${CMAKE_BINARY_DIR}/freeglutdll.def # generated below from src/freeglutdll.def.in
152 ELSEIF(ANDROID OR BLACKBERRY)
153 # BlackBerry and Android share some similar design concepts and ideas, as with many mobile devices.
154 # As such, some classes can be shared between the two. XXX: Possibly rename shareable classes to
155 # a more generic name. *_stub? *_mobile?
156 LIST(APPEND FREEGLUT_SRCS
157 src/android/fg_cursor_android.c
158 src/android/fg_ext_android.c
159 src/android/fg_gamemode_android.c
160 src/android/fg_joystick_android.c
161 src/android/fg_spaceball_android.c
164 LIST(APPEND FREEGLUT_SRCS
165 src/android/native_app_glue/android_native_app_glue.c
166 src/android/native_app_glue/android_native_app_glue.h
167 src/android/fg_internal_android.h
168 src/android/fg_init_android.c
169 src/android/fg_input_devices_android.c
170 src/android/fg_main_android.c
171 src/android/fg_main_android.h
172 src/android/fg_runtime_android.c
173 src/android/fg_state_android.c
174 src/android/fg_structure_android.c
175 src/android/fg_window_android.c
178 LIST(APPEND FREEGLUT_SRCS
179 src/blackberry/fg_internal_blackberry.h
180 src/blackberry/fg_init_blackberry.c
181 src/x11/fg_input_devices_x11.c
182 src/blackberry/fg_main_blackberry.c
183 src/blackberry/fg_state_blackberry.c
184 src/blackberry/fg_structure_blackberry.c
185 src/blackberry/fg_window_blackberry.c
192 LIST(APPEND FREEGLUT_SRCS
193 src/wayland/fg_cursor_wl.c
194 src/wayland/fg_ext_wl.c
195 src/wayland/fg_gamemode_wl.c
196 src/wayland/fg_init_wl.c
197 src/wayland/fg_internal_wl.h
198 src/wayland/fg_input_devices_wl.c
199 src/wayland/fg_main_wl.c
200 src/wayland/fg_state_wl.c
201 src/wayland/fg_structure_wl.c
202 src/wayland/fg_window_wl.c
203 # font, serial port & joystick code are agnostic
204 src/x11/fg_glutfont_definitions_x11.c
205 src/x11/fg_input_devices_x11.c
206 src/x11/fg_joystick_x11.c
210 LIST(APPEND FREEGLUT_SRCS
211 src/x11/fg_cursor_x11.c
213 src/x11/fg_gamemode_x11.c
214 src/x11/fg_glutfont_definitions_x11.c
215 src/x11/fg_init_x11.c
216 src/x11/fg_internal_x11.h
217 src/x11/fg_input_devices_x11.c
218 src/x11/fg_joystick_x11.c
219 src/x11/fg_main_x11.c
220 src/x11/fg_menu_x11.c
221 src/x11/fg_spaceball_x11.c
222 src/x11/fg_state_x11.c
223 src/x11/fg_structure_x11.c
224 src/x11/fg_window_x11.c
225 src/x11/fg_xinput_x11.c
227 IF(NOT(FREEGLUT_GLES))
228 LIST(APPEND FREEGLUT_SRCS
229 src/x11/fg_internal_x11_glx.h
230 src/x11/fg_display_x11_glx.c
231 src/x11/fg_state_x11_glx.c
232 src/x11/fg_state_x11_glx.h
233 src/x11/fg_window_x11_glx.c
234 src/x11/fg_window_x11_glx.h
240 # OpenGL ES requires EGL, and so does Wayland
241 IF(FREEGLUT_GLES OR FREEGLUT_WAYLAND)
242 LIST(APPEND FREEGLUT_SRCS
243 src/egl/fg_internal_egl.h
244 src/egl/fg_display_egl.c
246 src/egl/fg_init_egl.c
247 src/egl/fg_init_egl.h
248 src/egl/fg_state_egl.c
249 src/egl/fg_state_egl.h
250 src/egl/fg_structure_egl.c
251 src/egl/fg_structure_egl.h
252 src/egl/fg_window_egl.c
253 src/egl/fg_window_egl.h
257 # For OpenGL ES (GLES): compile with -DFREEGLUT_GLES to cleanly
258 # bootstrap headers inclusion in freeglut_std.h; this constant also
259 # need to be defined in client applications (e.g. through pkg-config),
260 # but do use GLES constants directly for all other needs
261 # GLES1 and GLES2 libraries are compatible and can be co-linked.
263 LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES)
264 LIST(APPEND LIBS GLESv2 GLESv1_CM EGL)
266 FIND_PACKAGE(OpenGL REQUIRED)
267 LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
268 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
271 # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL
273 ADD_DEFINITIONS(-DFREEGLUT_WAYLAND)
274 LIST(APPEND LIBS wayland-client wayland-cursor wayland-egl EGL xkbcommon)
277 # lib m for math, not needed on windows
281 # For CHECK_FUNCTION_EXISTS:
282 LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
286 # hide insecure CRT warnings, common practice
287 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
289 SET( CMAKE_DEBUG_POSTFIX "d" )
292 IF(NOT(MSVC_VERSION LESS "1600"))
293 # minimum requirement for WM_TOUCH device
294 ADD_DEFINITIONS(-D_WIN32_WINNT=0x0601)
295 ADD_DEFINITIONS(-DWINVER=0x0601)
296 ELSEIF(NOT(MSVC_VERSION LESS "1300"))
297 # minimum requirement for spaceball device
298 ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
299 ADD_DEFINITIONS(-DWINVER=0x0501)
301 # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
302 ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
303 ADD_DEFINITIONS(-DWINVER=0x0500)
308 IF(CMAKE_COMPILER_IS_GNUCC)
309 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
310 IF(NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
311 # not setting -ansi as EGL/KHR headers doesn't support it
312 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
314 ENDIF(CMAKE_COMPILER_IS_GNUCC)
316 INCLUDE(CheckIncludeFiles)
317 IF(UNIX AND NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
318 FIND_PACKAGE(X11 REQUIRED)
319 INCLUDE_DIRECTORIES(${X11_X11_INCLUDE_PATH})
320 LIST(APPEND LIBS ${X11_X11_LIB})
322 SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
323 LIST(APPEND LIBS ${X11_Xrandr_LIB})
325 IF(X11_xf86vmode_FOUND)
326 SET(HAVE_X11_EXTENSIONS_XF86VMODE_H TRUE)
327 LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
330 # Needed for multi-touch:
331 CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H)
332 LIST(APPEND LIBS ${X11_Xinput_LIB})
334 MESSAGE(FATAL_ERROR "Missing X11's XInput.h (X11/extensions/XInput.h)")
338 # -landroid for ANativeWindow
339 # -llog for native Android logging
340 LIST(APPEND LIBS android log)
342 # -lbps for event loop
343 # -screen for native screen
344 LIST(APPEND LIBS bps screen)
347 # -lslog2 for logging
348 # -pps for low-level screen manipulation
349 LIST(APPEND LIBS slog2 pps)
353 INCLUDE(CheckFunctionExists)
354 INCLUDE(CheckTypeSize)
355 INCLUDE(CheckCCompilerFlag)
356 CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
357 CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
358 CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
359 CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)
360 CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H)
361 CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)
362 CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)
363 CHECK_INCLUDE_FILES(usbhid.h HAVE_USBHID_H)
364 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
365 CHECK_FUNCTION_EXISTS(XParseGeometry HAVE_XPARSEGEOMETRY)
366 IF (NOT HAVE_XPARSEGEOMETRY)
367 LIST(APPEND FREEGLUT_SRCS
368 src/util/xparsegeometry_repl.c
369 src/util/xparsegeometry_repl.h)
370 SET(NEED_XPARSEGEOMETRY_IMPL TRUE)
372 # decide on suitable type for internal time keeping, 64-bit if possible
373 CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
374 CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
375 IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H))
377 # Some old Microsoft VC releases don't support unsigned long
378 # long, but all we care about is support for unsigned __int64 on
379 # MSVC, so test for presence of that type
380 CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY)
382 CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY)
386 # The generated config.h is placed in the project's build directory, just to
387 # ensure that all CMake-generated files are kept away from the main source tree.
388 # As a result, the build directory must to be added to the include path list.
389 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
390 INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
391 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
393 # we also have to generate freeglut.rc, which contains the version
395 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.rc.in ${CMAKE_BINARY_DIR}/freeglut.rc)
396 IF (MSVC AND NOT CMAKE_CL_64)
397 # .def file only for 32bit Windows builds with Visual Studio
398 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/freeglutdll.def.in ${CMAKE_BINARY_DIR}/freeglutdll.def)
402 IF(FREEGLUT_BUILD_SHARED_LIBS)
403 ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
405 IF(FREEGLUT_BUILD_STATIC_LIBS)
406 ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS})
410 SET(LIBNAME freeglut)
412 IF(FREEGLUT_REPLACE_GLUT)
416 LIST(APPEND LIBS winmm)
417 IF(FREEGLUT_BUILD_SHARED_LIBS)
418 TARGET_COMPILE_DEFINITIONS(freeglut PRIVATE FREEGLUT_EXPORTS)
419 SET_TARGET_PROPERTIES(freeglut PROPERTIES OUTPUT_NAME ${LIBNAME})
421 IF(FREEGLUT_BUILD_STATIC_LIBS)
422 TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC FREEGLUT_STATIC)
423 IF(FREEGLUT_REPLACE_GLUT)
424 SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
426 # need to set machine:x64 for linker, at least for VC10, and
427 # doesn't hurt for older compilers:
428 # http://public.kitware.com/Bug/view.php?id=11240#c22768
430 SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
434 # on UNIX we need to make sure:
435 # - all shared libraries must have a soname/version, see :
436 # http://sourceware.org/autobook/autobook/autobook_91.html#SEC91
437 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
438 # Current: -version-info 12:0:9 -> 3.9.0
439 # Note: most platforms now prefer the latter major.minor.revision form
440 # (e.g. FreeBSD, cf. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8765),
441 # or special-cased FreeGLUT long ago (e.g. .so.4 on OpenBSD), so
442 # the lack of support for current:revision:age in CMake should
444 # - the output library should be named glut so it'll be linkable with -lglut
445 # (unless FREEGLUT_REPLACE_GLUT is false).
446 # - the shared library should link to the dependency libraries so that the user
447 # won't have to link them explicitly (they shouldn't have to know that we depend
448 # on Xrandr or Xxf86vm)
450 SET(LIBNAME freeglut-gles)
452 IF(FREEGLUT_REPLACE_GLUT)
457 IF(FREEGLUT_BUILD_SHARED_LIBS)
458 SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION ${SO_MAJOR}.${SO_MINOR}.${SO_REV} SOVERSION ${SO_MAJOR} OUTPUT_NAME ${LIBNAME})
460 IF(FREEGLUT_BUILD_STATIC_LIBS)
461 SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
464 # Not in CMake toolchain file, because the toolchain
465 # file is called several times and generally doesn't
466 # seem to be meant for modifying CFLAGS:
467 # '-mandroid' is not mandatory but doesn't hurt
468 # '-O0 -gstabs+' helps the currently buggy GDB port
469 # Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid")
470 # Not using _INIT variables, they seem to be used internally only
471 IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
472 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid")
474 CHECK_C_COMPILER_FLAG(-O0 HAVE_O0_FLAG)
476 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")
478 CHECK_C_COMPILER_FLAG(-gstabs+ HAVE_GSTABSP_FLAG)
479 IF(HAVE_gstabsp_FLAG)
480 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gstabs+")
484 IF(FREEGLUT_BUILD_SHARED_LIBS)
485 TARGET_LINK_LIBRARIES(freeglut ${LIBS})
486 TARGET_COMPILE_DEFINITIONS(freeglut PUBLIC ${PUBLIC_DEFINITIONS})
488 IF(FREEGLUT_BUILD_STATIC_LIBS)
489 TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
490 TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC ${PUBLIC_DEFINITIONS})
493 IF(FREEGLUT_BUILD_SHARED_LIBS)
494 INSTALL(TARGETS freeglut EXPORT FreeGLUTTargets
495 RUNTIME DESTINATION bin
496 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
497 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
498 INCLUDES DESTINATION include
501 IF(CMAKE_GENERATOR MATCHES "^Visual Studio")
502 INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb
507 INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/freeglut${CMAKE_DEBUG_POSTFIX}.pdb
514 IF(FREEGLUT_BUILD_STATIC_LIBS)
515 INSTALL(TARGETS freeglut_static EXPORT FreeGLUTTargets
516 RUNTIME DESTINATION bin
517 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
518 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
519 INCLUDES DESTINATION include
522 INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel)
526 # Optionally build demos, on by default.
527 option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON )
529 SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS})
530 # lib m for math, not needed on windows
532 LIST(APPEND DEMO_LIBS m)
536 IF( FREEGLUT_BUILD_DEMOS )
537 IF(FREEGLUT_BUILD_SHARED_LIBS)
538 ADD_EXECUTABLE(${name} ${ARGN})
539 TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
541 SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
544 IF(FREEGLUT_BUILD_STATIC_LIBS)
545 ADD_EXECUTABLE(${name}_static ${ARGN})
546 TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
548 SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
554 ADD_DEMO(CallbackMaker progs/demos/CallbackMaker/CallbackMaker.c)
555 ADD_DEMO(Fractals progs/demos/Fractals/fractals.c)
556 ADD_DEMO(Fractals_random progs/demos/Fractals_random/fractals_random.c)
557 ADD_DEMO(Lorenz progs/demos/Lorenz/lorenz.c)
559 ADD_DEMO(One progs/demos/One/one.c)
561 ADD_DEMO(One progs/demos/One/one.c
562 progs/demos/One/one.rc)
564 ADD_DEMO(Resizer progs/demos/Resizer/Resizer.cpp)
565 ADD_DEMO(multi-touch progs/demos/multi-touch/multi-touch.c)
566 ADD_DEMO(shapes progs/demos/shapes/shapes.c
567 progs/demos/shapes/glmatrix.h
568 progs/demos/shapes/glmatrix.c)
569 ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c)
571 ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c
572 progs/demos/spaceball/vmath.c
573 progs/demos/spaceball/vmath.h)
575 ADD_DEMO(subwin progs/demos/subwin/subwin.c)
576 ADD_DEMO(timer progs/demos/timer/timer.c)
577 ADD_DEMO(timer_callback progs/demos/timer_callback/timer.c)
581 # pkg-config support, to install at $(libdir)/pkgconfig
582 # Define static build dependencies
584 SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm")
585 ELSEIF(FREEGLUT_GLES)
587 SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lGLESv1_CM -lEGL -lm")
590 SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
592 SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
594 ELSEIF(FREEGLUT_WAYLAND)
595 SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGLESv2 -lGLESv1_CM -lEGL -lxkbcommon -lm")
597 SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm")
601 SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGL -lxkbcommon -lm")
603 SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
606 # Client applications need to define FreeGLUT GLES version to
607 # bootstrap headers inclusion in freeglut_std.h:
608 SET(PC_LIBNAME ${LIBNAME})
609 SET(PC_FILENAME "${LIBNAME}.pc")
611 SET(PC_CFLAGS "-DFREEGLUT_GLES")
613 IF(FREEGLUT_BUILD_STATIC_LIBS)
614 LIST(APPEND PC_CFLAGS -DFREEGLUT_STATIC)
616 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
617 INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME} COMPONENT Devel)
618 # TODO: change the library and .pc name when building for GLES,
621 INCLUDE(CMakePackageConfigHelpers)
622 WRITE_BASIC_PACKAGE_VERSION_FILE(
623 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake"
625 COMPATIBILITY AnyNewerVersion
628 # needs cmake 3.0 (as does the "INCLUDES DIRECTORY" argument to install(TARGETS)):
629 EXPORT(EXPORT FreeGLUTTargets
630 FILE "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTTargets.cmake"
633 CONFIGURE_FILE(FreeGLUTConfig.cmake.in
634 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake"
637 SET(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/FreeGLUT)
638 INSTALL(EXPORT FreeGLUTTargets
639 FILE FreeGLUTTargets.cmake
641 DESTINATION ${ConfigPackageLocation}
645 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake"
646 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake"
647 DESTINATION ${ConfigPackageLocation}