Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 69e0d4d

Browse files
darrenclarkswiftlyfalling
authored andcommitted
Fix iOS builds from command line (xcodebuild) (#24)
When building inside Xcode.app, the amalgamation target has environment variables set as if it is being built for macOS (even when building the iOS library), so the configure/make steps work fine. However, when building via the command line (ie: `xcodebuild -scheme sqlitelib -configuration Release -sdk iphoneos`), the amalgamation target was getting environment variables set as if it was building for iOS. This was causing the `configure` step to fail, because it thought the compiler was broken (as macOS can't run binaries that were being built for iOS). This commit fixes the issue by always running configure as if we were building for macOS. (The sqlitecustom target will still build libraries for the correct platform, as previously.)
1 parent d0b7a5c commit 69e0d4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎SQLiteLib.xcodeproj/project.pbxproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
);
188188
runOnlyForDeploymentPostprocessing = 0;
189189
shellPath = /bin/sh;
190-
shellScript = "set -e\n\necho \"Configure and generate SQLite amalgamation files\"\n\npattern=\" |'\"\nif [[ ${PROJECT_DIR} =~ $pattern ]]\nthen\necho \"Unsafe PROJECT_DIR for make - contains spaces.\"\necho \"PROJECT_DIR=${PROJECT_DIR}\"\nexit 1\nfi\n\nSDK_VERSION=$(echo ${SDK_NAME} | grep -o '.\\{3\\}$')\n\n# Configure and make the amalgamation files using the appropriate simulator SDK\nif [ ${PLATFORM_NAME} = \"macosx\" ]; then\nSDK_PLATFORM_NAME=\"macosx\"\nelif [ ${PLATFORM_NAME} = \"appletvsimulator\" ] || [ ${PLATFORM_NAME} = \"appletvos\" ]; then\nSDK_PLATFORM_NAME=\"appletvsimulator\"\nelif [ ${PLATFORM_NAME} = \"watchsimulator\" ] || [ ${PLATFORM_NAME} = \"watchos\" ]; then\nSDK_PLATFORM_NAME=\"appletvsimulator\" #watchsimulator sdk doesn't work for build?\nelif [ ${PLATFORM_NAME} = \"iphonesimulator\" ] || [ ${PLATFORM_NAME} = \"iphoneos\" ]; then\nSDK_PLATFORM_NAME=\"iphonesimulator\"\nelse\necho \"Unsupported target platform and SDK: ${PLATFORM_NAME}, ${SDK_NAME}\"\nexit 1\nfi\n\n#macOS Sierra fix - this now always run configure with the macOS SDK\necho \"XCode has selected SDK: ${PLATFORM_NAME} with version: ${SDK_VERSION}\"\necho \"Making amalgamation source with SDK_PLATFORM_NAME = ${SDK_PLATFORM_NAME}\"\n\nSDKROOT=\"$(xcrun --sdk $SDK_PLATFORM_NAME --show-sdk-path)\"\nCC=\"$(xcrun --sdk $SDK_PLATFORM_NAME -f clang)\"\nCXX=\"$(xcrun --sdk $SDK_PLATFORM_NAME -f clang++)\"\nCFLAGS=\"-isysroot $SDKROOT $OTHER_CFLAGS\"\nCXXFLAGS=$CFLAGS\nexport CC CXX CFLAGS CXXFLAGS\n\nmkdir -p \"${DERIVED_SOURCES_DIR}\"\ncd \"${DERIVED_SOURCES_DIR}\"\n\necho \"Clean-up previous files if necessary\"\n[ -e Makefile ] && make distclean\n\necho \"Configure makefile\"\n\"${PROJECT_DIR}/sqlite/configure\" --srcdir=\"${PROJECT_DIR}/sqlite/\"\n\necho \"Make SQLite amalgamation\"\nmake sqlite3.c\n\n# copy generated amalgamation files (sqlite3.c and sqlite3.h)\n# to BUILD_DIR/sqlite\nSQLITE_OUTPUT_DIR=\"${BUILD_DIR}/sqlite\"\nmkdir -p \"${SQLITE_OUTPUT_DIR}\"\necho \"Copying sqlite3.c to ${SQLITE_OUTPUT_DIR}/sqlite3.c\"\ncp ./sqlite3.c \"${SQLITE_OUTPUT_DIR}/sqlite3.c\"\necho \"Copying sqlite3.h to ${PROJECT_DIR}/sqlite3.h\"\ncp ./sqlite3.h \"${PROJECT_DIR}/sqlite3.h\"\n\necho \"Finished generating SQLite amalgamation files\"\n";
190+
shellScript = "set -e\n\necho \"Configure and generate SQLite amalgamation files\"\n\npattern=\" |'\"\nif [[ ${PROJECT_DIR} =~ $pattern ]]\nthen\necho \"Unsafe PROJECT_DIR for make - contains spaces.\"\necho \"PROJECT_DIR=${PROJECT_DIR}\"\nexit 1\nfi\n\n# Ensure we always run configure/make as if we were compiling for macOS (as parts of the\n# configure/make process require building & running an executable)\n#\n# The generated sqlite3.c will be built for the correct platform by Xcode via the\n# 'sqlitecustom' target\nSDK_PLATFORM_NAME=\"macosx\"\nMACOSX_VERSION_MIN=\"$(sw_vers -productVersion | cut -d '.' -f 1,2)\"\n\n\nSDKROOT=\"$(xcrun --sdk $SDK_PLATFORM_NAME --show-sdk-path)\"\nCC=\"$(xcrun --sdk $SDK_PLATFORM_NAME -f clang)\"\nCXX=\"$(xcrun --sdk $SDK_PLATFORM_NAME -f clang++)\"\nCFLAGS=\"-arch x86_64 -isysroot $SDKROOT -mmacosx-version-min=$MACOSX_VERSION_MIN $OTHER_CFLAGS\"\nCXXFLAGS=$CFLAGS\nexport CC CXX CFLAGS CXXFLAGS\n\nmkdir -p \"${DERIVED_SOURCES_DIR}\"\ncd \"${DERIVED_SOURCES_DIR}\"\n\necho \"Clean-up previous files if necessary\"\n[ -e Makefile ] && make distclean\n\necho \"Configure makefile\"\n\"${PROJECT_DIR}/sqlite/configure\" --srcdir=\"${PROJECT_DIR}/sqlite/\"\n\necho \"Make SQLite amalgamation\"\nmake sqlite3.c\n\n# copy generated amalgamation files (sqlite3.c and sqlite3.h)\n# to BUILD_DIR/sqlite\nSQLITE_OUTPUT_DIR=\"${BUILD_DIR}/sqlite\"\nmkdir -p \"${SQLITE_OUTPUT_DIR}\"\necho \"Copying sqlite3.c to ${SQLITE_OUTPUT_DIR}/sqlite3.c\"\ncp ./sqlite3.c \"${SQLITE_OUTPUT_DIR}/sqlite3.c\"\necho \"Copying sqlite3.h to ${PROJECT_DIR}/sqlite3.h\"\ncp ./sqlite3.h \"${PROJECT_DIR}/sqlite3.h\"\n\necho \"Finished generating SQLite amalgamation files\"\n";
191191
};
192192
/* End PBXShellScriptBuildPhase section */
193193

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /