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-03-31 18:29:12 +03:00
|
|
|
import multiprocessing
|
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
|
|
|
|
2020-04-15 10:04:03 +03:00
|
|
|
def mainCmd(self):
|
2021-03-31 20:27:52 +03:00
|
|
|
options = [
|
2020-04-15 10:04:03 +03:00
|
|
|
'cmake',
|
2021-03-31 20:10:14 +03:00
|
|
|
"-B cmake_build"
|
2019-10-06 20:17:52 +03:00
|
|
|
]
|
2019-10-06 16:13:50 +03:00
|
|
|
|
2021-03-31 20:27:52 +03:00
|
|
|
return ' '.join(options)
|
2019-10-06 16:13:50 +03:00
|
|
|
|
2021-03-31 18:29:12 +03:00
|
|
|
def make(self):
|
2021-03-31 18:51:41 +03:00
|
|
|
return 'cmake --build cmake_build --target all'
|
2021-03-31 18:29:12 +03:00
|
|
|
|
|
|
|
def makeTarget(self, target):
|
2021-03-31 18:51:41 +03:00
|
|
|
return 'cmake --build cmake_build --target ' + target
|
2021-03-31 18:29:12 +03:00
|
|
|
|
2021-03-31 18:32:27 +03:00
|
|
|
def makeCommand(self, props):
|
2021-03-31 18:37:37 +03:00
|
|
|
command = self.make()
|
2021-03-31 18:29:12 +03:00
|
|
|
|
|
|
|
cpus = multiprocessing.cpu_count()
|
|
|
|
|
|
|
|
if cpus:
|
2021-03-31 18:40:39 +03:00
|
|
|
command += ' --parallel ' + str(cpus)
|
2021-03-31 18:29:12 +03:00
|
|
|
|
|
|
|
return command
|
|
|
|
|
2020-04-15 10:04:03 +03:00
|
|
|
def linuxXmakeCmd(self, props):
|
|
|
|
return self.mainCmd()
|
2019-10-06 16:13:50 +03:00
|
|
|
|
2020-04-15 10:04:03 +03:00
|
|
|
def windowsXmakeCmd(self, props):
|
2020-10-08 15:35:25 +03:00
|
|
|
|
|
|
|
options = [
|
|
|
|
'cmake -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
|
|
|
]
|
|
|
|
|
|
|
|
return ' '.join(options)
|
2019-10-06 16:13:50 +03:00
|
|
|
|
2019-10-06 20:17:52 +03:00
|
|
|
def androidXmakeCmd(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
|
|
|
|
2020-10-08 15:35:25 +03:00
|
|
|
options = [
|
2021-03-31 18:51:41 +03:00
|
|
|
'cmake -GNinja',
|
|
|
|
'-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-03-30 19:41:10 +03:00
|
|
|
'-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_ROOT/' + toochainFile,
|
2020-10-12 16:29:54 +03:00
|
|
|
'-DSIGN_PATH="' + secret.getValue('SIGPATH') + '"',
|
2020-10-12 16:18:13 +03:00
|
|
|
'-DSIGN_ALIES="quasarapp"',
|
|
|
|
'-DSIGN_STORE_PASSWORD="' + secret.getValue('SIGPASS') + '"',
|
2021-03-31 18:51:41 +03:00
|
|
|
'-B cmake_build'
|
2020-10-08 15:35:25 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
return ' '.join(options)
|
|
|
|
|
|
|
|
def wasmXmakeCmd(self, props):
|
|
|
|
options = [
|
|
|
|
'cmake -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
|
|
|
]
|
|
|
|
|
|
|
|
return ' '.join(options)
|