Skip to content

Commit

Permalink
ARM macOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
ninXout committed Oct 16, 2024
1 parent 0cfc4ef commit 5e522f6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
15 changes: 13 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.21)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64")
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_CXX_VISIBILITY_PRESET hidden)

if (MSVC)
Expand Down Expand Up @@ -83,7 +83,18 @@ elseif (ANDROID)
) # android
endif()
else ()
set(STATIC_LIBS ...) # macos
find_package(BZIP2 REQUIRED)
set(STATIC_LIBS
"-framework Security"
${CMAKE_SOURCE_DIR}/lib/libx264.a
${CMAKE_SOURCE_DIR}/lib/libavcodec.a
${CMAKE_SOURCE_DIR}/lib/libavformat.a
${CMAKE_SOURCE_DIR}/lib/libavutil.a
${CMAKE_SOURCE_DIR}/lib/libswresample.a
${CMAKE_SOURCE_DIR}/lib/libswscale.a
${BZIP2_LIBRARY}
"-lm -lbz2 -lz -liconv -pthread -framework Security -framework VideoToolbox -framework CoreFoundation -framework CoreMedia -framework CoreVideo -framework CoreServices -framework CoreAudio -framework AVFoundation -framework CoreGraphics -framework AudioToolbox -framework Metal -framework CoreImage -framework AppKit"
) # macos
endif()
target_link_libraries(${PROJECT_NAME} ${STATIC_LIBS})

Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,23 @@ You can either run it natively on Linux or using WSL on Windows.
When building for android32 you need to set android version 24, you can do so by adding this arg to your geode build command
```sh
geode build --platform android32 --config Release -- -DANDROID_PLATFORM=24
```

## MacOS
To get the needed libraries on MacOS, you must have pkg-config installed, have BZIP2, and build x264 from source.

```sh
brew install pkgconfig
brew install bzip2

git clone https://code.videolan.org/videolan/x264.git
cd x264
./configure --enable-static --enable-shared
make

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
brew install automake fdk-aac git lame libass libtool libvorbis libvpx opus sdl shtool texi2html theora wget x264 x265 xvid nasm
mkdir output
./configure --prefix=$PWD/output --enable-static --enable-shared --enable-libx264 --enable-gpl
make
```

0 comments on commit 5e522f6

Please sign in to comment.