set(VERSION_MINOR 0)
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)
# 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.
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)
SET(FREEGLUT_HEADERS
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
ENDIF()
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/fg_cursor_android.c
src/android/fg_ext_android.c
src/android/fg_gamemode_android.c
src/android/fg_joystick_android.c
src/android/fg_spaceball_android.c
- src/android/fg_structure_android.c
)
IF(ANDROID)
LIST(APPEND FREEGLUT_SRCS
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()
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()
src/x11/fg_window_x11.c
src/x11/fg_xinput_x11.c
)
- IF(NOT(FREEGLUT_GLES2 OR FREEGLUT_GLES1))
+ IF(NOT(FREEGLUT_GLES))
LIST(APPEND FREEGLUT_SRCS
src/x11/fg_internal_x11_glx.h
src/x11/fg_display_x11_glx.c
)
ENDIF()
ENDIF()
-IF(FREEGLUT_GLES2 OR FREEGLUT_GLES1)
+IF(FREEGLUT_GLES)
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)
+ ADD_DEFINITIONS(-DFREEGLUT_GLES)
+ LIST(APPEND LIBS GLESv2 GLESv1_CM EGL)
ELSE()
FIND_PACKAGE(OpenGL REQUIRED)
LIST(APPEND LIBS ${OPENGL_gl_LIBRARY})
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)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
IF(NOT(ANDROID OR BLACKBERRY))
# 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)
# -llog for native Android logging
LIST(APPEND LIBS android log)
ELSEIF(BLACKBERRY)
- # -lbps for event loop
- # -lslog2 for logging
- # -screen for native screen
- LIST(APPEND LIBS bps slog2 screen)
+ if(PLAYBOOK)
+ # -lbps for event loop
+ # -screen for native screen
+ LIST(APPEND LIBS bps screen)
+ ELSE()
+ # -lbps for event loop
+ # -lslog2 for logging
+ # -screen for native screen
+ LIST(APPEND LIBS bps slog2 screen)
+ ENDIF()
ENDIF()
INCLUDE(CheckFunctionExists)
# - 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)
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)
- SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv2 -lEGL -lm")
- ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL -lm")
- ENDIF()
-ELSEIF(FREEGLUT_GLES1)
- IF(ANDROID)
- SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv1_CM -lEGL -lm")
- ELSEIF(BLACKBERRY)
- SET(PC_LIBS_PRIVATE "-lbps -lslog2 -lscreen -lGLESv1_CM -lEGL -lm")
+ 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()
ELSE()
- SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv1_CM -lEGL -lm")
+ SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lGLESv1_CM -lEGL -lm")
ENDIF()
ELSE()
SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGL -lm")
# 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})
# TODO: change the library and .pc name when building for GLES,
-# e.g. -lglut-GLES2
+# e.g. -lglut-GLES