Skip to content

Commit

Permalink
CI: attempt to fix static linking of SDL2
Browse files Browse the repository at this point in the history
  • Loading branch information
fleroviux committed Oct 3, 2023
1 parent 39f09a8 commit 1a86c9c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: |
cmake -Bbuild \
-DCMAKE_CXX_FLAGS="-s" \
-DSDL2_STATIC=ON \
-DBUILD_STATIC=ON \
-DCMAKE_BUILD_TYPE=Release
cd build
make -j$(getconf _NPROCESSORS_ONLN)
Expand Down
14 changes: 12 additions & 2 deletions src/platform/sdl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ set(HEADERS
src/sdl2_audio_driver.hpp
)

find_package(SDL2 REQUIRED)
find_package(PkgConfig REQUIRED)

option(BUILD_STATIC "Build a statically linked executable" OFF)

if(BUILD_STATIC)
list(APPEND PKG_CONFIG_EXECUTABLE "--static")
endif()

pkg_check_modules(SDL2 REQUIRED IMPORTED_TARGET sdl2)

#find_package(SDL2 REQUIRED)

add_executable(dual-sdl ${SOURCES} ${HEADERS})
target_include_directories(dual-sdl PRIVATE src)
target_link_libraries(dual-sdl PRIVATE dual SDL2::SDL2)
target_link_libraries(dual-sdl PRIVATE dual PkgConfig::SDL2)

0 comments on commit 1a86c9c

Please sign in to comment.