mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 02:33:32 +00:00
fix: Linux compilation
There were linking errors Signed-off-by: Boss.sfc <boss.sfc@citron-emu.org>
This commit is contained in:
@@ -388,7 +388,30 @@ elseif(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(citron PRIVATE common core input_common frontend_common network video_core)
|
||||
# Robust static linking and linker selection under GCC LTO
|
||||
if (NOT MSVC)
|
||||
# Use GNU ld.bfd for GCC LTO plugin-aware archive resolution
|
||||
target_link_options(citron PRIVATE -fuse-ld=bfd)
|
||||
|
||||
# Force-include critical static archives and resolve cycles
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(citron PRIVATE -DENABLE_WEB_SERVICE)
|
||||
target_link_libraries(citron PRIVATE
|
||||
"-Wl,--start-group"
|
||||
"-Wl,--whole-archive" common core input_common frontend_common network video_core web_service "-Wl,--no-whole-archive"
|
||||
"-Wl,--end-group"
|
||||
)
|
||||
else()
|
||||
target_link_libraries(citron PRIVATE
|
||||
"-Wl,--start-group"
|
||||
"-Wl,--whole-archive" common core input_common frontend_common network video_core "-Wl,--no-whole-archive"
|
||||
"-Wl,--end-group"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(citron PRIVATE common core input_common frontend_common network video_core)
|
||||
endif()
|
||||
|
||||
target_link_libraries(citron PRIVATE Boost::headers glad Qt${QT_MAJOR_VERSION}::Widgets)
|
||||
target_link_libraries(citron PRIVATE ${PLATFORM_LIBRARIES} Threads::Threads)
|
||||
|
||||
|
||||
@@ -28,7 +28,30 @@ add_executable(citron-cmd
|
||||
citron.rc
|
||||
)
|
||||
|
||||
target_link_libraries(citron-cmd PRIVATE common core input_common frontend_common)
|
||||
# Robust static linking and linker selection under GCC LTO
|
||||
if (NOT MSVC)
|
||||
# Use GNU ld.bfd for GCC LTO plugin-aware archive resolution
|
||||
target_link_options(citron-cmd PRIVATE -fuse-ld=bfd)
|
||||
|
||||
# Force-include critical static archives and resolve cycles
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(citron-cmd PRIVATE -DENABLE_WEB_SERVICE)
|
||||
target_link_libraries(citron-cmd PRIVATE
|
||||
"-Wl,--start-group"
|
||||
"-Wl,--whole-archive" common core input_common frontend_common network web_service "-Wl,--no-whole-archive"
|
||||
"-Wl,--end-group"
|
||||
)
|
||||
else()
|
||||
target_link_libraries(citron-cmd PRIVATE
|
||||
"-Wl,--start-group"
|
||||
"-Wl,--whole-archive" common core input_common frontend_common network "-Wl,--no-whole-archive"
|
||||
"-Wl,--end-group"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(citron-cmd PRIVATE common core input_common frontend_common)
|
||||
endif()
|
||||
|
||||
target_link_libraries(citron-cmd PRIVATE glad)
|
||||
if (MSVC)
|
||||
target_link_libraries(citron-cmd PRIVATE getopt)
|
||||
|
||||
@@ -7,10 +7,33 @@ add_executable(citron-room
|
||||
citron_room.rc
|
||||
)
|
||||
|
||||
target_link_libraries(citron-room PRIVATE common network)
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
# Robust static linking order using GNU ld group to resolve cycles
|
||||
if (NOT MSVC)
|
||||
# Use GNU ld.bfd for GCC LTO archives (ld.lld cannot consume GCC LTO plugin objects)
|
||||
target_link_options(citron-room PRIVATE -fuse-ld=bfd)
|
||||
|
||||
# Robust static linking under LTO: force-include these archives and allow cyclic resolution
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(citron-room PRIVATE -DENABLE_WEB_SERVICE)
|
||||
target_link_libraries(citron-room PRIVATE
|
||||
"-Wl,--start-group"
|
||||
"-Wl,--whole-archive" common network core web_service "-Wl,--no-whole-archive"
|
||||
"-Wl,--end-group"
|
||||
)
|
||||
else()
|
||||
target_link_libraries(citron-room PRIVATE
|
||||
"-Wl,--start-group"
|
||||
"-Wl,--whole-archive" common network core "-Wl,--no-whole-archive"
|
||||
"-Wl,--end-group"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
# Fallback for MSVC (no --start-group/--end-group)
|
||||
target_link_libraries(citron-room PRIVATE common network core)
|
||||
if (ENABLE_WEB_SERVICE)
|
||||
target_compile_definitions(citron-room PRIVATE -DENABLE_WEB_SERVICE)
|
||||
target_link_libraries(citron-room PRIVATE web_service)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(citron-room PRIVATE mbedtls mbedcrypto)
|
||||
|
||||
Reference in New Issue
Block a user