forked from MethanePowered/MethaneKit
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
66 lines (53 loc) · 1.47 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
if(APPLE_IOS OR APPLE_TVOS)
# Console applications are not supported on iOS / tvOS
return()
endif()
set(TARGET MethaneConsoleCompute)
include(MethaneShaders)
add_executable(${TARGET}
ConsoleApp.h
ConsoleApp.cpp
ConsoleComputeApp.h
ConsoleComputeApp.cpp
)
target_link_libraries(${TARGET}
PRIVATE
MethaneKit
ftxui::component # FTXUI
)
add_methane_shaders_source(
TARGET ${TARGET}
SOURCE Shaders/GameOfLife.hlsl
VERSION 6_0
TYPES
comp=MainCS
)
add_methane_shaders_library(${TARGET})
set_target_properties(${TARGET}
PROPERTIES
FOLDER Apps
)
install(
TARGETS ${TARGET}
RUNTIME
DESTINATION Apps
COMPONENT Runtime
)
# PREREQUISITE_RESOURCES contains compiled Metal shaders library, which should be copied next to executable
get_target_property(COPY_RESOURCES ${TARGET} PREREQUISITE_RESOURCES)
if (COPY_RESOURCES AND NOT COPY_RESOURCES STREQUAL "COPY_RESOURCES-NOTFOUND")
if(METHANE_GFX_API EQUAL METHANE_GFX_METAL)
get_target_property(SHADER_TARGET ${TARGET} METAL_LIB_TARGET)
else()
set(SHADER_TARGETS ${TARGET})
endif()
add_custom_command(TARGET ${SHADER_TARGET} POST_BUILD
COMMENT "Copying prerequisite resources for application ${TARGET}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${COPY_RESOURCES} "$<TARGET_FILE_DIR:${TARGET}>"
)
install(
FILES ${COPY_RESOURCES}
DESTINATION Apps
COMPONENT Runtime
)
endif()