4
0
mirror of https://github.com/QuasarApp/QuasarAppCI.git synced 2025-04-28 14:44:36 +00:00

208 lines
5.5 KiB
Python
Raw Normal View History

2019-10-06 16:13:50 +03:00
# This Python file uses the following encoding: utf-8
2019-10-06 20:17:52 +03:00
from BuildBotLib.make import Make
2020-04-15 10:04:03 +03:00
from BuildBotLib.secretManager import SecretManager
2021-07-19 19:58:50 +03:00
from buildbot.plugins import steps, util
2021-03-31 18:29:12 +03:00
import multiprocessing
2022-01-21 15:34:36 +03:00
2019-10-06 16:13:50 +03:00
2019-10-06 20:17:52 +03:00
class CMake(Make):
2019-10-06 16:13:50 +03:00
2020-01-31 14:55:49 +03:00
def __init__(self, platform):
2020-04-15 10:04:03 +03:00
Make.__init__(self, platform)
2020-06-19 18:22:01 +03:00
# self.buildSystems = self.B_CMake
2019-10-06 16:13:50 +03:00
2020-04-15 10:04:03 +03:00
def makePrefix(self):
return "C"
2019-10-06 16:13:50 +03:00
def makeTarget(self, target, cxxFlags=None):
2022-01-21 18:20:45 +03:00
command = 'cmake --build cmake_build --config Release'
if len(target):
command += ' --target ' + target
else:
2022-02-22 18:36:52 +03:00
command += ' --parallel 4'
2021-03-31 18:29:12 +03:00
cxx = []
if cxxFlags is not None:
cxx += cxxFlags
2022-01-21 23:45:11 +03:00
if self.isiOS(''):
2022-01-21 23:45:11 +03:00
cxx += ['-allowProvisioningUpdates']
2022-01-21 23:45:11 +03:00
if len(cxx):
command += ' -- ' + ' '.join(cxx)
2022-01-21 18:20:45 +03:00
2021-03-31 18:29:12 +03:00
return command
2022-01-21 15:34:36 +03:00
def makeCommand(self, props):
2022-01-22 00:22:24 +03:00
return self.makeTarget('')
2022-01-21 15:34:36 +03:00
2020-04-15 10:04:03 +03:00
def linuxXmakeCmd(self, props):
2021-05-11 11:55:27 +03:00
defines = self.getDefinesList(props)
2019-10-06 16:13:50 +03:00
2021-05-11 11:55:27 +03:00
defines += [
'-DCMAKE_PREFIX_PATH=$QTDIR',
'-B cmake_build'
]
2020-10-08 15:35:25 +03:00
options = [
2021-05-11 11:55:27 +03:00
'cmake',
]
options += defines
return ' '.join(options)
def windowsXmakeCmd(self, props):
defines = self.getDefinesList(props)
defines += [
'-DCMAKE_PREFIX_PATH=%QTDIR%',
2021-04-01 18:33:25 +03:00
'-DBUILD_SHARED_LIBS=1',
2020-10-08 15:35:25 +03:00
'-DCMAKE_CXX_COMPILER=g++ -DCMAKE_C_COMPILER=gcc',
'-DQT_QMAKE_EXECUTABLE=%QTDIR%/bin/qmake.exe',
2021-03-31 18:51:41 +03:00
'"-GCodeBlocks - MinGW Makefiles"',
'-B cmake_build'
2020-10-08 15:35:25 +03:00
]
2021-05-11 11:55:27 +03:00
options = [
'cmake',
]
options += defines
2020-10-08 15:35:25 +03:00
return ' '.join(options)
2019-10-06 16:13:50 +03:00
2021-04-11 10:09:18 +03:00
def androidXmakeMultiAbiCmd(self, props):
2021-04-06 00:33:46 +03:00
file = self.home + "/buildBotSecret/secret.json"
secret = SecretManager(file, props)
2021-03-30 20:03:18 +03:00
toochainFile = 'build/cmake/android.toolchain.cmake'
2019-10-06 16:13:50 +03:00
2021-05-11 11:55:27 +03:00
defines = self.getDefinesList(props)
2021-05-19 11:45:09 +03:00
defines += secret.convertToCmakeDefines()
2021-05-11 11:55:27 +03:00
defines += [
2021-03-31 18:51:41 +03:00
'-DCMAKE_PREFIX_PATH=$QTDIR',
2021-03-30 20:44:29 +03:00
'-DQT_QMAKE_EXECUTABLE=$QTDIR/bin/qmake',
2021-03-31 18:29:12 +03:00
'-DANDROID_ABI=arm64-v8a',
2020-10-08 15:35:25 +03:00
'-DANDROID_BUILD_ABI_arm64-v8a=ON',
'-DANDROID_BUILD_ABI_armeabi-v7a=ON',
2021-03-30 21:07:31 +03:00
'-DCMAKE_FIND_ROOT_PATH=$QTDIR',
2021-04-19 23:52:39 +03:00
'-DANDROID_NDK=$ANDROID_NDK_ROOT/',
'-DANDROID_SDK=$ANDROID_SDK_ROOT/',
2020-10-12 16:18:13 +03:00
'-DSIGN_ALIES="quasarapp"',
2022-04-29 01:15:15 +03:00
'-DANDROID_NATIVE_API_LEVEL=$ANDROID_MIN_API_VERSION',
2021-04-27 16:33:55 +03:00
'-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/' + toochainFile,
2021-03-31 18:51:41 +03:00
'-B cmake_build'
2020-10-08 15:35:25 +03:00
]
2021-05-11 11:55:27 +03:00
options = [
'cmake -GNinja',
]
options += defines
2020-10-08 15:35:25 +03:00
return ' '.join(options)
2021-07-19 19:58:50 +03:00
def getQtMajorVersion(self, props):
qtDir = str(props.getProperty('QTDIR', ''))
2022-01-21 00:32:25 +03:00
if "5." in qtDir:
2021-07-19 19:27:58 +03:00
return "5"
2021-07-19 19:29:28 +03:00
elif "6." in qtDir:
2021-07-19 19:27:58 +03:00
return "6"
return "5"
2021-04-11 10:09:18 +03:00
def androidXmakeSinglAbiCmd(self, props):
file = self.home + "/buildBotSecret/secret.json"
secret = SecretManager(file, props)
toochainFile = 'build/cmake/android.toolchain.cmake'
2021-05-11 11:55:27 +03:00
defines = self.getDefinesList(props)
2021-05-19 11:45:09 +03:00
defines += secret.convertToCmakeDefines()
2021-07-19 20:04:43 +03:00
qtDir = "$QTDIR/lib/cmake/Qt" + self.getQtMajorVersion(props)
2021-07-19 19:27:58 +03:00
2021-05-11 11:55:27 +03:00
defines += [
2021-07-19 19:27:58 +03:00
'-DQT_DIR=' + qtDir,
2021-07-19 20:10:00 +03:00
'-DQT_HOST_PATH=$QTDIR/../gcc_64',
2021-07-23 09:48:37 +03:00
'-DQT_NO_GLOBAL_APK_TARGET_PART_OF_ALL=1',
2021-04-11 10:09:18 +03:00
'-DCMAKE_PREFIX_PATH=$QTDIR',
'-DQT_QMAKE_EXECUTABLE=$QTDIR/bin/qmake',
'-DANDROID_ABI=$ANDROID_ABI',
'-DCMAKE_FIND_ROOT_PATH=$QTDIR',
2021-04-19 23:52:39 +03:00
'-DANDROID_NDK=$ANDROID_NDK_ROOT/',
'-DANDROID_SDK=$ANDROID_SDK_ROOT/',
2021-07-23 09:48:37 +03:00
'-DANDROID_SDK_ROOT=$ANDROID_SDK_ROOT/',
2021-04-11 10:09:18 +03:00
'-DSIGN_ALIES="quasarapp"',
2022-04-29 01:15:15 +03:00
'-DANDROID_NATIVE_API_LEVEL=$ANDROID_MIN_API_VERSION',
2021-04-27 16:33:55 +03:00
'-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/' + toochainFile,
2021-04-11 10:09:18 +03:00
'-B cmake_build'
]
2021-05-11 11:55:27 +03:00
options = [
'cmake -GNinja',
]
options += defines
2021-04-11 10:09:18 +03:00
return ' '.join(options)
def androidXmakeCmd(self, props):
return self.androidXmakeSinglAbiCmd(props)
2022-01-21 15:07:30 +03:00
def iosXmakeCmd(self, props):
file = self.home + "/buildBotSecret/secret.json"
secret = SecretManager(file, props)
defines = self.getDefinesList(props)
defines += secret.convertToCmakeDefines()
defines += [
'-DCMAKE_PREFIX_PATH=$QTDIR',
'-DCMAKE_XCODE_ATTRIBUTE_DEVELOPMENT_TEAM=$XCODE_DEVELOPMENT_TEAM',
2022-01-23 21:25:07 +03:00
'-DDEPLOYMENT_TARGET=$DEPLOYMENT_TARGET',
2022-01-21 17:21:09 +03:00
'-DCMAKE_TOOLCHAIN_FILE=$CMAKE_TOOL_CHAIN_FILE',
2022-01-21 17:30:33 +03:00
'-DPLATFORM=OS64',
2022-01-21 15:07:30 +03:00
'-B cmake_build'
]
options = [
'cmake -G Xcode',
]
options += defines
return ' '.join(options)
2020-10-08 15:35:25 +03:00
def wasmXmakeCmd(self, props):
2021-05-11 11:55:27 +03:00
defines = self.getDefinesList(props)
defines += [
'-DCMAKE_PREFIX_PATH=$QTDIR',
2020-10-08 21:08:08 +03:00
'-DTARGET_PLATFORM_TOOLCHAIN=wasm32',
2021-03-31 18:51:41 +03:00
'-B cmake_build'
2020-10-08 15:35:25 +03:00
]
2021-05-11 11:55:27 +03:00
options = [
'cmake',
]
options += defines
2020-10-08 15:35:25 +03:00
return ' '.join(options)
2021-07-19 19:58:50 +03:00
def getFactory(self):
factory = super().getFactory()
factory.insertToBegin(
steps.SetPropertiesFromEnv(
2021-07-19 20:00:40 +03:00
variables=["QTDIR", "QTDIR"],
2021-07-19 20:10:00 +03:00
name='getting QTDIR',
description='getting QTDIR enviroment variable from worker',
2021-07-19 19:58:50 +03:00
)
)
return factory