-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
CMakeLists.txt
66 lines (52 loc) · 2.42 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
cmake_minimum_required(VERSION 3.20)
project(rpcsx)
set(CMAKE_CXX_EXTENSIONS off)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED on)
set(CMAKE_BUILD_RPATH_USE_ORIGIN on)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
find_package(nlohmann_json CONFIG)
add_subdirectory(3rdparty EXCLUDE_FROM_ALL)
function(add_precompiled_vulkan_spirv target)
add_library(${target} INTERFACE)
set(SPIRV_GEN_ROOT_DIR "spirv-gen/include/")
set(SPIRV_GEN_DIR "${SPIRV_GEN_ROOT_DIR}/shaders")
cmake_path(ABSOLUTE_PATH SPIRV_GEN_ROOT_DIR BASE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} NORMALIZE OUTPUT_VARIABLE outputrootdir)
cmake_path(ABSOLUTE_PATH SPIRV_GEN_DIR BASE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} NORMALIZE OUTPUT_VARIABLE outputdir)
file(MAKE_DIRECTORY ${outputrootdir})
file(MAKE_DIRECTORY ${outputdir})
target_include_directories(${target} INTERFACE ${outputrootdir})
foreach(input IN LISTS ARGN)
cmake_path(GET input FILENAME inputname)
cmake_path(REPLACE_EXTENSION inputname LAST_ONLY .h OUTPUT_VARIABLE outputname)
cmake_path(APPEND outputdir ${outputname} OUTPUT_VARIABLE outputpath)
cmake_path(REMOVE_EXTENSION inputname LAST_ONLY OUTPUT_VARIABLE varname)
string(REPLACE "." "_" varname ${varname})
string(PREPEND varname "spirv_")
add_custom_command(
OUTPUT ${outputpath}
COMMAND $<TARGET_FILE:glslang::glslang-standalone> -V --target-env vulkan1.2 --vn "${varname}" -o "${outputpath}" "${CMAKE_CURRENT_SOURCE_DIR}/${input}"
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${input}" glslang::glslang-standalone
COMMENT "Generating ${outputname}..."
)
set(subtarget ".${target}-subtarget-${outputname}")
add_custom_target(${subtarget} DEPENDS ${outputpath})
add_dependencies(${target} ${subtarget})
endforeach()
endfunction()
function(target_base_address target address)
set_target_properties(${target} PROPERTIES POSITION_INDEPENDENT_CODE off)
if(CMAKE_CXX_COMPILER_LINKER_ID MATCHES "^(LLD|MOLD)$")
target_link_options(${target} PUBLIC "LINKER:--image-base=${address}")
else()
target_link_options(${target} PUBLIC "LINKER:-Ttext-segment,${address}")
endif()
endfunction()
add_subdirectory(tools)
add_subdirectory(orbis-kernel)
add_subdirectory(rpcsx)
add_subdirectory(rx)
target_compile_definitions(rx PRIVATE
RX_TAG=0
RX_TAG_VERSION=0
)