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