144 lines
3.7 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-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
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):
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 += [
2021-06-04 12:41:54 +03:00
'-DCMAKE_PREFIX_PATH="$QT5DIR;$QT6DIR"',
2021-05-11 11:55:27 +03:00
'-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 += [
2021-06-04 16:52:54 +03:00
'-DCMAKE_PREFIX_PATH=%QT5DIR%;%QT6DIR%',
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',
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-06-04 12:41:54 +03:00
'-DCMAKE_PREFIX_PATH="$QT5DIR;$QT6DIR"',
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-06-04 12:41:54 +03:00
'-DCMAKE_FIND_ROOT_PATH="$QT5DIR;$QT6DIR"',
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"',
2021-04-27 16:23:40 +03:00
'-DANDROID_NATIVE_API_LEVEL=$ANDROID_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-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-05-11 11:55:27 +03:00
defines += [
2021-06-05 10:21:49 +03:00
'-DCMAKE_PREFIX_PATH="$QT6DIR"',
2021-04-11 10:09:18 +03:00
'-DANDROID_ABI=$ANDROID_ABI',
2021-06-05 10:21:49 +03:00
'-DCMAKE_FIND_ROOT_PATH="$QT6DIR"',
2021-04-19 23:52:39 +03:00
'-DANDROID_NDK=$ANDROID_NDK_ROOT/',
'-DANDROID_SDK=$ANDROID_SDK_ROOT/',
2021-04-11 10:09:18 +03:00
'-DSIGN_ALIES="quasarapp"',
2021-04-27 16:23:40 +03:00
'-DANDROID_NATIVE_API_LEVEL=$ANDROID_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)
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 += [
2021-06-04 12:41:54 +03:00
'-DCMAKE_PREFIX_PATH="$QT5DIR;$QT6DIR"',
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)