updated list of cmake switches in README.cmake
[freeglut] / CMakeLists.txt
index 7cd2afc..98e9289 100644 (file)
@@ -21,6 +21,11 @@ set(VERSION_PATCH 0)
 # 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
+
 # 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
@@ -44,6 +49,11 @@ ENDIF()
 # OpenGL ES support
 OPTION(FREEGLUT_GLES "Use OpenGL ES (requires EGL)" OFF)
 
+# option to build either as "glut" (ON) or "freeglut" (OFF)
+IF(NOT WIN32)
+    OPTION(FREEGLUT_REPLACE_GLUT "Be a replacement for GLUT" ON)
+ENDIF()
+
 
 SET(FREEGLUT_HEADERS
     include/GL/freeglut.h
@@ -228,6 +238,9 @@ IF(WIN32)
         SET( CMAKE_DEBUG_POSTFIX "d" )
     ENDIF(MSVC)
     
+    # enable the use of Win2000 APIs (needed for really old compilers like MSVC6)
+    ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)
+    ADD_DEFINITIONS(-DWINVER=0x0500)
 ENDIF()
 
 IF(CMAKE_COMPILER_IS_GNUCC)
@@ -265,15 +278,14 @@ IF(ANDROID)
     # -llog for native Android logging
     LIST(APPEND LIBS android log)
 ELSEIF(BLACKBERRY)
-    if(PLAYBOOK)
-        # -lbps for event loop
-        # -screen for native screen
-        LIST(APPEND LIBS bps screen)
-    ELSE()
-        # -lbps for event loop
+    # -lbps for event loop
+    # -screen for native screen
+    LIST(APPEND LIBS bps screen)
+
+    if(NOT PLAYBOOK)
         # -lslog2 for logging
-        # -screen for native screen
-        LIST(APPEND LIBS bps slog2 screen)
+        # -pps for low-level screen manipulation
+        LIST(APPEND LIBS slog2 pps)
     ENDIF()
 ENDIF()
 
@@ -286,11 +298,8 @@ 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)
 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
@@ -361,18 +370,23 @@ ELSE()
     #   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_GLES)
-      SET(LIBNAME freeglut-gles)
+               SET(LIBNAME freeglut-gles)
     ELSE()
-      SET(LIBNAME glut)
-    ENDIF()
+               IF(FREEGLUT_REPLACE_GLUT)
+                       SET(LIBNAME glut)
+               ELSE()
+                       SET(LIBNAME freeglut)
+               ENDIF()
+       ENDIF()
 
     IF(FREEGLUT_BUILD_SHARED_LIBS)
-      SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME ${LIBNAME})
+      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})