|
|
|
@ -154,20 +154,30 @@ set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
|
|
# not supported on Solaris - system libraries are not available as archives
|
|
|
|
|
# LTO is supported only for native builds
|
|
|
|
|
if(STATIC_LINK_RUNTIME)
|
|
|
|
|
if (NOT SOLARIS)
|
|
|
|
|
add_compile_options(-static -flto)
|
|
|
|
|
if(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
|
add_compile_options(-static -flto)
|
|
|
|
|
else()
|
|
|
|
|
add_compile_options(-static)
|
|
|
|
|
endif()
|
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
|
|
|
link_libraries( -static -static-libstdc++ -pthread -flto )
|
|
|
|
|
else()
|
|
|
|
|
# this is messing with release builds
|
|
|
|
|
add_compile_options(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0)
|
|
|
|
|
set(CMAKE_AR "gcc-ar")
|
|
|
|
|
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
|
set(CMAKE_C_ARCHIVE_FINISH "true")
|
|
|
|
|
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
|
set(CMAKE_CXX_ARCHIVE_FINISH "true")
|
|
|
|
|
link_libraries( -flto -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive )
|
|
|
|
|
if(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
|
# this is messing with release builds
|
|
|
|
|
add_compile_options(-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0)
|
|
|
|
|
set(CMAKE_AR "gcc-ar")
|
|
|
|
|
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
|
set(CMAKE_C_ARCHIVE_FINISH "true")
|
|
|
|
|
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
|
|
|
|
|
set(CMAKE_CXX_ARCHIVE_FINISH "true")
|
|
|
|
|
link_libraries( -flto -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive )
|
|
|
|
|
else()
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
else()
|
|
|
|
|
link_libraries( -static-libstdc++ -static-libgcc )
|
|
|
|
@ -262,8 +272,9 @@ else()
|
|
|
|
|
target_link_libraries(${ABYSS_EXE} PUBLIC ${ABYSS_LIB} ${STATIC_LIB} ws2_32)
|
|
|
|
|
endif(NOT WIN32)
|
|
|
|
|
|
|
|
|
|
target_include_directories(${ABYSS_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include")
|
|
|
|
|
target_include_directories(${ABYSS_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include")
|
|
|
|
|
# Why does abyss not inherit the existing include folders?
|
|
|
|
|
target_include_directories(${ABYSS_LIB} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include" llarp vendor/nlohmann/include include crypto/include)
|
|
|
|
|
target_include_directories(${ABYSS_EXE} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/${ABYSS}/include" llarp vendor/nlohmann/include include crypto/include)
|
|
|
|
|
|
|
|
|
|
# for freebsd
|
|
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
|
|
|
|
|