-
Notifications
You must be signed in to change notification settings - Fork 42
/
CMakeLists.txt.island_epilog.in
88 lines (68 loc) · 3.76 KB
/
CMakeLists.txt.island_epilog.in
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Load all modules which where requested
foreach( M IN LISTS MODULES_LIST )
request_island_module(${M})
endforeach()
while(REQUESTED_MODULES_LIST)
# remove any duplicates from requested modules
list(REMOVE_DUPLICATES REQUESTED_MODULES_LIST)
# remove any modules from the requested list which are already in the loaded list
list(REMOVE_ITEM REQUESTED_MODULES_LIST ${LOADED_MODULES_LIST})
# store the requested_modules_list back to global
set( REQUESTED_MODULES_LIST ${REQUESTED_MODULES_LIST} ${MODULE_NAME} CACHE INTERNAL "requested modules_list" )
# message(STATUS "requested modules 1: ${REQUESTED_MODULES_LIST}")
# Load all modules which where requested and which were not yet loaded
foreach( M IN LISTS REQUESTED_MODULES_LIST )
load_island_module(${M})
endforeach()
# message(STATUS "requested modules 2: ${REQUESTED_MODULES_LIST}")
list(REMOVE_ITEM REQUESTED_MODULES_LIST ${LOADED_MODULES_LIST})
# store requested modules list back to global
set( REQUESTED_MODULES_LIST ${REQUESTED_MODULES_LIST} ${MODULE_NAME} CACHE INTERNAL "requested modules_list" )
# repeat this until no more modules are requested.
# message(STATUS "requested modules 3: ${REQUESTED_MODULES_LIST}")
# remove any elements from requested modules which are now present in loaded modules
endwhile(REQUESTED_MODULES_LIST)
# print_current_includes()
# NOTE: provide paths for libraries which are used by modules,
# but not available via system search paths
# these were set via PARENT_SCOPE from the plugin CMake files.
link_directories(${PLUGIN_LINK_DIRS})
add_executable (${PROJECT_NAME} ${SOURCES})
# add -D definitions so that source code will know whether modules are linked
# statically or dynamically
if (PLUGINS_DYNAMIC)
target_compile_definitions(${PROJECT_NAME} PUBLIC "PLUGINS_DYNAMIC=1")
endif()
# we need to link in the dynamic linking library so we can use dynamic linking
target_link_libraries(${PROJECT_NAME} PRIVATE ${CMAKE_DL_LIBS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${PLUGIN_LIBS_DEPENDENCIES})
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# this is only needed for the GNU linker - it will force the linker to check all libraries for symbols,
# not just the ones that are specified before a given library.
# more modern (and faster) linkers such as lld (llvm) or mold won't need this.
target_link_libraries(${PROJECT_NAME} PRIVATE "-Wl,--start-group" $CACHE{STATIC_LIBRARIES} "-Wl,--end-group" )
else()
# link static libs
target_link_libraries(${PROJECT_NAME} PRIVATE $CACHE{STATIC_LIBRARIES} )
endif()
message(STATUS "Static libraries : $CACHE{STATIC_LIBRARIES}")
message(STATUS "Loaded modules : ${LOADED_MODULES_LIST}")
# Libraries against which we dynamically link our main application:
message(STATUS "Libs dependencies: ${PLUGIN_LIBS_DEPENDENCIES}")
##################################################################################
# OPTIONAL - Use Vulkan Validation Layers compiled from source -
# so that we may debug the validation layers, too (how meta!)
set(COMPILE_VALIDATION_LAYERS OFF CACHE BOOL "Compile Validation Layers as a subproject (useful to debug validation layers)")
function(compile_validation_layers)
# this allows us to debug debug layers -- how meta!!!
unset( CMAKE_ARCHIVE_OUTPUT_DIRECTORY )
unset( CMAKE_LIBRARY_OUTPUT_DIRECTORY )
unset( CMAKE_RUNTIME_OUTPUT_DIRECTORY )
# set (CMAKE_BUILD_TYPE Debug)
set (VulkanRegistry_DIR /usr/local/share/vulkan/registry)
add_subdirectory(3rdparty/src/Vulkan-ValidationLayers ${ISLAND_BASE_DIR}/3rdparty/src/Vulkan-ValidationLayers/build)
endfunction(compile_validation_layers)
if (COMPILE_VALIDATION_LAYERS)
set (GLSLANG_INSTALL_DIR "/usr/local" CACHE STRING "")
compile_validation_layers()
endif()