-CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0 FATAL_ERROR)
PROJECT(freeglut)
+# for multiarch LIBDIR support (requires cmake>=2.8.8)
+INCLUDE(GNUInstallDirs)
+
# 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
set(VERSION_MAJOR 3)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)
+set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH})
+
+# Update fg_version.h to match the versions number here in cmake
+CONFIGURE_FILE(src/fg_version.h.in src/fg_version.h)
+# shared lib version numbers (change before release)
+set(SO_MAJOR 3) # increment on backwards incompatible API/ABI changes
+set(SO_MINOR 10) # increment on backwards compatible or internal changes
+set(SO_REV 0) # if nothing else changed increment this
-# BUILD_SHARED_LIBS is already a standard CMake variable, but we need to
+# FREEGLUT_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)
+OPTION(FREEGLUT_BUILD_SHARED_LIBS "Build FreeGLUT shared library." ON)
+OPTION(FREEGLUT_BUILD_STATIC_LIBS "Build FreeGLUT static library." ON)
# option for whether warnings and errors should be printed
-OPTION(FREEGLUT_ERRORS "Lib prints errors to stderr" ON)
-#MARK_AS_ADVANCED(FREEGLUT_ERRORS)
-OPTION(FREEGLUT_WARNINGS "Lib prints warnings to stderr" ON)
-#MARK_AS_ADVANCED(FREEGLUT_WARNINGS)
+OPTION(FREEGLUT_PRINT_ERRORS "Lib prints errors to stderr" ON)
+#MARK_AS_ADVANCED(FREEGLUT_PRINT_ERRORS)
+OPTION(FREEGLUT_PRINT_WARNINGS "Lib prints warnings to stderr" ON)
+#MARK_AS_ADVANCED(FREEGLUT_PRINT_WARNINGS)
# option to also copy .pdb files to install directory when executing
# INSTALL target
ENDIF()
# 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)
+OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
+IF(NOT WIN32)
+ # Wayland support
+ OPTION(FREEGLUT_WAYLAND "Use Wayland (no X11)" OFF)
+ # option to build either as "glut" (ON) or "freeglut" (OFF)
+ OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
+ENDIF()
SET(FREEGLUT_HEADERS
src/fg_ext.c
src/fg_font_data.c
src/fg_gamemode.c
+ src/fg_geometry.c
src/fg_gl2.c
src/fg_gl2.h
src/fg_init.c
src/fg_stroke_mono_roman.c
src/fg_stroke_roman.c
src/fg_structure.c
+ src/fg_teapot.c
+ src/fg_teapot_data.h
src/fg_videoresize.c
src/fg_window.c
)
# TODO: OpenGL ES requires a compatible version of these files:
-IF(NOT FREEGLUT_GLES2 AND NOT FREEGLUT_GLES1)
+IF(NOT FREEGLUT_GLES)
LIST(APPEND FREEGLUT_SRCS
src/fg_font.c
src/fg_menu.c
- src/fg_teapot.c
- src/fg_teapot_data.h
- src/fg_geometry.c
)
ELSE()
LIST(APPEND FREEGLUT_SRCS
- src/fg_geometry.c
src/gles_stubs.c
)
ENDIF()
)
ENDIF()
-ELSEIF(ANDROID)
+ELSEIF(ANDROID OR BLACKBERRY)
+ # BlackBerry and Android share some similar design concepts and ideas, as with many mobile devices.
+ # As such, some classes can be shared between the two. XXX: Possibly rename shareable classes to
+ # a more generic name. *_stub? *_mobile?
LIST(APPEND FREEGLUT_SRCS
- src/android/native_app_glue/android_native_app_glue.c
- src/android/native_app_glue/android_native_app_glue.h
- src/android/fg_internal_android.h
src/android/fg_cursor_android.c
src/android/fg_ext_android.c
src/android/fg_gamemode_android.c
- src/android/fg_init_android.c
- src/android/fg_input_devices_android.c
src/android/fg_joystick_android.c
- src/android/fg_main_android.c
- src/android/fg_main_android.h
- src/android/fg_runtime_android.c
src/android/fg_spaceball_android.c
- src/android/fg_state_android.c
- src/android/fg_structure_android.c
- src/android/fg_window_android.c
)
+ IF(ANDROID)
+ LIST(APPEND FREEGLUT_SRCS
+ src/android/native_app_glue/android_native_app_glue.c
+ src/android/native_app_glue/android_native_app_glue.h
+ src/android/fg_internal_android.h
+ src/android/fg_init_android.c
+ src/android/fg_input_devices_android.c
+ src/android/fg_main_android.c
+ src/android/fg_main_android.h
+ src/android/fg_runtime_android.c
+ src/android/fg_state_android.c
+ src/android/fg_structure_android.c
+ src/android/fg_window_android.c
+ )
+ ELSE()
+ LIST(APPEND FREEGLUT_SRCS
+ src/blackberry/fg_internal_blackberry.h
+ src/blackberry/fg_init_blackberry.c
+ src/x11/fg_input_devices_x11.c
+ src/blackberry/fg_main_blackberry.c
+ src/blackberry/fg_state_blackberry.c
+ src/blackberry/fg_structure_blackberry.c
+ src/blackberry/fg_window_blackberry.c
+ )
+ ENDIF()
+
ELSE()
- 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
- )
- IF(NOT(FREEGLUT_GLES2 OR FREEGLUT_GLES1))
+ # UNIX (Wayland)
+ IF(FREEGLUT_WAYLAND)
+ LIST(APPEND FREEGLUT_SRCS
+ src/wayland/fg_cursor_wl.c
+ src/wayland/fg_ext_wl.c
+ src/wayland/fg_gamemode_wl.c
+ src/wayland/fg_init_wl.c
+ src/wayland/fg_internal_wl.h
+ src/wayland/fg_input_devices_wl.c
+ src/wayland/fg_main_wl.c
+ src/wayland/fg_state_wl.c
+ src/wayland/fg_structure_wl.c
+ src/wayland/fg_window_wl.c
+ # font, serial port & joystick code are agnostic
+ src/x11/fg_glutfont_definitions_x11.c
+ src/x11/fg_input_devices_x11.c
+ src/x11/fg_joystick_x11.c
+ )
+ # UNIX (X11)
+ ELSE()
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
- src/x11/fg_state_x11_glx.h
- src/x11/fg_window_x11_glx.c
- src/x11/fg_window_x11_glx.h
+ 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
)
+ IF(NOT(FREEGLUT_GLES))
+ 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
+ src/x11/fg_state_x11_glx.h
+ src/x11/fg_window_x11_glx.c
+ src/x11/fg_window_x11_glx.h
+ )
+ ENDIF()
ENDIF()
ENDIF()
-IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1)
+
+# OpenGL ES requires EGL, and so does Wayland
+IF(FREEGLUT_GLES OR FREEGLUT_WAYLAND)
LIST(APPEND FREEGLUT_SRCS
src/egl/fg_internal_egl.h
src/egl/fg_display_egl.c
)
ENDIF()
-# For OpenGL ES (GLES):
-# - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly
-# bootstrap headers inclusion in freeglut_std.h; these constants
-# also need to be defined in client applications (e.g. through
-# pkg-config), but use GLES constants directly for all other needs
-# - define GLES version-specific library
-IF(FREEGLUT_GLES2)
- ADD_DEFINITIONS(-DFREEGLUT_GLES2)
- LIST(APPEND LIBS GLESv2 EGL)
-ELSEIF(FREEGLUT_GLES1)
- ADD_DEFINITIONS(-DFREEGLUT_GLES1)
- LIST(APPEND LIBS GLESv1_CM EGL)
+# For OpenGL ES (GLES): compile with -DFREEGLUT_GLES to cleanly
+# bootstrap headers inclusion in freeglut_std.h; this constant also
+# need to be defined in client applications (e.g. through pkg-config),
+# but do use GLES constants directly for all other needs
+# GLES1 and GLES2 libraries are compatible and can be co-linked.
+IF(FREEGLUT_GLES)
+ LIST(APPEND PUBLIC_DEFINITIONS -DFREEGLUT_GLES)
+ LIST(APPEND LIBS GLESv2 GLESv1_CM EGL)
ELSE()
FIND_PACKAGE(OpenGL REQUIRED)
LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
ENDIF()
+# For Wayland: compile with -DFREEGLUT_WAYLAND and pull EGL
+IF(FREEGLUT_WAYLAND)
+ ADD_DEFINITIONS(-DFREEGLUT_WAYLAND)
+ LIST(APPEND LIBS wayland-client wayland-cursor wayland-egl EGL xkbcommon)
+ENDIF()
+
# lib m for math, not needed on windows
IF (NOT WIN32)
# For compilation:
SET( CMAKE_DEBUG_POSTFIX "d" )
ENDIF(MSVC)
+ IF(NOT(MSVC_VERSION LESS "1600"))
+ # minimum requirement for WM_TOUCH device
+ ADD_DEFINITIONS(-D_WIN32_WINNT=0x0601)
+ ADD_DEFINITIONS(-DWINVER=0x0601)
+ ELSEIF(NOT(MSVC_VERSION LESS "1300"))
+ # minimum requirement for spaceball device
+ ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
+ ADD_DEFINITIONS(-DWINVER=0x0501)
+ ELSE()
+ # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
+ ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
+ ADD_DEFINITIONS(-DWINVER=0x0500)
+ ENDIF()
+
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
- IF(!ANDROID)
+ IF(NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
# not setting -ansi as EGL/KHR headers doesn't support it
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ansi")
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic")
ENDIF()
ENDIF(CMAKE_COMPILER_IS_GNUCC)
INCLUDE(CheckIncludeFiles)
-IF(UNIX AND NOT ANDROID)
+IF(UNIX AND NOT(ANDROID OR BLACKBERRY OR FREEGLUT_WAYLAND))
FIND_PACKAGE(X11 REQUIRED)
+ INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
LIST(APPEND LIBS ${X11_LIBRARIES})
IF(X11_Xrandr_FOUND)
SET(HAVE_X11_EXTENSIONS_XRANDR_H TRUE)
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()
IF(X11_Xinput_FOUND)
# -landroid for ANativeWindow
# -llog for native Android logging
LIST(APPEND LIBS android log)
+ELSEIF(BLACKBERRY)
+ # -lbps for event loop
+ # -screen for native screen
+ LIST(APPEND LIBS bps screen)
+
+ if(NOT PLAYBOOK)
+ # -lslog2 for logging
+ # -pps for low-level screen manipulation
+ LIST(APPEND LIBS slog2 pps)
+ ENDIF()
ENDIF()
INCLUDE(CheckFunctionExists)
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)
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
-CHECK_FUNCTION_EXISTS(vfprintf HAVE_VFPRINTF)
-CHECK_FUNCTION_EXISTS(_doprnt HAVE_DOPRNT)
CHECK_FUNCTION_EXISTS(XParseGeometry HAVE_XPARSEGEOMETRY)
IF (NOT HAVE_XPARSEGEOMETRY)
LIST(APPEND FREEGLUT_SRCS
# 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_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_BINARY_DIR}/config.h)
-INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
+INCLUDE_DIRECTORIES(BEFORE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/src)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
IF(WIN32)
# we also have to generate freeglut.rc, which contains the version
ENDIF()
ENDIF()
-IF(BUILD_SHARED_LIBS)
+IF(FREEGLUT_BUILD_SHARED_LIBS)
ADD_LIBRARY(freeglut SHARED ${FREEGLUT_SRCS})
ENDIF()
-IF(BUILD_STATIC_LIBS)
+IF(FREEGLUT_BUILD_STATIC_LIBS)
ADD_LIBRARY(freeglut_static STATIC ${FREEGLUT_SRCS})
ENDIF()
IF(WIN32)
LIST(APPEND LIBS winmm)
- IF(BUILD_SHARED_LIBS)
- SET_TARGET_PROPERTIES(freeglut PROPERTIES COMPILE_FLAGS -DFREEGLUT_EXPORTS)
+ IF(FREEGLUT_BUILD_SHARED_LIBS)
+ TARGET_COMPILE_DEFINITIONS(freeglut PRIVATE FREEGLUT_EXPORTS)
ENDIF()
- IF(BUILD_STATIC_LIBS)
- SET_TARGET_PROPERTIES(freeglut_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
+ IF(FREEGLUT_BUILD_STATIC_LIBS)
+ TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC FREEGLUT_STATIC)
# 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
# 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.
- # - the output library should be named glut so it'll be linkable with -lglut
+ # - the output library should be named glut so it'll be linkable with -lglut
+ # (unless FREEGLUT_REPLACE_GLUT is false).
# - 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)
- IF(FREEGLUT_GLES2)
- SET(LIBNAME freeglut-gles2)
- ELSEIF(FREEGLUT_GLES1)
- SET(LIBNAME freeglut-gles1)
+ IF(FREEGLUT_GLES)
+ SET(LIBNAME freeglut-gles)
ELSE()
- SET(LIBNAME glut)
+ IF(FREEGLUT_REPLACE_GLUT)
+ SET(LIBNAME glut)
+ ELSE()
+ SET(LIBNAME freeglut)
+ ENDIF()
+ ENDIF()
+
+ IF(FREEGLUT_BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION ${SO_MAJOR}.${SO_MINOR}.${SO_REV} SOVERSION ${SO_MAJOR} OUTPUT_NAME ${LIBNAME})
+ ENDIF()
+ IF(FREEGLUT_BUILD_STATIC_LIBS)
+ SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
ENDIF()
-
- SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME ${LIBNAME})
- SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME ${LIBNAME})
IF(ANDROID)
# Not in CMake toolchain file, because the toolchain
# file is called several times and generally doesn't
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -gstabs+")
ENDIF()
ENDIF()
-IF(BUILD_SHARED_LIBS)
+IF(FREEGLUT_BUILD_SHARED_LIBS)
TARGET_LINK_LIBRARIES(freeglut ${LIBS})
+ TARGET_COMPILE_DEFINITIONS(freeglut PUBLIC ${PUBLIC_DEFINITIONS})
ENDIF()
-IF(BUILD_STATIC_LIBS)
+IF(FREEGLUT_BUILD_STATIC_LIBS)
TARGET_LINK_LIBRARIES(freeglut_static ${LIBS})
+ TARGET_COMPILE_DEFINITIONS(freeglut_static PUBLIC ${PUBLIC_DEFINITIONS})
ENDIF()
-IF(BUILD_SHARED_LIBS)
- INSTALL(TARGETS freeglut
+IF(FREEGLUT_BUILD_SHARED_LIBS)
+ INSTALL(TARGETS freeglut EXPORT FreeGLUTTargets
RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION include
)
IF(INSTALL_PDB)
INSTALL(FILES ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug/freeglut${CMAKE_DEBUG_POSTFIX}.pdb
DESTINATION bin
- CONFIGURATIONS Debug)
+ CONFIGURATIONS Debug
+ COMPONENT Devel)
ENDIF()
ENDIF()
-IF(BUILD_STATIC_LIBS)
- INSTALL(TARGETS freeglut_static
+IF(FREEGLUT_BUILD_STATIC_LIBS)
+ INSTALL(TARGETS freeglut_static EXPORT FreeGLUTTargets
RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION include
)
IF(INSTALL_PDB)
INSTALL(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/Debug/freeglut_static${CMAKE_DEBUG_POSTFIX}.pdb
DESTINATION lib
- CONFIGURATIONS Debug)
+ CONFIGURATIONS Debug
+ COMPONENT Devel)
ENDIF()
ENDIF()
-INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL)
+INSTALL(FILES ${FREEGLUT_HEADERS} DESTINATION include/GL COMPONENT Devel)
MACRO(ADD_DEMO name)
IF( FREEGLUT_BUILD_DEMOS )
- IF(BUILD_SHARED_LIBS)
+ IF(FREEGLUT_BUILD_SHARED_LIBS)
ADD_EXECUTABLE(${name} ${ARGN})
TARGET_LINK_LIBRARIES(${name} ${DEMO_LIBS} freeglut)
IF(WIN32 AND MSVC)
SET_TARGET_PROPERTIES(${name} PROPERTIES DEBUG_POSTFIX d)
ENDIF()
ENDIF()
- IF(BUILD_STATIC_LIBS)
+ IF(FREEGLUT_BUILD_STATIC_LIBS)
ADD_EXECUTABLE(${name}_static ${ARGN})
TARGET_LINK_LIBRARIES(${name}_static ${DEMO_LIBS} freeglut_static)
- SET_TARGET_PROPERTIES(${name}_static PROPERTIES COMPILE_FLAGS -DFREEGLUT_STATIC)
IF(WIN32 AND MSVC)
SET_TARGET_PROPERTIES(${name}_static PROPERTIES DEBUG_POSTFIX d)
ENDIF()
# Define static build dependencies
IF(WIN32)
SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm")
-ELSEIF(FREEGLUT_GLES2)
+ELSEIF(FREEGLUT_GLES)
IF(ANDROID)
- SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL -lm")
+ SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lGLESv1_CM -lEGL -lm")
+ ELSEIF(BLACKBERRY)
+ IF(PLAYBOOK)
+ SET(PC_LIBS_PRIVATE "-lbps -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
+ ELSE()
+ SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lGLESv1_CM -lEGL -lm")
+ ENDIF()
+ ELSEIF(FREEGLUT_WAYLAND)
+ SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGLESv2 -lGLESv1_CM -lEGL -lxkbcommon -lm")
ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL -lm")
+ SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm")
ENDIF()
-ELSEIF(FREEGLUT_GLES1)
- IF(ANDROID)
- SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv1_CM -lEGL -lm")
+ELSE()
+ IF(FREEGLUT_WAYLAND)
+ SET(PC_LIBS_PRIVATE "-lwayland-client -lwayland-cursor -lwayland-egl -lGL -lxkbcommon -lm")
ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv1_CM -lEGL -lm")
+ SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
ENDIF()
-ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
ENDIF()
# Client applications need to define FreeGLUT GLES version to
# bootstrap headers inclusion in freeglut_std.h:
SET(PC_LIBNAME "glut")
SET(PC_FILENAME "freeglut.pc")
-IF(FREEGLUT_GLES2)
- SET(PC_CFLAGS "-DFREEGLUT_GLES2")
- SET(PC_LIBNAME "freeglut-gles2")
- SET(PC_FILENAME "freeglut-gles2.pc")
-ELSEIF(FREEGLUT_GLES1)
- SET(PC_CFLAGS "-DFREEGLUT_GLES1")
- SET(PC_LIBNAME "freeglut-gles1")
- SET(PC_FILENAME "freeglut-gles1.pc")
+IF(FREEGLUT_GLES)
+ SET(PC_CFLAGS "-DFREEGLUT_GLES")
+ SET(PC_LIBNAME "freeglut-gles")
+ SET(PC_FILENAME "freeglut-gles.pc")
ENDIF()
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig/ RENAME ${PC_FILENAME})
+INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/ RENAME ${PC_FILENAME} COMPONENT Devel)
# TODO: change the library and .pc name when building for GLES,
-# e.g. -lglut-GLES2
+# e.g. -lglut-GLES
+
+INCLUDE(CMakePackageConfigHelpers)
+WRITE_BASIC_PACKAGE_VERSION_FILE(
+ "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake"
+ VERSION ${VERSION}
+ COMPATIBILITY AnyNewerVersion
+)
+
+# needs cmake 3.0 (as does the "INCLUDES DIRECTORY" argument to install(TARGETS)):
+EXPORT(EXPORT FreeGLUTTargets
+ FILE "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTTargets.cmake"
+ NAMESPACE FreeGLUT::
+)
+CONFIGURE_FILE(FreeGLUTConfig.cmake.in
+ "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake"
+ @ONLY
+)
+SET(ConfigPackageLocation lib/cmake/FreeGLUT)
+INSTALL(EXPORT FreeGLUTTargets
+ FILE FreeGLUTTargets.cmake
+ NAMESPACE FreeGLUT::
+ DESTINATION ${ConfigPackageLocation}
+)
+INSTALL(
+ FILES
+ "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/FreeGLUT/FreeGLUTConfigVersion.cmake"
+ DESTINATION ${ConfigPackageLocation}
+ COMPONENT Devel
+)