Skip to content

Instantly share code, notes, and snippets.

@iulian0512
Created May 10, 2022 09:49
Show Gist options
  • Save iulian0512/9e523c14d72a7dfc3adc9f35b1a1de5e to your computer and use it in GitHub Desktop.
Save iulian0512/9e523c14d72a7dfc3adc9f35b1a1de5e to your computer and use it in GitHub Desktop.
geos 3.10.2 ios simulator makefile
XCODE_DEVELOPER = $(shell xcode-select --print-path)
#used for selecting the sdk dir
IOS_PLATFORM ?= iPhoneOS
# Pick latest SDK in the directory
IOS_PLATFORM_DEVELOPER = ${XCODE_DEVELOPER}/Platforms/${IOS_PLATFORM}.platform/Developer
IOS_SDK = ${IOS_PLATFORM_DEVELOPER}/SDKs/$(shell ls ${IOS_PLATFORM_DEVELOPER}/SDKs | sort -r | head -n1)
all:
${MAKE} arch ARCH=x86_64 IOS_PLATFORM=iPhoneSimulator
${MAKE} arch ARCH=arm64 IOS_PLATFORM=iPhoneSimulator
PREFIX = ${CURDIR}/build/${ARCH}
LIBDIR = ${PREFIX}/lib
BINDIR = ${PREFIX}/bin
INCLUDEDIR = ${PREFIX}/include
COMPILER_FLAGS = '-arch ${ARCH} -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -stdlib=libc++ -Werror=non-modular-include-in-framework-module -fpascal-strings -Os -fembed-bitcode -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror=return-type -Werror=deprecated-objc-isa-usage -Werror=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wno-unused-label -Wno-unused-parameter -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wno-newline-eof -Wno-c++11-extensions -fasm-blocks -fstrict-aliasing -fvisibility-inlines-hidden -Wno-sign-conversion -Wno-semicolon-before-method-body -Wno-documentation-deprecated-sync -Wno-documentation'
arch: ${LIBDIR}/libgeos.a
${LIBDIR}/libgeos.a: ${CURDIR}/geos
cd geos && cmake -DCMAKE_INSTALL_PREFIX:PATH=${PREFIX} \
-DCMAKE_CXX_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang\
-DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang\
-DCMAKE_OSX_SYSROOT:PATH=${IOS_SDK} -DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DBUILD_GEOSOP:BOOL=OFF \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_C_FLAGS=${COMPILER_FLAGS} \
-DCMAKE_CXX_FLAGS=${COMPILER_FLAGS} \
&& cmake --build . --target clean && cmake --build . --config Release && cmake --install . --config Release
${CURDIR}/geos:
curl http://download.osgeo.org/geos/geos-3.10.2.tar.bz2 > geos.tar.bz2
tar -xzf geos.tar.bz2
rm geos.tar.bz2
mv geos-3.10.2 geos
clean:
rm -rf build geos include lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment