Skip to content

Commit

Permalink
Merge pull request #655 from SkyLeite/develop
Browse files Browse the repository at this point in the history
Fix missing libjpeg in ARM MacOS and set MacOS libraries in CMakeLists.txt
  • Loading branch information
Drewol authored Jan 2, 2024
2 parents b244b4b + 669a55d commit 2358d3a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 9 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,11 @@ jobs:
- name: brew update
run: brew update
- name: Install packages
run: brew install freetype libvorbis sdl2 libpng jpeg libarchive
run: brew install freetype libvorbis sdl2 libpng jpeg-turbo libarchive
- name: cmake
run: |
eval "$(brew shellenv)"
rm ./vcpkg.json
cmake . -DLibArchive_LIBRARY=$HOMEBREW_PREFIX/opt/libarchive/lib/libarchive.dylib -DLibArchive_INCLUDE_DIR=$HOMEBREW_PREFIX/opt/libarchive/include -DCMAKE_BUILD_TYPE=Release
env:
DCMAKE_BUILD_TYPE: Release
run: cmake .
- name: make
run: make
- name: Upload artifact
Expand Down
23 changes: 23 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,29 @@ endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )

set(CMAKE_MACOSX_RPATH 1)

# Set library paths for MacOS
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX TRUE)

# Set homebrew's include dir
execute_process(
COMMAND brew --prefix
OUTPUT_VARIABLE HOMEBREW_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
include_directories("${HOMEBREW_PREFIX}/include")

# Libarchive is shipped as a keg so we must get its path manually
execute_process(
COMMAND brew --prefix libarchive
OUTPUT_VARIABLE LIBARCHIVE_PREFIX
OUTPUT_STRIP_TRAILING_WHITESPACE
COMMAND_ERROR_IS_FATAL ANY
)
set(LibArchive_INCLUDE_DIR "${LIBARCHIVE_PREFIX}/include")
endif()

# Set folder where to find FindXXX.cmake and
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/")

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ To run from Visual Studio, go to Properties for Main > Debugging > Working Direc
### macOS:
0. Clone the project using `git` and then run `git submodule update --init --recursive` to download the required submodules.
1. Install dependencies
* [Homebrew](https://github.com/Homebrew/brew): `brew install cmake freetype libvorbis sdl2 libpng jpeg libarchive libiconv`
2. Run `mac-cmake.sh` and then `make` from the root of the project.
* [Homebrew](https://github.com/Homebrew/brew): `brew install cmake freetype libvorbis sdl2 libpng jpeg-turbo libarchive libiconv`
2. Run `cmake -DCMAKE_BUILD_TYPE=Release .` and then `make` from the root of the project.
3. Run the executable made in the 'bin' folder.

### Embedded (Raspberry Pi):
Expand Down
2 changes: 0 additions & 2 deletions mac-cmake.sh

This file was deleted.

0 comments on commit 2358d3a

Please sign in to comment.