-
Notifications
You must be signed in to change notification settings - Fork 22
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
Make VAMP usable as a C++ header-only library #31
base: main
Are you sure you want to change the base?
Conversation
I'm trying to move to a CPM based approach to using this as a library. The first issue (so far): Including vamp as a package like so: file(
DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.1/CPM.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
EXPECTED_HASH SHA256=117cbf2711572f113bab262933eb5187b08cfc06dce0714a1ee94f2183ddc3ec
)
set(CPM_USE_LOCAL_PACKAGES ON)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)
CPMAddPackage("gh:KavrakiLab/vamp#8105e16e070db72029ee1a658ac793b25bf08742") mkdir -p build/release
cd build/release
cmake ../.. I get the following error: CMake Error at /usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Python (missing: Python_INCLUDE_DIRS Development.Module)
(found suitable version "3.11.2", minimum required is "3.8")
Call Stack (most recent call first):
/usr/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.25/Modules/FindPython/Support.cmake:3240 (find_package_handle_standard_args)
/usr/share/cmake-3.25/Modules/FindPython.cmake:519 (include)
build/release/_deps/vamp-src/cmake/Dependencies.cmake:2 (find_package)
build/release/_deps/vamp-src/CMakeLists.txt:46 (include) I have two guesses as to fixes:
|
I think the version issue is actually just that your system doesn't have the Python development headers installed. It says 3.11.2 is suitable, but that it couldn't find |
Seems like no dice -
I've checked |
Looked around a little - maybe these two are related?
My guess is that something is declared as PUBLIC when it shouldn't be, but I can't say I fully understand how this works or why. |
I think this is a problem with the fact that we use CPM for our dependencies... Might be able to fix by marking some includes as private; I'll experiment. |
here's a link to a reproducing project: |
I manually rewrote my CMakeLists file to include all the transitive dependencies, which is a bit of a hack but it works for now. The latest version is here. I'm running up against a fun little compilation disaster right now:
|
Figured out the issue. For some reason I also need to manually set if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
# Need explicit AVX2 for some MacOS clang versions
set(VAMP_ARCH "-march=native -mavx2")
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
# ARM platforms (aarch64 / arm64)
set(VAMP_ARCH "-mcpu=native -mtune=native")
else()
message(FATAL_ERROR "Unsupported architecture ${CMAKE_SYSTEM_PROCESSOR}")
endif() The resulting CMakeLists for my project is a little ridiculous but it seems workable enough for now. |
@claytonwramsey The reason |
This PR extends the CMake configuration for VAMP to expose a header-only library of the core implementation, for use in downstream C++ projects.
I have not tested these changes at all yet; they are very likely incomplete and/or buggy.
One thing to consider is how much we want to restructure the project to provide more convenience aliases in the headers vs. in the current binding C++ files.