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
[faker-cxx] add new port #38583
base: master
Are you sure you want to change the base?
[faker-cxx] add new port #38583
Conversation
@microsoft-github-policy-service agree |
ports/faker-cxx/portfile.cmake
Outdated
@@ -0,0 +1,31 @@ | |||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a general limitation or just missing Windows DLL exports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2nd - I initially did not find any in the original project's CMakeFiles ... maybe at a later point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But then please
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | |
if(VCPKG_TARGET_IS_WINDOWS) | |
vcpkg_check_linkage(ONLY_STATIC_LIBRARY) | |
endif() |
ports/faker-cxx/usage
Outdated
find_package(faker-cxx CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE faker-cxx::faker-cxx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find_package(faker-cxx CONFIG REQUIRED) | |
target_link_libraries(main PRIVATE faker-cxx::faker-cxx) | |
find_package(faker-cxx CONFIG REQUIRED) | |
target_link_libraries(main PRIVATE faker-cxx::faker-cxx) |
with new line at the end.
Or just the heuristical tool output if it is good enough,
- set(FMT_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/externals/fmt/include") | ||
- target_link_libraries(${LIBRARY_NAME} PRIVATE fmt) | ||
+ find_package(fmt CONFIG REQUIRED) | ||
+ target_link_libraries(${LIBRARY_NAME} PRIVATE fmt::fmt) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will require find_dependency
in exported config. Is it present?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I am that proficient in CMake - for Apple clang builds, fmt will be included via vcpkg, too. But can you give me an example from another project on what I might be missing here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for Apple clang builds, fmt will be included via vcpkg, too.
I don't understand what this means.
can you give me an example from another project on what I might be missing here?
It is hard to find a minimal example but maybe soci comes close enough.
Making soci use unofficial::sqlite3::sqlite3
here:
vcpkg/ports/soci/dependencies.diff
Lines 43 to 52 in f4456c1
--- a/cmake/dependencies/SQLite3.cmake | |
+++ b/cmake/dependencies/SQLite3.cmake | |
@@ -1,5 +1,6 @@ | |
set(SQLITE3_FIND_QUIETLY TRUE) | |
-find_package(SQLite3) | |
+find_package(SQLITE3 NAMES unofficial-sqlite3 CONFIG REQUIRED) | |
+set(SQLITE3_LIBRARIES unofficial::sqlite3::sqlite3) | |
boost_external_report(SQLite3 INCLUDE_DIR LIBRARIES) |
makes $<LINK_ONLY:unofficial::sqlite3::sqlite3>
appearing in the INTERFACE_LINK_LIBRARIES
of the exported CMake config, so downstream usage will need to know what this target means. And that's why the same patch carries a change to the config file template:
vcpkg/ports/soci/dependencies.diff
Lines 55 to 68 in f4456c1
--- a/cmake/resources/SOCIConfig.cmake.in | |
+++ b/cmake/resources/SOCIConfig.cmake.in | |
@@ -1,3 +1,11 @@ | |
@PACKAGE_INIT@ | |
+include(CMakeFindDependencyMacro) | |
+if("@WITH_MYSQL@") | |
+ find_dependency(unofficial-libmysql) | |
+endif() | |
+if("@WITH_SQLITE3@") | |
+ find_dependency(unofficial-sqlite3) | |
+endif() | |
+ | |
include(${CMAKE_CURRENT_LIST_DIR}/SOCITargets.cmake) |
usage new lines, vcpkg copyright function, config path fix, head_ref and ref Co-authored-by: JonLiu1993 <63675417+JonLiu1993@users.noreply.github.com> Co-authored-by: Kai Pastor <dg0yt@darc.de>
ports/faker-cxx/CMakeLists.txt.patch
Outdated
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -stdlib=libc++ -fexperimental-library") | ||
else () | ||
set(CMAKE_CXX_FLAGS | ||
"${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wconversion -Wformat -Werror" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW -Werror
is nice for controlled environments (upstream development), but not appropriate for individual builds over a write range of environments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I removed it via the patch file. However, I might submit a PR for the original project to remove this, too and only enable it in their own CI/CD
remove stdlib enforcement Co-authored-by: Kai Pastor <dg0yt@darc.de>
ports/faker-cxx/usage
Outdated
find_package(faker-cxx CONFIG REQUIRED) | ||
target_link_libraries(main PRIVATE faker-cxx::faker-cxx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For common formatting:
find_package(faker-cxx CONFIG REQUIRED) | |
target_link_libraries(main PRIVATE faker-cxx::faker-cxx) | |
find_package(faker-cxx CONFIG REQUIRED) | |
target_link_libraries(main PRIVATE faker-cxx::faker-cxx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I saw some ports using 4-space intends - is it 2-space or 4-space?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no clear guideline, but...
It used to be 4 spaces. Then the tool's heuristical method was changed to use 2 spaces. Most of the existing usage files haven't been updated.
ports/faker-cxx/portfile.cmake
Outdated
vcpkg_cmake_config_fixup( | ||
PACKAGE_NAME "faker-cxx" | ||
CONFIG_PATH lib/cmake/faker-cxx | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vcpkg_cmake_config_fixup( | |
PACKAGE_NAME "faker-cxx" | |
CONFIG_PATH lib/cmake/faker-cxx | |
) | |
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/faker-cxx) |
ports/faker-cxx/portfile.cmake
Outdated
"CMakeLists.txt.patch" | ||
"FormatHelper.h.patch" | ||
"Helper.h.patch" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"CMakeLists.txt.patch" | |
"FormatHelper.h.patch" | |
"Helper.h.patch" | |
CMakeLists.txt.patch | |
FormatHelper.h.patch | |
Helper.h.patch |
…, only static lib on win only
find_package
calls are REQUIRED, are satisfied byvcpkg.json
's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxx.vcpkg.json
matches what upstream says.vcpkg.json
matches what upstream says../vcpkg x-add-version --all
and committing the result.