Skip to content

Commit

Permalink
fix: Fix CMake issues with MacOS
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePythonator committed Jul 28, 2024
1 parent d54275d commit 7749646
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
16 changes: 7 additions & 9 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
# 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_image SDL2_mixer::SDL2_mixer nlohmann_json::nlohmann_json)
target_link_libraries(${PROJECT_NAME} SDL2::SDL2main SDL2::SDL2-static SDL2_image::SDL2_image-static SDL2_mixer::SDL2_mixer-static nlohmann_json::nlohmann_json)


# Setup release packages
Expand Down
9 changes: 1 addition & 8 deletions fetch/get_sdl2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,14 @@ 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)

FetchContent_Populate(SDL2_mixer
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 7749646

Please sign in to comment.