Courtney Goeltzenleuchter | f53c3cb | 2015-04-14 14:55:44 -0600 | [diff] [blame] | 1 | # 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 Wu | c362459 | 2015-01-10 23:15:51 +0800 | [diff] [blame] | 4 | cmake_minimum_required(VERSION 2.8.11) |
Courtney Goeltzenleuchter | f53c3cb | 2015-04-14 14:55:44 -0600 | [diff] [blame] | 5 | project (VULKAN) |
Courtney Goeltzenleuchter | 1d22ed8 | 2014-08-01 13:01:47 -0600 | [diff] [blame] | 6 | # set (CMAKE_VERBOSE_MAKEFILE 1) |
Courtney Goeltzenleuchter | 2220a3b | 2014-07-24 08:36:15 -0600 | [diff] [blame] | 7 | |
David Pinedo | 0c08365 | 2015-07-09 12:44:38 -0600 | [diff] [blame] | 8 | # The MAJOR number of the version we're building, used in naming |
| 9 | # vulkan.<major>.dll (and other files). |
| 10 | set(MAJOR "0") |
| 11 | |
Chia-I Wu | c362459 | 2015-01-10 23:15:51 +0800 | [diff] [blame] | 12 | set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake") |
| 13 | |
Courtney Goeltzenleuchter | 2220a3b | 2014-07-24 08:36:15 -0600 | [diff] [blame] | 14 | # Header file for CMake settings |
Courtney Goeltzenleuchter | 2220a3b | 2014-07-24 08:36:15 -0600 | [diff] [blame] | 15 | include_directories("${PROJECT_SOURCE_DIR}/include") |
| 16 | |
Chia-I Wu | 155be03 | 2014-08-02 09:14:28 +0800 | [diff] [blame] | 17 | include(FindPkgConfig) |
Chia-I Wu | 155be03 | 2014-08-02 09:14:28 +0800 | [diff] [blame] | 18 | |
Chia-I Wu | 084c886 | 2015-02-17 09:55:34 -0700 | [diff] [blame] | 19 | if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") |
Ian Elliott | 661dc37 | 2015-02-13 14:04:01 -0700 | [diff] [blame] | 20 | set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers") |
Tony Barbour | f435160 | 2015-02-05 14:14:33 -0700 | [diff] [blame] | 21 | set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp") |
Chia-I Wu | bba8fc0 | 2014-12-19 11:34:46 +0800 | [diff] [blame] | 22 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}") |
Adam Jackson | 77d5fd3 | 2015-06-23 15:33:48 -0400 | [diff] [blame] | 23 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++11") |
Chia-I Wu | 1930060 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 24 | if (UNIX) |
| 25 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden") |
Chia-I Wu | 33ada63 | 2015-01-18 11:09:29 +0800 | [diff] [blame] | 26 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") |
Chia-I Wu | 1930060 | 2014-08-04 08:03:57 +0800 | [diff] [blame] | 27 | endif() |
| 28 | endif() |
Chia-I Wu | 155be03 | 2014-08-02 09:14:28 +0800 | [diff] [blame] | 29 | |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 30 | # Hard code our LunarGLASS and glslang paths for now |
| 31 | get_filename_component(GLSLANG_PREFIX ../glslang ABSOLUTE) |
| 32 | get_filename_component(LUNARGLASS_PREFIX ../LunarGLASS ABSOLUTE) |
Courtney Goeltzenleuchter | a43bbd8 | 2014-10-03 15:34:53 -0600 | [diff] [blame] | 33 | |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 34 | if(NOT EXISTS ${GLSLANG_PREFIX}) |
| 35 | message(FATAL_ERROR "Necessary glslang components do not exist: " ${GLSLANG_PREFIX}) |
| 36 | endif() |
Courtney Goeltzenleuchter | a43bbd8 | 2014-10-03 15:34:53 -0600 | [diff] [blame] | 37 | |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 38 | if(NOT WIN32) |
Adam Jackson | 3869f41 | 2015-07-23 16:29:26 -0400 | [diff] [blame^] | 39 | include(GNUInstallDirs) |
| 40 | add_definitions(-DLIBDIR="${CMAKE_INSTALL_FULL_LIBDIR}") |
| 41 | add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}") |
| 42 | add_definitions(-DDATADIR="${CMAKE_INSTALL_FULL_DATADIR}") |
| 43 | |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 44 | if(NOT EXISTS ${LUNARGLASS_PREFIX}) |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 45 | message(FATAL_ERROR "Necessary LunarGLASS components do not exist: " ${LUNARGLASS_PREFIX}) |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 46 | endif() |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 47 | if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") |
Jon Ashburn | 1a97d6c | 2015-03-18 09:29:11 -0600 | [diff] [blame] | 48 | set(PYTHON_CMD "python3") |
| 49 | endif() |
| 50 | else() |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 51 | set(PYTHON_CMD "py") |
Courtney Goeltzenleuchter | a43bbd8 | 2014-10-03 15:34:53 -0600 | [diff] [blame] | 52 | endif() |
| 53 | |
Tony Barbour | 67e9915 | 2015-07-10 14:10:27 -0600 | [diff] [blame] | 54 | option(BUILD_TESTS "Build tests" ON) |
Tony Barbour | 500194c | 2015-05-21 11:07:47 -0600 | [diff] [blame] | 55 | |
Courtney Goeltzenleuchter | f53c3cb | 2015-04-14 14:55:44 -0600 | [diff] [blame] | 56 | # loader: Generic VULKAN ICD loader |
| 57 | # icd: Device dependent (DD) VULKAN components |
| 58 | # tests: VULKAN tests |
Chia-I Wu | b72e87d | 2014-08-03 09:50:47 +0800 | [diff] [blame] | 59 | add_subdirectory(loader) |
David Pinedo | 691c6b2 | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 60 | add_subdirectory(icd) |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 61 | if(BUILD_TESTS) |
| 62 | add_subdirectory(tests) |
| 63 | endif() |
Tobin Ehlis | a30e7e5 | 2015-07-06 14:02:36 -0600 | [diff] [blame] | 64 | add_subdirectory(layers) |
David Pinedo | 691c6b2 | 2015-02-02 18:02:40 -0700 | [diff] [blame] | 65 | add_subdirectory(demos) |
Courtney Goeltzenleuchter | 17b8457 | 2015-04-16 09:29:43 -0600 | [diff] [blame] | 66 | #add_subdirectory(tools/glave) |