However, if we look at the CMake documentation in the cmake-toolchains section, we can see a paragraph where it is explained that we can generate a library with several architecture: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos
Now I just tried adding the variable CMAKE_IOS_INSTALL_COMBINED
and I get something interesting.
After compiling and installing the arm64 version, I get this type of line:
-- [iOS combined] Target: Catch2
-- [iOS combined] Config: Debug
-- [iOS combined] Destination: /Users/naubry/xxx/NextVersion/publibs/_install/iOS/debug/lib/libCatch2d.a
-- [iOS combined] Architectures (iphoneos): arm64 arm64e armv7 armv7s
-- [iOS combined] Architectures (iphonesimulator): arm64 arm64e i386 x86_64
-- [iOS combined] Architectures (iphonesimulator) after pruning: i386 x86_64
-- [iOS combined] Build `Catch2` for `iphonesimulator`
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project Catch2.xcodeproj build -target Catch2 -parallelizeTargets -configuration Debug -hideShellScriptEnvironment -sdk iphonesimulator
It looks like he’s actually trying to make a library with multiple architectures. However, I get an error pretty quickly like:
Command line invocation:
/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project Catch2.xcodeproj build -target Catch2 -parallelizeTargets -configuration Debug -hideShellScriptEnvironment -sdk iphonesimulator
User defaults from command line:
HideShellScriptEnvironment = YES
IDEPackageSupportUseBuiltinSCM = YES
Build settings from command line:
SDKROOT = iphonesimulator16.0
TOOLCHAINS = com.apple.dt.toolchain.XcodeDefault
Computing target dependency graph and provisioning inputs
Create build description
Build description signature: ac7b261392e652e6dcf24b6b17682a4a
Build description path: /Users/naubry/xxx/NextVersion/publibs/catch2/_build/build/build/XCBuildData/ac7b261392e652e6dcf24b6b17682a4a-desc.xcbuild
note: Building targets in dependency order
error: unable to attach DB: error: accessing build database "/Users/naubry/xxx/NextVersion/publibs/catch2/_build/build/build/XCBuildData/build.db": database is locked Possibly there are two concurrent builds running in the same filesystem location.
note: Run script build phase 'Generate CMakeFiles/ZERO_CHECK' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'ZERO_CHECK' from project 'Catch2')
** BUILD FAILED **
CMake Error at /usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeIOSInstallCombined.cmake:144 (message):
Build failed
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.24.2/share/cmake/Modules/CMakeIOSInstallCombined.cmake:299 (_ios_install_combined_build)
src/cmake_install.cmake:66 (ios_install_combined)
cmake_install.cmake:91 (include)
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution CMake\ PostBuild\ Rules /Users/naubry/xxx/NextVersion/publibs/catch2/_build/build/Catch2.build/Debug-iphoneos/install.build/Script-93426DA6A4AC2C2AC9CE883C.sh (in target 'install' from project 'Catch2')
(1 failure)
I have two questions now, that is why it seems to do for all architectures:
-- [iOS combined] Architectures (iphoneos): arm64 arm64e armv7 armv7s
-- [iOS combined] Architectures (iphonesimulator): arm64 arm64e i386 x86_64
-- [iOS combined] Architectures (iphonesimulator) after pruning: i386 x86_64
while I ask only for arm64 and x86_64?
{
"name": "release-iOS",
"inherits": ["release"],
"generator": "Xcode",
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "iOS",
"CMAKE_OSX_ARCHITECTURES": "arm64;x86_64",
"CMAKE_IOS_INSTALL_COMBINED": "YES",
"CMAKE_INSTALL_PREFIX": "${sourceParentDir}/_install/iOS/release"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "debug-iOS",
"inherits": ["debug", "release-iOS"],
"generator": "Xcode",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceParentDir}/_install/iOS/debug"
}
}
And the second question, why do I get a concurrency error when my python script first runs the configuration and then the compilation/installation?