Generate flat triangles in polygon offset tests. am: 975a59ebca am: 0bde00f9d6 am...
[platform/upstream/VK-GL-CTS.git] / CMakeLists.txt
1 # dEQP cmake file
2
3 cmake_minimum_required(VERSION 2.6)
4
5 # dEQP Target.
6 set(DEQP_TARGET "default" CACHE STRING "dEQP Target (default, android...)")
7
8 project(dEQP-Core-${DEQP_TARGET})
9
10 include(framework/delibs/cmake/Defs.cmake NO_POLICY_SCOPE)
11 include(framework/delibs/cmake/CFlags.cmake)
12
13 add_definitions(-DDE_ASSERT_FAILURE_CALLBACK)
14
15 # dEQP-specific configuration. Target file should override these.
16 set(DEQP_TARGET_NAME            "UNKNOWN")              # Target name
17
18 set(DEQP_GLES2_LIBRARIES        )                               # GLESv2 libraries. If empty, run-time linking is used
19 set(DEQP_GLES3_LIBRARIES        )                               # GLESv3 libraries. If empty, run-time linking is used
20 set(DEQP_EGL_LIBRARIES          )                               # EGL libraries
21
22 # Legacy APIs that don't use run-time loading
23 set(DEQP_SUPPORT_GLES1          OFF)                    # Is GLESv1 supported
24 set(DEQP_GLES1_LIBRARIES        )                               # GLESv1 libraries
25 set(DEQP_SUPPORT_VG                     OFF)                    # Is OpenVG supported
26 set(DEQP_VG_LIBRARIES           )                               # VG libraries
27
28 set(DEQP_SUPPORT_GLX            OFF)                    # Is GLX supported \todo [2016-10-12 pyry] X11 specific - move to framework/platform/
29
30 set(DEQP_PLATFORM_LIBRARIES     )                               # Other platform libraries
31
32 set(DEQP_PLATFORM_COPY_LIBRARIES        )               # Libraries / binaries that need to be copied to binary directory
33
34 # Delibs include directories
35 include_directories(
36         framework/delibs/debase
37         framework/delibs/decpp
38         framework/delibs/depool
39         framework/delibs/dethread
40         framework/delibs/deutil
41         framework/delibs/destream
42         )
43
44 # Include target-specific definitions
45 include(targets/${DEQP_TARGET}/${DEQP_TARGET}.cmake)
46
47 # zlib
48 find_path(ZLIB_INCLUDE_PATH     zlib.h)
49 find_library(ZLIB_LIBRARY       z)
50
51 if (NOT ZLIB_INCLUDE_PATH OR NOT ZLIB_LIBRARY)
52         message(STATUS "System version of zlib not found, using external/zlib")
53         add_subdirectory(external/zlib)
54         # \note ZLIB_LIBRARY and ZLIB_INCLUDE_PATH are promoted from external/zlib/CMakeLists.txt
55 endif ()
56
57 include_directories(${ZLIB_INCLUDE_PATH})
58
59 # libpng
60 find_path(PNG_INCLUDE_PATH      png.h)
61 find_library(PNG_LIBRARY        png)
62
63 if (NOT PNG_INCLUDE_PATH OR NOT PNG_LIBRARY)
64         message(STATUS "System version of libpng not found, using external/libpng")
65         add_subdirectory(external/libpng)
66         # \note PNG_LIBRARY and PNG_INCLUDE_PATH are promoted from external/libpng/CMakeLists.txt
67 endif ()
68
69 # glslang
70 add_subdirectory(external/glslang)
71
72 # spirv-tools
73 add_subdirectory(external/spirv-tools)
74
75 include_directories(${PNG_INCLUDE_PATH})
76
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_GLES2_LIBRARIES    = ${DEQP_GLES2_LIBRARIES}")
81 message(STATUS "DEQP_GLES3_LIBRARIES    = ${DEQP_GLES3_LIBRARIES}")
82 message(STATUS "DEQP_SUPPORT_VG         = ${DEQP_SUPPORT_VG}")
83 message(STATUS "DEQP_VG_LIBRARIES       = ${DEQP_VG_LIBRARIES}")
84 message(STATUS "DEQP_EGL_LIBRARIES      = ${DEQP_EGL_LIBRARIES}")
85 message(STATUS "DEQP_PLATFORM_LIBRARIES = ${DEQP_PLATFORM_LIBRARIES}")
86
87 # Defines
88 add_definitions(-DDEQP_TARGET_NAME="${DEQP_TARGET_NAME}")
89
90 if (DEQP_SUPPORT_GLES1)
91         add_definitions(-DDEQP_SUPPORT_GLES1=1)
92 endif ()
93
94 if (DEQP_SUPPORT_VG)
95         add_definitions(-DDEQP_SUPPORT_VG=1)
96 endif ()
97
98 # Entry points loaded on run-time?
99 if (NOT DEFINED DEQP_GLES2_LIBRARIES)
100         add_definitions(-DDEQP_GLES2_RUNTIME_LOAD=1)
101 endif ()
102
103 if (NOT DEFINED DEQP_GLES3_LIBRARIES)
104         add_definitions(-DDEQP_GLES3_RUNTIME_LOAD=1)
105 endif ()
106
107 if (NOT DEFINED DEQP_EGL_LIBRARIES)
108         add_definitions(-DDEQP_EGL_RUNTIME_LOAD=1)
109 endif ()
110
111 # OpenGL entry points are always loaded on run-time
112 add_definitions(-DDEQP_OPENGL_RUNTIME_LOAD=1)
113
114 # Legacy APIs that don't support run-time loading
115 if (DEQP_SUPPORT_GLES1 AND NOT DEFINED DEQP_GLES1_LIBRARIES)
116         message(FATAL_ERROR "Run-time loading of GLES1 is not supported (DEQP_GLES1_LIBRARIES is not set)")
117 endif ()
118
119 if (DEQP_SUPPORT_VG AND NOT DEFINED DEQP_VG_LIBRARIES)
120         message(FATAL_ERROR "Run-time loading of VG is not supported (DEQP_VG_LIBRARIES is not set)")
121 endif ()
122
123 if (DE_COMPILER_IS_MSC)
124         # Don't nag about std::copy for example
125         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_SCL_SECURE_NO_WARNINGS")
126 endif ()
127
128 # delibs projects
129 add_subdirectory(framework/delibs/debase)
130 add_subdirectory(framework/delibs/depool)
131 add_subdirectory(framework/delibs/dethread)
132 add_subdirectory(framework/delibs/destream)
133 add_subdirectory(framework/delibs/deutil)
134 add_subdirectory(framework/delibs/decpp)
135
136 # ExecServer
137 add_subdirectory(execserver)
138
139 # Executor framework and tools
140 if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/executor)
141         add_subdirectory(executor)
142 endif ()
143
144 # Test framework include directories
145 include_directories(
146         framework/common
147         framework/qphelper
148         framework/opengl
149         framework/opengl/wrapper
150         framework/referencerenderer
151         framework/opengl/simplereference
152         framework/randomshaders
153         framework/egl
154         framework/egl/wrapper
155         external/vulkancts/framework/vulkan
156         )
157
158 if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
159         # On Android deqp modules are compiled as libraries and linked into final .so
160         set(DEQP_MODULE_LIBRARIES )
161         set(DEQP_MODULE_ENTRY_POINTS )
162 endif ()
163
164 if (DE_OS_IS_WIN32)
165         include_directories(framework/platform/win32)
166 endif ()
167
168 # Macro for adding targets for copying binaries (usually target libraries) to the target destination dir
169 macro (target_copy_files target dep_name files)
170         if (NOT "${files}" STREQUAL "")
171                 set(COPY_TARGETS )
172                 foreach (SRCNAME ${files})
173                         get_filename_component(BASENAME ${SRCNAME} NAME)
174                         set(DSTNAME "${CMAKE_CURRENT_BINARY_DIR}/${BASENAME}")
175                         add_custom_command(OUTPUT ${DSTNAME}
176                                                            COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRCNAME} ${DSTNAME})
177                         set(COPY_TARGETS ${COPY_TARGETS} ${DSTNAME})
178                 endforeach ()
179
180                 add_custom_target(${dep_name} ALL DEPENDS ${COPY_TARGETS})
181                 add_dependencies(${target} ${dep_name})
182         endif ()
183 endmacro (target_copy_files)
184
185 # Macro for adding dEQP module
186 macro (add_deqp_module MODULE_NAME SRCS LIBS ENTRY)
187         if (DE_OS_IS_ANDROID OR DE_OS_IS_IOS)
188                 # Single-binary targets
189                 add_library(${MODULE_NAME} STATIC ${SRCS})
190                 target_link_libraries(${MODULE_NAME} ${LIBS})
191
192                 set(DEQP_MODULE_LIBRARIES               ${DEQP_MODULE_LIBRARIES} ${MODULE_NAME})
193                 set(DEQP_MODULE_ENTRY_POINTS    ${DEQP_MODULE_ENTRY_POINTS} "${CMAKE_CURRENT_SOURCE_DIR}/${ENTRY}")
194
195                 # Forward to parent scope
196                 set(DEQP_MODULE_LIBRARIES               ${DEQP_MODULE_LIBRARIES} PARENT_SCOPE)
197                 set(DEQP_MODULE_ENTRY_POINTS    ${DEQP_MODULE_ENTRY_POINTS} PARENT_SCOPE)
198
199         else ()
200                 # Separate binary per target
201                 add_executable(${MODULE_NAME} ${CMAKE_SOURCE_DIR}/framework/platform/tcuMain.cpp ${ENTRY} ${SRCS})
202                 target_link_libraries(${MODULE_NAME} tcutil-platform ${LIBS})
203                 target_copy_files(${MODULE_NAME} platform-libs-${MODULE_NAME} "${DEQP_PLATFORM_COPY_LIBRARIES}")
204         endif ()
205
206         # Data file target
207         add_custom_target(${MODULE_NAME}-data)
208         add_dependencies(${MODULE_NAME} ${MODULE_NAME}-data)
209 endmacro (add_deqp_module)
210
211 # Macro for adding data dirs to module
212 macro (add_data_dir MODULE_NAME SRC_DIR DST_DIR)
213         if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)
214                 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})
215
216         elseif (DE_OS_IS_ANDROID)
217                 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})
218
219         elseif (DE_OS_IS_IOS)
220                 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})
221         endif ()
222 endmacro (add_data_dir)
223
224 # Macro for adding individual data files to module
225 macro (add_data_file MODULE_NAME SRC_FILE DST_FILE)
226         if (DE_OS_IS_WIN32 OR DE_OS_IS_UNIX OR DE_OS_IS_OSX)
227                 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})
228
229         elseif (DE_OS_IS_ANDROID)
230                 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})
231
232         elseif (DE_OS_IS_IOS)
233                 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})
234         endif ()
235 endmacro (add_data_file)
236
237 add_subdirectory(framework)
238 add_subdirectory(external/vulkancts/framework/vulkan)
239
240 if (DE_COMPILER_IS_MSC)
241         add_compile_options(/bigobj) # Required by glsBuiltinPrecisionTests.cpp
242 endif ()
243
244 add_subdirectory(modules)
245 add_subdirectory(external/vulkancts/modules/vulkan)
246
247 # Single-binary targets
248 if (DE_OS_IS_ANDROID)
249         include_directories(executor)
250
251         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})
252         target_link_libraries(deqp tcutil-platform xecore ${DEQP_MODULE_LIBRARIES})
253
254 elseif (DE_OS_IS_IOS)
255         # Code sign identity
256         set(DEQP_IOS_CODE_SIGN_IDENTITY "drawElements" CACHE STRING "Code sign identity for iOS build")
257
258         set(MACOSX_BUNDLE_PRODUCT_NAME "\${PRODUCT_NAME}")
259         set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.drawelements.\${PRODUCT_NAME:identifier}")
260
261         include_directories(framework/platform/ios)
262         set(TESTERCORE_SRC_FILES
263                 framework/platform/ios/tcuEAGLView.h
264                 framework/platform/ios/tcuEAGLView.m
265                 framework/platform/ios/tcuIOSAppDelegate.h
266                 framework/platform/ios/tcuIOSAppDelegate.m
267                 framework/platform/ios/tcuIOSViewController.h
268                 framework/platform/ios/tcuIOSViewController.m
269                 framework/platform/ios/tcuIOSMain.m
270                 )
271         set_source_files_properties(${TESTERCORE_SRC_FILES} COMPILE_FLAGS "-std=c99")
272
273         add_executable(deqp MACOSX_BUNDLE ${TESTERCORE_SRC_FILES} ${DEQP_MODULE_ENTRY_POINTS})
274         target_link_libraries(deqp tcutil-platform xscore ${DEQP_MODULE_LIBRARIES})
275         set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
276         set_target_properties(deqp PROPERTIES XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer: ${DEQP_IOS_CODE_SIGN_IDENTITY}")
277 endif ()