From 64affa8c8e4e871d22a853c0a3b264db8aeb35db Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Fri, 26 Mar 2021 18:27:23 -0700 Subject: [PATCH] Stop compiling FEXCore twice This now creates an object binary then static and shared libraries from that. This stops us outputting warnings twice in FEXCore. Also improves compilation time even with ccache enabled. Went from 12s to 8s compilation WITH ccache. I'm sure without ccache it is even better. --- External/FEXCore/Source/CMakeLists.txt | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/External/FEXCore/Source/CMakeLists.txt b/External/FEXCore/Source/CMakeLists.txt index a956ee0eb..0b4c6e4b5 100644 --- a/External/FEXCore/Source/CMakeLists.txt +++ b/External/FEXCore/Source/CMakeLists.txt @@ -218,7 +218,7 @@ add_custom_target(IR_INC check_cxx_compiler_flag(-fdiagnostics-color=always GCC_COLOR) check_cxx_compiler_flag(-fcolor-diagnostics CLANG_COLOR) -function(AddLibrary Name Type) +function(AddObject Name Type) add_library(${Name} ${Type} ${SRCS}) add_dependencies(${Name} IR_INC) target_link_libraries(${Name} pthread rt vixl ${LINUX_LIBS} dl) @@ -250,6 +250,17 @@ function(AddLibrary Name Type) endif() endfunction() +function(AddLibrary Name Type) + add_library(${Name} ${Type} $) + target_link_libraries(${Name} pthread rt vixl ${LINUX_LIBS} dl) + set_target_properties(${Name} PROPERTIES OUTPUT_NAME FEXCore) + + target_include_directories(${Name} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") + target_include_directories(${Name} PUBLIC "${PROJECT_SOURCE_DIR}/include/") + target_include_directories(${Name} PUBLIC "${CMAKE_BINARY_DIR}/include/") +endfunction() + +AddObject(${PROJECT_NAME}_object OBJECT) AddLibrary(${PROJECT_NAME} STATIC) AddLibrary(${PROJECT_NAME}_shared SHARED)