Skip to content

Commit

Permalink
VCPKG changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lindkvis committed Jun 11, 2024
1 parent 003321e commit d4c33aa
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 24 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/AppFwkUnitTestWin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
include:
- os: windows-latest
triplet: x64-windows
env:
VCPKG_ROOT: ${{ github.workspace }}/ThirdParty/vcpkg
VCPKG_DEFAULT_TRIPLET: ${{ matrix.triplet }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "ThirdParty/json"]
path = ThirdParty/json
url = https://github.com/nlohmann/json.git
[submodule "ThirdParty/stduuid"]
path = ThirdParty/stduuid
url = https://github.com/mariusbancila/stduuid.git
Expand All @@ -17,3 +14,6 @@
[submodule "ThirdParty/gtest"]
path = ThirdParty/gtest
url = https://github.com/google/googletest.git
[submodule "ThirdParty/vcpkg"]
path = ThirdParty/vcpkg
url = https://github.com/microsoft/vcpkg.git
23 changes: 5 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ set(CMAKE_CXX_STANDARD 20)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/scripts")

option(CAFFA_REST_INTERFACE "Enable the REST API interface to the Project Data Model" OFF)
option(CAFFA_REST_INTERFACE "Enable the REST API interface to the Project Data Model" ON)
option(CAFFA_BUILD_EXAMPLES "Build examples" OFF)
option(CAFFA_BUILD_UNIT_TESTS "Build unit tests" ON)
option(CAFFA_BUILD_DOCS "Build Doxygen documentation" OFF)
Expand Down Expand Up @@ -46,30 +46,13 @@ else()
endif()

add_definitions(-DGTEST_HAS_STD_WSTRING=0)
# Third Party libraries
set(JSON_BuildTests
OFF
CACHE INTERNAL "Build Json library with unit tests")
set(JSON_Coverage
OFF
CACHE INTERNAL "Build Json library with coverage tests")
set(JSON_Install
OFF
CACHE INTERNAL "Add install step to json library")
set(JSON_ImplicitConversions
ON
CACHE INTERNAL "Do implicit data type conversions")
set(JSON_MultipleHeaders
OFF
CACHE INTERNAL "Split in multiple headers")
set(UUID_USING_CXX20_SPAN
ON
CACHE INTERNAL "Use CXX20 span")
set(UUID_BUILD_TESTS
OFF
CACHE INTERNAL "Build stduuid tests")

add_subdirectory(ThirdParty/json)
add_subdirectory(ThirdParty/gtest)
add_subdirectory(ThirdParty/stduuid)
add_subdirectory(ThirdParty/caffa-base)
Expand Down Expand Up @@ -98,6 +81,10 @@ if(CAFFA_BUILD_UNIT_TESTS)
add_test(caffaCore_UnitTests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/caffaCore_UnitTests)
add_test(caffaIoCore_UnitTests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/caffaIoCore_UnitTests)
add_test(caffaProjectDataModel_UnitTests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/caffaProjectDataModel_UnitTests)

if(CAFFA_REST_INTERFACE)
add_test(caffaRestInterface_UnitTests ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/caffaRestInterface_UnitTests)
endif()
endif()

# Organize sub-projects into folders on Visual Studio Turn on using solution folders
Expand Down
2 changes: 1 addition & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"description": "Configure with vcpkg toolchain and generate Ninja project files for all configurations",
"binaryDir": "${sourceDir}/builds/${presetName}",
"generator": "Ninja Multi-Config",
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
"toolchainFile": "${sourceDir}/ThirdParty/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
],
"buildPresets": [
Expand Down
3 changes: 3 additions & 0 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ endif()

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

find_package(nlohmann_json CONFIG REQUIRED)

Check failure on line 95 in Core/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / caffa-x64 (macos-13)

Could not find a package configuration file provided by "nlohmann_json"

Check failure on line 95 in Core/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / caffa-x64 (ubuntu-22.04)

Could not find a package configuration file provided by "nlohmann_json"

Check failure on line 95 in Core/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / caffa-x64 (macos-13)

Could not find a package configuration file provided by "nlohmann_json"

Check failure on line 95 in Core/CMakeLists.txt

View workflow job for this annotation

GitHub Actions / caffa-x64 (ubuntu-22.04)

Could not find a package configuration file provided by "nlohmann_json"
find_package(stduuid CONFIG REQUIRED)

target_link_libraries(
${PROJECT_NAME}
PUBLIC caffaBase nlohmann_json::nlohmann_json
Expand Down
2 changes: 2 additions & 0 deletions Core/IoCore_UnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ project(caffaIoCore_UnitTests)
# add the executable
add_executable(${PROJECT_NAME} cafIo_UnitTests.cpp cafIoBasicTest.cpp cafAdvancedTemplateTest.cpp cafIoNumberTest.cpp cafReadmeObjects.cpp)

find_package(nlohmann_json CONFIG REQUIRED)

target_link_libraries(${PROJECT_NAME} caffaCore ${THREAD_LIBRARY} nlohmann_json::nlohmann_json gtest)

target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
2 changes: 2 additions & 0 deletions Core/ProjectDataModel_UnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ set(PROJECT_FILES cafBasicTest.cpp cafProjectDataModel_UnitTests.cpp Child.cpp P
# add the executable
add_executable(${PROJECT_NAME} ${PROJECT_FILES})

find_package(nlohmann_json CONFIG REQUIRED)

target_link_libraries(${PROJECT_NAME} PRIVATE caffaCore gtest ${THREAD_LIBRARY} nlohmann_json::nlohmann_json)

source_group("" FILES ${PROJECT_FILES})
Expand Down
12 changes: 11 additions & 1 deletion RestInterface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,17 @@ target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

find_package(Boost 1.71.0 REQUIRED COMPONENTS system)
find_package(OpenSSL REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC caffaBase caffaCore caffaRpcBase nlohmann_json::nlohmann_json OpenSSL::SSL OpenSSL::Crypto Boost::system)
find_package(nlohmann_json CONFIG REQUIRED)

target_link_libraries(
${PROJECT_NAME}
PUBLIC caffaBase
caffaCore
caffaRpcBase
nlohmann_json::nlohmann_json
OpenSSL::SSL
OpenSSL::Crypto
Boost::system)

install(
TARGETS ${PROJECT_NAME}
Expand Down
1 change: 0 additions & 1 deletion ThirdParty/json
Submodule json deleted from 4f8fba
1 change: 1 addition & 0 deletions ThirdParty/vcpkg
Submodule vcpkg added at b27651
12 changes: 12 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "main",
"version-string": "latest",
"dependencies": [
"nlohmann-json",
"gtest",
{
"name": "boost-system",
"platform": "windows"
}
]
}

0 comments on commit d4c33aa

Please sign in to comment.