2012-02-08 04:39:29 +02:00
|
|
|
PROJECT(freeglut)
|
|
|
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|
|
|
|
2012-03-13 13:03:23 +02:00
|
|
|
# NOTE: On Windows and Cygwin, the dll's are placed in the
|
|
|
|
# CMAKE_RUNTIME_OUTPUT_DIRECTORY, while their corresponding import
|
|
|
|
# libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY. On other
|
|
|
|
# platforms, such as Linux, the shared libraries are put in
|
|
|
|
# CMAKE_ARCHIVE_OUTPUT_DIRECTORY instead.
|
|
|
|
# Static libraries end up in CMAKE_ARCHIVE_OUTPUT_DIRECTORY on all
|
2012-05-05 03:52:45 +03:00
|
|
|
# platforms.
|
2012-03-12 17:41:39 +02:00
|
|
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
|
2012-03-13 13:03:23 +02:00
|
|
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
|
2012-03-12 17:41:39 +02:00
|
|
|
|
2012-03-15 04:30:50 +02:00
|
|
|
# setup version numbers
|
|
|
|
# TODO: Update these for each release!
|
|
|
|
set(VERSION_MAJOR 3)
|
|
|
|
set(VERSION_MINOR 0)
|
|
|
|
set(VERSION_PATCH 0)
|
|
|
|
|
2012-03-12 17:41:39 +02:00
|
|
|
|
2012-03-16 23:39:37 +02:00
|
|
|
# BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
|
|
|
|
# re-declare it here so it will show up in the GUI.
|
|
|
|
# by default, we want to build both
|
|
|
|
OPTION(BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
|
|
|
|
OPTION(BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
|
|
|
|
|
|
|
|
# OpenGL ES support
|
|
|
|
OPTION(FREEGLUT_GLES1 "Use OpenGL ES 1.x (requires EGL)" OFF)
|
|
|
|
OPTION(FREEGLUT_GLES2 "Use OpenGL ES 2.x (requires EGL) (overrides BUILD_GLES1)" OFF)
|
|
|
|
|
|
|
|
|
2012-02-08 04:39:29 +02:00
|
|
|
SET(FREEGLUT_HEADERS
|
2012-03-15 04:34:33 +02:00
|
|
|
include/GL/freeglut.h
|
|
|
|
include/GL/freeglut_ext.h
|
|
|
|
include/GL/freeglut_std.h
|
|
|
|
include/GL/glut.h
|
2012-02-08 04:39:29 +02:00
|
|
|
)
|
|
|
|
SET(FREEGLUT_SRCS
|
2012-03-15 04:34:33 +02:00
|
|
|
${FREEGLUT_HEADERS}
|
|
|
|
src/fg_callbacks.c
|
|
|
|
src/fg_cursor.c
|
|
|
|
src/fg_display.c
|
|
|
|
src/fg_ext.c
|
|
|
|
src/fg_font_data.c
|
|
|
|
src/fg_gamemode.c
|
2012-03-31 23:21:16 +03:00
|
|
|
src/fg_gl2.c
|
|
|
|
src/fg_gl2.h
|
2012-03-15 04:34:33 +02:00
|
|
|
src/fg_init.c
|
2012-04-21 21:22:24 +03:00
|
|
|
src/fg_init.h
|
2012-03-15 04:34:33 +02:00
|
|
|
src/fg_internal.h
|
|
|
|
src/fg_input_devices.c
|
|
|
|
src/fg_joystick.c
|
|
|
|
src/fg_main.c
|
2012-04-21 20:40:25 +03:00
|
|
|
src/fg_main.h
|
2012-03-15 04:34:33 +02:00
|
|
|
src/fg_misc.c
|
|
|
|
src/fg_overlay.c
|
|
|
|
src/fg_spaceball.c
|
|
|
|
src/fg_state.c
|
|
|
|
src/fg_stroke_mono_roman.c
|
|
|
|
src/fg_stroke_roman.c
|
|
|
|
src/fg_structure.c
|
|
|
|
src/fg_videoresize.c
|
|
|
|
src/fg_window.c
|
2012-02-08 04:39:29 +02:00
|
|
|
)
|
2012-03-16 23:39:37 +02:00
|
|
|
# TODO: OpenGL ES requires a compatible version of these files:
|
|
|
|
IF(NOT FREEGLUT_GLES2 AND NOT FREEGLUT_GLES1)
|
2012-03-12 06:24:40 +02:00
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
|
|
|
src/fg_font.c
|
|
|
|
src/fg_menu.c
|
|
|
|
src/fg_teapot.c
|
2012-03-18 11:59:50 +02:00
|
|
|
src/fg_teapot_data.h
|
2012-03-23 21:03:56 +02:00
|
|
|
src/fg_geometry.c
|
2012-03-12 07:07:35 +02:00
|
|
|
)
|
2012-03-17 12:33:28 +02:00
|
|
|
ELSE()
|
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
2012-03-23 03:02:57 +02:00
|
|
|
src/fg_geometry.c
|
2012-03-17 12:33:28 +02:00
|
|
|
src/gles_stubs.c
|
|
|
|
)
|
2012-03-11 11:31:44 +02:00
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
|
2012-03-12 06:24:40 +02:00
|
|
|
IF(WIN32)
|
2012-03-15 04:34:33 +02:00
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
|
|
|
src/mswin/fg_cursor_mswin.c
|
|
|
|
src/mswin/fg_display_mswin.c
|
|
|
|
src/mswin/fg_ext_mswin.c
|
|
|
|
src/mswin/fg_gamemode_mswin.c
|
|
|
|
src/mswin/fg_init_mswin.c
|
|
|
|
src/mswin/fg_internal_mswin.h
|
|
|
|
src/mswin/fg_input_devices_mswin.c
|
|
|
|
src/mswin/fg_joystick_mswin.c
|
|
|
|
src/mswin/fg_main_mswin.c
|
|
|
|
src/mswin/fg_menu_mswin.c
|
|
|
|
src/mswin/fg_spaceball_mswin.c
|
|
|
|
src/mswin/fg_state_mswin.c
|
|
|
|
src/mswin/fg_structure_mswin.c
|
|
|
|
src/mswin/fg_window_mswin.c
|
2012-03-15 04:30:50 +02:00
|
|
|
${CMAKE_BINARY_DIR}/freeglut.rc # generated below from freeglut.rc.in
|
2012-03-12 07:07:35 +02:00
|
|
|
)
|
2012-03-16 22:43:29 +02:00
|
|
|
IF (MSVC AND NOT CMAKE_CL_64)
|
2012-05-05 03:52:45 +03:00
|
|
|
# .def file only for 32bit Windows builds (TODO: MSVC only right
|
|
|
|
# now, needed for any other Windows platform?)
|
2012-03-12 07:07:35 +02:00
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
2012-03-15 04:30:50 +02:00
|
|
|
${CMAKE_BINARY_DIR}/freeglutdll.def # generated below from src/freeglutdll.def.in
|
2012-03-12 07:07:35 +02:00
|
|
|
)
|
|
|
|
ENDIF()
|
|
|
|
|
2012-03-11 11:31:44 +02:00
|
|
|
ELSEIF(ANDROID)
|
2012-03-11 17:26:01 +02:00
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
|
|
|
src/android/native_app_glue/android_native_app_glue.c
|
|
|
|
src/android/native_app_glue/android_native_app_glue.h
|
2012-04-01 18:42:47 +03:00
|
|
|
src/android/fg_internal_android.h
|
|
|
|
src/android/fg_cursor_android.c
|
|
|
|
src/android/fg_ext_android.c
|
2012-03-11 17:26:01 +02:00
|
|
|
src/android/fg_gamemode_android.c
|
2012-03-17 12:30:31 +02:00
|
|
|
src/android/fg_init_android.c
|
2012-03-11 17:26:01 +02:00
|
|
|
src/android/fg_input_devices_android.c
|
|
|
|
src/android/fg_joystick_android.c
|
|
|
|
src/android/fg_main_android.c
|
2012-04-21 20:40:25 +03:00
|
|
|
src/android/fg_main_android.h
|
2012-04-01 18:42:47 +03:00
|
|
|
src/android/fg_runtime_android.c
|
2012-03-11 17:26:01 +02:00
|
|
|
src/android/fg_spaceball_android.c
|
|
|
|
src/android/fg_state_android.c
|
2012-04-01 18:42:47 +03:00
|
|
|
src/android/fg_structure_android.c
|
2012-03-11 17:26:01 +02:00
|
|
|
src/android/fg_window_android.c
|
2012-03-12 07:07:35 +02:00
|
|
|
)
|
2012-02-08 04:39:29 +02:00
|
|
|
ELSE()
|
2012-03-15 04:34:33 +02:00
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
|
|
|
src/x11/fg_cursor_x11.c
|
|
|
|
src/x11/fg_ext_x11.c
|
|
|
|
src/x11/fg_gamemode_x11.c
|
|
|
|
src/x11/fg_glutfont_definitions_x11.c
|
|
|
|
src/x11/fg_init_x11.c
|
|
|
|
src/x11/fg_internal_x11.h
|
|
|
|
src/x11/fg_input_devices_x11.c
|
|
|
|
src/x11/fg_joystick_x11.c
|
|
|
|
src/x11/fg_main_x11.c
|
|
|
|
src/x11/fg_menu_x11.c
|
|
|
|
src/x11/fg_spaceball_x11.c
|
|
|
|
src/x11/fg_state_x11.c
|
|
|
|
src/x11/fg_structure_x11.c
|
|
|
|
src/x11/fg_window_x11.c
|
|
|
|
src/x11/fg_xinput_x11.c
|
2012-03-12 07:07:35 +02:00
|
|
|
)
|
2012-04-21 21:22:24 +03:00
|
|
|
IF(NOT(FREEGLUT_GLES2 OR FREEGLUT_GLES1))
|
2012-03-18 14:38:07 +02:00
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
|
|
|
src/x11/fg_internal_x11_glx.h
|
|
|
|
src/x11/fg_display_x11_glx.c
|
|
|
|
src/x11/fg_state_x11_glx.c
|
2012-04-21 22:04:02 +03:00
|
|
|
src/x11/fg_state_x11_glx.h
|
2012-03-18 14:38:07 +02:00
|
|
|
src/x11/fg_window_x11_glx.c
|
|
|
|
src/x11/fg_window_x11_glx.h
|
|
|
|
)
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
2012-04-21 20:40:25 +03:00
|
|
|
IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1)
|
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
|
|
|
src/egl/fg_internal_egl.h
|
|
|
|
src/egl/fg_display_egl.c
|
|
|
|
src/egl/fg_ext_egl.c
|
|
|
|
src/egl/fg_init_egl.c
|
|
|
|
src/egl/fg_init_egl.h
|
|
|
|
src/egl/fg_state_egl.c
|
|
|
|
src/egl/fg_state_egl.h
|
|
|
|
src/egl/fg_structure_egl.c
|
|
|
|
src/egl/fg_structure_egl.h
|
|
|
|
src/egl/fg_window_egl.c
|
|
|
|
src/egl/fg_window_egl.h
|
|
|
|
)
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
|
2012-03-16 23:30:26 +02:00
|
|
|
# For OpenGL ES (GLES):
|
|
|
|
# - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly
|
|
|
|
# bootstrap headers inclusion in freeglut_std.h; these constants
|
2012-05-05 03:52:45 +03:00
|
|
|
# also need to be defined in client applications (e.g. through
|
2012-03-16 23:30:26 +02:00
|
|
|
# pkg-config), but use GLES constants directly for all other needs
|
|
|
|
# - define GLES version-specific library
|
2012-03-11 11:18:15 +02:00
|
|
|
IF(FREEGLUT_GLES2)
|
2012-03-16 23:30:26 +02:00
|
|
|
ADD_DEFINITIONS(-DFREEGLUT_GLES2)
|
2012-03-11 11:18:15 +02:00
|
|
|
LIST(APPEND LIBS GLESv2 EGL)
|
|
|
|
ELSEIF(FREEGLUT_GLES1)
|
2012-03-16 23:30:26 +02:00
|
|
|
ADD_DEFINITIONS(-DFREEGLUT_GLES1)
|
2012-03-17 18:26:00 +02:00
|
|
|
LIST(APPEND LIBS GLESv1_CM EGL)
|
2012-03-11 11:18:15 +02:00
|
|
|
ELSE()
|
|
|
|
FIND_PACKAGE(OpenGL REQUIRED)
|
|
|
|
LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
|
|
|
|
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
|
|
|
|
ENDIF()
|
2012-03-10 13:08:44 +02:00
|
|
|
|
|
|
|
# lib m for math, not needed on windows
|
|
|
|
IF (NOT WIN32)
|
2012-05-02 19:44:40 +03:00
|
|
|
# For compilation:
|
2012-03-10 13:08:44 +02:00
|
|
|
LIST(APPEND LIBS m)
|
2012-05-02 19:44:40 +03:00
|
|
|
# For CHECK_FUNCTION_EXISTS:
|
|
|
|
LIST(APPEND CMAKE_REQUIRED_LIBRARIES m)
|
2012-03-10 13:08:44 +02:00
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
|
|
|
|
IF(WIN32)
|
2012-03-15 05:07:57 +02:00
|
|
|
# hide insecure CRT warnings, common practice
|
2012-03-15 04:34:33 +02:00
|
|
|
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
2012-05-25 04:31:25 +03:00
|
|
|
IF(MSVC)
|
|
|
|
SET( CMAKE_DEBUG_POSTFIX "d" )
|
|
|
|
ENDIF(MSVC)
|
|
|
|
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
|
|
|
|
2012-04-21 19:53:57 +03:00
|
|
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
2012-04-21 21:22:24 +03:00
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
2012-04-21 19:53:57 +03:00
|
|
|
IF(!ANDROID)
|
|
|
|
# not setting -ansi as EGL/KHR headers doesn't support it
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
|
|
|
|
ENDIF()
|
|
|
|
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
|
2012-05-13 12:08:35 +03:00
|
|
|
INCLUDE(CheckIncludeFiles)
|
2012-05-01 12:33:05 +03:00
|
|
|
IF(UNIX AND NOT ANDROID)
|
2012-03-15 04:34:33 +02:00
|
|
|
FIND_PACKAGE(X11 REQUIRED)
|
|
|
|
LIST(APPEND LIBS ${X11_LIBRARIES})
|
|
|
|
IF(X11_Xrandr_FOUND)
|
|
|
|
SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
|
|
|
|
LIST(APPEND LIBS ${X11_Xrandr_LIB})
|
|
|
|
ENDIF()
|
|
|
|
IF(X11_xf86vmode_FOUND)
|
|
|
|
SET(HAVE_X11_EXTENSIONS_XF86VMODE_H TRUE)
|
|
|
|
# Work-around http://www.cmake.org/Bug/bug_view_page.php?bug_id=6976
|
|
|
|
IF(NOT "${X11_Xxf86vm_LIB}")
|
|
|
|
SET(X11_Xxf86vm_LIB "Xxf86vm")
|
|
|
|
ENDIF()
|
|
|
|
LIST(APPEND LIBS ${X11_Xxf86vm_LIB})
|
|
|
|
ENDIF()
|
2012-05-13 12:08:35 +03:00
|
|
|
IF(X11_Xinput_FOUND)
|
2012-05-29 21:33:22 +03:00
|
|
|
# Needed for multi-touch:
|
2012-05-13 12:08:35 +03:00
|
|
|
CHECK_INCLUDE_FILES("${X11_Xinput_INCLUDE_PATH}/X11/extensions/XInput2.h" HAVE_X11_EXTENSIONS_XINPUT2_H)
|
|
|
|
LIST(APPEND LIBS ${X11_Xinput_LIB})
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
2012-05-01 12:33:05 +03:00
|
|
|
IF(ANDROID)
|
|
|
|
# -landroid for ANativeWindow
|
|
|
|
# -llog for native Android logging
|
|
|
|
LIST(APPEND LIBS android log)
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
|
2012-02-25 07:34:24 +02:00
|
|
|
INCLUDE(CheckFunctionExists)
|
2012-03-11 15:03:14 +02:00
|
|
|
INCLUDE(CheckTypeSize)
|
2012-02-08 04:39:29 +02:00
|
|
|
CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H)
|
|
|
|
CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H)
|
|
|
|
CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H)
|
|
|
|
CHECK_INCLUDE_FILES(stdbool.h HAVE_STDBOOL_H)
|
|
|
|
CHECK_INCLUDE_FILES(sys/param.h HAVE_SYS_PARAM_H)
|
|
|
|
CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H)
|
|
|
|
CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H)
|
|
|
|
CHECK_INCLUDE_FILES(errno.h HAVE_ERRNO_H)
|
|
|
|
CHECK_INCLUDE_FILES(usbhid.h HAVE_USBHID_H)
|
2012-02-25 07:34:24 +02:00
|
|
|
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
|
2012-03-11 15:03:14 +02:00
|
|
|
CHECK_FUNCTION_EXISTS(vfprintf HAVE_VFPRINTF)
|
|
|
|
CHECK_FUNCTION_EXISTS(_doprnt HAVE_DOPRNT)
|
2012-03-11 17:26:01 +02:00
|
|
|
CHECK_FUNCTION_EXISTS(XParseGeometry HAVE_XPARSEGEOMETRY)
|
|
|
|
IF (NOT HAVE_XPARSEGEOMETRY)
|
|
|
|
LIST(APPEND FREEGLUT_SRCS
|
2012-03-15 04:34:33 +02:00
|
|
|
src/util/xparsegeometry_repl.c
|
|
|
|
src/util/xparsegeometry_repl.h)
|
2012-03-11 17:26:01 +02:00
|
|
|
SET(NEED_XPARSEGEOMETRY_IMPL TRUE)
|
|
|
|
ENDIF()
|
2012-03-11 15:03:14 +02:00
|
|
|
# decide on suitable type for internal time keeping, 64-bit if possible
|
|
|
|
CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H)
|
|
|
|
CHECK_INCLUDE_FILES(inttypes.h HAVE_INTTYPES_H)
|
2012-03-12 05:32:53 +02:00
|
|
|
IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H))
|
|
|
|
IF (MSVC)
|
2012-05-05 03:52:45 +03:00
|
|
|
# Some old Microsoft VC releases don't support unsigned long
|
|
|
|
# long, but all we care about is support for unsigned __int64 on
|
|
|
|
# MSVC, so test for presence of that type
|
2012-03-12 05:32:53 +02:00
|
|
|
CHECK_TYPE_SIZE("unsigned __int64" U__INT64 BUILTIN_TYPES_ONLY)
|
|
|
|
ELSEIF()
|
|
|
|
CHECK_TYPE_SIZE("unsigned long long" ULONG_LONG BUILTIN_TYPES_ONLY)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2012-03-11 15:03:14 +02:00
|
|
|
|
2012-02-08 04:39:29 +02:00
|
|
|
# The generated config.h is placed in the project's build directory, just to
|
|
|
|
# ensure that all CMake-generated files are kept away from the main source tree.
|
|
|
|
# As a result, the build directory must to be added to the include path list.
|
|
|
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
|
2012-03-09 22:46:15 +02:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src)
|
2012-02-08 04:39:29 +02:00
|
|
|
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
2012-03-15 04:30:50 +02:00
|
|
|
IF(WIN32)
|
|
|
|
# we also have to generate freeglut.rc, which contains the version
|
|
|
|
# number
|
|
|
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.rc.in ${CMAKE_BINARY_DIR}/freeglut.rc)
|
2012-03-15 05:06:42 +02:00
|
|
|
IF (MSVC AND NOT CMAKE_CL_64)
|
|
|
|
# .def file only for 32bit Windows builds with Visual Studio
|
2012-03-15 04:30:50 +02:00
|
|
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/src/freeglutdll.def.in ${CMAKE_BINARY_DIR}/freeglutdll.def)
|
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
|
|
|
|
IF(BUILD_SHARED_LIBS)
|
2012-03-15 04:34:33 +02:00
|
|
|
ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
|
|
|
IF(BUILD_STATIC_LIBS)
|
2012-03-15 04:34:33 +02:00
|
|
|
ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS})
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
|
|
IF(WIN32)
|
2012-03-15 04:34:33 +02:00
|
|
|
LIST(APPEND LIBS winmm)
|
|
|
|
IF(BUILD_SHARED_LIBS)
|
|
|
|
SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS)
|
|
|
|
ENDIF()
|
2012-03-12 06:24:40 +02:00
|
|
|
IF(BUILD_STATIC_LIBS)
|
2012-03-15 04:34:33 +02:00
|
|
|
SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
|
2012-03-12 09:26:37 +02:00
|
|
|
# need to set machine:x64 for linker, at least for VC10, and
|
|
|
|
# doesn't hurt for older compilers:
|
|
|
|
# http://public.kitware.com/Bug/view.php?id=11240#c22768
|
2012-03-12 07:07:35 +02:00
|
|
|
IF (CMAKE_CL_64)
|
|
|
|
SET_TARGET_PROPERTIES(freeglut_static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64")
|
|
|
|
ENDIF()
|
2012-03-15 04:34:33 +02:00
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
ELSE()
|
2012-03-15 04:34:33 +02:00
|
|
|
# on UNIX we need to make sure:
|
|
|
|
# - all shared libraries must have a soname/version, see :
|
|
|
|
# http://sourceware.org/autobook/autobook/autobook_91.html#SEC91
|
|
|
|
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
|
|
|
|
# Current: -version-info 12:0:9 -> 3.9.0
|
2012-05-05 22:11:41 +03:00
|
|
|
# Note: most platforms now prefer the latter major.minor.revision form
|
|
|
|
# (e.g. FreeBSD, cf. http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8765),
|
|
|
|
# or special-cased FreeGLUT long ago (e.g. .so.4 on OpenBSD), so
|
|
|
|
# the lack of support for current:revision:age in CMake should
|
|
|
|
# not be a problem.
|
2012-03-15 04:34:33 +02:00
|
|
|
# - the output library should be named glut so it'll be linkable with -lglut
|
|
|
|
# - the shared library should link to the dependency libraries so that the user
|
|
|
|
# won't have to link them explicitly (they shouldn't have to know that we depend
|
|
|
|
# on Xrandr or Xxf86vm)
|
2012-04-03 01:22:33 +03:00
|
|
|
IF(FREEGLUT_GLES2)
|
|
|
|
SET(LIBNAME freeglut-gles2)
|
|
|
|
ELSEIF(FREEGLUT_GLES1)
|
|
|
|
SET(LIBNAME freeglut-gles1)
|
|
|
|
ELSE()
|
|
|
|
SET(LIBNAME glut)
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME ${LIBNAME})
|
|
|
|
SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
|
2012-03-15 04:34:33 +02:00
|
|
|
IF(ANDROID)
|
|
|
|
# Not in CMake toolchain file, because the toolchain
|
|
|
|
# file is called several times and generally doesn't
|
2012-03-15 22:48:32 +02:00
|
|
|
# seem to be meant for modifying CFLAGS:
|
2012-03-15 04:34:33 +02:00
|
|
|
# '-mandroid' is not mandatory but doesn't hurt
|
|
|
|
# '-O0 -gstabs+' helps the currently buggy GDB port
|
|
|
|
# Too late to manipulate ENV: SET(ENV{CFLAGS} "$ENV{CFLAGS} -mandroid")
|
|
|
|
# Not using _INIT variables, they seem to be used internally only
|
|
|
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mandroid")
|
|
|
|
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+")
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
2012-03-10 13:08:44 +02:00
|
|
|
IF(BUILD_SHARED_LIBS)
|
|
|
|
TARGET_LINK_LIBRARIES(freeglut ${LIBS})
|
|
|
|
ENDIF()
|
|
|
|
IF(BUILD_STATIC_LIBS)
|
|
|
|
TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
|
|
|
|
IF(BUILD_SHARED_LIBS)
|
2012-03-15 04:34:33 +02:00
|
|
|
INSTALL(TARGETS freeglut DESTINATION lib)
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
|
|
|
IF(BUILD_STATIC_LIBS)
|
2012-03-15 04:34:33 +02:00
|
|
|
INSTALL(TARGETS freeglut_static DESTINATION lib)
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDIF()
|
|
|
|
INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Optionally build demos, on by default.
|
|
|
|
option( FREEGLUT_BUILD_DEMOS "Build FreeGLUT demos." ON )
|
|
|
|
|
2012-03-09 22:02:30 +02:00
|
|
|
SET(DEMO_LIBS ${OPENGL_glu_LIBRARY} ${LIBS})
|
2012-03-10 13:08:44 +02:00
|
|
|
# lib m for math, not needed on windows
|
|
|
|
IF (NOT WIN32)
|
|
|
|
LIST(APPEND DEMO_LIBS m)
|
|
|
|
ENDIF()
|
2012-03-09 21:24:57 +02:00
|
|
|
|
2012-02-08 04:39:29 +02:00
|
|
|
MACRO(ADD_DEMO name)
|
2012-03-10 13:08:44 +02:00
|
|
|
IF( FREEGLUT_BUILD_DEMOS )
|
|
|
|
IF(BUILD_SHARED_LIBS)
|
|
|
|
ADD_EXECUTABLE(${name} ${ARGN})
|
|
|
|
TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
|
2012-06-07 16:52:23 +03:00
|
|
|
IF(WIN32 AND MSVC)
|
|
|
|
SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
|
|
|
|
ENDIF()
|
2012-03-10 13:08:44 +02:00
|
|
|
ENDIF()
|
|
|
|
IF(BUILD_STATIC_LIBS)
|
|
|
|
ADD_EXECUTABLE(${name}_static ${ARGN})
|
|
|
|
TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
|
2012-03-12 06:24:40 +02:00
|
|
|
SET_TARGET_PROPERTIES(${name}_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
|
2012-06-07 16:52:23 +03:00
|
|
|
IF(WIN32 AND MSVC)
|
|
|
|
SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
|
|
|
|
ENDIF()
|
2012-03-10 13:08:44 +02:00
|
|
|
ENDIF()
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
ENDMACRO()
|
|
|
|
|
|
|
|
ADD_DEMO(CallbackMaker progs/demos/CallbackMaker/CallbackMaker.c)
|
|
|
|
ADD_DEMO(Fractals progs/demos/Fractals/fractals.c)
|
|
|
|
ADD_DEMO(Fractals_random progs/demos/Fractals_random/fractals_random.c)
|
|
|
|
ADD_DEMO(Lorenz progs/demos/Lorenz/lorenz.c)
|
|
|
|
ADD_DEMO(One progs/demos/One/one.c)
|
|
|
|
ADD_DEMO(Resizer progs/demos/Resizer/Resizer.cpp)
|
2012-05-08 20:09:38 +03:00
|
|
|
ADD_DEMO(multi-touch progs/demos/multi-touch/multi-touch.c)
|
2012-06-09 20:38:24 +03:00
|
|
|
ADD_DEMO(shapes progs/demos/shapes/shapes.c
|
|
|
|
progs/demos/shapes/glmatrix.h
|
|
|
|
progs/demos/shapes/glmatrix.c)
|
2012-02-08 04:39:29 +02:00
|
|
|
ADD_DEMO(smooth_opengl3 progs/demos/smooth_opengl3/smooth_opengl3.c)
|
2012-05-25 04:35:06 +03:00
|
|
|
IF(UNIX)
|
|
|
|
ADD_DEMO(spaceball progs/demos/spaceball/spaceball.c
|
|
|
|
progs/demos/spaceball/vmath.c
|
|
|
|
progs/demos/spaceball/vmath.h)
|
|
|
|
ENDIF()
|
2012-02-08 04:39:29 +02:00
|
|
|
ADD_DEMO(subwin progs/demos/subwin/subwin.c)
|
2012-03-10 16:55:50 +02:00
|
|
|
ADD_DEMO(timer progs/demos/timer/timer.c)
|
2012-03-12 17:41:39 +02:00
|
|
|
|
2012-05-05 03:52:45 +03:00
|
|
|
|
|
|
|
|
2012-03-15 22:48:32 +02:00
|
|
|
# pkg-config support, to install at $(libdir)/pkgconfig
|
|
|
|
# Define static build dependencies
|
|
|
|
IF(WIN32)
|
2012-03-18 12:25:19 +02:00
|
|
|
SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm")
|
2012-03-17 18:26:00 +02:00
|
|
|
ELSEIF(FREEGLUT_GLES2)
|
|
|
|
IF(ANDROID)
|
2012-03-18 12:25:19 +02:00
|
|
|
SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL -lm")
|
2012-03-17 18:26:00 +02:00
|
|
|
ELSE()
|
2012-03-18 12:25:19 +02:00
|
|
|
SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL -lm")
|
2012-03-17 18:26:00 +02:00
|
|
|
ENDIF()
|
|
|
|
ELSEIF(FREEGLUT_GLES1)
|
|
|
|
IF(ANDROID)
|
2012-03-18 12:25:19 +02:00
|
|
|
SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv1_CM -lEGL -lm")
|
2012-03-17 18:26:00 +02:00
|
|
|
ELSE()
|
2012-03-18 12:25:19 +02:00
|
|
|
SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv1_CM -lEGL -lm")
|
2012-03-17 18:26:00 +02:00
|
|
|
ENDIF()
|
2012-03-15 22:48:32 +02:00
|
|
|
ELSE()
|
2012-03-18 12:25:19 +02:00
|
|
|
SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
|
2012-03-16 23:30:26 +02:00
|
|
|
ENDIF()
|
|
|
|
# Client applications need to define FreeGLUT GLES version to
|
|
|
|
# bootstrap headers inclusion in freeglut_std.h:
|
2012-04-03 01:22:33 +03:00
|
|
|
SET(PC_LIBNAME "glut")
|
|
|
|
SET(PC_FILENAME "freeglut.pc")
|
2012-03-16 23:30:26 +02:00
|
|
|
IF(FREEGLUT_GLES2)
|
|
|
|
SET(PC_CFLAGS "-DFREEGLUT_GLES2")
|
2012-04-03 01:22:33 +03:00
|
|
|
SET(PC_LIBNAME "freeglut-gles2")
|
|
|
|
SET(PC_FILENAME "freeglut-gles2.pc")
|
2012-03-16 23:30:26 +02:00
|
|
|
ELSEIF(FREEGLUT_GLES1)
|
|
|
|
SET(PC_CFLAGS "-DFREEGLUT_GLES1")
|
2012-04-03 01:22:33 +03:00
|
|
|
SET(PC_LIBNAME "freeglut-gles1")
|
|
|
|
SET(PC_FILENAME "freeglut-gles1.pc")
|
2012-03-15 22:48:32 +02:00
|
|
|
ENDIF()
|
|
|
|
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
|
2012-04-03 01:22:33 +03:00
|
|
|
INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig/ RENAME ${PC_FILENAME})
|
2012-03-16 23:30:26 +02:00
|
|
|
# TODO: change the library and .pc name when building for GLES,
|
|
|
|
# e.g. -lglut-GLES2
|