diff options
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | cmake/FindWaffle.cmake | 2 | ||||
-rw-r--r-- | retrace/CMakeLists.txt | 13 | ||||
-rw-r--r-- | retrace/glws_waffle.cpp | 17 |
4 files changed, 29 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 156a5c5d..bad0ad20 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,8 @@ set (ENABLE_CLI true CACHE BOOL "Enable command Line interface.") set (ENABLE_EGL true CACHE BOOL "Enable EGL support.") +set (ENABLE_WAFFLE false CACHE BOOL "Enable WAFFLE support.") + ############################################################################## # Find dependencies @@ -88,6 +90,11 @@ else () endif () endif () +if (ENABLE_EGL AND (ANDROID OR ENABLE_WAFFLE)) + # if waffle is found eglretrace will be built for Android. + find_package (Waffle) +endif () + ############################################################################## # Set global build options diff --git a/cmake/FindWaffle.cmake b/cmake/FindWaffle.cmake index e2f6a84c..03be9cfd 100644 --- a/cmake/FindWaffle.cmake +++ b/cmake/FindWaffle.cmake @@ -10,6 +10,7 @@ if (ANDROID) set (Waffle_LIB_SEARCH_PATH "$ENV{OUT}/obj/lib") endif () +endif () find_path (Waffle_INCLUDE_DIR waffle.h PATHS ${Waffle_INC_SEARCH_PATH} @@ -31,7 +32,6 @@ if (ANDROID) Waffle_INCLUDE_DIR Waffle_LIBRARY ) -endif () mark_as_advanced ( Waffle_FOUND diff --git a/retrace/CMakeLists.txt b/retrace/CMakeLists.txt index 010368f4..4e37979c 100644 --- a/retrace/CMakeLists.txt +++ b/retrace/CMakeLists.txt @@ -41,11 +41,6 @@ add_library (retrace_common STATIC json.cpp ) -if (ENABLE_EGL AND ANDROID) - # if waffle is found eglretrace will be built for Android. - find_package (Waffle) -endif () - target_link_libraries (retrace_common image common @@ -119,7 +114,7 @@ if (WIN32 OR APPLE OR X11_FOUND) install (TARGETS glretrace RUNTIME DESTINATION bin) endif () -if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE) +if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE AND NOT ENABLE_WAFFLE) add_executable (eglretrace glws_egl_xlib.cpp ) @@ -145,7 +140,7 @@ if (ENABLE_EGL AND X11_FOUND AND NOT WIN32 AND NOT APPLE) install (TARGETS eglretrace RUNTIME DESTINATION bin) endif () -if (ENABLE_EGL AND ANDROID AND Waffle_FOUND) +if (ENABLE_EGL AND (ANDROID OR ENABLE_WAFFLE) AND Waffle_FOUND) add_executable (eglretrace glws_waffle.cpp ) @@ -157,8 +152,10 @@ if (ENABLE_EGL AND ANDROID AND Waffle_FOUND) retrace_common glretrace_common glproc_egl - dl ${Waffle_LIBRARY} + ${X11_X11_LIB} + ${CMAKE_THREAD_LIBS_INIT} + dl ) target_link_libraries (eglretrace ${proc_LIBRARY}) install (TARGETS eglretrace RUNTIME DESTINATION bin) diff --git a/retrace/glws_waffle.cpp b/retrace/glws_waffle.cpp index e959fb6b..3fcbe32f 100644 --- a/retrace/glws_waffle.cpp +++ b/retrace/glws_waffle.cpp @@ -95,7 +95,22 @@ init(void) { i = 0; waffle_init_attrib_list[i++] = WAFFLE_PLATFORM; - waffle_init_attrib_list[i++] = WAFFLE_PLATFORM_ANDROID; + waffle_init_attrib_list[i++] = +#if defined(__ANDROID__) + WAFFLE_PLATFORM_ANDROID +#elif defined(__APPLE__) + WAFFLE_PLATFORM_CGL +#elif defined(HAVE_X11) +# if 1 + WAFFLE_PLATFORM_GLX +# else + WAFFLE_PLATFORM_X11_EGL +# endif +#else +# warning Unsupported platform + WAFFLE_NONE +#endif + ; waffle_init_attrib_list[i++] = WAFFLE_NONE; waffle_init(waffle_init_attrib_list); |