def configureOptions(self, defines=""): """returns default configure options""" craftRoot = OsUtils.toUnixPath(CraftCore.standardDirs.craftRoot()) options = Arguments([defines]) options += [ "-DBUILD_TESTING={testing}".format( testing="ON" if self.buildTests else "OFF"), BuildSystemBase.configureOptions(self), f"-DCMAKE_INSTALL_PREFIX={craftRoot}", f"-DCMAKE_PREFIX_PATH={craftRoot}" ] if self.buildType() is not None: options.append(f"-DCMAKE_BUILD_TYPE={self.buildType()}") #if CraftCore.compiler.isGCC() and not CraftCore.compiler.isNative(): # options += " -DCMAKE_TOOLCHAIN_FILE=%s" % os.path.join(CraftStandardDirs.craftRoot(), "craft", "bin", "toolchains", "Toolchain-cross-mingw32-linux-%s.cmake" % CraftCore.compiler.architecture) if CraftCore.settings.getboolean("CMake", "KDE_L10N_AUTO_TRANSLATIONS", False): options.append("-DKDE_L10N_AUTO_TRANSLATIONS=ON") if CraftCore.compiler.isWindows: # people use InstallRequiredSystemLibraries.cmake wrong and unconditionally install the # msvc crt... options.append("-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON") elif CraftCore.compiler.isMacOS: options += [ f"-DKDE_INSTALL_BUNDLEDIR={OsUtils.toUnixPath(CraftCore.standardDirs.craftRoot())}/Applications/KDE", "-DAPPLE_SUPPRESS_X11_WARNING=ON" ] elif CraftCore.compiler.isLinux: # use the same lib dir on all distributions options += ["-DCMAKE_INSTALL_LIBDIR=lib"] if CraftCore.compiler.isWindows or CraftCore.compiler.isMacOS: options.append("-DKDE_INSTALL_USE_QT_SYS_PATHS=ON") if self.subinfo.options.buildTools: options += self.subinfo.options.configure.toolsDefine if self.subinfo.options.buildStatic and self.subinfo.options.configure.staticArgs: options += self.subinfo.options.configure.staticArgs if CraftCore.compiler.isIntel(): # this is needed because otherwise it'll detect the MSVC environment options += " -DCMAKE_CXX_COMPILER=\"%s\" " % os.path.join( os.getenv("BIN_ROOT"), os.getenv("ARCH_PATH"), "icl.exe").replace("\\", "/") options += " -DCMAKE_C_COMPILER=\"%s\" " % os.path.join( os.getenv("BIN_ROOT"), os.getenv("ARCH_PATH"), "icl.exe").replace("\\", "/") options += " -DCMAKE_LINKER=\"%s\" " % os.path.join( os.getenv("BIN_ROOT"), os.getenv("ARCH_PATH"), "xilink.exe").replace("\\", "/") options += ["-S", self.configureSourceDir()] return options
def makeOptions(self, args): """return options for make command line""" defines = Arguments() if self.subinfo.options.make.ignoreErrors: defines.append("-i") makeProgram = self.makeProgram if makeProgram == "ninja": if CraftCore.debug.verbose() > 0: defines.append("-v") else: if CraftCore.debug.verbose() > 0: defines += ["VERBOSE=1", "V=1"] if self.subinfo.options.make.supportsMultijob and makeProgram != "nmake": if makeProgram not in { "ninja", "jom" } or ("Compile", "Jobs") in CraftCore.settings: defines += [ "-j", str( CraftCore.settings.get("Compile", "Jobs", multiprocessing.cpu_count())) ] if args: defines.append(args) return defines
def configureOptions(self, defines=""): """returns default configure options""" craftRoot = OsUtils.toUnixPath(CraftCore.standardDirs.craftRoot()) options = Arguments([defines]) options += [ "-DBUILD_TESTING={testing}".format( testing="ON" if self.buildTests else "OFF"), "-DBUILD_SHARED_LIBS={shared}".format( shared="OFF" if self.subinfo.options.buildStatic else "ON"), BuildSystemBase.configureOptions(self), f"-DCMAKE_INSTALL_PREFIX={craftRoot}", f"-DCMAKE_PREFIX_PATH={craftRoot}" ] if self.buildType() is not None: options.append(f"-DCMAKE_BUILD_TYPE={self.buildType()}") #if CraftCore.compiler.isGCC() and not CraftCore.compiler.isNative(): # options += " -DCMAKE_TOOLCHAIN_FILE=%s" % os.path.join(CraftStandardDirs.craftRoot(), "craft", "bin", "toolchains", "Toolchain-cross-mingw32-linux-%s.cmake" % CraftCore.compiler.architecture) if CraftCore.settings.getboolean("CMake", "KDE_L10N_AUTO_TRANSLATIONS", False): options.append("-DKDE_L10N_AUTO_TRANSLATIONS=ON") if CraftCore.compiler.isWindows: # people use InstallRequiredSystemLibraries.cmake wrong and unconditionally install the # msvc crt... options.append("-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=ON") elif CraftCore.compiler.isMacOS: options += [ f"-DKDE_INSTALL_BUNDLEDIR={OsUtils.toUnixPath(CraftCore.standardDirs.craftRoot())}/Applications/KDE", "-DAPPLE_SUPPRESS_X11_WARNING=ON" ] elif CraftCore.compiler.isLinux: # use the same lib dir on all distributions options += ["-DCMAKE_INSTALL_LIBDIR=lib"] elif CraftCore.compiler.isAndroid: nativeToolingRoot = CraftCore.settings.get("General", "KF5HostToolingRoot", "/opt/nativetooling") nativeToolingCMake = CraftCore.settings.get( "General", "KF5HostToolingCMakePath", "/opt/nativetooling/lib/x86_64-linux-gnu/cmake/") additionalFindRoots = ";".join( filter(None, [ CraftCore.settings.get( "General", "AndroidAdditionalFindRootPath", ""), craftRoot ])) options += [ f"-DCMAKE_TOOLCHAIN_FILE={nativeToolingRoot}/share/ECM/toolchain/Android.cmake", f"-DECM_ADDITIONAL_FIND_ROOT_PATH='{additionalFindRoots}'", f"-DKF5_HOST_TOOLING={nativeToolingCMake}", f"-DANDROID_APK_OUTPUT_DIR={self.packageDestinationDir()}", f"-DANDROID_FASTLANE_METADATA_OUTPUT_DIR={self.packageDestinationDir()}" ] self.__autodetectAndroidApkTargets() if self.androidApkTargets != None and len( self.androidApkTargets) > 0: options += [ f"-DQTANDROID_EXPORTED_TARGET={';'.join(self.androidApkTargets)}", f"-DANDROID_APK_DIR={';'.join(self.androidApkDirs)}" ] if self.buildType() == "Release" or self.buildType( ) == "MinSizeRel": options += ["-DANDROIDDEPLOYQT_EXTRA_ARGS=--release"] if CraftCore.compiler.isWindows or CraftCore.compiler.isMacOS: options.append("-DKDE_INSTALL_USE_QT_SYS_PATHS=ON") if self.subinfo.options.buildTools: options += self.subinfo.options.configure.toolsDefine if self.subinfo.options.buildStatic and self.subinfo.options.configure.staticArgs: options += self.subinfo.options.configure.staticArgs if CraftCore.compiler.isIntel(): # this is needed because otherwise it'll detect the MSVC environment options += " -DCMAKE_CXX_COMPILER=\"%s\" " % os.path.join( os.getenv("BIN_ROOT"), os.getenv("ARCH_PATH"), "icl.exe").replace("\\", "/") options += " -DCMAKE_C_COMPILER=\"%s\" " % os.path.join( os.getenv("BIN_ROOT"), os.getenv("ARCH_PATH"), "icl.exe").replace("\\", "/") options += " -DCMAKE_LINKER=\"%s\" " % os.path.join( os.getenv("BIN_ROOT"), os.getenv("ARCH_PATH"), "xilink.exe").replace("\\", "/") options += ["-S", self.configureSourceDir()] return options