From 3dec81b9ebe856f3575f7aa68f8a099d8a99fc39 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sun, 22 May 2022 17:49:54 +0200 Subject: First attempt to get a static build (not working for now, don't use it) --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fabaa09..4768be68 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,7 @@ option(LD80BITS "Set to ON if host device have 80bits long double (i.e. i386)" $ option(NOALIGN "Set to ON if host device doesn't need re-align (i.e. i386)" ${NOALIGN}) option(ARM_DYNAREC "Set to ON to use ARM Dynamic Recompilation" ${ARM_DYNAREC}) option(PAGE16K "Set to ON if host device have PageSize of 16K (instead of 4K)" ${PAGE16K}) +option(STATICBUILD "Set to ON to have a static build (Warning, not working)" ${STATICBUILD}) if(${CMAKE_VERSION} VERSION_LESS "3.12.2") find_package(PythonInterp 3) @@ -546,7 +547,11 @@ set_target_properties(${BOX64} PROPERTIES ENABLE_EXPORTS ON) add_dependencies(${BOX64} WRAPPERS) #add_dependencies(${BOX64} PRINTER) #target_link_libraries(${BOX64} c m dl rt pthread resolv) -set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed -lc -lm -ldl -lrt -lpthread -lresolv -Wl,--as-needed -pthread") +if(STATICBUILD) + set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-static -Wl,--no-as-needed -Wl,--whole-archive -Wl,--allow-multiple-definition -lm -ldl -lrt -lpthread -lresolv -lc -Wl,-defsym,_DYNAMIC=0 -pthread") +else() + set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-Wl,--no-as-needed -lc -lm -ldl -lrt -lpthread -lresolv -Wl,--as-needed -pthread") +endif() if(DYNAREC) target_link_libraries(${BOX64} dynarec) endif() -- cgit 1.4.1