Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
laggykiller committed Aug 15, 2023
1 parent fcf1043 commit 74d0c99
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,27 @@ jobs:
arch: x64
submodules_mode: true
cibw_archs_macos: x86_64
cibw_environment: _PYTHON_HOST_PLATFORM=macosx-11-x86_64 APNGASM_COMPILE_TARGET=x64
cibw_environment: >
APNGASM_COMPILE_TARGET=x64
_PYTHON_HOST_PLATFORM=macosx-10.15-x86_64
VCPKG_OSX_DEPLOYMENT_TARGET=10.15
MACOSX_DEPLOYMENT_TARGET=10.15
CMAKE_OSX_DEPLOYMENT_TARGET=10.15
VCPKG_C_FLAGS="-mmacosx-version-min=10.15"
VCPKG_CXX_FLAGS="-mmacosx-version-min=10.15"
cibw_before_all: ./prepare-mac.sh
- os: macos-11
arch: arm64
submodules_mode: recursive
cibw_archs_macos: arm64
cibw_environment: _PYTHON_HOST_PLATFORM=macosx-11-arm64 APNGASM_COMPILE_TARGET=arm64
cibw_environment: >
APNGASM_COMPILE_TARGET=arm64
_PYTHON_HOST_PLATFORM=macosx-10.15-arm64
VCPKG_OSX_DEPLOYMENT_TARGET=10.15
MACOSX_DEPLOYMENT_TARGET=10.15
CMAKE_OSX_DEPLOYMENT_TARGET=10.15
VCPKG_C_FLAGS="-mmacosx-version-min=10.15"
VCPKG_CXX_FLAGS="-mmacosx-version-min=10.15"
cibw_before_all: ./prepare-mac.sh
- os: ubuntu-20.04
arch: x64
Expand Down Expand Up @@ -115,7 +129,6 @@ jobs:
- name: Build wheels
uses: pypa/[email protected]
env:
MACOSX_DEPLOYMENT_TARGET: 11
CIBW_BUILD_FRONTEND: build
CIBW_ARCHS_WINDOWS: ${{ matrix.cibw_archs_windows }}
CIBW_ARCHS_MACOS: ${{ matrix.cibw_archs_macos }}
Expand Down
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ if (WIN32)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
elseif (LINUX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
elseif (APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
endif()

if (WIN32)
Expand Down
2 changes: 1 addition & 1 deletion prepare-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fi

# Cross compiling supported only through vcpkg
if [[ ! -z $VCPKG_INSTALLATION_ROOT ]]; then
APNGASM_COMPILE_TARGET=$(./get-target-linux.sh)
export APNGASM_COMPILE_TARGET=$(./get-target-linux.sh)

${VCPKG_INSTALLATION_ROOT}/vcpkg install zlib:${APNGASM_COMPILE_TARGET}-linux
${VCPKG_INSTALLATION_ROOT}/vcpkg install libpng:${APNGASM_COMPILE_TARGET}-linux
Expand Down
11 changes: 7 additions & 4 deletions prepare-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ fi

# Cross compiling supported only through vcpkg
if [[ ! -z $VCPKG_INSTALLATION_ROOT ]]; then
APNGASM_COMPILE_TARGET=$(./get-target-mac.sh)
export VCPKG_OSX_DEPLOYMENT_TARGET=10.15
export VCPKG_C_FLAGS="-mmacosx-version-min=10.15"
export VCPKG_CXX_FLAGS="-mmacosx-version-min=10.15"
export APNGASM_COMPILE_TARGET=$(./get-target-mac.sh)

${VCPKG_INSTALLATION_ROOT}/vcpkg install zlib:${APNGASM_COMPILE_TARGET}-osx
${VCPKG_INSTALLATION_ROOT}/vcpkg install libpng:${APNGASM_COMPILE_TARGET}-osx
Expand Down Expand Up @@ -40,21 +43,21 @@ else
cd ${SOURCE_PATH}/zlib
mkdir build
cd ./build
cmake -DCMAKE_INSTALL_PREFIX:PATH=${FAKEROOT} ..
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_INSTALL_PREFIX:PATH=${FAKEROOT} ..
make install -j
fi

if [ ! -f ${FAKEROOT}/include/png.h ]; then
cd ${SOURCE_PATH}/libpng
mkdir build
cd ./build
cmake -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX:PATH=${FAKEROOT} -DPNG_SHARED=OFF -DZLIB_ROOT=${FAKEROOT} -DZLIB_USE_STATIC_LIBS=ON ..
cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15 -DCMAKE_POLICY_DEFAULT_CMP0074=NEW -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX:PATH=${FAKEROOT} -DPNG_SHARED=OFF -DZLIB_ROOT=${FAKEROOT} -DZLIB_USE_STATIC_LIBS=ON ..
make install -j
fi

if [ ! -d ${FAKEROOT}/include/boost ]; then
cd ${SOURCE_PATH}/boost
./bootstrap.sh --prefix=.
./b2 install link=static --build-dir=tmp --prefix=${FAKEROOT} --with-program_options --with-regex --with-system -j${CORES} --layout=tagged
./b2 install link=static macosx-version-min=10.15 --build-dir=tmp --prefix=${FAKEROOT} --with-program_options --with-regex --with-system -j${CORES} --layout=tagged
fi
fi

0 comments on commit 74d0c99

Please sign in to comment.