Skip to content

Commit

Permalink
[macos] Builds for 10.15 & 11.0 depending on arch
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Dec 26, 2023
1 parent 36f7cd5 commit 430ef01
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 6 deletions.
30 changes: 30 additions & 0 deletions .cninja/macos-release-10.15.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cninja_require(compiler=xcode)
cninja_require(static-release)
cninja_require(linker-warnings=no)
cninja_require(era=10.15)

execute_process(
COMMAND xcode-select --print-path
OUTPUT_VARIABLE XCODE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set_cache(CMAKE_OSX_SYSROOT "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")

if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
string(APPEND CMAKE_C_FLAGS_INIT " -march=ivybridge -mtune=cannonlake ")
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=ivybridge -mtune=cannonlake ")
set_cache(KFR_ARCH sse2)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm*")
set_cache(KFR_ARCH neon)
endif()

set_cache(BUILD_SHARED_LIBS OFF)
set_cache(CMAKE_INSTALL_MESSAGE NEVER)

set_cache(SCORE_DEPLOYMENT_BUILD 1)
set_cache(SCORE_INSTALL_HEADERS ON)
set_cache(OSSIA_STATIC_EXPORT ON)
set_cache(SCORE_MACOS_ONLY_SYSTEM_LIBARIES ON)

# Disabled because of std::binary_semaphore
set_cache(LIBREMIDI_NO_JACK ON)
27 changes: 27 additions & 0 deletions .cninja/macos-release-11.0.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
cninja_require(compiler=xcode)
cninja_require(static-release)
cninja_require(linker-warnings=no)
cninja_require(era=11.0)

execute_process(
COMMAND xcode-select --print-path
OUTPUT_VARIABLE XCODE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set_cache(CMAKE_OSX_SYSROOT "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")

if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "x86_64")
string(APPEND CMAKE_C_FLAGS_INIT " -march=ivybridge -mtune=cannonlake ")
string(APPEND CMAKE_CXX_FLAGS_INIT " -march=ivybridge -mtune=cannonlake ")
set_cache(KFR_ARCH sse2)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "arm*")
set_cache(KFR_ARCH neon)
endif()

set_cache(BUILD_SHARED_LIBS OFF)
set_cache(CMAKE_INSTALL_MESSAGE NEVER)

set_cache(SCORE_DEPLOYMENT_BUILD 1)
set_cache(SCORE_INSTALL_HEADERS ON)
set_cache(OSSIA_STATIC_EXPORT ON)
set_cache(SCORE_MACOS_ONLY_SYSTEM_LIBARIES ON)
2 changes: 1 addition & 1 deletion 3rdparty/libsndfile
Submodule libsndfile updated 118 files
3 changes: 3 additions & 0 deletions 3rdparty/sndfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ if(SCORE_USE_SYSTEM_LIBRARIES)
else()
disable_var(BUILD_PROGRAMS)
disable_var(BUILD_EXAMPLES)
disable_var(ENABLE_CPACK)
disable_var(ENABLE_PACKAGE_CONFIG)
disable_var(INSTALL_PKGCONFIG_MODULE)
disable_var(INSTALL_MANPAGES)
disable_var(ENABLE_BOW_DOCS)
disable_var(ENABLE_EXPERIMENTAL)
disable_var(ENABLE_EXTERNAL_LIBS)
disable_var(ENABLE_MPEG)
Expand Down
19 changes: 15 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,25 @@ endif()
set(QT_VERSION Qt6 6.2)

if(SCORE_MACOS_ONLY_SYSTEM_LIBARIES)
if(APPLE)
foreach(xpath "/opt/homebrew;/usr/local;/usr/X11R6;/usr/pkg;/opt;/sw;/opt/local")
set(CMAKE_IGNORE_PATH "/opt/homebrew;/usr/local;/usr/X11R6;/usr/pkg;/sw;/opt/local")
set(CMAKE_SYSTEM_IGNORE_PATH "/opt/homebrew;/usr/local;/usr/X11R6;/usr/pkg;/sw;/opt/local")
set(CMAKE_IGNORE_PREFIX_PATH "/opt/homebrew;/usr/local;/usr/X11R6;/usr/pkg;/sw;/opt/local")
set(CMAKE_SYSTEM_IGNORE_PREFIX_PATH "/opt/homebrew;/usr/local;/usr/X11R6;/usr/pkg;/sw;/opt/local")
foreach(xpath "/opt/homebrew;/usr/local;/usr/X11R6;/usr/pkg;/opt;/sw;/opt/local;/")
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH ${xpath})
list(REMOVE_ITEM CMAKE_PREFIX_PATH ${xpath})
endforeach()
foreach(xpath ${CMAKE_SYSTEM_PREFIX_PATH})
if("${xpath}" MATCHES ".*homebrew.*")
list(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH ${xpath})
list(REMOVE_ITEM CMAKE_PREFIX_PATH ${xpath})
endforeach()
endif()
endif()
endforeach()
endif()

set(CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_SYSTEM_PREFIX_PATH}" CACHE INTERNAL "" FORCE)
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}" CACHE INTERNAL "" FORCE)

# QT_PREFIX: Qt5 / Qt6
list(GET QT_VERSION 0 QT_PREFIX)

Expand Down
2 changes: 1 addition & 1 deletion ci/osx-package.build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ else
export CNINJA_TOOLCHAIN=macos-release-11.0
fi

xcrun /usr/local/bin/cninja -S "$PWD" -B build macos-release -- \
xcrun /usr/local/bin/cninja -S "$PWD" -B build "$CNINJA_TOOLCHAIN" -- \
-DOSSIA_SDK="$OSSIA_SDK" \
-DCMAKE_INSTALL_PREFIX="$PWD/install"

Expand Down

0 comments on commit 430ef01

Please sign in to comment.