blob: b5c63c6b51cb947610da76bd0e58b86b110ced7f [file] [log] [blame]
Courtney Goeltzenleuchtera8c06282015-04-14 14:55:44 -06001# The name of our project is "VULKAN". CMakeLists files in this project can
2# refer to the root source directory of the project as ${VULKAN_SOURCE_DIR} and
3# to the root binary directory of the project as ${VULKAN_BINARY_DIR}.
Chia-I Wu60a20b82015-01-10 23:15:51 +08004cmake_minimum_required(VERSION 2.8.11)
Courtney Goeltzenleuchtera8c06282015-04-14 14:55:44 -06005project (VULKAN)
Courtney Goeltzenleuchter1d22ed82014-08-01 13:01:47 -06006# set (CMAKE_VERBOSE_MAKEFILE 1)
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -06007
David Pinedodba967a2015-07-09 12:44:38 -06008# The MAJOR number of the version we're building, used in naming
9# vulkan.<major>.dll (and other files).
10set(MAJOR "0")
11
Chia-I Wu60a20b82015-01-10 23:15:51 +080012set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
13
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060014# Header file for CMake settings
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060015include_directories("${PROJECT_SOURCE_DIR}/include")
16
Chia-I Wu155be032014-08-02 09:14:28 +080017include(FindPkgConfig)
Chia-I Wu155be032014-08-02 09:14:28 +080018
Chia-I Wu93d06182015-02-17 09:55:34 -070019if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
Ian Elliott3fdadc82015-02-13 14:04:01 -070020 set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
Tony Barbour42869bc2015-02-05 14:14:33 -070021 set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
Chia-I Wu5a782ae2014-12-19 11:34:46 +080022 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}")
Adam Jacksond7148b32015-06-23 15:33:48 -040023 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++11")
Chia-I Wu468e3c32014-08-04 08:03:57 +080024 if (UNIX)
25 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
Chia-I Wucb5f2e62015-01-18 11:09:29 +080026 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
Chia-I Wu468e3c32014-08-04 08:03:57 +080027 endif()
28endif()
Chia-I Wu155be032014-08-02 09:14:28 +080029
Tony Barbourb4ab8742015-05-21 11:07:47 -060030# Hard code our LunarGLASS and glslang paths for now
31get_filename_component(GLSLANG_PREFIX ../glslang ABSOLUTE)
32get_filename_component(LUNARGLASS_PREFIX ../LunarGLASS ABSOLUTE)
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -060033
Tony Barbourb4ab8742015-05-21 11:07:47 -060034if(NOT EXISTS ${GLSLANG_PREFIX})
35 message(FATAL_ERROR "Necessary glslang components do not exist: " ${GLSLANG_PREFIX})
36endif()
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -060037
Tony Barbourb4ab8742015-05-21 11:07:47 -060038if(NOT WIN32)
Ian Elliott81ac44c2015-01-13 17:52:38 -070039 if(NOT EXISTS ${LUNARGLASS_PREFIX})
Tony Barbourb4ab8742015-05-21 11:07:47 -060040 message(FATAL_ERROR "Necessary LunarGLASS components do not exist: " ${LUNARGLASS_PREFIX})
Ian Elliott81ac44c2015-01-13 17:52:38 -070041 endif()
Tony Barbourb4ab8742015-05-21 11:07:47 -060042 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Jon Ashburn34cafb62015-03-18 09:29:11 -060043 set(PYTHON_CMD "python3")
44 endif()
45else()
Tony Barbourb4ab8742015-05-21 11:07:47 -060046 set(PYTHON_CMD "py")
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -060047endif()
48
Tony Barboure84a8d62015-07-10 14:10:27 -060049option(BUILD_TESTS "Build tests" ON)
Tony Barbourb4ab8742015-05-21 11:07:47 -060050
Courtney Goeltzenleuchtera8c06282015-04-14 14:55:44 -060051# loader: Generic VULKAN ICD loader
52# icd: Device dependent (DD) VULKAN components
53# tests: VULKAN tests
Chia-I Wu41eddec2014-08-03 09:50:47 +080054add_subdirectory(loader)
David Pinedo0257fbf2015-02-02 18:02:40 -070055add_subdirectory(icd)
Tony Barbour2a199c12015-07-09 17:31:46 -060056if(BUILD_TESTS)
57 add_subdirectory(tests)
58endif()
Tobin Ehlis0b9c1952015-07-06 14:02:36 -060059add_subdirectory(layers)
David Pinedo0257fbf2015-02-02 18:02:40 -070060add_subdirectory(demos)
Courtney Goeltzenleuchter9f51a022015-04-16 09:29:43 -060061#add_subdirectory(tools/glave)