[sndfile] Add new port sndfile#4514
Conversation
|
Thanks for the PR and sorry for the long delay getting back to you! Generally, the reasons to keep a library as a separate ports is:
If either of these is true, then it would make sense to keep it separate. However, if it is just for CMake compatibility, it would be a much better strategy to just deploy a CMake compatibility file that allows users to find the new package with the old name (in addition to the current name). Edit: And we can create+deploy this shim inside the portfile without needing upstream changes. |
|
@bagong , what do you think? |
|
@evpobr sure! Sorry, I am not following any more these days... |
|
@ras0219-msft , so author of old
No, see
No.
Hmm, probably it is possible to edit |
|
Has there been any progress on this? The current EDIT: Just tried this, it still doesn't build under linux: |
|
@evpobr I found a workaround for the linux issue: diff --git a/ports/sndfile/portfile.cmake b/ports/sndfile/portfile.cmake
index cd6ad459..905329ef 100644
--- a/ports/sndfile/portfile.cmake
+++ b/ports/sndfile/portfile.cmake
@@ -33,13 +33,17 @@ vcpkg_configure_cmake(
vcpkg_install_cmake()
-vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
+if(WIN32)
+ vcpkg_fixup_cmake_targets(CONFIG_PATH cmake)
+else()
+ vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/SndFile)
+endif()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
-file(RENAME ${CURRENT_PACKAGES_DIR}/share/doc/libsndfile ${CURRENT_PACKAGES_DIR}/share/${PORT}/doc)
+#file(RENAME ${CURRENT_PACKAGES_DIR}/share/doc/libsndfile ${CURRENT_PACKAGES_DIR}/share/${PORT}/doc)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/share/doc)
if(BUILD_EXECUTABLES) |
ports/sndfile/portfile.cmake
Outdated
| vcpkg_install_cmake() | ||
|
|
||
| vcpkg_fixup_cmake_targets(CONFIG_PATH cmake) | ||
| +if(WIN32) |
|
@Rastaban Can we have a summary of what's failing? |
|
@evpobr I've discovered that linking to |
|
@frabert, static build or both? |
|
I have only tested with |
|
Not sure. Linked libraries are private for shared build. |
|
In my experience, private dependencies are still needed to be found on the system because of the way Windows handles symbols. Basically, dlls are not sufficient for the linker to resolve the symbols and still need the |
|
I'm using MSYS2 + MinGW toolchain, shared build target has no external libraries dependencies. Can you check |
|
I can confirm that |
|
So it is Libsndfile issue. But the problem is compicated. The simple solution is to search dependencies in The status is:
Export library names are also problem. Because CMake developers din't explain it, we have many variants: (Ogg::Ogg, LibOgg::ogg, Ogg::ogg and so on). But i think it should be:
|
|
If I can suggest a course of action: it seems that most of the libraries you depend on don't natively offer CMake packages, thus you rely on vcpkg. What I would do is create FindXXX.cmake modules that first do a |
|
Hmm. Maybe just copy Libsndfile FindXXX modules to package config directory? And add |
|
Copying the list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
find_package(Ogg REQUIRED)
find_package(FLAC REQUIRED)
find_package(Vorbis REQUIRED)
find_package(VorbisEnc REQUIRED)towards the end of SndFileConfig.cmake seems to do the trick |
|
find_dependency is recommended in package config modules. |
|
I fear that still doesn't solve the fact that two different |
|
The solution is configure_package_config_file. It is possible to generate find_dependency(Ogg)
...
@PACKAGE_INIT@
set(HAVE_EXTERNAL_LIBS @HAVE_EXTERNAL_LIBS@)
include("${CMAKE_CURRENT_LIST_DIR}/SndFileTargets.cmake")
check_required_components(SndFile)Then we need to install both |
|
I think this is best solved upstream though |
otherwise the vcpkg_configure_cmake can fail.
This alternative to libsndfile port. As CMake developer for libsndfile I've made huge amout of changes to libsndfile CMake build system, so i think we need to recreate port with new name because:
(find_package(SndFile)SndFile::sndfile:target_link_libraries(Foo PRIVATE SndFile::sndfile)sndfile.dllunder WindowsOld
libsndfileis untouched and still works.