-
Notifications
You must be signed in to change notification settings - Fork 56
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
Vcpkg support #69
Comments
I'm not sure if any of the current maintainers use Vcpkg but I'm sure someone could create a portfile for the library and we wouldn't be against it. My question is though, what's wrong with using the Amalgamated builds? They won't add a target and just live on your include path/in your primary project. |
It is even worse to keep the deps sources as part of your primary project 😛 So I would rather move it to a separate target. |
I don't think it's that bad, they're very small files and it keeps it simple, but I understand your concerns and I don't see anything wrong with getting a portfile made for the library. If you have experience with Vcpkg perhaps you could get a simple portfile working to get the ball rolling? 😄 |
I don't have any experience with portfiles but this is a good opportunity to learn it finally, I will see what I can do. |
I've been using a personal overlay port in my projects for a while. It's far from perfect and I don't remember why I wrote a separate CMakeLists.txt for it - I think the upstream one didn't have the I'm still not sure how the |
I eventually decided to use CPM (it is just simpler for my project) so I abandoned this idea 😛 |
That's alright, I wouldn't mind trying myself. It'd be cool to have packages in MSYS2 & AUR at some point too. I played around a bit more with the install stuff, now adding it to diff --git a/cmake.toml b/cmake.toml
index df17b9f..a3e6c58 100644
--- a/cmake.toml
+++ b/cmake.toml
@@ -24,12 +24,14 @@ condition = "build-test"
git = "https://github.com/boost-ext/ut.git"
tag = "v2.0.1"
shallow = true
+EXCLUDE_FROM_ALL = true
[fetch-content.xbyak]
condition = "build-test"
git = "https://github.com/herumi/xbyak.git"
tag = "v6.69"
shallow = true
+EXCLUDE_FROM_ALL = true
[fetch-content.Zydis]
condition = "fetch-zydis"
@@ -41,6 +43,7 @@ option(ZYDIS_BUILD_EXAMPLES "" OFF)
option(ZYDIS_BUILD_TOOLS "" OFF)
option(ZYDIS_BUILD_DOXYGEN "" OFF)
"""
+EXCLUDE_FROM_ALL = true
[find-package.Doxygen]
condition = "build-docs"
@@ -53,7 +56,10 @@ required = true
[target.safetyhook]
type = "static"
sources = ["src/*.cpp"]
-include-directories = ["include/"]
+include-directories = [
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>",
+ "$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
+]
compile-features = ["cxx_std_23"]
alias = "safetyhook::safetyhook"
link-libraries = ["Zydis"]
@@ -64,6 +70,29 @@ cmake-after = """
if(SAFETYHOOK_USE_CXXMODULES)
target_compile_definitions(safetyhook INTERFACE SAFETYHOOK_USE_CXXMODULES)
endif()
+
+include(GNUInstallDirs)
+
+install(
+ TARGETS safetyhook
+ EXPORT safetyhook-export
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(
+ DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+)
+
+install(
+ EXPORT safetyhook-export
+ FILE safetyhook-config.cmake
+ NAMESPACE safetyhook::
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/safetyhook
+)
"""
[target.docs]
Works as expected, but I'm not certain the install stuff is set up correctly. Still mostly a product of trial and error. Should I make a pull request for this? It'd make packaging for vcpkg and others a bit easier. |
It would be nice to see this library in the vcpkg registry, I hate having deps as a target inside Visual Studio.
Anyway, this is a great library, thanks for your work!
The text was updated successfully, but these errors were encountered: