[Piglit] [PATCH 12/13] cmake: Relax waffle requirement.
Kenney Phillis
kphillisjr at gmail.com
Thu Oct 31 15:48:08 CET 2013
GLFW also works on linux so allow proper fallback handling of tests.
This means Waffle to GLFW to GLUT.
---
CMakeLists.txt | 56 +++++++++++++++++++++++++++-----------------------------
1 file changed, 27 insertions(+), 29 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3dd488f..b70ae1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,31 +26,29 @@ else()
find_package(OpenGL)
endif()
-if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
- option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" ON)
- option(PIGLIT_USE_GLFW3 "Use GLFW in place of GLUT" ON)
-else()
- option(PIGLIT_USE_WAFFLE "Use Waffle in place of GLUT" OFF)
- option(PIGLIT_USE_GLFW3 "Use GLFW in place of GLUT" ON)
-endif()
+option(PIGLIT_USE_WAFFLE "Attempt to use Waffle in place of GLUT" ON)
+option(PIGLIT_USE_GLFW3 "Attempt to use GLFW in place of GLUT" ON)
if(PIGLIT_USE_WAFFLE)
- pkg_check_modules(WAFFLE REQUIRED waffle-1>=1.2.2)
+ pkg_check_modules(WAFFLE waffle-1>=1.2.2)
+
+ if(WAFFLE_FOUND)
+ add_definitions(-DPIGLIT_USE_WAFFLE)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WAFFLE_CFLAGS}")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WAFFLE_CFLAGS}")
+ else()
+ # Waffle not found.
+ set(PIGLIT_USE_WAFFLE OFF CACHE "" FORCE)
+ endif()
- if(NOT WAFFLE_FOUND)
- message(FATAL_ERROR "Failed to find Waffle. If Waffle is not "
- "packaged for your distribution, you can get it at "
- "http://people.freedesktop.org/~chadversary/waffle."
- )
- endif()
- add_definitions(-DPIGLIT_USE_WAFFLE)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WAFFLE_CFLAGS}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WAFFLE_CFLAGS}")
-elseif(PIGLIT_USE_GLFW3)
- pkg_search_module(GLFW3 glfw3)
+endif(PIGLIT_USE_WAFFLE)
+
+if(PIGLIT_USE_GLFW3 AND( NOT PIGLIT_USE_WAFFLE))
+ pkg_search_module(GLFW3 glfw3)
if(GLFW3_FOUND)
include_directories(${GLFW3_INCLUDE_DIRS})
+ add_definitions(-DPIGLIT_USE_GLFW3)
else()
if(EXISTS "${CMAKE_SOURCE_DIR}/glfw/CMakeLists.txt")
set(GLFW_BUILD_EXAMPLES OFF CACHE STRING "" FORCE)
@@ -84,18 +82,17 @@ elseif(PIGLIT_USE_GLFW3)
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}/bin"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}/bin"
)
- if(MSVC_IDE)
- endif()
endif(WIN32)
+ add_definitions(-DPIGLIT_USE_GLFW3)
else()
- message(FATAL_ERROR "Failed to find GLFW version 3.\n"
- "If GLFW3 is not installed, You can download GLFW3 from "
- "their website at http://www.glfw.org/"
- )
+ # GLFW3 not found.
+ set(PIGLIT_USE_GLFW3 OFF CACHE "" FORCE)
endif()
endif()
- add_definitions(-DPIGLIT_USE_GLFW3)
-else()
+
+endif(PIGLIT_USE_GLFW3 AND( NOT PIGLIT_USE_WAFFLE))
+
+if(NOT (PIGLIT_USE_GLFW3 OR PIGLIT_USE_WAFFLE))
find_package(GLUT REQUIRED)
# The 'REQUIRED' above correctly produces an error for
@@ -109,9 +106,10 @@ else()
#
# Work around the bug and error out quickly here instead.
if (NOT GLUT_FOUND)
- message(FATAL_ERROR "GLUT library not found")
+ message(FATAL_ERROR
+ "Unable to find Framework to use. Please Install GLUT, GLFW, nor Waffle.")
endif()
-endif(PIGLIT_USE_WAFFLE)
+endif(NOT (PIGLIT_USE_GLFW3 OR PIGLIT_USE_WAFFLE))
if(PIGLIT_BUILD_GLES1_TESTS AND NOT PIGLIT_USE_WAFFLE)
message(FATAL_ERROR "Option PIGLIT_BUILD_GLES1_TESTS requires PIGLIT_USE_WAFFLE")
--
1.7.9.5
More information about the Piglit
mailing list