Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 1 | include_directories( |
| 2 | ${CMAKE_CURRENT_SOURCE_DIR} |
Chia-I Wu | f46b81a | 2015-01-04 11:12:47 +0800 | [diff] [blame] | 3 | ${CMAKE_CURRENT_BINARY_DIR} |
Jon Ashburn | d38bfb1 | 2014-10-14 19:15:22 -0600 | [diff] [blame] | 4 | ) |
Chia-I Wu | 0c10534 | 2014-08-03 09:31:26 +0800 | [diff] [blame] | 5 | |
David Pinedo | 0c08365 | 2015-07-09 12:44:38 -0600 | [diff] [blame] | 6 | if (WIN32) |
David Pinedo | 4bb0d30 | 2015-09-08 11:07:46 -0600 | [diff] [blame] | 7 | add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vulkan-${MAJOR}.def |
Mun, Gwan-gyeong | 4f36496 | 2016-02-22 20:27:31 +0900 | [diff] [blame] | 8 | COMMAND ${PYTHON_CMD} ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py ${DisplayServer} win-def-file vulkan-${MAJOR}.dll all > ${CMAKE_CURRENT_BINARY_DIR}/vulkan-${MAJOR}.def |
David Pinedo | 0c08365 | 2015-07-09 12:44:38 -0600 | [diff] [blame] | 9 | DEPENDS ${PROJECT_SOURCE_DIR}/loader/vk-loader-generate.py ${PROJECT_SOURCE_DIR}/vulkan.py) |
David Pinedo | 0c08365 | 2015-07-09 12:44:38 -0600 | [diff] [blame] | 10 | endif() |
Tony Barbour | 1d825c7 | 2015-06-18 16:29:32 -0600 | [diff] [blame] | 11 | |
Courtney Goeltzenleuchter | 64ca923 | 2015-02-10 18:40:14 -0700 | [diff] [blame] | 12 | # DEBUG enables runtime loader ICD verification |
| 13 | set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG") |
| 14 | set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") |
Mark Lobodzinski | 391bb6d | 2015-01-09 15:12:03 -0600 | [diff] [blame] | 15 | |
Jon Ashburn | 761de4b | 2016-03-11 10:58:56 -0700 | [diff] [blame] | 16 | set(NORMAL_LOADER_SRCS |
Jon Ashburn | 2077e38 | 2015-06-29 11:25:34 -0600 | [diff] [blame] | 17 | loader.c |
| 18 | loader.h |
Tobin Ehlis | b835d1b | 2015-07-03 10:34:49 -0600 | [diff] [blame] | 19 | vk_loader_platform.h |
Jon Ashburn | 2077e38 | 2015-06-29 11:25:34 -0600 | [diff] [blame] | 20 | trampoline.c |
Ian Elliott | 954fa34 | 2015-10-30 15:28:23 -0600 | [diff] [blame] | 21 | wsi.c |
| 22 | wsi.h |
Jon Ashburn | 2077e38 | 2015-06-29 11:25:34 -0600 | [diff] [blame] | 23 | debug_report.c |
| 24 | debug_report.h |
| 25 | table_ops.h |
| 26 | gpa_helper.h |
| 27 | cJSON.c |
| 28 | cJSON.h |
Jon Ashburn | fc1031e | 2015-11-17 15:31:02 -0700 | [diff] [blame] | 29 | murmurhash.c |
| 30 | murmurhash.h |
Jon Ashburn | 2077e38 | 2015-06-29 11:25:34 -0600 | [diff] [blame] | 31 | ) |
Ian Elliott | 1962880 | 2015-02-04 12:06:46 -0700 | [diff] [blame] | 32 | |
Jon Ashburn | 761de4b | 2016-03-11 10:58:56 -0700 | [diff] [blame] | 33 | set (OPT_LOADER_SRCS |
| 34 | dev_ext_trampoline.c |
| 35 | ) |
| 36 | |
| 37 | set (LOADER_SRCS ${NORMAL_LOADER_SRCS} ${OPT_LOADER_SRCS}) |
Ian Elliott | d3ef02f | 2015-07-06 14:36:13 -0600 | [diff] [blame] | 38 | |
Jon Ashburn | 2077e38 | 2015-06-29 11:25:34 -0600 | [diff] [blame] | 39 | if (WIN32) |
Jon Ashburn | ce816b6 | 2016-01-12 11:33:33 -0700 | [diff] [blame] | 40 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_CRT_SECURE_NO_WARNINGS") |
Jon Ashburn | 761de4b | 2016-03-11 10:58:56 -0700 | [diff] [blame] | 41 | # Build dev_ext_trampoline.c with -O2 to allow tail-call optimization. |
| 42 | # Build other C files with normal options |
| 43 | # setup two Cmake targets (loader-norm and loader-opt) for the different compilation flags |
| 44 | separate_arguments(LOCAL_C_FLAGS_DBG WINDOWS_COMMAND ${CMAKE_C_FLAGS_DEBUG}) |
| 45 | set(CMAKE_C_FLAGS_DEBUG " ") |
| 46 | separate_arguments(LOCAL_C_FLAGS_REL WINDOWS_COMMAND ${CMAKE_C_FLAGS_RELEASE}) |
Jon Ashburn | 2077e38 | 2015-06-29 11:25:34 -0600 | [diff] [blame] | 47 | |
Jon Ashburn | 761de4b | 2016-03-11 10:58:56 -0700 | [diff] [blame] | 48 | add_library(loader-norm OBJECT ${NORMAL_LOADER_SRCS} dirent_on_windows.c) |
| 49 | target_compile_options(loader-norm PUBLIC "$<$<CONFIG:DEBUG>:${LOCAL_C_FLAGS_DBG}>") |
| 50 | add_library(loader-opt OBJECT ${OPT_LOADER_SRCS}) |
| 51 | target_compile_options(loader-opt PUBLIC "$<$<CONFIG:DEBUG>:${LOCAL_C_FLAGS_REL}>") |
| 52 | add_library(vulkan-${MAJOR} SHARED $<TARGET_OBJECTS:loader-opt> $<TARGET_OBJECTS:loader-norm> ${CMAKE_CURRENT_BINARY_DIR}/vulkan-${MAJOR}.def) |
David Pinedo | 4bb0d30 | 2015-09-08 11:07:46 -0600 | [diff] [blame] | 53 | set_target_properties(vulkan-${MAJOR} PROPERTIES LINK_FLAGS "/DEF:${CMAKE_CURRENT_BINARY_DIR}/vulkan-${MAJOR}.def") |
Jon Ashburn | 761de4b | 2016-03-11 10:58:56 -0700 | [diff] [blame] | 54 | add_library(VKstatic.${MAJOR} STATIC $<TARGET_OBJECTS:loader-opt> $<TARGET_OBJECTS:loader-norm>) |
David Pinedo | 0c08365 | 2015-07-09 12:44:38 -0600 | [diff] [blame] | 55 | set_target_properties(VKstatic.${MAJOR} PROPERTIES OUTPUT_NAME VKstatic.${MAJOR}) |
David Pinedo | 4bb0d30 | 2015-09-08 11:07:46 -0600 | [diff] [blame] | 56 | target_link_libraries(vulkan-${MAJOR} shlwapi) |
Jon Ashburn | bb7e35b | 2016-02-12 16:39:20 -0700 | [diff] [blame] | 57 | else() |
Jon Ashburn | ce816b6 | 2016-01-12 11:33:33 -0700 | [diff] [blame] | 58 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith") |
Ian Elliott | 1962880 | 2015-02-04 12:06:46 -0700 | [diff] [blame] | 59 | |
Jeremy Hayes | 2264144 | 2016-02-08 12:14:51 -0700 | [diff] [blame] | 60 | add_library(vulkan SHARED ${LOADER_SRCS}) |
Tony Barbour | d83f06c | 2016-03-08 14:50:03 -0700 | [diff] [blame] | 61 | set_target_properties(vulkan PROPERTIES SOVERSION "1" VERSION "1.0.5") |
Jeremy Hayes | 2264144 | 2016-02-08 12:14:51 -0700 | [diff] [blame] | 62 | target_link_libraries(vulkan -ldl -lpthread -lm) |
Ian Elliott | 2d4ab1e | 2015-01-13 17:52:38 -0700 | [diff] [blame] | 63 | endif() |