Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 1 | cmake_minimum_required (VERSION 2.8.11) |
| 2 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 3 | macro(run_vk_helper subcmd) |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 4 | add_custom_command(OUTPUT ${ARGN} |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 5 | COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/vk_helper.py --${subcmd} ${PROJECT_SOURCE_DIR}/include/vulkan.h --abs_out_dir ${CMAKE_CURRENT_BINARY_DIR} |
| 6 | DEPENDS ${PROJECT_SOURCE_DIR}/vk_helper.py ${PROJECT_SOURCE_DIR}/include/vulkan.h |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 7 | ) |
| 8 | endmacro() |
| 9 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 10 | macro(run_vk_layer_generate subcmd output) |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 11 | add_custom_command(OUTPUT ${output} |
Courtney Goeltzenleuchter | f53c3cb | 2015-04-14 14:55:44 -0600 | [diff] [blame] | 12 | COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/vk-layer-generate.py ${subcmd} ${PROJECT_SOURCE_DIR}/include/vulkan.h > ${output} |
| 13 | DEPENDS ${PROJECT_SOURCE_DIR}/vk-layer-generate.py ${PROJECT_SOURCE_DIR}/include/vulkan.h ${PROJECT_SOURCE_DIR}/vulkan.py |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 14 | ) |
| 15 | endmacro() |
| 16 | |
Courtney Goeltzenleuchter | b38936a | 2015-07-07 14:27:31 -0600 | [diff] [blame] | 17 | set(LAYER_JSON_FILES |
Jon Ashburn | 4efec94 | 2015-07-07 15:21:07 -0600 | [diff] [blame] | 18 | api_dump |
| 19 | basic |
| 20 | draw_state |
| 21 | generic |
| 22 | image |
| 23 | mem_tracker |
| 24 | multi |
| 25 | object_tracker |
| 26 | param_checker |
| 27 | screenshot |
| 28 | shader_checker |
Ian Elliott | 0b4d624 | 2015-09-22 10:51:24 -0600 | [diff] [blame] | 29 | swapchain |
Jon Ashburn | 4efec94 | 2015-07-07 15:21:07 -0600 | [diff] [blame] | 30 | threading |
Tobin Ehlis | b5fc4fb | 2015-09-03 09:50:06 -0600 | [diff] [blame] | 31 | device_limits |
Courtney Goeltzenleuchter | b38936a | 2015-07-07 14:27:31 -0600 | [diff] [blame] | 32 | ) |
| 33 | |
Mike Stroyan | 897d475 | 2015-07-10 12:51:14 -0600 | [diff] [blame] | 34 | set(VK_LAYER_RPATH /usr/lib/x86_64-linux-gnu/vulkan/layer:/usr/lib/i386-linux-gnu/vulkan/layer) |
| 35 | set(CMAKE_INSTALL_RPATH ${VK_LAYER_RPATH}) |
| 36 | |
Courtney Goeltzenleuchter | b38936a | 2015-07-07 14:27:31 -0600 | [diff] [blame] | 37 | if (NOT WIN32) |
| 38 | # extra setup for out-of-tree builds |
| 39 | if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) |
| 40 | foreach (config_file ${LAYER_JSON_FILES}) |
| 41 | add_custom_target(${config_file}-json ALL |
Courtney Goeltzenleuchter | 0eae6fd | 2015-07-30 10:49:03 -0600 | [diff] [blame] | 42 | COMMAND ln -sf ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json |
Courtney Goeltzenleuchter | b38936a | 2015-07-07 14:27:31 -0600 | [diff] [blame] | 43 | VERBATIM |
| 44 | ) |
| 45 | endforeach(config_file) |
| 46 | endif() |
| 47 | else() |
| 48 | if (NOT (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)) |
| 49 | foreach (config_file ${LAYER_JSON_FILES}) |
Courtney Goeltzenleuchter | 0eae6fd | 2015-07-30 10:49:03 -0600 | [diff] [blame] | 50 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/windows/${config_file}.json src_json) |
David Pinedo | 5d78eb8 | 2015-09-15 10:58:27 -0600 | [diff] [blame] | 51 | FILE(TO_NATIVE_PATH ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>/${config_file}.json dst_json) |
Cody Northrop | 5c7533b | 2015-07-08 16:22:51 -0600 | [diff] [blame] | 52 | add_custom_target(${config_file}-json ALL |
Cody Northrop | 06a455b | 2015-07-09 10:47:40 -0600 | [diff] [blame] | 53 | COMMAND copy ${src_json} ${dst_json} |
Courtney Goeltzenleuchter | b38936a | 2015-07-07 14:27:31 -0600 | [diff] [blame] | 54 | VERBATIM |
| 55 | ) |
| 56 | endforeach(config_file) |
| 57 | endif() |
| 58 | endif() |
| 59 | |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 60 | if (WIN32) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 61 | macro(add_vk_layer target) |
| 62 | add_custom_command(OUTPUT VKLayer${target}.def |
Ian Elliott | 2ff2167 | 2015-04-15 11:16:04 -0600 | [diff] [blame] | 63 | COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/vk-generate.py win-def-file VKLayer${target} layer > VKLayer${target}.def |
| 64 | DEPENDS ${PROJECT_SOURCE_DIR}/vk-generate.py ${PROJECT_SOURCE_DIR}/vk.py |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 65 | ) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 66 | add_library(VKLayer${target} SHARED ${ARGN} VKLayer${target}.def) |
| 67 | target_link_Libraries(VKLayer${target} layer_utils) |
Cody Northrop | d0892c8 | 2015-05-28 10:09:50 -0600 | [diff] [blame] | 68 | add_dependencies(VKLayer${target} layer_utils_static) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 69 | add_dependencies(VKLayer${target} generate_vk_layer_helpers) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 70 | set_target_properties(VKLayer${target} PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/VKLayer${target}.def") |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 71 | endmacro() |
| 72 | else() |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 73 | macro(add_vk_layer target) |
| 74 | add_library(VKLayer${target} SHARED ${ARGN}) |
| 75 | target_link_Libraries(VKLayer${target} layer_utils) |
| 76 | add_dependencies(VKLayer${target} generate_vk_layer_helpers) |
| 77 | set_target_properties(VKLayer${target} PROPERTIES LINK_FLAGS "-Wl,-Bsymbolic") |
Mike Stroyan | 897d475 | 2015-07-10 12:51:14 -0600 | [diff] [blame] | 78 | install(TARGETS VKLayer${target} DESTINATION ${PROJECT_BINARY_DIR}/install_staging) |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 79 | endmacro() |
| 80 | endif() |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 81 | |
Chia-I Wu | 21bddab | 2014-11-19 23:05:04 +0800 | [diff] [blame] | 82 | include_directories( |
| 83 | ${CMAKE_CURRENT_SOURCE_DIR} |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 84 | ${CMAKE_CURRENT_SOURCE_DIR}/../loader |
Chia-I Wu | 21bddab | 2014-11-19 23:05:04 +0800 | [diff] [blame] | 85 | ${CMAKE_CURRENT_BINARY_DIR} |
| 86 | ) |
| 87 | |
Ian Elliott | 1962880 | 2015-02-04 12:06:46 -0700 | [diff] [blame] | 88 | if (WIN32) |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 89 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES -D_CRT_SECURE_NO_WARNINGS") |
| 90 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES -D_CRT_SECURE_NO_WARNINGS") |
Ian Elliott | 1962880 | 2015-02-04 12:06:46 -0700 | [diff] [blame] | 91 | endif() |
| 92 | if (NOT WIN32) |
| 93 | set (CMAKE_CXX_FLAGS "-std=c++11") |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 94 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DVK_PROTOTYPES -Wpointer-arith") |
| 95 | set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DVK_PROTOTYPES -Wpointer-arith") |
Ian Elliott | 1962880 | 2015-02-04 12:06:46 -0700 | [diff] [blame] | 96 | endif() |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 97 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 98 | add_custom_command(OUTPUT vk_dispatch_table_helper.h |
Courtney Goeltzenleuchter | f53c3cb | 2015-04-14 14:55:44 -0600 | [diff] [blame] | 99 | COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/vk-generate.py dispatch-table-ops layer > vk_dispatch_table_helper.h |
| 100 | DEPENDS ${PROJECT_SOURCE_DIR}/vk-generate.py ${PROJECT_SOURCE_DIR}/vulkan.py) |
Chia-I Wu | aa4121f | 2015-01-04 23:11:43 +0800 | [diff] [blame] | 101 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 102 | run_vk_helper(gen_enum_string_helper vk_enum_string_helper.h) |
| 103 | run_vk_helper(gen_struct_wrappers |
| 104 | vk_struct_string_helper.h |
| 105 | vk_struct_string_helper_cpp.h |
| 106 | vk_struct_string_helper_no_addr.h |
| 107 | vk_struct_string_helper_no_addr_cpp.h |
| 108 | vk_struct_size_helper.h |
| 109 | vk_struct_size_helper.c |
| 110 | vk_struct_wrappers.h |
| 111 | vk_struct_wrappers.cpp |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 112 | ) |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 113 | |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 114 | add_custom_target(generate_vk_layer_helpers DEPENDS |
| 115 | vk_dispatch_table_helper.h |
Courtney Goeltzenleuchter | d8e229c | 2015-04-08 15:36:08 -0600 | [diff] [blame] | 116 | vk_enum_string_helper.h |
| 117 | vk_struct_string_helper.h |
| 118 | vk_struct_string_helper_no_addr.h |
| 119 | vk_struct_string_helper_cpp.h |
| 120 | vk_struct_string_helper_no_addr_cpp.h |
| 121 | vk_struct_size_helper.h |
| 122 | vk_struct_size_helper.c |
| 123 | vk_struct_wrappers.h |
| 124 | vk_struct_wrappers.cpp |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 125 | ) |
| 126 | |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 127 | run_vk_layer_generate(Generic generic_layer.cpp) |
Mark Lobodzinski | 4c7ac0a | 2015-05-26 09:29:09 -0500 | [diff] [blame] | 128 | run_vk_layer_generate(APIDump api_dump.cpp) |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 129 | run_vk_layer_generate(ObjectTracker object_track.cpp) |
Mike Stroyan | be2b5d8 | 2015-07-09 11:01:07 -0600 | [diff] [blame] | 130 | run_vk_layer_generate(Threading threading.cpp) |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 131 | |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 132 | add_library(layer_utils SHARED vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp) |
Ian Elliott | a6bbf3e | 2015-02-12 11:36:44 -0700 | [diff] [blame] | 133 | if (WIN32) |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 134 | add_library(layer_utils_static STATIC vk_layer_config.cpp vk_layer_extension_utils.cpp vk_layer_utils.cpp) |
Ian Elliott | a6bbf3e | 2015-02-12 11:36:44 -0700 | [diff] [blame] | 135 | set_target_properties(layer_utils_static PROPERTIES OUTPUT_NAME layer_utils) |
| 136 | target_link_libraries(layer_utils) |
Mike Stroyan | 897d475 | 2015-07-10 12:51:14 -0600 | [diff] [blame] | 137 | else() |
| 138 | install(TARGETS layer_utils DESTINATION ${PROJECT_BINARY_DIR}/install_staging) |
Ian Elliott | a6bbf3e | 2015-02-12 11:36:44 -0700 | [diff] [blame] | 139 | endif() |
Jon Ashburn | ba60628 | 2015-01-13 15:22:19 -0700 | [diff] [blame] | 140 | |
Courtney Goeltzenleuchter | 4ad43f7 | 2015-07-09 19:04:04 -0600 | [diff] [blame] | 141 | add_vk_layer(Basic basic.cpp vk_layer_table.cpp) |
Jon Ashburn | 1e41a44 | 2015-08-12 16:43:01 -0600 | [diff] [blame] | 142 | add_vk_layer(Multi multi.cpp vk_layer_table.cpp) |
Tobin Ehlis | 60a9b4f | 2015-07-07 10:42:20 -0600 | [diff] [blame] | 143 | add_vk_layer(DrawState draw_state.cpp vk_layer_debug_marker_table.cpp vk_layer_table.cpp) |
Mark Lobodzinski | 6f2274e | 2015-09-22 09:33:21 -0600 | [diff] [blame] | 144 | add_vk_layer(DeviceLimits device_limits.cpp vk_layer_debug_marker_table.cpp vk_layer_table.cpp vk_layer_utils.cpp) |
Tobin Ehlis | 257d974 | 2015-07-08 17:08:02 -0600 | [diff] [blame] | 145 | add_vk_layer(MemTracker mem_tracker.cpp vk_layer_table.cpp) |
Chris Forbes | 9715d4a | 2015-07-10 09:06:54 +1200 | [diff] [blame] | 146 | add_vk_layer(ShaderChecker shader_checker.cpp vk_layer_table.cpp) |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 147 | add_vk_layer(Image image.cpp vk_layer_table.cpp) |
Courtney Goeltzenleuchter | ee5d80b | 2015-07-10 19:50:17 -0600 | [diff] [blame] | 148 | add_vk_layer(ParamChecker param_checker.cpp vk_layer_debug_marker_table.cpp vk_layer_table.cpp) |
David Pinedo | 8897e19 | 2015-07-31 10:56:20 -0600 | [diff] [blame] | 149 | add_vk_layer(ScreenShot screenshot.cpp vk_layer_table.cpp) |
Ian Elliott | 0b4d624 | 2015-09-22 10:51:24 -0600 | [diff] [blame] | 150 | add_vk_layer(Swapchain swapchain.cpp vk_layer_table.cpp) |
Chia-I Wu | db2b387 | 2014-12-19 10:59:01 +0800 | [diff] [blame] | 151 | # generated |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 152 | add_vk_layer(Generic generic_layer.cpp vk_layer_table.cpp) |
Tobin Ehlis | a0cb02e | 2015-07-03 10:15:26 -0600 | [diff] [blame] | 153 | add_vk_layer(APIDump api_dump.cpp vk_layer_table.cpp) |
Tony Barbour | a05dbaa | 2015-07-09 17:31:46 -0600 | [diff] [blame] | 154 | add_vk_layer(ObjectTracker object_track.cpp vk_layer_table.cpp) |
Mike Stroyan | be2b5d8 | 2015-07-09 11:01:07 -0600 | [diff] [blame] | 155 | add_vk_layer(Threading threading.cpp vk_layer_table.cpp) |