X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=CMakeLists.txt;h=b5e1920e2d598b64b20f986888cace844516ba73;hb=c72a923191b4c307d10c153eee8406b0272a0d19;hp=aec2c742df59f1fdf55d80078b85a801857d666c;hpb=091b26aaa1610f8762beffd84e1e5ae2062b6289;p=freeglut diff --git a/CMakeLists.txt b/CMakeLists.txt index aec2c74..b5e1920 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,17 @@ set(VERSION_MINOR 0) set(VERSION_PATCH 0) +# 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) + + SET(FREEGLUT_HEADERS include/GL/freeglut.h include/GL/freeglut_ext.h @@ -32,6 +43,8 @@ SET(FREEGLUT_SRCS src/fg_ext.c src/fg_font_data.c src/fg_gamemode.c + src/fg_gl2.c + src/fg_gl2.h src/fg_init.c src/fg_internal.h src/fg_input_devices.c @@ -47,14 +60,19 @@ SET(FREEGLUT_SRCS src/fg_videoresize.c src/fg_window.c ) -# Android port requires adding a version of these compatible with -# OpenGL ES (TODO): -IF(NOT ANDROID) +# TODO: OpenGL ES requires a compatible version of these files: +IF(NOT FREEGLUT_GLES2 AND NOT FREEGLUT_GLES1) LIST(APPEND FREEGLUT_SRCS src/fg_font.c - src/fg_geometry.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() @@ -87,26 +105,32 @@ ELSEIF(ANDROID) 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_state_egl.c src/egl/fg_structure_egl.c + src/egl/fg_structure_egl.h src/egl/fg_window_egl.c + src/egl/fg_window_egl.h src/android/native_app_glue/android_native_app_glue.c src/android/native_app_glue/android_native_app_glue.h - src/android/fg_runtime_android.c + 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_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 - src/android/opengles_stubs.c - src/android/fg_internal_android.h ) ELSE() LIST(APPEND FREEGLUT_SRCS src/x11/fg_cursor_x11.c - src/x11/fg_display_x11.c src/x11/fg_ext_x11.c src/x11/fg_gamemode_x11.c src/x11/fg_glutfont_definitions_x11.c @@ -122,18 +146,27 @@ ELSE() src/x11/fg_window_x11.c src/x11/fg_xinput_x11.c ) + 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_state_egl.c + src/egl/fg_structure_egl.c + src/egl/fg_window_egl.c + ) + 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_window_x11_glx.c + src/x11/fg_window_x11_glx.h + ) + ENDIF() ENDIF() -# 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) - # For OpenGL ES (GLES): # - compile with -DFREEGLUT_GLES1 and -DFREEGLUT_GLES2 to cleanly # bootstrap headers inclusion in freeglut_std.h; these constants @@ -145,7 +178,7 @@ IF(FREEGLUT_GLES2) LIST(APPEND LIBS GLESv2 EGL) ELSEIF(FREEGLUT_GLES1) ADD_DEFINITIONS(-DFREEGLUT_GLES1) - LIST(APPEND LIBS GLESv1 EGL) + LIST(APPEND LIBS GLESv1_CM EGL) ELSE() FIND_PACKAGE(OpenGL REQUIRED) LIST(APPEND LIBS ${OPENGL_gl_LIBRARY}) @@ -264,8 +297,16 @@ ELSE() # - 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) - SET_TARGET_PROPERTIES(freeglut PROPERTIES VERSION 3.9.0 SOVERSION 3 OUTPUT_NAME glut) - SET_TARGET_PROPERTIES(freeglut_static PROPERTIES OUTPUT_NAME glut) + 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}) IF(ANDROID) # Not in CMake toolchain file, because the toolchain # file is called several times and generally doesn't @@ -354,20 +395,36 @@ ENDIF() # pkg-config support, to install at $(libdir)/pkgconfig # Define static build dependencies IF(WIN32) - SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32") -ELSEIF(ANDROID) - SET(PC_LIBS_PRIVATE "-llog -landroid -lGLESv2 -lEGL") + SET(PC_LIBS_PRIVATE "-lopengl32 -lwinmm -lgdi32 -lm") +ELSEIF(FREEGLUT_GLES2) + IF(ANDROID) + SET(PC_LIBS_PRIVATE "-llog -landroid -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") + ELSE() + SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv1_CM -lEGL -lm") + ENDIF() ELSE() - SET(PC_LIBS_PRIVATE "-lX11 -lXxf86vm -lXrandr -lGLESv2 -lEGL") + 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") ENDIF() CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/freeglut.pc.in ${CMAKE_BINARY_DIR}/freeglut.pc @ONLY) -INSTALL(FILES ${CMAKE_BINARY_DIR}/freeglut.pc DESTINATION share/pkgconfig) +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