Skip to content

Commit

Permalink
Merge pull request #7 from ThePythonator/chore/upgrade-sdl-and-mixer
Browse files Browse the repository at this point in the history
chore: Upgraded SDL2 and SDL2_mixer versions
fix: Fixed CMake issues with project not building
  • Loading branch information
ThePythonator committed Jul 28, 2024
2 parents f246e7b + f993eab commit 6863239
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 26 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: Linux
release-suffix: LIN64
cmake-args: #-DSDL2_IMAGE_DIR=$GITHUB_WORKSPACE/main/SDL2
apt-packages: libsdl2-dev libsdl2-image-dev python3-setuptools
apt-packages: #libxmp-dev
can-fail: false

- os: ubuntu-20.04
Expand All @@ -43,7 +43,7 @@ jobs:
name: macOS
release-suffix: MACOS
cmake-args: #-DSDL2_IMAGE_DIR=$GITHUB_WORKSPACE/main/SDL2
brew-packages: sdl2 sdl2_image
brew-packages: #libxmp
can-fail: true

- os: windows-latest
Expand Down Expand Up @@ -71,21 +71,19 @@ jobs:
if: runner.os == 'Linux'
run: |
sudo apt update && sudo apt install ${{matrix.apt-packages}}
pip3 install 32blit
# MacOS dependencies
- name: Install macOS deps
if: runner.os == 'macOS'
run: |
brew install ${{matrix.brew-packages}}
python3 -m pip install 32blit
#- name: Install macOS deps
# if: runner.os == 'macOS'
# run: |
# brew install ${{matrix.brew-packages}}

# Windows dependencies
- name: Install Windows deps
if: runner.os == 'Windows'
shell: bash
run: |
python -m pip install 32blit
#- name: Install Windows deps
# if: runner.os == 'Windows'
# shell: bash
# run: |
# python -m pip install 32blit

# Emscripten SDK setup
- name: Setup Emscripten cache
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ include_directories(${PROJECT_SOURCE_DIR}/include/external)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

# Link
target_link_libraries(${PROJECT_NAME} SDL2::SDL2main SDL2::SDL2 SDL2::image SDL2::mixer nlohmann_json::nlohmann_json)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2main SDL2::SDL2 SDL2_image::SDL2_image SDL2_mixer::SDL2_mixer nlohmann_json::nlohmann_json)


# Setup release packages
Expand Down
20 changes: 8 additions & 12 deletions fetch/get_sdl2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(EMSCRIPTEN)
add_library(SDL2::SDL2main INTERFACE IMPORTED)

add_library(SDL2::image INTERFACE IMPORTED)
set_target_properties(SDL2::image PROPERTIES
set_target_properties(SDL2_image::SDL2_image PROPERTIES
INTERFACE_COMPILE_OPTIONS "SHELL:-s USE_SDL_IMAGE=2"
INTERFACE_LINK_LIBRARIES "-s USE_SDL_IMAGE=2"
)
Expand All @@ -30,7 +30,7 @@ if(NOT TARGET SDL2::SDL2)

FetchContent_Populate(SDL2
GIT_REPOSITORY https://github.com/libsdl-org/SDL
GIT_TAG release-2.0.16
GIT_TAG release-2.30.5
)
add_subdirectory(${sdl2_SOURCE_DIR} SDL2 EXCLUDE_FROM_ALL)
endif()
Expand All @@ -42,21 +42,17 @@ if(NOT TARGET SDL2::image)
GIT_TAG release-2.8.2
)
add_subdirectory(${sdl2_image_SOURCE_DIR} SDL2_image EXCLUDE_FROM_ALL)
#set_property(TARGET jpeg PROPERTY POSITION_INDEPENDENT_CODE ON) # build fix
endif()

if(NOT TARGET SDL2::mixer)
# Not sure what I'm doing here
set(SUPPORT_MP3_MPG123 ON)
#set(SUPPORT_OGG ON)
set(SUPPORT_OGG ON CACHE BOOL "")
set(SDL2MIXER_OPUS OFF CACHE BOOL "" FORCE)
set(SDL2MIXER_MOD OFF CACHE BOOL "" FORCE)
set(SDL2MIXER_MIDI OFF CACHE BOOL "" FORCE)
set(SDL2MIXER_WAVPACK OFF CACHE BOOL "" FORCE)

FetchContent_Populate(SDL2_mixer
GIT_REPOSITORY https://github.com/Daft-Freak/SDL_mixer
GIT_TAG patch-1
GIT_REPOSITORY https://github.com/libsdl-org/SDL_mixer
GIT_TAG release-2.8.0
)
#add_definitions(-DMUSIC_MP3 -DMUSIC_OGG) # VS compile errors if no music formats?? //-DMUSIC_WAV
add_subdirectory(${sdl2_mixer_SOURCE_DIR} SDL2_mixer EXCLUDE_FROM_ALL)
#set_property(TARGET vorbisidec PROPERTY POSITION_INDEPENDENT_CODE ON) # build fix
# ogg too?
endif()

0 comments on commit 6863239

Please sign in to comment.