Revert "Allow old behavior in image format property tests" am: 6d962c2a6f am: 8c75e4b...
[platform/upstream/VK-GL-CTS.git] / CMakeLists.txt
1 # dEQP cmake file
2
3 cmake_minimum_required(VERSION 2.8)
4
5 # dEQP Target.
6 set(DEQP_TARGET "default" CACHE STRING "dEQP Target (default, android...)")
7
8 if (DEFINED DEQP_TARGET_TOOLCHAIN)
9         # \note Toolchain must be included before project() command
10         include(targets/${DEQP_TARGET}/${DEQP_TARGET_TOOLCHAIN}.cmake)
11 endif ()
12
13 project(dEQP-Core-${DEQP_TARGET})
14
15 include(framework/delibs/cmake/Defs.cmake NO_POLICY_SCOPE)
16 include(framework/delibs/cmake/CFlags.cmake)
17
18 add_definitions(-DDE_ASSERT_FAILURE_CALLBACK)
19
20 # dEQP-specific configuration. Target file should override these.
21 set(DEQP_TARGET_NAME            "UNKNOWN")              # Target name
22
23 set(DEQP_GLES2_LIBRARIES        )                               # GLESv2 libraries. If empty, run-time linking is used
24 set(DEQP_GLES3_LIBRARIES        )                               # GLESv3 libraries. If empty, run-time linking is used
25 set(DEQP_EGL_LIBRARIES          )                               # EGL libraries
26
27 # Legacy APIs that don't use run-time loading
28 set(DEQP_SUPPORT_GLES1          OFF)                    # Is GLESv1 supported
29 set(DEQP_GLES1_LIBRARIES        )                               # GLESv1 libraries
30 set(DEQP_SUPPORT_VG                     OFF)                    # Is OpenVG supported
31 set(DEQP_VG_LIBRARIES           )                               # VG libraries
32
33 set(DEQP_SUPPORT_WGL            OFF)
34 set(DEQP_SUPPORT_GLX            OFF)                    # Is GLX supported \todo [2016-10-12 pyry] X11 specific - move to framework/platform/
35
36 set(DEQP_PLATFORM_LIBRARIES     )                               # Other platform libraries
37
38 set(DEQP_PLATFORM_COPY_LIBRARIES        )               # Libraries / binaries that need to be copied to binary directory
39
40 # Delibs include directories
41 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
48         )
49
50 # Include target-specific definitions
51 include(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake)
52
53 # zlib
54 find_path(ZLIB_INCLUDE_PATH     zlib.h)
55 find_library(ZLIB_LIBRARY       z)
56
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
61 endif ()
62
63 include_directories(${ZLIB_INCLUDE_PATH})
64
65 # libpng
66 find_path(PNG_INCLUDE_PATH      png.h)
67 find_library(PNG_LIBRARY        png)
68
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
73 endif ()
74
75 # glslang
76 add_subdirectory(external/glslang)
77
78 # spirv-tools
79 add_subdirectory(external/spirv-tools)
80
81 include_directories(${PNG_INCLUDE_PATH})
82
83 message(STATUS "DEQP_TARGET_NAME        = ${DEQP_TARGET_NAME}")
84 message(STATUS "DEQP_SUPPORT_GLES1      = ${DEQP_SUPPORT_GLES1}")
85 message(STATUS "DEQP_GLES1_LIBRARIES    = ${DEQP_GLES1_LIBRARIES}")
86 message(STATUS "DEQP_GLES2_LIBRARIES    = ${DEQP_GLES2_LIBRARIES}")
87 message(STATUS "DEQP_GLES3_LIBRARIES    = ${DEQP_GLES3_LIBRARIES}")
88 message(STATUS "DEQP_GLES31_LIBRARIES   = ${DEQP_GLES31_LIBRARIES}")
89 message(STATUS "DEQP_GLES32_LIBRARIES   = ${DEQP_GLES32_LIBRARIES}")
90 message(STATUS "DEQP_SUPPORT_VG         = ${DEQP_SUPPORT_VG}")
91 message(STATUS "DEQP_VG_LIBRARIES       = ${DEQP_VG_LIBRARIES}")
92 message(STATUS "DEQP_EGL_LIBRARIES      = ${DEQP_EGL_LIBRARIES}")
93 message(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}")
94
95 # Defines
96 add_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}")
97
98 # Entry points loaded directly by linking to libGL*?
99 if (DEFINED DEQP_GLES2_LIBRARIES)
100         add_definitions(-DDEQP_GLES2_DIRECT_LINK=1)
101 endif ()
102
103 if (DEFINED DEQP_GLES3_LIBRARIES)
104         add_definitions(-DDEQP_GLES3_DIRECT_LINK=1)
105 endif ()
106
107 if (DEFINED DEQP_GLES31_LIBRARIES)
108         add_definitions(-DDEQP_GLES31_DIRECT_LINK=1)
109 endif ()
110
111 if (DEFINED DEQP_GLES32_LIBRARIES)
112         add_definitions(-DDEQP_GLES32_DIRECT_LINK=1)
113 endif ()
114
115 if (DEFINED DEQP_EGL_LIBRARIES)
116         add_definitions(-DDEQP_EGL_DIRECT_LINK=1)
117 endif ()
118
119 # Legacy APIs that don't support run-time loading
120 if (DEQP_SUPPORT_GLES1)
121         add_definitions(-DDEQP_SUPPORT_GLES1=1)
122
123         if (NOT DEFINED DEQP_GLES1_LIBRARIES)
124                 message(FATAL_ERROR "Run-time loading of GLES1 is not supported (DEQP_GLES1_LIBRARIES is not set)")
125         endif ()
126 endif ()
127
128 if (DEQP_SUPPORT_VG)
129         add_definitions(-DDEQP_SUPPORT_VG=1)
130
131         if (NOT DEFINED DEQP_VG_LIBRARIES)
132                 message(FATAL_ERROR "Run-time loading of VG is not supported (DEQP_VG_LIBRARIES is not set)")
133         endif ()
134 endif ()
135
136 if (DE_COMPILER_IS_MSC)
137         # Don't nag about std::copy for example
138         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
139 endif ()
140
141 # delibs projects
142 add_subdirectory(framework/delibs/debase)
143 add_subdirectory(framework/delibs/depool)
144 add_subdirectory(framework/delibs/dethread)
145 add_subdirectory(framework/delibs/destream)
146 add_subdirectory(framework/delibs/deutil)
147 add_subdirectory(framework/delibs/decpp)
148
149 # ExecServer
150 add_subdirectory(execserver)
151
152 # Executor framework and tools
153 if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/executor)
154         add_subdirectory(executor)
155 endif ()
156
157 # Test framework include directories
158 include_directories(
159         framework/common
160         framework/qphelper
161         framework/opengl
162         framework/opengl/wrapper
163         framework/referencerenderer
164         framework/opengl/simplereference
165         framework/randomshaders
166         framework/egl
167         framework/egl/wrapper
168         external/vulkancts/framework/vulkan
169         )
170
171 if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
172         # On Android deqp modules are compiled as libraries and linked into final .so
173         set(DEQP_MODULE_LIBRARIES )
174         set(DEQP_MODULE_ENTRY_POINTS )
175 endif ()
176
177 # Macro for adding targets for copying binaries (usually target libraries) to the target destination dir
178 macro (target_copy_files target dep_name files)
179         if (NOT "${files}" STREQUAL "")
180                 set(COPY_TARGETS )
181                 foreach (SRCNAME ${files})
182                         get_filename_component(BASENAME ${SRCNAME} NAME)
183                         set(DSTNAME "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}")
184                         add_custom_command(OUTPUT ${DSTNAME}
185                                                            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRCNAME} ${DSTNAME})
186                         set(COPY_TARGETS ${COPY_TARGETS} ${DSTNAME})
187                 endforeach ()
188
189                 add_custom_target(${dep_name} ALL DEPENDS ${COPY_TARGETS})
190                 add_dependencies(${target} ${dep_name})
191         endif ()
192 endmacro (target_copy_files)
193
194 set(MODULE_LIB_TARGET_POSTFIX   "-package")
195 set(MODULE_DATA_TARGET_POSTFIX  "-data")
196
197 # Macro for adding dEQP module
198 # This adds 3 targets:
199 #       ${MODULE_NAME}-package:         Static library that contains all SRCS and links to LIBS
200 #       ${MODULE_NAME}-data:            Custom target that is used for data file copies
201 #       ${MODULE_NAME}:                         Executable binary (if supported by the platform)
202 macro (add_deqp_module MODULE_NAME SRCS LIBS ENTRY)
203
204         # Library target
205         add_library("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" STATIC ${SRCS})
206         target_link_libraries("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" ${LIBS})
207
208         set(DEQP_MODULE_LIBRARIES               ${DEQP_MODULE_LIBRARIES} "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
209         set(DEQP_MODULE_ENTRY_POINTS    ${DEQP_MODULE_ENTRY_POINTS} "${CMAKE_CURRENT_SOURCE_DIR}/${ENTRY}")
210
211         # Forward to parent scope
212         set(DEQP_MODULE_LIBRARIES               ${DEQP_MODULE_LIBRARIES} PARENT_SCOPE)
213         set(DEQP_MODULE_ENTRY_POINTS    ${DEQP_MODULE_ENTRY_POINTS} PARENT_SCOPE)
214
215         if (NOT DE_OS_IS_ANDROID AND NOT DE_OS_IS_IOS)
216                 # Executable target
217                 add_executable(${MODULE_NAME} ${PROJECT_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY})
218                 target_link_libraries(${MODULE_NAME} tcutil-platform "${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}")
219                 target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}")
220         endif ()
221
222         # Data file target
223         add_custom_target("${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
224         add_dependencies("${MODULE_NAME}${MODULE_LIB_TARGET_POSTFIX}" "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}")
225 endmacro (add_deqp_module)
226
227 # Macro for adding data dirs to module
228 macro (add_data_dir MODULE_NAME SRC_DIR DST_DIR)
229         if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX OR DE_OS_IS_QNX)
230                 add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${DST_DIR})
231
232         elseif (DE_OS_IS_ANDROID)
233                 add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_DIR} ${CMAKE_BINARY_DIR}/assets/${DST_DIR})
234
235         elseif (DE_OS_IS_IOS)
236                 add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" 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})
237         endif ()
238 endmacro (add_data_dir)
239
240 # Macro for adding individual data files to module
241 macro (add_data_file MODULE_NAME SRC_FILE DST_FILE)
242         if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX OR DE_OS_IS_QNX)
243                 add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_CURRENT_BINARY_DIR}/${DST_FILE})
244
245         elseif (DE_OS_IS_ANDROID)
246                 add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/${SRC_FILE} ${CMAKE_BINARY_DIR}/assets/${DST_FILE})
247
248         elseif (DE_OS_IS_IOS)
249                 add_custom_command(TARGET "${MODULE_NAME}${MODULE_DATA_TARGET_POSTFIX}" 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})
250         endif ()
251 endmacro (add_data_file)
252
253 add_subdirectory(framework)
254 add_subdirectory(external/vulkancts/framework/vulkan)
255
256 if (DE_COMPILER_IS_MSC)
257         add_compile_options(/bigobj) # Required by glsBuiltinPrecisionTests.cpp
258 endif ()
259
260 add_subdirectory(modules)
261 add_subdirectory(external/vulkancts/modules/vulkan)
262 add_subdirectory(external/openglcts)
263
264 # Single-binary targets
265 if (DE_OS_IS_ANDROID)
266         include_directories(executor)
267
268         set(DEQP_SRCS
269                 framework/platform/android/tcuAndroidMain.cpp
270                 framework/platform/android/tcuAndroidJNI.cpp
271                 framework/platform/android/tcuAndroidPlatformCapabilityQueryJNI.cpp
272                 framework/platform/android/tcuTestLogParserJNI.cpp
273                 ${DEQP_MODULE_ENTRY_POINTS}
274                 )
275
276         set(DEQP_LIBS
277                 tcutil-platform
278                 xecore
279                 ${DEQP_MODULE_LIBRARIES}
280                 )
281
282         add_library(deqp SHARED ${DEQP_SRCS})
283         target_link_libraries(deqp ${DEQP_LIBS})
284
285         # Needed by OpenGL CTS that defines its own activity but depends on
286         # common Android support code.
287         target_include_directories(deqp PRIVATE framework/platform/android)
288
289 elseif (DE_OS_IS_IOS)
290         # Code sign identity
291         set(DEQP_IOS_CODE_SIGN_IDENTITY "drawElements" CACHE STRING "Code sign identity for iOS build")
292
293         set(MACOSX_BUNDLE_PRODUCT_NAME "\${PRODUCT_NAME}")
294         set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.drawelements.\${PRODUCT_NAME:identifier}")
295
296         include_directories(framework/platform/ios)
297         set(TESTERCORE_SRC_FILES
298                 framework/platform/ios/tcuEAGLView.h
299                 framework/platform/ios/tcuEAGLView.m
300                 framework/platform/ios/tcuIOSAppDelegate.h
301                 framework/platform/ios/tcuIOSAppDelegate.m
302                 framework/platform/ios/tcuIOSViewController.h
303                 framework/platform/ios/tcuIOSViewController.m
304                 framework/platform/ios/tcuIOSMain.m
305                 )
306         set_source_files_properties(${TESTERCORE_SRC_FILES} COMPILE_FLAGS "-std=c99")
307
308         add_executable(deqp MACOSX_BUNDLE ${TESTERCORE_SRC_FILES} ${DEQP_MODULE_ENTRY_POINTS})
309         target_link_libraries(deqp tcutil-platform xscore ${DEQP_MODULE_LIBRARIES})
310         set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
311         set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: ${DEQP_IOS_CODE_SIGN_IDENTITY}")
312 endif ()