Skip to content

Commit

Permalink
build: use host version for osx deployment target by default (#481)
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Jun 8, 2022
1 parent d1ecc59 commit 12b36c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
os_version: latest
qt_version: 5.15.2
arch: x64
cmake_opts:
cmake_opts: -DKLOGG_OSX_DEPLOYMENT_TARGET=10.14

runs-on: ${{ matrix.config.os }}-${{ matrix.config.os_version }}
steps:
Expand Down Expand Up @@ -258,7 +258,7 @@ jobs:
mkdir -p pkg_resources/en.lproj
cp ../COPYING pkg_resources/en.lproj
cp ../packaging/description.txt pkg_resources/en.lproj
sed -e s/%klogg_version%/${{ env.KLOGG_VERSION }}/ -e s/%klogg_pkg%/klogg-${{ env.KLOGG_VERSION }}-OSX.pkg/ ../packaging/osx/distribution.xml > distribution.xml
g sed -e s/%klogg_version%/${{ env.KLOGG_VERSION }}/ -e s/%klogg_pkg%/klogg-${{ env.KLOGG_VERSION }}-OSX.pkg/ ../packaging/osx/distribution.xml > distribution.xml
pkgbuild --component ./output/klogg.app --install-location /Applications --version ${{ env.KLOGG_VERSION }} --sign "Developer ID Installer: Anton Filimonov (GAW773U324)" --timestamp ./output/klogg-${{ env.KLOGG_VERSION }}-OSX.pkg
productbuild --package-path ./output --distribution distribution.xml --resources ./pkg_resources --sign "Developer ID Installer: Anton Filimonov (GAW773U324)" --timestamp ./output/klogg-${{ env.KLOGG_VERSION }}-OSX-product.pkg
pkgutil --expand ./output/klogg-${{ env.KLOGG_VERSION }}-OSX-product.pkg ./output/klogg_product_pkg
Expand Down
5 changes: 3 additions & 2 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ cmake --build .

Binaries are placed into `build_root/output`.

It might be necessary to pass `-DCMAKE_OSX_DEPLOYMENT_TARGET=<your_current_os_number>` to cmake during configuration step,
`<your_current_os_number>` is one of `10.14`, `10.15`, `11`, `12`.
By default, klogg will rely on cmake to figure out target MacOS version. Usually it uses build host version.
To override default cmake value pass an option `-DKLOGG_OSX_DEPLOYMENT_TARGET=<target>` to cmake during configuration step,
`<target>` is one of `10.14`, `10.15`, `11`, `12`. Klogg's traget must be greater or equal to target used by Qt libraries.

## Running tests
Tests are built by default. To turn them off pass `-DBUILD_TESTS:BOOL=OFF` to cmake.
Expand Down
9 changes: 4 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ option(KLOGG_BUILD_TESTS "Build tests" ON)
option(KLOGG_USE_LTO "Use link time optimization" ON)
option(KLOGG_USE_SENTRY "Use Sentry" OFF)
option(KLOGG_GENERIC_CPU "Build for generic CPU" OFF)
option(KLOGG_OSX_DEPLOYMENT_TARGET "Override target MacOS version" "")

if(APPLE)
option(KLOGG_OVERRIDE_MALLOC "Use malloc global override" OFF)
Expand Down Expand Up @@ -194,12 +195,10 @@ message("Qt version ${KLOGG_QT_VERSION}")
message("LTO ${KLOGG_USE_LTO}")

if(APPLE)
if(${QT_VERSION_MAJOR} STREQUAL "6")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.15)
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14)
if(${KLOGG_OSX_DEPLOYMENT_TARGET})
set(CMAKE_OSX_DEPLOYMENT_TARGET ${KLOGG_OSX_DEPLOYMENT_TARGET})
message("OSX target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()
message("OSX target ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()

set(CMAKE_AUTOMOC OFF)
Expand Down

0 comments on commit 12b36c6

Please sign in to comment.