3 cmake_minimum_required(VERSION 2.6)
6 set(DEQP_TARGET "default" CACHE STRING "dEQP Target (default, android...)")
8 project(dEQP-Core-${DEQP_TARGET})
10 include(framework/delibs/cmake/Defs.cmake NO_POLICY_SCOPE)
11 include(framework/delibs/cmake/CFlags.cmake)
13 add_definitions(-DDE_ASSERT_FAILURE_CALLBACK)
15 # dEQP-specific configuration. Target file should override these.
16 set(DEQP_TARGET_NAME "UNKNOWN") # Target name
18 set(DEQP_SUPPORT_GLES1 OFF) # Is GLESv1 supported
19 set(DEQP_GLES1_LIBRARIES ) # GLESv1 libraries
21 set(DEQP_SUPPORT_GLES2 OFF) # Is GLESv2 supported
22 set(DEQP_GLES2_LIBRARIES ) # GLESv2 libraries. If empty, run-time linking is used
24 set(DEQP_SUPPORT_GLES3 OFF) # Is GLESv3 supported
25 set(DEQP_GLES3_LIBRARIES ) # GLESv3 libraries. If empty, run-time linking is used
27 set(DEQP_SUPPORT_VG OFF) # Is VG supported
28 set(DEQP_VG_LIBRARIES ) # VG libraries
30 set(DEQP_SUPPORT_EGL OFF) # Is EGL supported
31 set(DEQP_EGL_LIBRARIES ) # EGL libraries
33 set(DEQP_PLATFORM_LIBRARIES ) # Other platform libraries
35 set(DEQP_SUPPORT_OPENGL OFF) # Is OpenGL supported on platform
36 # \note OpenGL is always loaded on run-time
38 set(DEQP_PLATFORM_COPY_LIBRARIES ) # Libraries / binaries that need to be copied to binary directory
40 # Delibs include directories
42 framework/delibs/debase
43 framework/delibs/decpp
44 framework/delibs/depool
45 framework/delibs/dethread
46 framework/delibs/deutil
47 framework/delibs/destream
50 # Include target-specific definitions
51 include(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake)
54 find_path(ZLIB_INCLUDE_PATH zlib.h)
55 find_library(ZLIB_LIBRARY z)
57 if (NOT ZLIB_INCLUDE_PATH OR NOT ZLIB_LIBRARY)
58 message(STATUS "System version of zlib not found, using external/zlib")
59 add_subdirectory(external/zlib)
60 # \note ZLIB_LIBRARY and ZLIB_INCLUDE_PATH are promoted from external/zlib/CMakeLists.txt
63 include_directories(${ZLIB_INCLUDE_PATH})
66 find_path(PNG_INCLUDE_PATH libpng.h)
67 find_library(PNG_LIBRARY png)
69 if (NOT PNG_INCLUDE_PATH OR NOT PNG_LIBRARY)
70 message(STATUS "System version of libpng not found, using external/libpng")
71 add_subdirectory(external/libpng)
72 # \note PNG_LIBRARY and PNG_INCLUDE_PATH are promoted from external/libpng/CMakeLists.txt
75 include_directories(${PNG_INCLUDE_PATH})
77 message(STATUS "DEQP_TARGET_NAME = ${DEQP_TARGET_NAME}")
78 message(STATUS "DEQP_SUPPORT_GLES1 = ${DEQP_SUPPORT_GLES1}")
79 message(STATUS "DEQP_GLES1_LIBRARIES = ${DEQP_GLES1_LIBRARIES}")
80 message(STATUS "DEQP_SUPPORT_GLES2 = ${DEQP_SUPPORT_GLES2}")
81 message(STATUS "DEQP_GLES2_LIBRARIES = ${DEQP_GLES2_LIBRARIES}")
82 message(STATUS "DEQP_SUPPORT_GLES3 = ${DEQP_SUPPORT_GLES3}")
83 message(STATUS "DEQP_GLES3_LIBRARIES = ${DEQP_GLES3_LIBRARIES}")
84 message(STATUS "DEQP_SUPPORT_VG = ${DEQP_SUPPORT_VG}")
85 message(STATUS "DEQP_VG_LIBRARIES = ${DEQP_VG_LIBRARIES}")
86 message(STATUS "DEQP_SUPPORT_EGL = ${DEQP_SUPPORT_EGL}")
87 message(STATUS "DEQP_EGL_LIBRARIES = ${DEQP_EGL_LIBRARIES}")
88 message(STATUS "DEQP_SUPPORT_OPENGL = ${DEQP_SUPPORT_OPENGL}")
89 message(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}")
92 add_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}")
94 if (DEQP_SUPPORT_GLES1)
95 add_definitions(-DDEQP_SUPPORT_GLES1=1)
98 if (DEQP_SUPPORT_GLES2)
99 add_definitions(-DDEQP_SUPPORT_GLES2=1)
102 if (DEQP_SUPPORT_GLES3)
103 add_definitions(-DDEQP_SUPPORT_GLES3=1)
107 add_definitions(-DDEQP_SUPPORT_VG=1)
110 if (DEQP_SUPPORT_EGL)
111 add_definitions(-DDEQP_SUPPORT_EGL=1)
114 if (DEQP_SUPPORT_OPENGL)
115 add_definitions(-DDEQP_SUPPORT_OPENGL=1)
118 if (DEQP_SUPPORT_WGL)
119 add_definitions(-DDEQP_SUPPORT_WGL=1)
122 if (DEQP_SUPPORT_GLX)
123 add_definitions(-DDEQP_SUPPORT_GLX=1)
126 # Check runtime linking support
127 if (DEQP_SUPPORT_GLES1 AND NOT DEFINED DEQP_GLES1_LIBRARIES)
128 message(FATAL_ERROR "Run-time loading of GLES1 is not supported (DEQP_GLES1_LIBRARIES is not set)")
131 if (DEQP_SUPPORT_GLES2 AND NOT DEFINED DEQP_GLES2_LIBRARIES)
132 add_definitions(-DDEQP_GLES2_RUNTIME_LOAD=1)
135 if (DEQP_SUPPORT_GLES3 AND NOT DEFINED DEQP_GLES3_LIBRARIES)
136 add_definitions(-DDEQP_GLES3_RUNTIME_LOAD=1)
139 if (DEQP_SUPPORT_VG AND NOT DEFINED DEQP_VG_LIBRARIES)
140 message(FATAL_ERROR "Run-time loading of VG is not supported (DEQP_VG_LIBRARIES is not set)")
143 if (DEQP_SUPPORT_EGL AND NOT DEFINED DEQP_EGL_LIBRARIES)
144 add_definitions(-DDEQP_EGL_RUNTIME_LOAD=1)
147 # OpenGL is always loaded on run-time
148 if (DEQP_SUPPORT_OPENGL)
149 add_definitions(-DDEQP_OPENGL_RUNTIME_LOAD=1)
152 if (DE_COMPILER_IS_MSC)
153 # Don't nag about std::copy for example
154 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
158 add_subdirectory(framework/delibs/debase)
159 add_subdirectory(framework/delibs/depool)
160 add_subdirectory(framework/delibs/dethread)
161 add_subdirectory(framework/delibs/destream)
162 add_subdirectory(framework/delibs/deutil)
163 add_subdirectory(framework/delibs/decpp)
166 add_subdirectory(execserver)
168 # Executor framework and tools
169 if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/executor)
170 add_subdirectory(executor)
173 # Test framework include directories
178 framework/opengl/wrapper
179 framework/referencerenderer
180 framework/opengl/simplereference
181 framework/randomshaders
183 framework/egl/wrapper
186 if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
187 # On Android deqp modules are compiled as libraries and linked into final .so
188 set(DEQP_MODULE_LIBRARIES )
189 set(DEQP_MODULE_ENTRY_POINTS )
193 include_directories(framework/platform/win32)
196 # Macro for adding targets for copying binaries (usually target libraries) to the target destination dir
197 macro (target_copy_files target dep_name files)
198 if (NOT "${files}" STREQUAL "")
200 foreach (SRCNAME ${files})
201 get_filename_component(BASENAME ${SRCNAME} NAME)
202 set(DSTNAME "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}")
203 add_custom_command(OUTPUT ${DSTNAME}
204 COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRCNAME} ${DSTNAME})
205 set(COPY_TARGETS ${COPY_TARGETS} ${DSTNAME})
208 add_custom_target(${dep_name} ALL DEPENDS ${COPY_TARGETS})
209 add_dependencies(${target} ${dep_name})
211 endmacro (target_copy_files)
213 # Macro for adding dEQP module
214 macro (add_deqp_module MODULE_NAME SRCS LIBS ENTRY)
215 if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
216 # Single-binary targets
217 add_library(${MODULE_NAME} STATIC ${SRCS})
218 target_link_libraries(${MODULE_NAME} ${LIBS})
220 set(DEQP_MODULE_LIBRARIES ${DEQP_MODULE_LIBRARIES} ${MODULE_NAME})
221 set(DEQP_MODULE_ENTRY_POINTS ${DEQP_MODULE_ENTRY_POINTS} "${CMAKE_CURRENT_SOURCE_DIR}/${ENTRY}")
223 # Forward to parent scope
224 set(DEQP_MODULE_LIBRARIES ${DEQP_MODULE_LIBRARIES} PARENT_SCOPE)
225 set(DEQP_MODULE_ENTRY_POINTS ${DEQP_MODULE_ENTRY_POINTS} PARENT_SCOPE)
228 # Separate binary per target
229 add_executable(${MODULE_NAME} ${CMAKE_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY} ${SRCS})
230 target_link_libraries(${MODULE_NAME} tcutil-platform ${LIBS})
231 target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}")
235 add_custom_target(${MODULE_NAME}-data)
236 add_dependencies(${MODULE_NAME} ${MODULE_NAME}-data)
237 endmacro (add_deqp_module)
239 # Macro for adding data dirs to module
240 macro (add_data_dir MODULE_NAME SRC_DIR DST_DIR)
241 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)
242 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${DST_DIR})
244 elseif (DE_OS_IS_ANDROID)
245 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_BINARY_DIR}/assets/${DST_DIR})
247 elseif (DE_OS_IS_IOS)
248 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_BINARY_DIR}/\${CONFIGURATION}\${EFFECTIVE_PLATFORM_NAME}/deqp.app/${DST_DIR})
250 endmacro (add_data_dir)
252 # Macro for adding individual data files to module
253 macro (add_data_file MODULE_NAME SRC_FILE DST_FILE)
254 if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)
255 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DST_FILE})
257 elseif (DE_OS_IS_ANDROID)
258 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_BINARY_DIR}/assets/${DST_FILE})
260 elseif (DE_OS_IS_IOS)
261 add_custom_command(TARGET ${MODULE_NAME}-data POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_BINARY_DIR}/\${CONFIGURATION}\${EFFECTIVE_PLATFORM_NAME}/deqp.app/${DST_FILE})
263 endmacro (add_data_file)
265 add_subdirectory(framework)
267 if (DE_COMPILER_IS_MSC)
268 add_compile_options(/bigobj) # Required by glsBuiltinPrecisionTests.cpp
271 add_subdirectory(modules)
273 # Single-binary targets
274 if (DE_OS_IS_ANDROID)
275 include_directories(executor)
277 add_library(deqp SHARED framework/platform/android/tcuAndroidMain.cpp framework/platform/android/tcuAndroidJNI.cpp framework/platform/android/tcuAndroidPlatformCapabilityQueryJNI.cpp framework/platform/android/tcuTestLogParserJNI.cpp ${DEQP_MODULE_ENTRY_POINTS})
278 target_link_libraries(deqp tcutil-platform xecore ${DEQP_MODULE_LIBRARIES})
280 elseif (DE_OS_IS_IOS)
282 set(DEQP_IOS_CODE_SIGN_IDENTITY "drawElements" CACHE STRING "Code sign identity for iOS build")
284 set(MACOSX_BUNDLE_PRODUCT_NAME "\${PRODUCT_NAME}")
285 set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.drawelements.\${PRODUCT_NAME:identifier}")
287 include_directories(framework/platform/ios)
288 set(TESTERCORE_SRC_FILES
289 framework/platform/ios/tcuEAGLView.h
290 framework/platform/ios/tcuEAGLView.m
291 framework/platform/ios/tcuIOSAppDelegate.h
292 framework/platform/ios/tcuIOSAppDelegate.m
293 framework/platform/ios/tcuIOSViewController.h
294 framework/platform/ios/tcuIOSViewController.m
295 framework/platform/ios/tcuIOSMain.m
297 set_source_files_properties(${TESTERCORE_SRC_FILES} COMPILE_FLAGS "-std=c99")
299 add_executable(deqp MACOSX_BUNDLE ${TESTERCORE_SRC_FILES} ${DEQP_MODULE_ENTRY_POINTS})
300 target_link_libraries(deqp tcutil-platform xscore ${DEQP_MODULE_LIBRARIES})
301 set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
302 set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: ${DEQP_IOS_CODE_SIGN_IDENTITY}")