Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pkg-config for the TOML package #291

Merged
merged 7 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/windows-msvc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"

jobs:
windows-msvc-conan:
runs-on: windows-latest
windows-msvc:
runs-on: windows-latest
steps:
Expand Down
14 changes: 3 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ else()
target_compile_options(reflectcpp PRIVATE $<$<CONFIG:Debug>:-Wall -Wextra>)
endif()

# target_compile_features(reflectcpp PUBLIC cxx_std_20)

set(REFLECT_CPP_SOURCES
src/reflectcpp.cpp
)
Expand Down Expand Up @@ -147,12 +145,9 @@ if (REFLECTCPP_TOML)
src/reflectcpp_toml.cpp
)
if(REFLECTCPP_USE_VCPKG)
target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
if (MSVC)
target_link_libraries(reflectcpp PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/tomlplusplus${CMAKE_STATIC_LIBRARY_SUFFIX}")
else ()
target_link_libraries(reflectcpp PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/libtomlplusplus${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif ()
find_package(PkgConfig REQUIRED)
pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus)
target_link_libraries(reflectcpp PUBLIC PkgConfig::tomlplusplus)
else()
find_package(tomlplusplus)
target_link_libraries(reflectcpp PUBLIC tomlplusplus::tomlplusplus)
Expand All @@ -163,9 +158,6 @@ if (REFLECTCPP_UBJSON)
list(APPEND REFLECT_CPP_SOURCES
src/reflectcpp_ubjson.cpp
)
if(REFLECTCPP_USE_VCPKG)
target_include_directories(reflectcpp SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")
endif()
find_package(jsoncons CONFIG REQUIRED)
endif ()

Expand Down
13 changes: 1 addition & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -545,18 +545,7 @@ The following compilers are supported:

### Using vcpkg

```bash
vcpkg install reflectcpp
```

or:

```bash
vcpkg add port reflectcpp
```

If the library cannot be found, please update vcpkg itself and/or update the `builtin-baseline`
tag in the *vcpkg.json* of your project.
https://vcpkg.io/en/package/reflectcpp

### Using Conan

Expand Down
4 changes: 4 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ You can include the source files into your build or compile it using cmake and v

## Option 1: Using vcpkg

Refer to the following port:

https://vcpkg.io/en/package/reflectcpp

```bash
vcpkg install reflectcpp
```
Expand Down
2 changes: 0 additions & 2 deletions tests/toml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ add_executable(
)
target_precompile_headers(reflect-cpp-toml-tests PRIVATE [["rfl.hpp"]] <iostream> <string> <functional> <gtest/gtest.h>)

target_include_directories(reflect-cpp-toml-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")

target_link_libraries(
reflect-cpp-toml-tests
PRIVATE
Expand Down
2 changes: 0 additions & 2 deletions tests/ubjson/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ add_executable(
)
target_precompile_headers(reflect-cpp-ubjson-tests PRIVATE [["rfl.hpp"]] <iostream> <string> <functional> <gtest/gtest.h>)

target_include_directories(reflect-cpp-ubjson-tests SYSTEM PRIVATE "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/include")

target_link_libraries(
reflect-cpp-ubjson-tests
PRIVATE
Expand Down
4 changes: 4 additions & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
{
"name": "vcpkg-cmake-config",
"version>=": "2022-02-06#1"
},
{
"name":"vcpkg-pkgconfig-get-modules",
"version>=": "2024-04-03"
}
]
}
Loading