- changed the minor so version for the new release to 3.10.0 (fg2.8.1 was 3.9.0)
[freeglut] / CMakeLists.txt
1 CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
2 PROJECT(freeglut)
3
4 # NOTE: On Windows and Cygwin, the dll's are placed in the
5 # CMAKE_RUNTIME_OUTPUT_DIRECTORY, while their corresponding import
6 # libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY. On other
7 # platforms, such as Linux, the shared libraries are put in
8 # CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.
9 # Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all
10 # platforms.
11 SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
12 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
13 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
14
15 # setup version numbers
16 # TODO: Update these for each release!
17 set(VERSION_MAJOR 3)
18 set(VERSION_MINOR 0)
19 set(VERSION_PATCH 0)
20
21 # Update fg_version.h to match the versions number here in cmake
22 CONFIGURE_FILE(src/fg_version.h.in src/fg_version.h)
23
24 # shared lib version numbers (change before release)
25 set(SO_MAJOR 3)         # increment on backwards incompatible API/ABI changes
26 set(SO_MINOR 10)        # increment on backwards compatible or internal changes
27 set(SO_REV 0)           # if nothing else changed increment this
28
29 # FREEGLUT_BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
30 # re-declare it here so it will show up in the GUI.
31 # by default, we want to build both
32 OPTION(FREEGLUT_BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
33 OPTION(FREEGLUT_BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
34
35 # option for whether warnings and errors should be printed
36 OPTION(FREEGLUT_PRINT_ERRORS "Lib prints errors to stderr" ON)
37 #MARK_AS_ADVANCED(FREEGLUT_PRINT_ERRORS)
38 OPTION(FREEGLUT_PRINT_WARNINGS "Lib prints warnings to stderr" ON)
39 #MARK_AS_ADVANCED(FREEGLUT_PRINT_WARNINGS)
40
41 # option to also copy .pdb files to install directory when executing
42 # INSTALL target
43 IF(MSVC)
44     OPTION(INSTALL_PDB "Also install .pdb files" ON)
45 ELSE()
46     SET(INSTALL_PDB OFF)
47 ENDIF()
48
49 # OpenGL ES support
50 OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
51
52
53 SET(FREEGLUT_HEADERS
54     include/GL/freeglut.h
55     include/GL/freeglut_ext.h
56     include/GL/freeglut_std.h
57     include/GL/glut.h
58 )
59 SET(FREEGLUT_SRCS
60     ${FREEGLUT_HEADERS}
61     src/fg_callbacks.c
62     src/fg_cursor.c
63     src/fg_display.c
64     src/fg_ext.c
65     src/fg_font_data.c
66     src/fg_gamemode.c
67     src/fg_geometry.c
68     src/fg_gl2.c
69     src/fg_gl2.h
70     src/fg_init.c
71     src/fg_init.h
72     src/fg_internal.h
73     src/fg_input_devices.c
74     src/fg_joystick.c
75     src/fg_main.c
76     src/fg_misc.c
77     src/fg_overlay.c
78     src/fg_spaceball.c
79     src/fg_state.c
80     src/fg_stroke_mono_roman.c
81     src/fg_stroke_roman.c
82     src/fg_structure.c
83     src/fg_teapot.c
84     src/fg_teapot_data.h
85     src/fg_videoresize.c
86     src/fg_window.c
87 )
88 # TODO: OpenGL ES requires a compatible version of these files:
89 IF(NOT FREEGLUT_GLES)
90     LIST(APPEND FREEGLUT_SRCS
91         src/fg_font.c
92         src/fg_menu.c
93     )
94 ELSE()
95     LIST(APPEND FREEGLUT_SRCS
96         src/gles_stubs.c
97     )
98 ENDIF()
99
100 IF(WIN32)
101     LIST(APPEND FREEGLUT_SRCS
102         src/mswin/fg_cursor_mswin.c
103         src/mswin/fg_display_mswin.c
104         src/mswin/fg_ext_mswin.c
105         src/mswin/fg_gamemode_mswin.c
106         src/mswin/fg_init_mswin.c
107         src/mswin/fg_internal_mswin.h
108         src/mswin/fg_input_devices_mswin.c
109         src/mswin/fg_joystick_mswin.c
110         src/mswin/fg_main_mswin.c
111         src/mswin/fg_menu_mswin.c
112         src/mswin/fg_spaceball_mswin.c
113         src/mswin/fg_state_mswin.c
114         src/mswin/fg_structure_mswin.c
115         src/mswin/fg_window_mswin.c
116         ${CMAKE_BINARY_DIR}/freeglut.rc # generated below from freeglut.rc.in
117     )
118     IF (MSVC AND NOT CMAKE_CL_64)
119         # .def file only for 32bit Windows builds (TODO: MSVC only right
120         # now, needed for any other Windows platform?)
121         LIST(APPEND FREEGLUT_SRCS
122             ${CMAKE_BINARY_DIR}/freeglutdll.def # generated below from src/freeglutdll.def.in
123         )
124     ENDIF()
125
126 ELSEIF(ANDROID OR BLACKBERRY)
127     # BlackBerry and Android share some similar design concepts and ideas, as with many mobile devices.
128     # As such, some classes can be shared between the two. XXX: Possibly rename shareable classes to
129     # a more generic name. *_stub? *_mobile?
130     LIST(APPEND FREEGLUT_SRCS
131         src/android/fg_cursor_android.c
132         src/android/fg_ext_android.c
133         src/android/fg_gamemode_android.c
134         src/android/fg_joystick_android.c
135         src/android/fg_spaceball_android.c
136     )
137     IF(ANDROID)
138         LIST(APPEND FREEGLUT_SRCS
139             src/android/native_app_glue/android_native_app_glue.c
140             src/android/native_app_glue/android_native_app_glue.h
141             src/android/fg_internal_android.h
142             src/android/fg_init_android.c
143             src/android/fg_input_devices_android.c
144             src/android/fg_main_android.c
145             src/android/fg_main_android.h
146             src/android/fg_runtime_android.c
147             src/android/fg_state_android.c
148             src/android/fg_structure_android.c
149             src/android/fg_window_android.c
150         )
151     ELSE()
152         LIST(APPEND FREEGLUT_SRCS
153             src/blackberry/fg_internal_blackberry.h
154             src/blackberry/fg_init_blackberry.c
155             src/x11/fg_input_devices_x11.c
156             src/blackberry/fg_main_blackberry.c
157             src/blackberry/fg_state_blackberry.c
158             src/blackberry/fg_structure_blackberry.c
159             src/blackberry/fg_window_blackberry.c
160         )
161     ENDIF()
162 ELSE()
163     LIST(APPEND FREEGLUT_SRCS
164         src/x11/fg_cursor_x11.c
165         src/x11/fg_ext_x11.c
166         src/x11/fg_gamemode_x11.c
167         src/x11/fg_glutfont_definitions_x11.c
168         src/x11/fg_init_x11.c
169         src/x11/fg_internal_x11.h
170         src/x11/fg_input_devices_x11.c
171         src/x11/fg_joystick_x11.c
172         src/x11/fg_main_x11.c
173         src/x11/fg_menu_x11.c
174         src/x11/fg_spaceball_x11.c
175         src/x11/fg_state_x11.c
176         src/x11/fg_structure_x11.c
177         src/x11/fg_window_x11.c
178         src/x11/fg_xinput_x11.c
179     )
180     IF(NOT(FREEGLUT_GLES))
181         LIST(APPEND FREEGLUT_SRCS
182             src/x11/fg_internal_x11_glx.h
183             src/x11/fg_display_x11_glx.c
184             src/x11/fg_state_x11_glx.c
185             src/x11/fg_state_x11_glx.h
186             src/x11/fg_window_x11_glx.c
187             src/x11/fg_window_x11_glx.h
188         )
189     ENDIF()
190 ENDIF()
191 IF(FREEGLUT_GLES)
192     LIST(APPEND FREEGLUT_SRCS
193         src/egl/fg_internal_egl.h
194         src/egl/fg_display_egl.c
195         src/egl/fg_ext_egl.c
196         src/egl/fg_init_egl.c
197         src/egl/fg_init_egl.h
198         src/egl/fg_state_egl.c
199         src/egl/fg_state_egl.h
200         src/egl/fg_structure_egl.c
201         src/egl/fg_structure_egl.h
202         src/egl/fg_window_egl.c
203         src/egl/fg_window_egl.h
204     )
205 ENDIF()
206
207 # For OpenGL ES (GLES): compile with -DFREEGLUT_GLES to cleanly
208 # bootstrap headers inclusion in freeglut_std.h; this constant also
209 # need to be defined in client applications (e.g. through pkg-config),
210 # but do use GLES constants directly for all other needs
211 # GLES1 and GLES2 libraries are compatible and can be co-linked.
212 IF(FREEGLUT_GLES)
213   ADD_DEFINITIONS(-DFREEGLUT_GLES)
214   LIST(APPEND LIBS GLESv2 GLESv1_CM EGL)
215 ELSE()
216   FIND_PACKAGE(OpenGL REQUIRED)
217   LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
218   INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
219 ENDIF()
220
221 # lib m for math, not needed on windows
222 IF (NOT WIN32)
223     # For compilation:
224     LIST(APPEND LIBS m)
225     # For CHECK_FUNCTION_EXISTS:
226     LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
227 ENDIF()
228
229 IF(WIN32)
230     # hide insecure CRT warnings, common practice
231     ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
232     IF(MSVC)
233         SET( CMAKE_DEBUG_POSTFIX "d" )
234     ENDIF(MSVC)
235     
236     # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
237     ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
238     ADD_DEFINITIONS(-DWINVER=0x0500)
239 ENDIF()
240
241 IF(CMAKE_COMPILER_IS_GNUCC)
242   SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
243   IF(NOT(ANDROID OR BLACKBERRY))
244     # not setting -ansi as EGL/KHR headers doesn't support it
245     SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
246   ENDIF()
247 ENDIF(CMAKE_COMPILER_IS_GNUCC)
248
249 INCLUDE(CheckIncludeFiles)
250 IF(UNIX AND NOT(ANDROID OR BLACKBERRY))
251     FIND_PACKAGE(X11 REQUIRED)
252     LIST(APPEND LIBS ${X11_LIBRARIES})
253     IF(X11_Xrandr_FOUND)
254         SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
255         LIST(APPEND LIBS ${X11_Xrandr_LIB})
256     ENDIF()
257     IF(X11_xf86vmode_FOUND)
258         SET(HAVE_X11_EXTENSIONS_XF86VMODE_H TRUE)
259         # Work-around http://www.cmake.org/Bug/bug_view_page.php?bug_id=6976
260         IF(NOT "${X11_Xxf86vm_LIB}")
261             SET(X11_Xxf86vm_LIB "Xxf86vm")
262         ENDIF()
263         LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
264     ENDIF()
265     IF(X11_Xinput_FOUND)
266         # Needed for multi-touch:
267         CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H)
268         LIST(APPEND LIBS ${X11_Xinput_LIB})
269     ENDIF()
270 ENDIF()
271 IF(ANDROID)
272     # -landroid for ANativeWindow
273     # -llog for native Android logging
274     LIST(APPEND LIBS android log)
275 ELSEIF(BLACKBERRY)
276     # -lbps for event loop
277     # -screen for native screen
278     LIST(APPEND LIBS bps screen)
279
280     if(NOT PLAYBOOK)
281         # -lslog2 for logging
282         # -pps for low-level screen manipulation
283         LIST(APPEND LIBS slog2 pps)
284     ENDIF()
285 ENDIF()
286
287 INCLUDE(CheckFunctionExists)
288 INCLUDE(CheckTypeSize)
289 CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
290 CHECK_INCLUDE_FILES(unistd.h    HAVE_UNISTD_H)
291 CHECK_INCLUDE_FILES(sys/time.h  HAVE_SYS_TIME_H)
292 CHECK_INCLUDE_FILES(stdbool.h   HAVE_STDBOOL_H)
293 CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H)
294 CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)
295 CHECK_INCLUDE_FILES(fcntl.h     HAVE_FCNTL_H)
296 CHECK_INCLUDE_FILES(usbhid.h    HAVE_USBHID_H)
297 CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
298 CHECK_FUNCTION_EXISTS(XParseGeometry   HAVE_XPARSEGEOMETRY)
299 IF (NOT HAVE_XPARSEGEOMETRY)
300    LIST(APPEND FREEGLUT_SRCS
301         src/util/xparsegeometry_repl.c
302         src/util/xparsegeometry_repl.h)
303    SET(NEED_XPARSEGEOMETRY_IMPL TRUE)
304 ENDIF()
305 # decide on suitable type for internal time keeping, 64-bit if possible
306 CHECK_INCLUDE_FILES(stdint.h    HAVE_STDINT_H)
307 CHECK_INCLUDE_FILES(inttypes.h  HAVE_INTTYPES_H)
308 IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H))
309     IF (MSVC)
310         # Some old Microsoft VC releases don't support unsigned long
311         # long, but all we care about is support for unsigned __int64 on
312         # MSVC, so test for presence of that type
313         CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY)
314     ELSEIF()
315         CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY)
316     ENDIF()
317 ENDIF()
318
319 # The generated config.h is placed in the project's build directory, just to
320 # ensure that all CMake-generated files are kept away from the main source tree.
321 # As a result, the build directory must to be added to the include path list.
322 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
323 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
324 ADD_DEFINITIONS(-DHAVE_CONFIG_H)
325 IF(WIN32)
326     # we also have to generate freeglut.rc, which contains the version
327     # number
328     CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.rc.in ${CMAKE_BINARY_DIR}/freeglut.rc)
329     IF (MSVC AND NOT CMAKE_CL_64)
330         # .def file only for 32bit Windows builds with Visual Studio
331         CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/freeglutdll.def.in ${CMAKE_BINARY_DIR}/freeglutdll.def)
332     ENDIF()
333 ENDIF()
334
335 IF(FREEGLUT_BUILD_SHARED_LIBS)
336     ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
337 ENDIF()
338 IF(FREEGLUT_BUILD_STATIC_LIBS)
339     ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS})
340 ENDIF()
341
342
343 IF(WIN32)
344     LIST(APPEND LIBS winmm)
345     IF(FREEGLUT_BUILD_SHARED_LIBS)
346         SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS)
347     ENDIF()
348     IF(FREEGLUT_BUILD_STATIC_LIBS)
349         SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
350         # need to set machine:x64 for linker, at least for VC10, and
351         # doesn't hurt for older compilers:
352         # http://public.kitware.com/Bug/view.php?id=11240#c22768
353         IF (CMAKE_CL_64)
354             SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
355         ENDIF()
356     ENDIF()
357 ELSE()
358     # on UNIX we need to make sure:
359     # - all shared libraries must have a soname/version, see :
360     #   http://sourceware.org/autobook/autobook/autobook_91.html#SEC91
361     #   http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
362     #   Current: -version-info 12:0:9 -> 3.9.0
363     #   Note: most platforms now prefer the latter major.minor.revision form
364     #   (e.g. FreeBSD, cf. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8765),
365     #   or special-cased FreeGLUT long ago (e.g. .so.4 on OpenBSD), so
366     #   the lack of support for current:revision:age in CMake should
367     #   not be a problem.
368     # - the output library should be named glut so it'll be linkable with -lglut
369     # - the shared library should link to the dependency libraries so that the user
370     #   won't have to link them explicitly (they shouldn't have to know that we depend
371     #   on Xrandr or Xxf86vm)
372     IF(FREEGLUT_GLES)
373       SET(LIBNAME freeglut-gles)
374     ELSE()
375       SET(LIBNAME glut)
376     ENDIF()
377
378     IF(FREEGLUT_BUILD_SHARED_LIBS)
379       SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION ${SO_MAJOR}.${SO_MINOR}.${SO_REV} SOVERSION ${SO_MAJOR} OUTPUT_NAME ${LIBNAME})
380     ENDIF()
381     IF(FREEGLUT_BUILD_STATIC_LIBS)
382       SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
383     ENDIF()
384     IF(ANDROID)
385         # Not in CMake toolchain file, because the toolchain
386         # file is called several times and generally doesn't
387         # seem to be meant for modifying CFLAGS:
388         # '-mandroid' is not mandatory but doesn't hurt
389         # '-O0 -gstabs+' helps the currently buggy GDB port
390         # Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid")
391         # Not using _INIT variables, they seem to be used internally only
392         SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid")
393         SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+")
394     ENDIF()
395 ENDIF()
396 IF(FREEGLUT_BUILD_SHARED_LIBS)
397     TARGET_LINK_LIBRARIES(freeglut ${LIBS})
398 ENDIF()
399 IF(FREEGLUT_BUILD_STATIC_LIBS)
400     TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
401 ENDIF()
402
403 IF(FREEGLUT_BUILD_SHARED_LIBS)
404     INSTALL(TARGETS freeglut
405             RUNTIME DESTINATION bin
406             LIBRARY DESTINATION lib
407             ARCHIVE DESTINATION lib
408     )
409     IF(INSTALL_PDB)
410         INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb
411             DESTINATION bin
412                         CONFIGURATIONS Debug)
413     ENDIF()
414 ENDIF()
415 IF(FREEGLUT_BUILD_STATIC_LIBS)
416     INSTALL(TARGETS freeglut_static
417             RUNTIME DESTINATION bin
418             LIBRARY DESTINATION lib
419             ARCHIVE DESTINATION lib
420     )
421     IF(INSTALL_PDB)
422         INSTALL(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Debug/freeglut_static${CMAKE_DEBUG_POSTFIX}.pdb
423             DESTINATION lib
424                         CONFIGURATIONS Debug)
425     ENDIF()
426 ENDIF()
427 INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL)
428
429
430
431 # Optionally build demos, on by default.
432 option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON )
433
434 SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS})
435 # lib m for math, not needed on windows
436 IF (NOT WIN32)
437     LIST(APPEND DEMO_LIBS m)
438 ENDIF()
439
440 MACRO(ADD_DEMO name)
441     IF( FREEGLUT_BUILD_DEMOS )
442         IF(FREEGLUT_BUILD_SHARED_LIBS)
443             ADD_EXECUTABLE(${name} ${ARGN})
444             TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
445             IF(WIN32 AND MSVC)
446                 SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
447             ENDIF()
448         ENDIF()
449         IF(FREEGLUT_BUILD_STATIC_LIBS)
450             ADD_EXECUTABLE(${name}_static ${ARGN})
451             TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
452             SET_TARGET_PROPERTIES(${name}_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
453             IF(WIN32 AND MSVC)
454                 SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
455             ENDIF()
456         ENDIF()
457     ENDIF()
458 ENDMACRO()
459
460 ADD_DEMO(CallbackMaker   progs/demos/CallbackMaker/CallbackMaker.c)
461 ADD_DEMO(Fractals        progs/demos/Fractals/fractals.c)
462 ADD_DEMO(Fractals_random progs/demos/Fractals_random/fractals_random.c)
463 ADD_DEMO(Lorenz          progs/demos/Lorenz/lorenz.c)
464 IF (NOT WIN32)
465     ADD_DEMO(One             progs/demos/One/one.c)
466 ELSE()
467     ADD_DEMO(One             progs/demos/One/one.c
468                              progs/demos/One/one.rc)
469 ENDIF()
470 ADD_DEMO(Resizer         progs/demos/Resizer/Resizer.cpp)
471 ADD_DEMO(multi-touch     progs/demos/multi-touch/multi-touch.c)
472 ADD_DEMO(shapes          progs/demos/shapes/shapes.c
473                          progs/demos/shapes/glmatrix.h
474                          progs/demos/shapes/glmatrix.c)
475 ADD_DEMO(smooth_opengl3  progs/demos/smooth_opengl3/smooth_opengl3.c)
476 IF(UNIX)
477     ADD_DEMO(spaceball       progs/demos/spaceball/spaceball.c
478                              progs/demos/spaceball/vmath.c
479                              progs/demos/spaceball/vmath.h)
480 ENDIF()
481 ADD_DEMO(subwin          progs/demos/subwin/subwin.c)
482 ADD_DEMO(timer           progs/demos/timer/timer.c)
483
484
485
486 # pkg-config support, to install at $(libdir)/pkgconfig
487 # Define static build dependencies
488 IF(WIN32)
489   SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm")
490 ELSEIF(FREEGLUT_GLES)
491   IF(ANDROID)
492     SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lGLESv1_CM -lEGL -lm")
493   ELSEIF(BLACKBERRY)
494     IF(PLAYBOOK)
495       SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
496     ELSE()
497       SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
498     ENDIF()
499   ELSE()
500     SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm")
501   ENDIF()
502 ELSE()
503   SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
504 ENDIF()
505 # Client applications need to define FreeGLUT GLES version to
506 # bootstrap headers inclusion in freeglut_std.h:
507 SET(PC_LIBNAME "glut")
508 SET(PC_FILENAME "freeglut.pc")
509 IF(FREEGLUT_GLES)
510   SET(PC_CFLAGS "-DFREEGLUT_GLES")
511   SET(PC_LIBNAME "freeglut-gles")
512   SET(PC_FILENAME "freeglut-gles.pc")
513 ENDIF()
514 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
515 INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig/ RENAME ${PC_FILENAME})
516 # TODO: change the library and .pc name when building for GLES,
517 # e.g. -lglut-GLES