Skip to content

Conversation

@hatch01
Copy link
Contributor

@hatch01 hatch01 commented Apr 15, 2025

Summary

I added options to be able to use system libs instead of vendored one, following this #1140
I am far from a cmake expert, so don't hesitate to ask me to modify things to make this PR cleaner.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

The PR fulfills these requirements:

  • When resolving a specific issue, it's referenced in the PR's body (e.g. Fixes: #xxx[,#xxx], where "xxx" is the issue number)

@hatch01 hatch01 marked this pull request as ready for review April 17, 2025 20:37
@awawa-dev
Copy link
Owner

awawa-dev commented Apr 18, 2025

Hi
Thank you. Looks OK to me. One thing: maybe move library adding changes from sources/utils-image/CMakeLists.txt to external/CMakeLists.txt That would simplified the PR and code (to have external libraries configuration in one place just like the rest)?
BTW you can make an alias if you need an altered name like here: https://github.com/awawa-dev/HyperHDR/blob/196918ebe4141e7af64d09e0af8cf35704b6ab1c/external/CMakeLists.txt#L256C3-L256C40

then you wont need to add different named (namespaced or not namespaced) libraries that point to the same library if one name doesnt exist in specific build configuration.

if (USE_SYSTEM_LUNASVG_LIBS)
	......
	target_link_libraries(utils-image PRIVATE lunasvg::lunasvg)
else()
	target_link_libraries(utils-image PRIVATE lunasvg)
endif()

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

Aliases were not enough so I used another approach which seems to work fine.

@awawa-dev
Copy link
Owner

Did you try add_library(lunasvg ALIAS lunasvg::lunasvg)?

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

Yes, I tried it and the import <lunasvg.h> fail when doing this.

@awawa-dev
Copy link
Owner

OK, try the other way and add to the old code add_library(lunasvg::lunasvg ALIAS lunasvg) somewhere here: https://github.com/hatch01/HyperHDR/blob/7971af61147e550e0d47fbc4df1333eb21c74f91/external/CMakeLists.txt#L117
and change lunasvg to lunasvg::lunasvg here: https://github.com/hatch01/HyperHDR/blob/7971af61147e550e0d47fbc4df1333eb21c74f91/sources/utils-image/CMakeLists.txt#L38. Then maybe you can drop creating lunasvg interface library: https://github.com/hatch01/HyperHDR/blob/7971af61147e550e0d47fbc4df1333eb21c74f91/external/CMakeLists.txt#L107 do not force push this new commit to have an opportunity to roll it back.

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

I get this error :

CMake Error at sources/utils-image/CMakeLists.txt:34 (target_link_libraries):
  Target "utils-image" links to:

    lunasvg::lunasvg

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

Running phase: qtPreHook
@nix { "action": "setPhase", "phase": "qtPreHook" }
Running phase: unpackPhase
@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking source archive /nix/store/j9jk6znjl8znzc7ddrmzz3yrs1b9x8j4-HyperHDR
source root is HyperHDR
Running phase: patchPhase
@nix { "action": "setPhase", "phase": "patchPhase" }
Running phase: updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
Running phase: configurePhase
@nix { "action": "setPhase", "phase": "configurePhase" }
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DCMAKE_INSTALL_LOCALEDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/share/doc/HyperHdr -DCMAKE_INSTALL_INFODIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/share/man -DCMAKE_INSTALL_INCLUDEDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/include -DCMAKE_INSTALL_SBINDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/sbin -DCMAKE_INSTALL_BINDIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/bin -DCMAKE_INSTALL_NAME_DIR=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0/lib -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_STRIP=/nix/store/n6a48h70jhwqc4x09kqbbfqsgjhw3ljc-binutils-wrapper-2.44/bin/strip -DCMAKE_RANLIB=/nix/store/n6a48h70jhwqc4x09kqbbfqsgjhw3ljc-binutils-wrapper-2.44/bin/ranlib -DCMAKE_AR=/nix/store/n6a48h70jhwqc4x09kqbbfqsgjhw3ljc-binutils-wrapper-2.44/bin/ar -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_INSTALL_PREFIX=/nix/store/30v4k92j3p1wvnslqzllpqfswp9g5mqj-hyperhdr-21.0.0.0 -DPLATFORM=linux -DUSE_SYSTEM_SDBUS_CPP_LIBS:BOOL=TRUE -DUSE_SYSTEM_MQTT_LIBS:BOOL=TRUE -DUSE_SYSTEM_FLATBUFFERS_LIBS:BOOL=TRUE -DUSE_SYSTEM_MBEDTLS_LIBS:BOOL=TRUE -DUSE_SYSTEM_NANOPB_LIBS:BOOL=TRUE -DUSE_SYSTEM_LUNASVG_LIBS:BOOL=TRUE -DUSE_SYSTEM_STB_LIBS:BOOL=TRUE -DPROTOC_EXE=/nix/store/s0521fkq7z9lycdgal6y7g726vz5d6zk-protobuf-29.4/bin/protoc -DProtobuf_PROTOC_EXE=/nix/store/s0521fkq7z9lycdgal6y7g726vz5d6zk-protobuf-29.4/bin/protoc -DProtobuf_PROTOC_EXECUTABLE=/nix/store/s0521fkq7z9lycdgal6y7g726vz5d6zk-protobuf-29.4/bin/protoc
-- CMake Version: 3.31.6
-- The C compiler identification is GNU 14.2.1
-- The CXX compiler identification is GNU 14.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /nix/store/f0m6caffiykyvsjim9376a3hx2yj2ghj-gcc-wrapper-14.2.1.20250322/bin/gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /nix/store/f0m6caffiykyvsjim9376a3hx2yj2ghj-gcc-wrapper-14.2.1.20250322/bin/g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CCache is not found
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found Qt Version: 6.9.0
-- Debian version: 
-- PLATFORM: linux
-- Found PkgConfig: /nix/store/bbp56ai8w43xkfisar83h37imjdlcx6r-pkg-config-wrapper-0.29.2/bin/pkg-config (found version "0.29.2")
-- Checking for module 'x11'
--   Found x11, version 1.8.12
-- Checking for module 'ayatana-appindicator3-0.1'
--   No package 'ayatana-appindicator3-0.1' found
�[33mCMake Warning at CMakeLists.txt:316 (message):
  AppIndicator dev package (eg.  libayatana-appindicator3-dev) not found.
  Disabling support for the systray.

�[0m
-- Looking for linux/fb.h
-- Looking for linux/fb.h - found
-- Checking for module 'libsystemd>=238'
--   Found libsystemd, version 257
-- Found OpenSSL: /nix/store/yss7dszbr0pz3zqym0kf167rh71l870m-openssl-3.4.1/lib/libcrypto.so (found version "3.4.1")
-- Checking for module 'libpipewire-0.3'
--   Found libpipewire-0.3, version 1.4.1
-- Found OpenGL: /nix/store/sq50878z0rdxwdyjw3fvbgf6wkpcnpcp-libglvnd-1.7.0/lib/libOpenGL.so
-- 
�[36mLED DEVICES�[m
-- ENABLE_SPIDEV = �[32mON�[m
-- ENABLE_WS281XPWM = �[31mOFF�[m
-- 
�[36mSOFTWARE GRABBERS�[m
-- ENABLE_DX = �[31mOFF�[m
-- ENABLE_FRAMEBUFFER = �[32mON�[m
-- ENABLE_AMLOGIC = �[31mOFF�[m
-- ENABLE_MAC_SYSTEM = �[31mOFF�[m
-- ENABLE_PIPEWIRE = �[32mON�[m
-- ENABLE_PIPEWIRE_EGL = �[32mON�[m
-- ENABLE_X11 = �[32mON�[m
-- 
�[36mHARDWARE GRABBERS�[m
-- ENABLE_AVF = �[31mOFF�[m
-- ENABLE_MF = �[31mOFF�[m
-- ENABLE_V4L2 = �[32mON�[m
-- 
�[36mSOUND CAPTURING�[m
-- ENABLE_SOUNDCAPLINUX = �[32mON�[m
-- ENABLE_SOUNDCAPMACOS = �[31mOFF�[m
-- ENABLE_SOUNDCAPWINDOWS = �[31mOFF�[m
-- 
�[36mSERVICE SUPPORT�[m
-- ENABLE_BONJOUR = �[32mON�[m
-- ENABLE_CEC = �[31mOFF�[m
-- ENABLE_MQTT = �[32mON�[m
-- ENABLE_POWER_MANAGEMENT = �[32mON�[m
-- ENABLE_PROTOBUF = �[32mON�[m
-- ENABLE_SYSTRAY = �[31mOFF�[m
-- ENABLE_ZSTD = �[32mON�[m
-- 
�[36mBUILD FEATURES�[m
-- USE_SHARED_LIBS = �[32mON�[m
-- USE_EMBEDDED_WEB_RESOURCES = �[31mOFF�[m
-- USE_PRECOMPILED_HEADERS = �[32mON�[m
-- USE_CCACHE_CACHING = �[31mOFF�[m
-- USE_SYSTEM_MQTT_LIBS = �[32mTRUE�[m
-- USE_SYSTEM_FLATBUFFERS_LIBS = �[32mTRUE�[m
-- USE_SYSTEM_SDBUS_CPP_LIBS = �[32mTRUE�[m
-- USE_SYSTEM_LUNASVG_LIBS = �[32mTRUE�[m
-- USE_SYSTEM_NANOPB_LIBS = �[32mTRUE�[m
-- USE_SYSTEM_STB_LIBS = �[32mTRUE�[m
-- USE_STATIC_QT_PLUGINS = �[31mOFF�[m
-- USE_STANDARD_INSTALLER_NAME = �[31mOFF�[m
-- HYPERHDR_HAVE_DBUS = �[32mON�[m
-- 

-- Current Version: 22.0.0.0beta0
--  - Build:  ()
-- Found zstd: /nix/store/jhpnlsrqi0qvv0jjwk1pq8ddqmgz1gjl-zstd-1.5.7/lib/libzstd.so
-- Performing Test COMPILER_SUPPORTS_CXX17
-- Performing Test COMPILER_SUPPORTS_CXX17 - Success
-- Performing Test COMPILER_SUPPORTS_CXX11
-- Performing Test COMPILER_SUPPORTS_CXX11 - Success
-- Performing Test COMPILER_SUPPORTS_CXX0X
-- Performing Test COMPILER_SUPPORTS_CXX0X - Success
-- Enabling support for C++17
-- Linker: GNU gold
-- Found Threads: TRUE
-- Found TurboJPEG: /nix/store/18nq54s8n57m4yp3amny15cg52lq595z-libjpeg-turbo-3.0.4/lib/libturbojpeg.so
-- TURBOJPEG_LIBRARY_DIRS=/nix/store/18nq54s8n57m4yp3amny15cg52lq595z-libjpeg-turbo-3.0.4/lib/libturbojpeg.so
-- TURBOJPEG_INCLUDE_DIRS=/nix/store/jbiswghsxac3jlc2bhw4x0iq3bmj6kwv-libjpeg-turbo-3.0.4-dev/include
-- �[33mTry using the flatbuffers system libraries instead of the embedded submodule. Absolutely no guarantee.�[m
-- Found FlatBuffers: /nix/store/4k56rivr328b4jz33gicw051w023qc8v-flatbuffers-25.2.10/bin/flatc
-- Found system FLATBUFFERS libs (/nix/store/4k56rivr328b4jz33gicw051w023qc8v-flatbuffers-25.2.10/include).
-- Creating interface for the FLATBUFFERS lib
-- �[33mTry using the qmqtt system libraries instead of the embedded submodule. Absolutely no guarantee.�[m
-- Found system QMQTT libs.
-- Checking for module 'sdbus-c++>=2.0.0'
--   Found sdbus-c++, version 2.0.0
-- Found system STB libraries: /nix/store/k22sfp28nd6sr28k598gx8p2acgk5gik-stb-unstable-2023-01-29/include/stb
-- Found Qt SerialPort library
-- Found ALSA: /nix/store/2bp6s10j3b6rwqn6p0wy27q78db7ldz1-alsa-lib-1.2.13/lib/libasound.so (found version "1.2.13")
�[0mSkipping archives�[0m
�[0mGlibc version: 2.40�[0m
�[0mDEB deps: xz-utils, libglib2.0-0, libc6 (>=2.40)�[0m
�[0mRPM deps: xz, glibc >= 2.40�[0m
-- Configuring done (4.0s)
�[31mCMake Error at sources/utils-image/CMakeLists.txt:34 (target_link_libraries):
  Target "utils-image" links to:

    lunasvg::lunasvg

  but the target was not found.  Possible reasons include:

    * There is a typo in the target name.
    * A find_package call is missing for an IMPORTED target.
    * An ALIAS target is missing.


�[0m
-- Generating done (0.3s)
�[33mCMake Warning:
  Manually-specified variables were not used by the project:

    BUILD_TESTING
    CMAKE_EXPORT_NO_PACKAGE_REGISTRY
    CMAKE_POLICY_DEFAULT_CMP0025
    PROTOC_EXE
    Protobuf_PROTOC_EXE
    Protobuf_PROTOC_EXECUTABLE

�[0m
�[0mCMake Generate step failed.  Build files cannot be regenerated correctly.�[0m

here is the build result with your last commit

@awawa-dev
Copy link
Owner

awawa-dev commented Apr 18, 2025

but there was target lunasvg::lunasvg overwritten in your previous commit 54d7ae2#diff-9fef6ae71d6c1cfbe602513a8aa078942e803a88d0177cc91ddb757e71e864f2L108

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

I don't understand, have I done something wrong in this commit?

@awawa-dev
Copy link
Owner

awawa-dev commented Apr 18, 2025

No, but after find_package(lunasvg REQUIRED) there was a target lunasvg::lunasvg that you used to create new target lunasvg. And in these logs #1158 (comment) target lunasvg::lunasvg is supposly missing even if the find_package(lunasvg) was used. Did you use some cache mechanism when you compile it? Anyway after my changes https://github.com/awawa-dev/HyperHDR/actions/runs/14533404638 is compiling fine even using lunasvg::lunasvg target from the submodule but cant verify the system lunasvg.

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

Very strangely when using find_package in the cmakelist from utils-images it works but when I move it into the external cmakelists it is not found

@awawa-dev
Copy link
Owner

Maybe its something with the GLOBAL atribute but the problem should be the same for the other libraries.

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

This is now building fine on my side

@hatch01
Copy link
Contributor Author

hatch01 commented Apr 18, 2025

Do you want me to clean up the git tree a little bit, or is it fine like this?

@awawa-dev
Copy link
Owner

No it's fine. PR will be squash merged anyway.

@awawa-dev awawa-dev merged commit d7a1d65 into awawa-dev:master Apr 18, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants