1
0
Fork 0

Specify submodule path as URL rather than SOURCE_DIR to ExternalProject

This commit is contained in:
Ilya Fedin 2021-12-29 01:51:27 +04:00 committed by John Preston
parent 6518009931
commit 815bdb2fb5
3 changed files with 42 additions and 40 deletions

View file

@ -19,11 +19,10 @@ if (DESKTOP_APP_USE_PACKAGED)
endif()
add_library(external_dispatch_bundled STATIC IMPORTED)
set(dispatch_loc ${third_party_loc}/dispatch)
include(ExternalProject)
ExternalProject_Add(dispatch
SOURCE_DIR ${dispatch_loc}
URL ${third_party_loc}/dispatch
CMAKE_GENERATOR Ninja
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
@ -38,14 +37,16 @@ ExternalProject_Add(dispatch
<BINARY_DIR>/src/BlocksRuntime/libBlocksRuntime.a
)
ExternalProject_Get_property(dispatch SOURCE_DIR)
ExternalProject_Get_property(dispatch BINARY_DIR)
set_target_properties(external_dispatch_bundled PROPERTIES
IMPORTED_LOCATION "${BINARY_DIR}/src/libdispatch.a"
)
target_include_directories(external_dispatch_bundled SYSTEM
INTERFACE
${dispatch_loc}
${SOURCE_DIR}
)
target_link_libraries(external_dispatch_bundled

View file

@ -23,47 +23,46 @@ if (DESKTOP_APP_USE_PACKAGED)
${JEMALLOC_LINK_LIBRARIES}
-Wl,--as-needed
)
return()
endif()
endif()
if (NOT JEMALLOC_FOUND)
add_library(external_jemalloc_bundled STATIC IMPORTED)
set(jemalloc_loc ${third_party_loc}/jemalloc)
add_library(external_jemalloc_bundled STATIC IMPORTED)
include(ExternalProject)
ExternalProject_Add(jemalloc
SOURCE_DIR ${jemalloc_loc}
CONFIGURE_COMMAND cd "${jemalloc_loc}" && export EXTRA_CFLAGS=-fstack-protector-all\ -fPIC\ -D_FORTIFY_SOURCE=2 && export EXTRA_CXXFLAGS=-fstack-protector-all\ -fPIC\ -D_FORTIFY_SOURCE=2 && CC=clang CXX=clang++ ./autogen.sh
BUILD_IN_SOURCE 1
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS ${jemalloc_loc}/lib/libjemalloc.a
)
include(ExternalProject)
ExternalProject_Add(jemalloc
URL ${third_party_loc}/jemalloc
CONFIGURE_COMMAND cd "<SOURCE_DIR>" && export EXTRA_CFLAGS=-fstack-protector-all\ -fPIC\ -D_FORTIFY_SOURCE=2 && export EXTRA_CXXFLAGS=-fstack-protector-all\ -fPIC\ -D_FORTIFY_SOURCE=2 && CC=clang CXX=clang++ ./autogen.sh
BUILD_IN_SOURCE 1
STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS <SOURCE_DIR>/lib/libjemalloc.a
)
file(MAKE_DIRECTORY "${jemalloc_loc}/include")
ExternalProject_Get_property(jemalloc SOURCE_DIR)
file(MAKE_DIRECTORY "${SOURCE_DIR}/include")
set_target_properties(external_jemalloc_bundled PROPERTIES
IMPORTED_LOCATION "${jemalloc_loc}/lib/libjemalloc.a"
)
set_target_properties(external_jemalloc_bundled PROPERTIES
IMPORTED_LOCATION "${SOURCE_DIR}/lib/libjemalloc.a"
)
target_include_directories(external_jemalloc_bundled SYSTEM
INTERFACE
${jemalloc_loc}/include
)
target_include_directories(external_jemalloc_bundled SYSTEM
INTERFACE
${SOURCE_DIR}/include
)
target_link_libraries(external_jemalloc_bundled
INTERFACE
${CMAKE_DL_LIBS}
pthread
)
target_link_libraries(external_jemalloc_bundled
INTERFACE
${CMAKE_DL_LIBS}
pthread
)
add_dependencies(external_jemalloc_bundled jemalloc-build)
add_dependencies(external_jemalloc_bundled jemalloc-build)
target_link_libraries(external_jemalloc
INTERFACE
-Wl,--whole-archive
$<TARGET_FILE:external_jemalloc_bundled>
-Wl,--no-whole-archive
external_jemalloc_bundled
)
endif()
target_link_libraries(external_jemalloc
INTERFACE
-Wl,--whole-archive
$<TARGET_FILE:external_jemalloc_bundled>
-Wl,--no-whole-archive
external_jemalloc_bundled
)

View file

@ -17,7 +17,6 @@ if (DESKTOP_APP_USE_PACKAGED AND NOT DESKTOP_APP_QT6)
endif()
add_library(external_kwayland_bundled STATIC IMPORTED)
set(kwayland_loc ${third_party_loc}/kwayland)
set(kwayland_patch_command :)
if (DESKTOP_APP_QT6)
@ -26,7 +25,7 @@ endif()
include(ExternalProject)
ExternalProject_Add(kwayland
SOURCE_DIR ${kwayland_loc}
URL ${third_party_loc}/kwayland
CMAKE_GENERATOR Ninja
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=Release
@ -39,7 +38,10 @@ ExternalProject_Add(kwayland
BUILD_BYPRODUCTS <BINARY_DIR>/lib/libKF5WaylandClient.a
)
ExternalProject_Get_property(kwayland SOURCE_DIR)
ExternalProject_Get_property(kwayland BINARY_DIR)
file(MAKE_DIRECTORY "${SOURCE_DIR}/src/client")
file(MAKE_DIRECTORY "${BINARY_DIR}/src/client")
set_target_properties(external_kwayland_bundled PROPERTIES
@ -48,7 +50,7 @@ set_target_properties(external_kwayland_bundled PROPERTIES
target_include_directories(external_kwayland_bundled SYSTEM
INTERFACE
${kwayland_loc}/src/client
${SOURCE_DIR}/src/client
${BINARY_DIR}/src/client
)