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 # TODO: 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 (change before release)
29 set(SO_MAJOR 3) # increment on backwards incompatible API/ABI changes
30 set(SO_MINOR 10) # increment on backwards compatible or internal changes
31 set(SO_REV 0) # if nothing else changed increment this
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)
54 OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
56 # option to build either as "glut" (ON) or "freeglut" (OFF)
58 OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" OFF)
60 OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
65 OPTION(FREEGLUT_WAYLAND "Use Wayland (no X11)" OFF)
71 include/GL/freeglut_ext.h
72 include/GL/freeglut_std.h
74 IF(FREEGLUT_REPLACE_GLUT)
75 LIST(APPEND FREEGLUT_SRCS
93 src/fg_input_devices.c
100 src/fg_stroke_mono_roman.c
101 src/fg_stroke_roman.c
108 # TODO: OpenGL ES requires a compatible version of these files:
109 IF(NOT FREEGLUT_GLES)
110 LIST(APPEND FREEGLUT_SRCS
115 LIST(APPEND FREEGLUT_SRCS
121 LIST(APPEND FREEGLUT_SRCS
122 src/mswin/fg_cursor_mswin.c
123 src/mswin/fg_display_mswin.c
124 src/mswin/fg_ext_mswin.c
125 src/mswin/fg_gamemode_mswin.c
126 src/mswin/fg_init_mswin.c
127 src/mswin/fg_internal_mswin.h
128 src/mswin/fg_input_devices_mswin.c
129 src/mswin/fg_joystick_mswin.c
130 src/mswin/fg_main_mswin.c
131 src/mswin/fg_menu_mswin.c
132 src/mswin/fg_spaceball_mswin.c
133 src/mswin/fg_state_mswin.c
134 src/mswin/fg_structure_mswin.c
135 src/mswin/fg_window_mswin.c
136 ${CMAKE_BINARY_DIR}/freeglut.rc # generated below from freeglut.rc.in
138 IF (MSVC AND NOT CMAKE_CL_64)
139 # .def file only for 32bit Windows builds (TODO: MSVC only right
140 # now, needed for any other Windows platform?)
141 LIST(APPEND FREEGLUT_SRCS
142 ${CMAKE_BINARY_DIR}/freeglutdll.def # generated below from src/freeglutdll.def.in
146 ELSEIF(ANDROID OR BLACKBERRY)
147 # BlackBerry and Android share some similar design concepts and ideas, as with many mobile devices.
148 # As such, some classes can be shared between the two. XXX: Possibly rename shareable classes to
149 # a more generic name. *_stub? *_mobile?
150 LIST(APPEND FREEGLUT_SRCS
151 src/android/fg_cursor_android.c
152 src/android/fg_ext_android.c
153 src/android/fg_gamemode_android.c
154 src/android/fg_joystick_android.c
155 src/android/fg_spaceball_android.c
158 LIST(APPEND FREEGLUT_SRCS
159 src/android/native_app_glue/android_native_app_glue.c
160 src/android/native_app_glue/android_native_app_glue.h
161 src/android/fg_internal_android.h
162 src/android/fg_init_android.c
163 src/android/fg_input_devices_android.c
164 src/android/fg_main_android.c
165 src/android/fg_main_android.h
166 src/android/fg_runtime_android.c
167 src/android/fg_state_android.c
168 src/android/fg_structure_android.c
169 src/android/fg_window_android.c
172 LIST(APPEND FREEGLUT_SRCS
173 src/blackberry/fg_internal_blackberry.h
174 src/blackberry/fg_init_blackberry.c
175 src/x11/fg_input_devices_x11.c
176 src/blackberry/fg_main_blackberry.c
177 src/blackberry/fg_state_blackberry.c
178 src/blackberry/fg_structure_blackberry.c
179 src/blackberry/fg_window_blackberry.c
186 LIST(APPEND FREEGLUT_SRCS
187 src/wayland/fg_cursor_wl.c
188 src/wayland/fg_ext_wl.c
189 src/wayland/fg_gamemode_wl.c
190 src/wayland/fg_init_wl.c
191 src/wayland/fg_internal_wl.h
192 src/wayland/fg_input_devices_wl.c
193 src/wayland/fg_main_wl.c
194 src/wayland/fg_state_wl.c
195 src/wayland/fg_structure_wl.c
196 src/wayland/fg_window_wl.c
197 # font, serial port & joystick code are agnostic
198 src/x11/fg_glutfont_definitions_x11.c
199 src/x11/fg_input_devices_x11.c
200 src/x11/fg_joystick_x11.c
204 LIST(APPEND FREEGLUT_SRCS
205 src/x11/fg_cursor_x11.c
207 src/x11/fg_gamemode_x11.c
208 src/x11/fg_glutfont_definitions_x11.c
209 src/x11/fg_init_x11.c
210 src/x11/fg_internal_x11.h
211 src/x11/fg_input_devices_x11.c
212 src/x11/fg_joystick_x11.c
213 src/x11/fg_main_x11.c
214 src/x11/fg_menu_x11.c
215 src/x11/fg_spaceball_x11.c
216 src/x11/fg_state_x11.c
217 src/x11/fg_structure_x11.c
218 src/x11/fg_window_x11.c
219 src/x11/fg_xinput_x11.c
221 IF(NOT(FREEGLUT_GLES))
222 LIST(APPEND FREEGLUT_SRCS
223 src/x11/fg_internal_x11_glx.h
224 src/x11/fg_display_x11_glx.c
225 src/x11/fg_state_x11_glx.c
226 src/x11/fg_state_x11_glx.h
227 src/x11/fg_window_x11_glx.c
228 src/x11/fg_window_x11_glx.h
234 # OpenGL ES requires EGL, and so does Wayland
235 IF(FREEGLUT_GLES OR FREEGLUT_WAYLAND)
236 LIST(APPEND FREEGLUT_SRCS
237 src/egl/fg_internal_egl.h
238 src/egl/fg_display_egl.c
240 src/egl/fg_init_egl.c
241 src/egl/fg_init_egl.h
242 src/egl/fg_state_egl.c
243 src/egl/fg_state_egl.h
244 src/egl/fg_structure_egl.c
245 src/egl/fg_structure_egl.h
246 src/egl/fg_window_egl.c
247 src/egl/fg_window_egl.h
251 # For OpenGL ES (GLES): compile with -DFREEGLUT_GLES to cleanly
252 # bootstrap headers inclusion in freeglut_std.h; this constant also
253 # need to be defined in client applications (e.g. through pkg-config),
254 # but do use GLES constants directly for all other needs
255 # GLES1 and GLES2 libraries are compatible and can be co-linked.
257 LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES)
258 LIST(APPEND LIBS GLESv2 GLESv1_CM EGL)
260 FIND_PACKAGE(OpenGL REQUIRED)
261 LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
262 INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
265 # For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL
267 ADD_DEFINITIONS(-DFREEGLUT_WAYLAND)
268 LIST(APPEND LIBS wayland-client wayland-cursor wayland-egl EGL xkbcommon)
271 # lib m for math, not needed on windows
275 # For CHECK_FUNCTION_EXISTS:
276 LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
280 # hide insecure CRT warnings, common practice
281 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
283 SET( CMAKE_DEBUG_POSTFIX "d" )
286 IF(NOT(MSVC_VERSION LESS "1600"))
287 # minimum requirement for WM_TOUCH device
288 ADD_DEFINITIONS(-D_WIN32_WINNT=0x0601)
289 ADD_DEFINITIONS(-DWINVER=0x0601)
290 ELSEIF(NOT(MSVC_VERSION LESS "1300"))
291 # minimum requirement for spaceball device
292 ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
293 ADD_DEFINITIONS(-DWINVER=0x0501)
295 # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
296 ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
297 ADD_DEFINITIONS(-DWINVER=0x0500)
302 IF(CMAKE_COMPILER_IS_GNUCC)
303 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
304 IF(NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
305 # not setting -ansi as EGL/KHR headers doesn't support it
306 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
308 ENDIF(CMAKE_COMPILER_IS_GNUCC)
310 INCLUDE(CheckIncludeFiles)
311 IF(UNIX AND NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
312 FIND_PACKAGE(X11 REQUIRED)
313 INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
314 LIST(APPEND LIBS ${X11_LIBRARIES})
316 SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
317 LIST(APPEND LIBS ${X11_Xrandr_LIB})
319 IF(X11_xf86vmode_FOUND)
320 SET(HAVE_X11_EXTENSIONS_XF86VMODE_H TRUE)
321 LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
324 # Needed for multi-touch:
325 CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H)
326 LIST(APPEND LIBS ${X11_Xinput_LIB})
330 # -landroid for ANativeWindow
331 # -llog for native Android logging
332 LIST(APPEND LIBS android log)
334 # -lbps for event loop
335 # -screen for native screen
336 LIST(APPEND LIBS bps screen)
339 # -lslog2 for logging
340 # -pps for low-level screen manipulation
341 LIST(APPEND LIBS slog2 pps)
345 INCLUDE(CheckFunctionExists)
346 INCLUDE(CheckTypeSize)
347 CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
348 CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
349 CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
350 CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)
351 CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H)
352 CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)
353 CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)
354 CHECK_INCLUDE_FILES(usbhid.h HAVE_USBHID_H)
355 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
356 CHECK_FUNCTION_EXISTS(XParseGeometry HAVE_XPARSEGEOMETRY)
357 IF (NOT HAVE_XPARSEGEOMETRY)
358 LIST(APPEND FREEGLUT_SRCS
359 src/util/xparsegeometry_repl.c
360 src/util/xparsegeometry_repl.h)
361 SET(NEED_XPARSEGEOMETRY_IMPL TRUE)
363 # decide on suitable type for internal time keeping, 64-bit if possible
364 CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
365 CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
366 IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H))
368 # Some old Microsoft VC releases don't support unsigned long
369 # long, but all we care about is support for unsigned __int64 on
370 # MSVC, so test for presence of that type
371 CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY)
373 CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY)
377 # The generated config.h is placed in the project's build directory, just to
378 # ensure that all CMake-generated files are kept away from the main source tree.
379 # As a result, the build directory must to be added to the include path list.
380 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
381 INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
382 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
384 # we also have to generate freeglut.rc, which contains the version
386 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.rc.in ${CMAKE_BINARY_DIR}/freeglut.rc)
387 IF (MSVC AND NOT CMAKE_CL_64)
388 # .def file only for 32bit Windows builds with Visual Studio
389 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/freeglutdll.def.in ${CMAKE_BINARY_DIR}/freeglutdll.def)
393 IF(FREEGLUT_BUILD_SHARED_LIBS)
394 ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
396 IF(FREEGLUT_BUILD_STATIC_LIBS)
397 ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS})
401 SET(LIBNAME freeglut)
403 IF(FREEGLUT_REPLACE_GLUT)
407 LIST(APPEND LIBS winmm)
408 IF(FREEGLUT_BUILD_SHARED_LIBS)
409 TARGET_COMPILE_DEFINITIONS(freeglut PRIVATE FREEGLUT_EXPORTS)
410 SET_TARGET_PROPERTIES(freeglut PROPERTIES OUTPUT_NAME ${LIBNAME})
412 IF(FREEGLUT_BUILD_STATIC_LIBS)
413 TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC FREEGLUT_STATIC)
414 IF(FREEGLUT_REPLACE_GLUT)
415 SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
417 # need to set machine:x64 for linker, at least for VC10, and
418 # doesn't hurt for older compilers:
419 # http://public.kitware.com/Bug/view.php?id=11240#c22768
421 SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
425 # on UNIX we need to make sure:
426 # - all shared libraries must have a soname/version, see :
427 # http://sourceware.org/autobook/autobook/autobook_91.html#SEC91
428 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
429 # Current: -version-info 12:0:9 -> 3.9.0
430 # Note: most platforms now prefer the latter major.minor.revision form
431 # (e.g. FreeBSD, cf. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8765),
432 # or special-cased FreeGLUT long ago (e.g. .so.4 on OpenBSD), so
433 # the lack of support for current:revision:age in CMake should
435 # - the output library should be named glut so it'll be linkable with -lglut
436 # (unless FREEGLUT_REPLACE_GLUT is false).
437 # - the shared library should link to the dependency libraries so that the user
438 # won't have to link them explicitly (they shouldn't have to know that we depend
439 # on Xrandr or Xxf86vm)
441 SET(LIBNAME freeglut-gles)
443 IF(FREEGLUT_REPLACE_GLUT)
448 IF(FREEGLUT_BUILD_SHARED_LIBS)
449 SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION ${SO_MAJOR}.${SO_MINOR}.${SO_REV} SOVERSION ${SO_MAJOR} OUTPUT_NAME ${LIBNAME})
451 IF(FREEGLUT_BUILD_STATIC_LIBS)
452 SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
455 # Not in CMake toolchain file, because the toolchain
456 # file is called several times and generally doesn't
457 # seem to be meant for modifying CFLAGS:
458 # '-mandroid' is not mandatory but doesn't hurt
459 # '-O0 -gstabs+' helps the currently buggy GDB port
460 # Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid")
461 # Not using _INIT variables, they seem to be used internally only
462 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid")
463 SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+")
466 IF(FREEGLUT_BUILD_SHARED_LIBS)
467 TARGET_LINK_LIBRARIES(freeglut ${LIBS})
468 TARGET_COMPILE_DEFINITIONS(freeglut PUBLIC ${PUBLIC_DEFINITIONS})
470 IF(FREEGLUT_BUILD_STATIC_LIBS)
471 TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
472 TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC ${PUBLIC_DEFINITIONS})
475 IF(FREEGLUT_BUILD_SHARED_LIBS)
476 INSTALL(TARGETS freeglut EXPORT FreeGLUTTargets
477 RUNTIME DESTINATION bin
478 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
479 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
480 INCLUDES DESTINATION include
483 INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb
489 IF(FREEGLUT_BUILD_STATIC_LIBS)
490 INSTALL(TARGETS freeglut_static EXPORT FreeGLUTTargets
491 RUNTIME DESTINATION bin
492 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
493 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
494 INCLUDES DESTINATION include
497 INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel)
501 # Optionally build demos, on by default.
502 option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON )
504 SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS})
505 # lib m for math, not needed on windows
507 LIST(APPEND DEMO_LIBS m)
511 IF( FREEGLUT_BUILD_DEMOS )
512 IF(FREEGLUT_BUILD_SHARED_LIBS)
513 ADD_EXECUTABLE(${name} ${ARGN})
514 TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
516 SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
519 IF(FREEGLUT_BUILD_STATIC_LIBS)
520 ADD_EXECUTABLE(${name}_static ${ARGN})
521 TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
523 SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
529 ADD_DEMO(CallbackMaker progs/demos/CallbackMaker/CallbackMaker.c)
530 ADD_DEMO(Fractals progs/demos/Fractals/fractals.c)
531 ADD_DEMO(Fractals_random progs/demos/Fractals_random/fractals_random.c)
532 ADD_DEMO(Lorenz progs/demos/Lorenz/lorenz.c)
534 ADD_DEMO(One progs/demos/One/one.c)
536 ADD_DEMO(One progs/demos/One/one.c
537 progs/demos/One/one.rc)
539 ADD_DEMO(Resizer progs/demos/Resizer/Resizer.cpp)
540 ADD_DEMO(multi-touch progs/demos/multi-touch/multi-touch.c)
541 ADD_DEMO(shapes progs/demos/shapes/shapes.c
542 progs/demos/shapes/glmatrix.h
543 progs/demos/shapes/glmatrix.c)
544 ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c)
546 ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c
547 progs/demos/spaceball/vmath.c
548 progs/demos/spaceball/vmath.h)
550 ADD_DEMO(subwin progs/demos/subwin/subwin.c)
551 ADD_DEMO(timer progs/demos/timer/timer.c)
555 # pkg-config support, to install at $(libdir)/pkgconfig
556 # Define static build dependencies
558 SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm")
559 ELSEIF(FREEGLUT_GLES)
561 SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lGLESv1_CM -lEGL -lm")
564 SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
566 SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
568 ELSEIF(FREEGLUT_WAYLAND)
569 SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGLESv2 -lGLESv1_CM -lEGL -lxkbcommon -lm")
571 SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm")
575 SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGL -lxkbcommon -lm")
577 SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
580 # Client applications need to define FreeGLUT GLES version to
581 # bootstrap headers inclusion in freeglut_std.h:
582 SET(PC_LIBNAME ${LIBNAME})
583 SET(PC_FILENAME "${LIBNAME}.pc")
585 SET(PC_CFLAGS "-DFREEGLUT_GLES")
587 IF(FREEGLUT_BUILD_STATIC_LIBS)
588 LIST(APPEND PC_CFLAGS -DFREEGLUT_STATIC)
590 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
591 INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME} COMPONENT Devel)
592 # TODO: change the library and .pc name when building for GLES,
595 INCLUDE(CMakePackageConfigHelpers)
596 WRITE_BASIC_PACKAGE_VERSION_FILE(
597 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake"
599 COMPATIBILITY AnyNewerVersion
602 # needs cmake 3.0 (as does the "INCLUDES DIRECTORY" argument to install(TARGETS)):
603 EXPORT(EXPORT FreeGLUTTargets
604 FILE "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTTargets.cmake"
607 CONFIGURE_FILE(FreeGLUTConfig.cmake.in
608 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake"
611 SET(ConfigPackageLocation lib/cmake/FreeGLUT)
612 INSTALL(EXPORT FreeGLUTTargets
613 FILE FreeGLUTTargets.cmake
615 DESTINATION ${ConfigPackageLocation}
619 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake"
620 "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake"
621 DESTINATION ${ConfigPackageLocation}