aboutsummaryrefslogtreecommitdiff
path: root/src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake
diff options
context:
space:
mode:
authorcrueter <crueter@eden-emu.dev>2025-08-04 04:50:14 +0200
committercrueter <crueter@eden-emu.dev>2025-08-04 04:50:14 +0200
commit51b170b470ed587f99a7c2a773e4464687f0d07a (patch)
tree4c03c510cfb17a5f5d6233df490d78f06dcfa7f7 /src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake
parent04e5e6453875ffa5c79cdb421a29bc19985b1049 (diff)
[cmake] refactor: Use CPM over submodules (#143)
Transfers the majority of submodules and large externals to CPM, using source archives rather than full Git clones. Not only does this save massive amounts of clone and configure time, but dependencies are grabbed on-demand rather than being required by default. Additionally, CPM will (generally) automatically search for system dependencies, though certain dependencies have options to control this. Testing shows gains ranging from 5x to 10x in terms of overall clone/configure time. Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/143 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake')
-rw-r--r--src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake b/src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake
new file mode 100644
index 0000000000..f08911c6f2
--- /dev/null
+++ b/src/dynarmic/CMakeModules/TargetArchitectureSpecificSources.cmake
@@ -0,0 +1,26 @@
+function(target_architecture_specific_sources project arch)
+ if (NOT DYNARMIC_MULTIARCH_BUILD)
+ target_sources("${project}" PRIVATE ${ARGN})
+ return()
+ endif()
+
+ foreach(input_file IN LISTS ARGN)
+ if(input_file MATCHES ".cpp$")
+ if(NOT IS_ABSOLUTE ${input_file})
+ set(input_file "${CMAKE_CURRENT_SOURCE_DIR}/${input_file}")
+ endif()
+
+ set(output_file "${CMAKE_CURRENT_BINARY_DIR}/arch_gen/${input_file}")
+ add_custom_command(
+ OUTPUT "${output_file}"
+ COMMAND ${CMAKE_COMMAND} "-Darch=${arch}"
+ "-Dinput_file=${input_file}"
+ "-Doutput_file=${output_file}"
+ -P "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/impl/TargetArchitectureSpecificSourcesWrapFile.cmake"
+ DEPENDS "${input_file}"
+ VERBATIM
+ )
+ target_sources(${project} PRIVATE "${output_file}")
+ endif()
+ endforeach()
+endfunction()