blob: 329bb274709304f855228e83e7a29e1230fcc62b [file] [log] [blame]
Courtney Goeltzenleuchterf53c3cb2015-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 Wuc3624592015-01-10 23:15:51 +08004cmake_minimum_required(VERSION 2.8.11)
Courtney Goeltzenleuchterf53c3cb2015-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
Chia-I Wuc3624592015-01-10 23:15:51 +08008set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
9
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060010# Header file for CMake settings
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060011include_directories("${PROJECT_SOURCE_DIR}/include")
12
Chia-I Wu155be032014-08-02 09:14:28 +080013include(FindPkgConfig)
Chia-I Wu155be032014-08-02 09:14:28 +080014
Chia-I Wu084c8862015-02-17 09:55:34 -070015if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
Ian Elliott661dc372015-02-13 14:04:01 -070016 set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
Tony Barbourf4351602015-02-05 14:14:33 -070017 set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
Chia-I Wubba8fc02014-12-19 11:34:46 +080018 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}")
Chia-I Wuf0f1a0d2014-12-16 00:07:11 +080019 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS}")
Chia-I Wu19300602014-08-04 08:03:57 +080020 if (UNIX)
21 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
Chia-I Wu33ada632015-01-18 11:09:29 +080022 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
Chia-I Wu19300602014-08-04 08:03:57 +080023 endif()
24endif()
Chia-I Wu155be032014-08-02 09:14:28 +080025
Tony Barbour500194c2015-05-21 11:07:47 -060026# Hard code our LunarGLASS and glslang paths for now
27get_filename_component(GLSLANG_PREFIX ../glslang ABSOLUTE)
28get_filename_component(LUNARGLASS_PREFIX ../LunarGLASS ABSOLUTE)
Courtney Goeltzenleuchtera43bbd82014-10-03 15:34:53 -060029
Tony Barbour500194c2015-05-21 11:07:47 -060030if(NOT EXISTS ${GLSLANG_PREFIX})
31 message(FATAL_ERROR "Necessary glslang components do not exist: " ${GLSLANG_PREFIX})
32endif()
Courtney Goeltzenleuchtera43bbd82014-10-03 15:34:53 -060033
Tony Barbour500194c2015-05-21 11:07:47 -060034if(NOT WIN32)
Ian Elliott2d4ab1e2015-01-13 17:52:38 -070035 if(NOT EXISTS ${LUNARGLASS_PREFIX})
Tony Barbour500194c2015-05-21 11:07:47 -060036 message(FATAL_ERROR "Necessary LunarGLASS components do not exist: " ${LUNARGLASS_PREFIX})
Ian Elliott2d4ab1e2015-01-13 17:52:38 -070037 endif()
Tony Barbour500194c2015-05-21 11:07:47 -060038 if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
Jon Ashburn1a97d6c2015-03-18 09:29:11 -060039 set(PYTHON_CMD "python3")
40 endif()
41else()
Tony Barbour500194c2015-05-21 11:07:47 -060042 set(PYTHON_CMD "py")
Courtney Goeltzenleuchtera43bbd82014-10-03 15:34:53 -060043endif()
44
Tony Barbour500194c2015-05-21 11:07:47 -060045option(BUILD_TESTS "Build tests" ON)
46
Courtney Goeltzenleuchterf53c3cb2015-04-14 14:55:44 -060047# loader: Generic VULKAN ICD loader
48# icd: Device dependent (DD) VULKAN components
49# tests: VULKAN tests
Chia-I Wub72e87d2014-08-03 09:50:47 +080050add_subdirectory(loader)
David Pinedo691c6b22015-02-02 18:02:40 -070051add_subdirectory(icd)
Tony Barbour500194c2015-05-21 11:07:47 -060052if(BUILD_TESTS)
Ian Elliott2d4ab1e2015-01-13 17:52:38 -070053 add_subdirectory(tests)
54endif()
Jon Ashburn2112d6b2015-04-01 13:30:06 -060055add_subdirectory(layers)
David Pinedo691c6b22015-02-02 18:02:40 -070056add_subdirectory(demos)
Courtney Goeltzenleuchter17b84572015-04-16 09:29:43 -060057#add_subdirectory(tools/glave)