Skip to content

Commit

Permalink
Separate libplist in another package
Browse files Browse the repository at this point in the history
  • Loading branch information
Dadoum committed May 23, 2023
1 parent cb953a2 commit e302d13
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 1,380 deletions.
32 changes: 26 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,18 @@ add_library(provision STATIC ${PROVISION_D_SOURCES})
target_include_directories(provision PUBLIC ${PROVISION_SOURCE_DIR})

if (link_libplist_dynamic)
add_library(plist INTERFACE)
target_compile_versions(provision PUBLIC LibPlist)
target_compile_versions(plist INTERFACE LibPlistDynamic)

include(UseDub)
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/Dadoum/libplist-d
GIT_TAG d494cf3fe79a2bb20583173c0c8cf85ef33b719e
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -c dynamic -s plist-d
)
FetchContent_MakeAvailable(plist_proj)

add_library(plist ALIAS plist-d)
else()
if(NOT CMAKE_CROSSCOMPILING)
pkg_check_modules(plist IMPORTED_TARGET libplist-2.0)
Expand All @@ -32,16 +41,27 @@ else()

if (plist_FOUND AND NOT use_native_plist)
message("Using libplist. ")
add_library(plist ALIAS PkgConfig::plist)
target_compile_versions(provision PUBLIC LibPlist)

include(UseDub)
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/Dadoum/libplist-d
GIT_TAG d494cf3fe79a2bb20583173c0c8cf85ef33b719e
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -c static -s plist-d
)
FetchContent_MakeAvailable(plist_proj)

add_library(plist INTERFACE)
target_link_libraries(plist INTERFACE PkgConfig::plist plist-d)
else()
message(WARNING "Using fallback Property list parser. ")

include(UseDub)
FetchContent_Declare(
plist_proj
GIT_REPOSITORY https://github.com/hatf0/plist
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -s plist
plist_proj
GIT_REPOSITORY https://github.com/hatf0/plist
PATCH_COMMAND ${DUB_DIRECTORY}/CMakeTmp/DubToCMake -s plist
)
FetchContent_MakeAvailable(plist_proj)
endif()
Expand Down
1 change: 1 addition & 0 deletions dub.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ configuration "plist-d" {

configuration "libplist" {
versions "LibPlist"
dependency "plist-d" repository="git+https://github.com/Dadoum/libplist-d.git" version="d494cf3fe79a2bb20583173c0c8cf85ef33b719e"
}

subPackage {
Expand Down
2 changes: 1 addition & 1 deletion lib/provision/adi.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import std.string;
import slf4d;

version (LibPlist) {
import provision.plist;
import plist;
} else {
import plist;
import plist.types;
Expand Down
Loading

0 comments on commit e302d13

Please sign in to comment.