File tree Expand file tree Collapse file tree 4 files changed +47
-8
lines changed
Expand file tree Collapse file tree 4 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -37,12 +37,13 @@ jobs:
3737 # We remove the pinned CMake if it's installed so commands below can succeed
3838 # TODO: remove when not needed anymore
3939 brew tap KDAB/tap
40- brew install fmt spdlog KDBindings mosquitto
40+ brew install doctest fmt spdlog KDBindings mosquitto
4141
4242 - name : Configure project
4343 run : >
4444 cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Debug -G Ninja
4545 -DKDUTILS_BUILD_TESTS=ON
46+ -DKDUTILS_USE_EXTERNAL_DEPENDENCIES=ON
4647 -DBUILD_SHARED_LIBS=${{ matrix.shared }}
4748
4849 - name : Check if external dependencies were used
Original file line number Diff line number Diff line change 1010
1111cmake_minimum_required (VERSION 3.16)
1212
13+ option (KDUTILS_USE_EXTERNAL_DEPENDENCIES
14+ "Assume all project dependencies are available on the system. Don't fetch through vcpkg." OFF
15+ )
16+
1317# vcpkg manifest mode
14- include (cmake/KDUtilsFunctions.cmake)
15- kdutils_check_submodule_exists(vcpkg vcpkg)
16- if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
17- set (CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR} /vcpkg/scripts/buildsystems/vcpkg.cmake)
18+ if (NOT KDUTILS_USE_EXTERNAL_DEPENDENCIES)
19+ if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)
20+ include (cmake/KDUtilsFunctions.cmake)
21+ kdutils_check_submodule_exists(vcpkg vcpkg)
22+ set (CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR} /vcpkg/scripts/buildsystems/vcpkg.cmake)
23+ endif ()
1824endif ()
1925
2026option (KDUTILS_BUILD_EXAMPLES "Build examples" ON )
Original file line number Diff line number Diff line change 88# Contact KDAB at <info@kdab.com> for commercial licensing options.
99#
1010
11+ include (FetchContent)
12+
1113message (STATUS "Looking for KDUtils dependencies" )
1214
1315find_package (spdlog REQUIRED)
1416find_package (KDBindings REQUIRED)
15- find_package (whereami REQUIRED)
16- find_package (mio REQUIRED)
17+
18+ # Following two packages are still acquired via fetchcontent because they aren't
19+ # available in brew on macOS so the non-vcpkg build would be hard to set up there
20+
21+ # whereami library
22+ find_package (whereami QUIET )
23+ if (NOT TARGET whereami::whereami)
24+ fetchcontent_declare(
25+ whereami
26+ GIT_REPOSITORY https://github.com/gpakosz/whereami
27+ GIT_TAG e4b7ba1be0e9fd60728acbdd418bc7195cdd37e7 # master at 5/July/2021
28+ )
29+ fetchcontent_makeavailable(whereami)
30+ endif ()
31+
32+ # mio header-only lib (provides memory mapping for files)
33+ find_package (mio QUIET )
34+ if (NOT TARGET mio::mio)
35+ fetchcontent_declare(
36+ mio
37+ GIT_REPOSITORY https://github.com/mandreyel/mio.git
38+ GIT_TAG 8b6b7d878c89e81614d05edca7936de41ccdd2da # March 3rd 2023
39+ )
40+ fetchcontent_makeavailable(mio)
41+ endif ()
1742
1843if (KDUTILS_BUILD_MQTT_SUPPORT)
1944 find_package (mosquitto REQUIRED)
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ add_library(
4747target_link_libraries (
4848 KDUtils
4949 PUBLIC spdlog::spdlog
50- PRIVATE mio::mio whereami::whereami
50+ PRIVATE mio::mio
5151)
5252
5353if (ANDROID)
@@ -59,6 +59,13 @@ target_include_directories(
5959 PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /../> $<INSTALL_INTERFACE:include />
6060)
6161
62+ if (NOT TARGET whereami::whereami)
63+ target_include_directories (KDUtils PRIVATE ${whereami_SOURCE_DIR} /src)
64+ target_sources (KDUtils PRIVATE ${whereami_SOURCE_DIR} /src/whereami.c)
65+ else ()
66+ target_link_libraries (KDUtils PRIVATE whereami::whereami)
67+ endif ()
68+
6269set_target_properties (
6370 KDUtils
6471 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR} /lib"
You can’t perform that action at this time.
0 commit comments