X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=CMakeLists.txt;h=2f0b14657d69f7880fe9ce649e5763e187be3785;hb=b744f1401b990f642e96d4c65cc86eca5224efd1;hp=aec2c742df59f1fdf55d80078b85a801857d666c;hpb=091b26aaa1610f8762beffd84e1e5ae2062b6289;p=freeglut diff --git a/CMakeLists.txt b/CMakeLists.txt index aec2c74..2f0b146 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 @@ -47,14 +58,18 @@ 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 + ) +ELSE() + LIST(APPEND FREEGLUT_SRCS + src/gles_stubs.c ) ENDIF() @@ -88,25 +103,28 @@ ELSEIF(ANDROID) src/egl/fg_internal_egl.h src/egl/fg_display_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_gamemode_android.c + src/android/fg_structure_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_spaceball_android.c src/android/fg_state_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 +140,26 @@ 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_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 +171,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}) @@ -354,11 +380,21 @@ 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: