about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2025-05-23 15:26:52 +0800
committerYang Liu <liuyang22@iscas.ac.cn>2025-05-23 15:26:52 +0800
commit37068c4f3658af67dcfa8d0b469824f9e5ed2b3a (patch)
tree54a4b14616cb37a4b47d29b8787ccca1d9b46d1e
parent18a02fafb1a14d70affb16cee2cb59c1c1e7849e (diff)
downloadbox64-37068c4f3658af67dcfa8d0b469824f9e5ed2b3a.tar.gz
box64-37068c4f3658af67dcfa8d0b469824f9e5ed2b3a.zip
[CMAKE] Removed the hard dependency between dynarec and main executable to speed up build
-rw-r--r--CMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e49adfc9..73fbfcae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1140,7 +1140,7 @@ if(DYNAREC)
     add_custom_command(
         OUTPUT "${BOX64_ROOT}/src/git_head.h"
         COMMAND sh -c "echo \\\#define GITREV \\\"$(git rev-parse --short HEAD)\\\">\"${BOX64_ROOT}/src/git_head.h\""
-        DEPENDS dynarec ${ELFLOADER_SRC} ${INTERPRETER} ${WRAPPEDS} ${WRAPPEDS32}
+        DEPENDS ${DYNAREC_SRC} ${DYNAREC_ASM} ${DYNAREC_PASS} ${ELFLOADER_SRC} ${INTERPRETER} ${WRAPPEDS} ${WRAPPEDS32}
         VERBATIM)
 else()
     add_custom_command(
@@ -1150,9 +1150,17 @@ else()
         VERBATIM)
 endif()
 
+add_custom_target(generate_git_head_target
+  DEPENDS "${BOX64_ROOT}/src/git_head.h"
+)
+
 add_library(interpreter OBJECT ${INTERPRETER})
 
-add_executable(${BOX64} ${OS_LINUX_SRC} ${ELFLOADER_SRC} ${WRAPPEDS} ${WRAPPEDS32} "${BOX64_ROOT}/src/git_head.h")
+add_library(mainobj OBJECT ${OS_LINUX_SRC} ${ELFLOADER_SRC} ${WRAPPEDS} ${WRAPPEDS32})
+add_dependencies(mainobj generate_git_head_target)
+
+add_executable(${BOX64})
+target_link_libraries(${BOX64} mainobj)
 set_target_properties(${BOX64} PROPERTIES ENABLE_EXPORTS ON)
 add_dependencies(${BOX64} WRAPPERS)
 if(BOX32)