mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 11:00:44 -06:00
build: Use cmake for macOS builds
This is a first attempt to use cmake instead of qmake for building our nightlies on macOS. We are using cmake on most platforms and it would be easier for us to only maintain one build system. Because support for qmake is dropped in Qt6 anyway it makes sense to transition to only using cmake in the near-ish future. Please note that this commit has been assembled in a mostly blind fashion. I would be surprised if this worked without further tweaking.
This commit is contained in:
@@ -69,6 +69,14 @@ if(WIN32 AND MSVC)
|
||||
set(CMAKE_PREFIX_PATH "${QT5_PATH};${SQLITE3_PATH}")
|
||||
endif()
|
||||
|
||||
# See https://github.com/Homebrew/homebrew-core/issues/8392#issuecomment-325226494
|
||||
if(APPLE AND EXISTS /usr/local/opt/qt5)
|
||||
# Homebrew installs Qt5 (up to at least 5.9.1) in
|
||||
# /usr/local/qt5, ensure it can be found by CMake since
|
||||
# it is not in the default /usr/local prefix.
|
||||
list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt5")
|
||||
endif()
|
||||
|
||||
find_package(Qt5 REQUIRED COMPONENTS Concurrent Gui LinguistTools Network PrintSupport Test Widgets Xml)
|
||||
|
||||
if(NOT FORCE_INTERNAL_QSCINTILLA)
|
||||
@@ -418,14 +426,23 @@ else()
|
||||
include_directories(${QSCINTILLA_DIR})
|
||||
endif()
|
||||
|
||||
add_executable(${PROJECT_NAME}
|
||||
if(NOT APPLE)
|
||||
add_executable(${PROJECT_NAME}
|
||||
${SQLB_HDR}
|
||||
${SQLB_SRC}
|
||||
${SQLB_FORM_HDR}
|
||||
${SQLB_MOC}
|
||||
${SQLB_RESOURCES_RCC}
|
||||
${SQLB_MISC})
|
||||
else()
|
||||
add_executable(${PROJECT_NAME} MACOSX_BUNDLE
|
||||
${SQLB_HDR}
|
||||
${SQLB_SRC}
|
||||
${SQLB_FORM_HDR}
|
||||
${SQLB_MOC}
|
||||
${SQLB_RESOURCES_RCC}
|
||||
${SQLB_MISC})
|
||||
|
||||
endif()
|
||||
|
||||
# Warnings
|
||||
if (ALL_WARNINGS AND CMAKE_COMPILER_IS_GNUCC)
|
||||
@@ -495,7 +512,7 @@ if(WIN32 AND MSVC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT WIN32)
|
||||
if(NOT WIN32 AND NOT APPLE)
|
||||
install(TARGETS ${PROJECT_NAME}
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib)
|
||||
@@ -588,3 +605,10 @@ if(WIN32 AND MSVC)
|
||||
distri/winlaunch.bat
|
||||
DESTINATION "/")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
BUNDLE True
|
||||
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/src/app.plist
|
||||
)
|
||||
endif()
|
||||
|
||||
@@ -13,7 +13,7 @@ LRELEASE="$HOME/Qt/${QTVER}/clang_64/bin/lrelease"
|
||||
LUPDATE="$HOME/Qt/${QTVER}/clang_64/bin/lupdate"
|
||||
MACDEPLOYQT="$HOME/Qt/${QTVER}/clang_64/bin/macdeployqt"
|
||||
PATH="$PATH:/usr/local/bin:/usr/sbin"
|
||||
QMAKE="$HOME/Qt/${QTVER}/clang_64/bin/qmake"
|
||||
CMAKE="/usr/local/bin/cmake"
|
||||
|
||||
# Add the sensitive values we don't want to store in this script file
|
||||
source ~/.db4s_secure
|
||||
@@ -85,13 +85,16 @@ $LRELEASE src/src.pro >>$LOG 2>&1
|
||||
|
||||
# Build and package standard sqlitebrowser nightly
|
||||
echo Build and package standard sqlitebrowser nightly >>$LOG 2>&1
|
||||
mkdir build >>$LOG 2>&1
|
||||
cd build >>$LOG 2>&1
|
||||
if [ "${BUILD_TYPE}" = "debug" ]; then
|
||||
$QMAKE sqlitebrowser.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+="c++14" >>$LOG 2>&1
|
||||
$CMAKE -DCMAKE_BUILD_TYPE=Debug .. >>$LOG 2>&1
|
||||
else
|
||||
$QMAKE sqlitebrowser.pro -r -spec macx-clang CONFIG+=x86_64 CONFIG+="c++14" >>$LOG 2>&1
|
||||
$CMAKE .. >>$LOG 2>&1
|
||||
fi
|
||||
make -j3 >>$LOG 2>&1
|
||||
make -j3 >>$LOG 2>&1 # Seems to need a 2nd time now, due to language files needing initialisation or something
|
||||
cd .. >>$LOG 2>&1
|
||||
cp -R build/sqlitebrowser.app src/DB\ Browser\ for\ SQLite.app >>$LOG 2>&1
|
||||
|
||||
# Include the depencencies in the .app bundle
|
||||
$MACDEPLOYQT src/DB\ Browser\ for\ SQLite.app -verbose=2 -sign-for-notarization="${DEV_ID}">>$LOG 2>&1
|
||||
@@ -163,13 +166,16 @@ $LRELEASE src/src.pro >>$LOG 2>&1
|
||||
|
||||
# Build and package sqlitebrowser with SQLCipher support
|
||||
echo Build and package sqlitebrowser with SQLCipher support >>$LOG 2>&1
|
||||
mkdir build >>$LOG 2>&1
|
||||
cd build >>$LOG 2>&1
|
||||
if [ "${BUILD_TYPE}" = "debug" ]; then
|
||||
$QMAKE sqlitebrowser.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=sqlcipher CONFIG+="c++14" >>$LOG 2>&1
|
||||
$CMAKE -DCMAKE_BUILD_TYPE=Debug -Dsqlcipher=1 .. >>$LOG 2>&1
|
||||
else
|
||||
$QMAKE sqlitebrowser.pro -r -spec macx-clang CONFIG+=x86_64 CONFIG+=sqlcipher CONFIG+="c++14" >>$LOG 2>&1
|
||||
$CMAKE -Dsqlcipher=1 .. >>$LOG 2>&1
|
||||
fi
|
||||
make -j3 >>$LOG 2>&1
|
||||
make -j3 >>$LOG 2>&1 # Seems to need a 2nd time now, due to language files needing initialisation or something
|
||||
cd .. >>$LOG 2>&1
|
||||
cp -R build/sqlitebrowser.app src/DB\ Browser\ for\ SQLite.app >>$LOG 2>&1
|
||||
|
||||
# Unlock the local security keychain, so signing can be done
|
||||
security unlock-keychain -p "${KEYCHAIN_PASSWORD}" "${HOME}/Library/Keychains/login.keychain"
|
||||
|
||||
Reference in New Issue
Block a user