-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
[cdt] Add new port #29324
[cdt] Add new port #29324
Conversation
I manually checked that the SHA in here is not affected by #29288 |
Tested usage successfully by the cdt:x64-windows triplet
|
FEATURES | ||
"64-bit-index-type" CDT_USE_64_BIT_INDEX_TYPE | ||
"as-compiled-library" CDT_USE_AS_COMPILED_LIBRARY | ||
"boost" CDT_USE_BOOST |
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 looks like an alternative but it doesn't appear to leak into any ABI sensitive bits, so it's probably OK. However, the value does need to be "baked" into the resulting headers. See https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#a-feature-may-replace-polyfills-with-aliases-provided-that-replacement-is-baked-into-the-installed-tree
I think you can do this with something like:
if(CDT_USE_BOOST)
set(CDT_USE_BOOST_STR "#if 1")
else()
set(CDT_USE_BOOST_STR "#if 0")
endif()
foreach(FILE CDTUtils.h Triangulation.hpp)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/${FILE}" "#ifdef CDT_USE_BOOST" "${CDT_USE_BOOST_STR}")
endforeach()
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.
Done
How did it find boost for you? 👀 |
Sorry, I tested the feature and usage of several PRs locally at the same time. After testing the usage of this port, I thought I had already tested its feature, so I wrote it like that and this caused this error. I have always been in the local The test result will be written after the test is completed. If the test fails, I will provide the user with an error log. usage test:
Build :
|
Yeah it looks like the boost feature wasn't turned on in that test. Oh well 🤷 |
11da2f0
@ex-purple, when I test the feature by command
F:\Feature-test\cdt\vcpkg\buildtrees\cdt\install-x64-windows-dbg-out.log
|
85eee7c
@JonLiu1993 I added a patch |
but when I tested usage by cdt:x64-windows failed: CMakeLists:
CMakeProject42.cpp:
config:
|
Pinging @ex-purple for response. |
@JonLiu1993 You just can prepend If this should be solved in another way please show me how |
Thank you for the PR ! |
|
||
if(CDT_USE_BOOST) | ||
- target_link_libraries(${PROJECT_NAME} INTERFACE Boost::boost) | ||
+ target_link_libraries(${PROJECT_NAME} PUBLIC Boost::boost) |
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.
@ex-purple
Hello, CDT maintainer here.
Could you explain why this patch is necessary? Maybe I could do the change upstream to avoid the need for patching.
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.
Looks this #29324 (comment)
Otherwise the compiler just doesn't know where to find the boost headers to build cdt as 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.
@ex-purple
Sorry, I still don't get it :)
Error in this comment looks to be an include error. As CDT does not require any of the compiled parts of boost, in my understanding using target_link_libraries
with INTERFACE
should be enough. At least it works for cdt's automated CI builds.
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.
When I build CDT as header-only and use PUBLIC
I get the CMake error: "INTERFACE library can only be used with the INTERFACE keyword"
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.
Look this: https://cmake.org/cmake/help/latest/module/FindBoost.html#imported-targets
Boost::boost
Target for header-only dependencies. (Boost include directory).
The command target_link_libraries(${PROJECT_NAME} PUBLIC Boost::boost) provides path to the boost headers
How else would the compiler find the boost header files to build CDT?
fatal error C1083: Cannot open include file: 'boost/container/flat_set.hpp':
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.
When I build CDT as header-only and use PUBLIC I get the CMake error: "INTERFACE library can only be used with the INTERFACE keyword"
Just check the value of the CDT_USE_AS_COMPILED_LIBRARY flag to choose between the INTERFACE or PUBLIC option.
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.
Error in this comment looks to be an include error. As CDT does not require any of the compiled parts of boost, in my understanding using target_link_libraries with INTERFACE should be enough. At least it works for cdt's automated CI builds.
You are looking to get boost's include directories added to the build, so they need to be in cdt's build. INTERFACE
supplies those include directories only to downstream consumers of your library.
You might not see this in your CI if another one of your dependencies happens to add the same include path, or if your system has another copy of boost installed somewhere global like /usr/include
that is actually getting used here rather than the copy the user expected.
Great to see CDT in vcpkg 🥳 |
Fixes #28238.
find_package
calls are REQUIRED, are satisfied byvcpkg.json
's declared dependencies, or disabled with CMAKE_DISABLE_FIND_PACKAGE_Xxxvcpkg.json
matches what upstream says.vcpkg.json
matches what upstream says../vcpkg x-add-version --all
and committing the result.