diff --git a/CMakeLists.txt b/CMakeLists.txt index a4ba5837d..3d5a8297f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -580,8 +580,13 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") endif() if(MAPSUPPORT) install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)") + # this is really weird. We first try a plugin that ended up in the Qt install prefix + # then we try one that's in that odd broken install location that the qmake file results in (that includes the QT_INSTALL_PREFIX after our INSTALL_ROOT + # and finally, for fat binaries, we copy the one that's in the 'logical' spot under the INSTALL_ROOT + # this should cover all cases and always get us the correct library install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") + install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") endif() # this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently # also, on M1 macOS systems macdeployqt throws a ton of (apparently harmless) errors. Warn the unsuspecting developer diff --git a/scripts/build.sh b/scripts/build.sh index 1e481a12c..2240760da 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -559,7 +559,8 @@ if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && ( [[ $QT_VE if [ "$PLATFORM" = Darwin ] && [[ $QT_VERSION == 6* ]]; then # since we are currently building QtLocation from source, we don't have a way to easily install # the private headers... so this is a bit of a hack to get those for googlemaps... - $QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" ../googlemaps.pro + # regardless of whether we do a fat build or not, let's do the 'native' build here + $QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" QMAKE_APPLE_DEVICE_ARCHS=$(arch) ../googlemaps.pro else $QMAKE "INCLUDEPATH=$INSTALL_ROOT/include" ../googlemaps.pro fi @@ -571,7 +572,21 @@ if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && ( [[ $QT_VE cat Makefile.bak | sed -e 's/std=c++1z/std=c++11/g ; s/-Wdate-time//' > Makefile fi make -j4 - make install + if [ "$PLATFORM" = Darwin ] && [[ $QT_VERSION == 6* ]] && [[ $ARCHS == *" "* ]] ; then + # we can't build fat binaries directly here, so let's do it in two steps + # above we build the 'native' binary, now build the other one + OTHERARCH=${ARCHS//$(arch)/} + OTHERARCH=${OTHERARCH// /} + mkdir -p ../build-$OTHERARCH + cd ../build-$OTHERARCH + $QMAKE "INCLUDEPATH=$INSTALL_ROOT/../qtlocation/build/include/QtLocation/6.3.0" QMAKE_APPLE_DEVICE_ARCHS=$OTHERARCH ../googlemaps.pro + make -j4 + # now combine them into one .dylib + mkdir -p "$INSTALL_ROOT"/plugins/geoservices + lipo -create ./libqtgeoservices_googlemaps.dylib ../build/libqtgeoservices_googlemaps.dylib -output "$INSTALL_ROOT"/plugins/geoservices/libqtgeoservices_googlemaps.dylib + else + make install + fi popd fi