Skip to content
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

Compile avif_apps_internal without -DAVIF_DLL #2318

Conversation

wantehchang
Copy link
Collaborator

@wantehchang wantehchang commented Jul 24, 2024

In shared library builds (-DBUILD_SHARED_LIBS=ON), compile the source
files in the avif_apps_internal static library without -DAVIF_DLL.

Also link avif_obj with the m and Threads::Threads libraries in the
PRIVATE scope instead of the PUBLIC scope.

Fix #2339.

@wantehchang wantehchang force-pushed the build-avif-apps-internal-without-avif-dll branch 11 times, most recently from 7e82740 to c38f940 Compare July 26, 2024 01:11
@wantehchang wantehchang force-pushed the build-avif-apps-internal-without-avif-dll branch 3 times, most recently from 39f17d7 to 11d0965 Compare July 30, 2024 22:06
In shared library builds (-DBUILD_SHARED_LIBS=ON), compile the source
files in the avif_apps_internal static library without -DAVIF_DLL.

Also link avif_obj with the m and Threads::Threads libraries in the
PRIVATE scope instead of the PUBLIC scope.

Fix AOMediaCodec#2339.
@wantehchang wantehchang force-pushed the build-avif-apps-internal-without-avif-dll branch from 11d0965 to e7169b3 Compare July 30, 2024 22:19
@wantehchang wantehchang marked this pull request as ready for review July 30, 2024 23:06
@wantehchang wantehchang requested a review from jzern July 30, 2024 23:15
@wantehchang
Copy link
Collaborator Author

@vrabaud FYI.

macro(add_avif_apps_library suffix)
add_library(avif_apps${suffix} STATIC ${AVIF_APPS_SRCS})
target_link_libraries(avif_apps${suffix} PUBLIC avif${suffix} PRIVATE PNG::PNG ZLIB::ZLIB JPEG::JPEG avif_enable_warnings)
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this generic enough? I'm wondering if BSD variants would need this too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In line 454 we use the condition if(UNIX OR MINGW) for linking with libm and Threads::Threads.

In libaom we check the condition if(NOT WIN32 AND NOT APPLE) for linking with libm.

I also found a Stack Overflow article on this issue:
https://stackoverflow.com/questions/34625627/how-to-link-to-the-c-math-library-with-cmake

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the find_library method might be the safest.

@wantehchang wantehchang merged commit cde6fcd into AOMediaCodec:main Jul 31, 2024
31 checks passed
@wantehchang wantehchang deleted the build-avif-apps-internal-without-avif-dll branch July 31, 2024 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants