Open chicoferreira opened 2 months ago
@chicoferreira, Thanks for posting this issue, devil not provide find_package() usage, just provide pkg-config modules
:
-- Fixing pkgconfig file: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/lib/pkgconfig/IL.pc
-- Fixing pkgconfig file: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/lib/pkgconfig/ILU.pc
-- Fixing pkgconfig file: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/lib/pkgconfig/ILUT.pc
-- Fixing pkgconfig file: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/debug/lib/pkgconfig/IL.pc
-- Fixing pkgconfig file: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/debug/lib/pkgconfig/ILU.pc
-- Fixing pkgconfig file: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/debug/lib/pkgconfig/ILUT.pc
-- Installing: /Users/vcpkg/Jon/vcpkg/packages/devil_arm64-osx/share/devil/copyright
-- Performing post-build validation
Elapsed time to handle devil:arm64-osx: 6.6 s
Total install time: 1.1 min
devil provides pkg-config modules:
# Developer's Image Library - IL part (just image load/save)
IL
# Developer's Image Library - ILU part (image library utilities)
ILU
# Developer's Image Library - ILUT part (connection to higher level libraries)
ILUT
How can I then use it both on Windows, Linux and MacOS with the same vcpkg.json and CMakeLists.txt? The compilation works on Windows without needing to link .dll's but fails on Linux and Mac OS.
The default linux and osx triplets use static library linkage, the default windows triplet uses dynamic library linkage. I guess this explains the different observations.
I was expecting that vcpkg would abstract that and just link the package correctly in any supported OS, which it doesn't, or at least tell me how to do it like other packages do.
@JonLiu1993 as this issue is no longer marked as a bug, could you please tell me how could I do https://github.com/microsoft/vcpkg/issues/38559#issuecomment-2097938466? Thank you for the support.
Option 1: use triplets with dynamic linkage (e.g. x64-linux-dynamic
or arm64-osx-dynamic
or x64-windows
).
Option 2: instead of using find_package(DevIL REQUIRED)
use pkg-config:
find_package(PkgConfig REQUIRED)
pkg_check_modules(DevIL REQUIRED IMPORTED_TARGET DevIL)
target_link_libraries(my_target PRIVATE PkgConfig::DevIL)
(Note that it's still possible that pkg-config files installed by devil
don't express transitive dependencies properly. You may also need to add pkgconf
to your dependencies list on windows.)
Option 3: write vcpkg-cmake-wrapper.cmake
for the port. Port tiff
does something similar.
Option 3: write
vcpkg-cmake-wrapper.cmake
for the port. Porttiff
does something similar.
~No wrapper please. Only CMake config.~ Sorry, yes. Wrap the official cmake module.
Thank you for the options given. Unfortunately they didn't fit my needs so I end up switch from devil
to stb
which gives me the same features I needed.
Please re-open. This need a fix.
Operating system
MacOS (ARM)
Compiler
Clang
Steps to reproduce the behavior
Add
devil
as a dependency tovcpkg.json
.Add the following to
CMakeLists.txt
:Include the file on
main.cpp
and call some function:Compile and run with CMake.
Failure logs
Additional context
Removing "devil" as a dependency from
vcpkg.json
solves the issue, but then can't compile on Windows.