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