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

View file

@ -23,47 +23,46 @@ if (DESKTOP_APP_USE_PACKAGED)
${JEMALLOC_LINK_LIBRARIES} ${JEMALLOC_LINK_LIBRARIES}
-Wl,--as-needed -Wl,--as-needed
) )
return()
endif() endif()
endif() endif()
if (NOT JEMALLOC_FOUND) add_library(external_jemalloc_bundled STATIC IMPORTED)
add_library(external_jemalloc_bundled STATIC IMPORTED)
set(jemalloc_loc ${third_party_loc}/jemalloc)
include(ExternalProject) include(ExternalProject)
ExternalProject_Add(jemalloc ExternalProject_Add(jemalloc
SOURCE_DIR ${jemalloc_loc} URL ${third_party_loc}/jemalloc
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 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 BUILD_IN_SOURCE 1
STEP_TARGETS build STEP_TARGETS build
EXCLUDE_FROM_ALL TRUE EXCLUDE_FROM_ALL TRUE
BUILD_BYPRODUCTS ${jemalloc_loc}/lib/libjemalloc.a 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 set_target_properties(external_jemalloc_bundled PROPERTIES
IMPORTED_LOCATION "${jemalloc_loc}/lib/libjemalloc.a" IMPORTED_LOCATION "${SOURCE_DIR}/lib/libjemalloc.a"
) )
target_include_directories(external_jemalloc_bundled SYSTEM target_include_directories(external_jemalloc_bundled SYSTEM
INTERFACE INTERFACE
${jemalloc_loc}/include ${SOURCE_DIR}/include
) )
target_link_libraries(external_jemalloc_bundled target_link_libraries(external_jemalloc_bundled
INTERFACE INTERFACE
${CMAKE_DL_LIBS} ${CMAKE_DL_LIBS}
pthread pthread
) )
add_dependencies(external_jemalloc_bundled jemalloc-build) add_dependencies(external_jemalloc_bundled jemalloc-build)
target_link_libraries(external_jemalloc target_link_libraries(external_jemalloc
INTERFACE INTERFACE
-Wl,--whole-archive -Wl,--whole-archive
$<TARGET_FILE:external_jemalloc_bundled> $<TARGET_FILE:external_jemalloc_bundled>
-Wl,--no-whole-archive -Wl,--no-whole-archive
external_jemalloc_bundled external_jemalloc_bundled
) )
endif()

View file

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