Skip to content

Commit

Permalink
build: fix dependency on SDL2
Browse files Browse the repository at this point in the history
This is a followup on 81d5a24 (build: fix building with MSVC,
2024-03-07) and 68a555e (build: fix __attribute__((aligned(x))) on
gcc/clang, 2024-03-09) for the purposes of creating a vcpkg FAudio port.

Add a `Requires.private: sdl2` to the pkgconf file for the SDL2
dependency when not using PLATFORM_WIN32.

Add the SDL2 dependency to the generated cmake config file when not
using PLATFORM_WIN32 as well.

Signed-off-by: Rafael Kitover <[email protected]>
  • Loading branch information
dg0yt authored and flibitijibibo committed Mar 10, 2024
1 parent 68a555e commit cfdc4db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,11 @@ install(
include(cmake/JoinPaths.cmake)
join_paths(FAUDIO_PKGCONF_LIBDIR "\${prefix}" "${CMAKE_INSTALL_LIBDIR}")
join_paths(FAUDIO_PKGCONF_INCLUDEDIR "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}")

if(NOT PLATFORM_WIN32)
set(PC_REQUIRES_PRIVATE "Requires.private: sdl2")
endif()

configure_file(
"${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}.pc.in"
${PROJECT_BINARY_DIR}/generated/${PROJECT_NAME}.pc
Expand Down
1 change: 1 addition & 0 deletions cmake/FAudio.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Name: @PROJECT_NAME@
URL: https://github.com/FNA-XNA/FAudio
Description: Accuracy-focused XAudio reimplementation for open platforms
Version: @LIB_VERSION@
@PC_REQUIRES_PRIVATE@

Libs: -L${libdir} -l@PROJECT_NAME@
Cflags: -I${includedir} @PLATFORM_CFLAGS@
5 changes: 5 additions & 0 deletions cmake/config.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
@PACKAGE_INIT@

if(NOT "@PLATFORM_WIN32@")
include(CMakeFindDependencyMacro)
find_dependency(SDL2 CONFIG)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")
check_required_components("@CMAKE_PROJECT_NAME@")

0 comments on commit cfdc4db

Please sign in to comment.