diff --git a/CMakeLists.txt b/CMakeLists.txt index feec9a90dac27709a22b385913c863c78136883d..2b9737cc9885c4bda03c5cd1bced0182d9d3d0d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,7 +96,7 @@ endif() bb_enable_warnings( msvc warnings-as-errors "/wd4996" ) # enable sse4.1 build for all source files for gcc and clang -if( UNIX ) +if( UNIX OR MINGW ) add_compile_options( "-msse4.1" ) endif() diff --git a/Makefile b/Makefile index b1d03c555c91bc07e2c55fbdd1ac97abcc5a91aa..d737cd85630e7d19638cf0f2324ca23b86571eb6 100644 --- a/Makefile +++ b/Makefile @@ -20,16 +20,28 @@ TARGETS := CommonLib DecoderAnalyserApp DecoderAnalyserLib DecoderApp DecoderLib TARGETS += EncoderApp EncoderLib Utilities SEIRemovalApp ifeq ($(OS),Windows_NT) - PY := $(wildcard c:/windows/py.*) - ifeq ($(PY),) - PYTHON_LAUNCHER := python + ifneq ($(MSYSTEM),) + # MSYS runtime environment + UNAME_S := $(shell uname -s) + PYTHON_LAUNCHER := python3 + BUILD_CMD := $(PYTHON_LAUNCHER) $(BUILD_SCRIPT) else - PYTHON_LAUNCHER := $(notdir $(PY)) + UNAME_S := Windows + PY := $(wildcard c:/windows/py.*) + ifeq ($(PY),) + PYTHON_LAUNCHER := python + else + PYTHON_LAUNCHER := $(notdir $(PY)) + endif + # If a plain cmake.py is used, the exit codes won't arrive in make; i.e. build failures are reported as success by make. + BUILD_CMD := $(PYTHON_LAUNCHER) $(BUILD_SCRIPT) + ifeq ($(toolset),gcc) + g := mgwmake + endif endif - # If a plain cmake.py is used, the exit codes won't arrive in make; i.e. build failures are reported as success by make. - BUILD_SCRIPT := $(PYTHON_LAUNCHER) $(CURDIR)/cmake/CMakeBuild/bin/cmake.py else UNAME_S := $(shell uname -s) + BUILD_CMD := $(BUILD_SCRIPT) ifeq ($(UNAME_S),Linux) endif ifeq ($(UNAME_S),Darwin) @@ -48,7 +60,12 @@ CONFIG_OPTIONS += -g $(g) endif ifneq ($(toolset),) -CONFIG_OPTIONS += toolset=$(toolset) + # aarch64 and mingw are two shortcuts to simplify toolset specification. + ifeq ($(toolset),mingw) + CONFIG_OPTIONS += toolset=x86_64-w64-mingw32-gcc-posix + else + CONFIG_OPTIONS += toolset=$(toolset) + endif endif ifneq ($(address-model),) @@ -82,33 +99,33 @@ endif BUILD_OPTIONS := $(CONFIG_OPTIONS) -b debug: - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug all: - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo release: - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release relwithdebinfo: - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo clean: # clean is equal to realclean to ensure that CMake options are reset $(RM) -rf bin build lib -# $(BUILD_SCRIPT) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo --target clean +# $(BUILD_CMD) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo --target clean clean-r: - $(BUILD_SCRIPT) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release --target clean + $(BUILD_CMD) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release --target clean clean-d: - $(BUILD_SCRIPT) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug --target clean + $(BUILD_CMD) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug --target clean clean-p: - $(BUILD_SCRIPT) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo --target clean + $(BUILD_CMD) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo --target clean configure: - $(BUILD_SCRIPT) $(CONFIG_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo + $(BUILD_CMD) $(CONFIG_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo # # project specific targets @@ -126,28 +143,28 @@ TARGETS_DEBUG_CLEAN_FIRST := $(foreach t,$(TARGETS),$(t)-cd) TARGETS_RELWITHDEBINFO_CLEAN_FIRST := $(foreach t,$(TARGETS),$(t)-cp) $(TARGETS_ALL): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo --target $(patsubst %-a,%,$@) + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo --target $(patsubst %-a,%,$@) $(TARGETS_ALL_CLEAN_FIRST): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo --clean-first --target $(patsubst %-ca,%,$@) + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug,release,relwithdebinfo --clean-first --target $(patsubst %-ca,%,$@) $(TARGETS_RELEASE): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release --target $(patsubst %-r,%,$@) + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release --target $(patsubst %-r,%,$@) $(TARGETS_RELEASE_CLEAN_FIRST): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release --clean-first --target $(patsubst %-cr,%,$@) + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=release --clean-first --target $(patsubst %-cr,%,$@) $(TARGETS_DEBUG): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug --target $(patsubst %-d,%,$@) + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug --target $(patsubst %-d,%,$@) $(TARGETS_DEBUG_CLEAN_FIRST): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug --target $(patsubst %-cd,%,$@) --clean-first + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=debug --target $(patsubst %-cd,%,$@) --clean-first $(TARGETS_RELWITHDEBINFO): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo --target $(patsubst %-p,%,$@) + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo --target $(patsubst %-p,%,$@) $(TARGETS_RELWITHDEBINFO_CLEAN_FIRST): - $(BUILD_SCRIPT) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo --target $(patsubst %-cp,%,$@) --clean-first + $(BUILD_CMD) $(BUILD_JOBS) $(BUILD_OPTIONS) $(CMAKE_OPTIONS) variant=relwithdebinfo --target $(patsubst %-cp,%,$@) --clean-first realclean: $(RM) -rf bin build lib diff --git a/README.txt b/README.txt index c0b48bad6721f847a49c047672e8eff76629bcf9..8c8f02715a0dac363cb2721636ae51c789eb3184 100644 --- a/README.txt +++ b/README.txt @@ -1,10 +1,24 @@ -NextSoftware build howto: +NextSoftware/VVCSoftware_VTM build howto: The software uses cmake to create the needed build files. Download cmake: http://www.cmake.org/ and install it. -Usage: +=================== Windows only ======================= +Python and gnuwin32 are not mandatory, but they simplifiy the build process for the user. +python: https://www.python.org/downloads/release/python-371/ +gnuwin32: https://sourceforge.net/projects/getgnuwin32/files/getgnuwin32/0.6.30/GetGnuWin32-0.6.3.exe/download +To use MinGW, install MSYS2: +http://repo.msys2.org/distrib/msys2-x86_64-latest.exe + +Installation instructions: +https://www.msys2.org/ + +and install the needed toolchains. +pacman -S --needed base-devel mingw-w64-i686-toolchain mingw-w64-x86_64-toolchain git subversion mingw-w64-i686-cmake mingw-w64-x86_64-cmake +======================================================== + +========= Build instructions for plain cmake =========== Open a command prompt on your system and change into the root directory of this project (location of README.txt). @@ -29,3 +43,23 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug MACOSX Xcode sample: cd build cmake .. -G "Xcode" +======================================================== + +============= Build instructions for make ============== +remark: +If you installed python and gnuwin32 on Windows operating systems, +you will be able to use make. + +Open a command prompt on your system and change into the root directory +of this project (location of README.txt). + +to use the default system compiler simply call: +make all + +Using MSYS2 and MinGW: +Open an MSYS MinGW 64-Bit terminal and change into the root directory +of this project (location of README.txt). + +Call: +make all toolset=gcc +======================================================== diff --git a/cmake/CMakeBuild/bin/boost_install.py b/cmake/CMakeBuild/bin/boost_install.py deleted file mode 100755 index 5e150020f4a8241eef890ef7c576851ba95b34ea..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/boost_install.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -# boost_install.py -# -import pyhhi.build.common.util -import pyhhi.cmbuild.app.boost - -app = pyhhi.cmbuild.app.boost.BoostInstallApp() -pyhhi.build.common.util.exec_main_default_try(app) diff --git a/cmake/CMakeBuild/bin/cmake.py b/cmake/CMakeBuild/bin/cmake.py index d20c7148f96b290368254200df96bb5f2b8a0493..f913176873dbed9c014ebe2b9735ee0357ca3b7a 100755 --- a/cmake/CMakeBuild/bin/cmake.py +++ b/cmake/CMakeBuild/bin/cmake.py @@ -1,11 +1,11 @@ -#!/usr/bin/env python +#!/usr/bin/python # # cmake.py # import pyhhi.build.common.util -import pyhhi.cmbuild.app.cmk +import pyhhi.build.app.cmk -app = pyhhi.cmbuild.app.cmk.CMakeLauncherApp() +app = pyhhi.build.app.cmk.CMakeLauncherApp() pyhhi.build.common.util.exec_main_default_try(app) diff --git a/cmake/CMakeBuild/bin/cmake_docutil.py b/cmake/CMakeBuild/bin/cmake_docutil.py new file mode 100755 index 0000000000000000000000000000000000000000..fce08866ab83bbd7410f4a2c43e3cbea905390f5 --- /dev/null +++ b/cmake/CMakeBuild/bin/cmake_docutil.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +# +# cmake_docutil.py +# + +import pyhhi.build.app.cmkdocapp +import pyhhi.build.common.util + + +app = pyhhi.build.app.cmkdocapp.CMakeDocUtilApp() +pyhhi.build.common.util.exec_main_default_try(app) diff --git a/cmake/CMakeBuild/bin/cmakebuild_update.py b/cmake/CMakeBuild/bin/cmakebuild_update.py new file mode 100755 index 0000000000000000000000000000000000000000..3e3a9119bbcf9f8bac2b28b39ed643886e2cd3a5 --- /dev/null +++ b/cmake/CMakeBuild/bin/cmakebuild_update.py @@ -0,0 +1,11 @@ +#!/usr/bin/python +# +# cmakebuild_update.py +# + +import pyhhi.build.app.cmbldup +import pyhhi.build.common.util + + +app = pyhhi.build.app.cmbldup.CMakeBuildUpdateApp() +pyhhi.build.common.util.exec_main_default_try(app) diff --git a/cmake/CMakeBuild/bin/create_ndk_toolchain.py b/cmake/CMakeBuild/bin/create_ndk_toolchain.py deleted file mode 100755 index 1c6faf519b60ec110740f1655188e63833744d16..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/create_ndk_toolchain.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python -# -# create_ndk_toolchain.py -# -import pyhhi.build.common.util -import pyhhi.cmbuild.app.androidapp - -app = pyhhi.cmbuild.app.androidapp.CreateNdkToolchainApp() -pyhhi.build.common.util.exec_main_default_try(app) diff --git a/cmake/CMakeBuild/bin/pyhhi/__init__.py b/cmake/CMakeBuild/bin/pyhhi/__init__.py old mode 100644 new mode 100755 diff --git a/cmake/CMakeBuild/bin/pyhhi/build/__init__.py b/cmake/CMakeBuild/bin/pyhhi/build/__init__.py old mode 100644 new mode 100755 diff --git a/cmake/CMakeBuild/bin/pyhhi/build/test/__init__.py b/cmake/CMakeBuild/bin/pyhhi/build/app/__init__.py old mode 100644 new mode 100755 similarity index 100% rename from cmake/CMakeBuild/bin/pyhhi/build/test/__init__.py rename to cmake/CMakeBuild/bin/pyhhi/build/app/__init__.py diff --git a/cmake/CMakeBuild/bin/pyhhi/build/app/cmbldup.py b/cmake/CMakeBuild/bin/pyhhi/build/app/cmbldup.py new file mode 100755 index 0000000000000000000000000000000000000000..9626e1a0ca1d27eb1f2057149e9d2624ee3fd9df --- /dev/null +++ b/cmake/CMakeBuild/bin/pyhhi/build/app/cmbldup.py @@ -0,0 +1,391 @@ + +from __future__ import print_function + +import argparse +import logging +import os +import re +import subprocess +import sys + +import pyhhi.build.common.util as util +import pyhhi.build.common.ver as ver +import pyhhi.build.vcsutil as vcsutil + +from pyhhi.build.common.system import SystemInfo +from pyhhi.build.common.error import InvalidInputParameterError + + +class CMakeBuildUpdateAppParams(object): + + def __init__(self): + self.top_dir = None + self.update_prepare = True + self.cmakebuild_repo = 'git@vigitlab.fe.hhi.de:git/CMakeBuildCore.git' + # A CMakeBuild tag of None means latest tag. + self.cmakebuild_tag = None + + +class CMakeBuildUpdateApp(object): + + def __init__(self): + self._logger = logging.getLogger(__name__) + self._sys_info = SystemInfo() + self._prog_name = os.path.basename(sys.argv[0]) + self._prog_name_full = os.path.normpath(os.path.abspath(sys.argv[0])) + self._list_summary = True + self._summary_lines = [] + self._git_helper = vcsutil.GitHelper() + self._git_executable = self._git_helper.get_git_executable() + + # List of python modules this script depends on. + self._py_mod_list = ['pyhhi.build.app.cmbldup', + 'pyhhi.build.vcsutil', + 'pyhhi.build.common.cmbldver', + 'pyhhi.build.common.error', + 'pyhhi.build.common.system', + 'pyhhi.build.common.util', + 'pyhhi.build.common.ver'] + + self._usage = """ +%(prog)s [options] [top_dir] + +%(prog)s updates a CMakeBuild Git subtree embedded inside a Git standard workspace. +The update procedure requires a clean Git working directory. Unfinished work must be +saved somehow; e.g. use git stash .. or anything else. + +The optional positional argument allows you to update an existing Git workspace out-of-tree. +""" + + self._epilog = """ +""" + + def __call__(self, argv=None): + if argv is None: + self.main(sys.argv[1:]) + else: + self.main(argv) + + def main(self, argv): + params = self._parse_command_line(argv) + self.cmakebuild_update(params) + + def cmakebuild_update(self, params): + + initial_work_dir = os.getcwd() + # (Re)create GitHelper in case the log level has been changed. + self._git_helper = vcsutil.GitHelper() + params = self._check_params(params) + if params.top_dir is None: + params.top_dir = util.get_top_dir() + self._summary_lines = [] + if params.update_prepare: + print("{}: preparing CMakeBuild update ...".format(self._prog_name)) + + cmakebuild_version_current = self._get_current_cmakebuild_version(params.top_dir) + if cmakebuild_version_current is None: + print("{}: no existing CMakeBuild version found.".format(params.top_dir)) + + if not self._is_workspace_clean(params.top_dir): + return + + if params.cmakebuild_tag is None: + cmakebuild_tag = self._git_helper.get_latest_cmakebuild_tag(params.cmakebuild_repo) + + if cmakebuild_version_current and (ver.version_compare(cmakebuild_version_current, ver.version_tuple_from_str(cmakebuild_tag)) == 0): + print("{}: CMakeBuild is up to date, nothing to be done.".format(params.top_dir)) + return + else: + # Validate CMakeBuild tag + cmakebuild_tags = self._git_helper.get_remote_tags(params.cmakebuild_repo) + if params.cmakebuild_tag not in cmakebuild_tags: + raise InvalidInputParameterError("requested tag {0} does not exists in {1}.".format(params.cmakebuild_tag, params.cmakebuild_repo)) + cmakebuild_tag = params.cmakebuild_tag + if cmakebuild_version_current and (ver.version_compare(ver.version_tuple_from_str(cmakebuild_tag), cmakebuild_version_current) <= 0): + print("{}: CMakeBuild is up to date, nothing to be done.".format(params.top_dir)) + return + + install_dir = os.path.join(params.top_dir, 'build', 'cmakebuild_update') + self._install_self(install_dir) + + update_script = os.path.join(install_dir, self._prog_name) + # Prepare execv argument vector to call self with different arguments using the current python executable. + if self._sys_info.is_windows(): + child_args = [self._sys_info.get_short_path(self._sys_info.get_python_executable())] + else: + child_args = [self._sys_info.get_python_executable()] + child_args.extend([update_script, '--update']) + if cmakebuild_tag: + child_args.extend(['-t', cmakebuild_tag]) + if params.cmakebuild_repo: + child_args.extend(['--cmakebuild-repo', params.cmakebuild_repo]) + + # Add currrent log option to child_args[] to propagate the current log option to the child process. + log_level = self._logger.getEffectiveLevel() + log_level_str = None + if log_level == logging.DEBUG: + log_level_str = 'debug' + elif log_level == logging.INFO: + log_level_str = 'info' + elif log_level == logging.WARNING: + log_level_str = 'warning' + elif log_level == logging.ERROR: + log_level_str = 'error' + elif log_level == logging.CRITICAL: + log_level_str = 'critical' + if log_level_str is not None: + child_args.append('--log={}'.format(log_level_str)) + + child_args.append(params.top_dir) + os.chdir(params.top_dir) + if self._sys_info.is_windows(): + # Unfortunately, there are issues with os.execv() on Windows and therefore a subprocess call is used instead. + util.subproc_check_call_flushed(child_args) + else: + # execv() is preferred as the child is likely to remove python files just being executed + # by the current python process. + os.execv(child_args[0], child_args) + else: + try: + print("{}: updating CMakeBuild in {} to {}".format(self._prog_name, params.top_dir, params.cmakebuild_tag)) + os.chdir(params.top_dir) + if not self._is_workspace_clean(): + return + + self._append_item_to_summary("Git workspace:", params.top_dir) + if self._list_summary: + cmakebuild_version_current = self._get_current_cmakebuild_version(params.top_dir) + if cmakebuild_version_current is not None: + self._append_item_to_summary("Current CMakeBuild version:", "{}-{:d}".format(ver.version_tuple_to_str(cmakebuild_version_current[:3]), cmakebuild_version_current[-1])) + self._append_item_to_summary("New CMakeBuild version:", params.cmakebuild_tag) + + # Inventory of CMakeBuild to remember existing directories to be removed later on. + (git_cmakebuild_dirs, cmakebuild_dirs) = self._get_git_cmakebuild_dirs(params.top_dir) + if params.cmakebuild_tag in git_cmakebuild_dirs: + git_cmakebuild_dirs.remove(params.cmakebuild_tag) + if params.cmakebuild_tag in cmakebuild_dirs: + cmakebuild_dirs.remove(params.cmakebuild_tag) + # print("found existing Git CMakeBuild subdirs:", git_cmakebuild_dirs) + # print("found existing CMakeBuild subdirs:", cmakebuild_dirs) + + # Add new CMakeBuild subtree + self._add_cmakebuild_to_git_repo(params.cmakebuild_tag, params.cmakebuild_repo) + + # Update .svnimportprops in case is does exist. + svnimportprops_file = os.path.join(params.top_dir, '.svnimportprops') + svnimportprops_modified = self._update_svnimportprops(svnimportprops_file, params.cmakebuild_tag) + + for dname in git_cmakebuild_dirs: + git_argv = [self._git_executable, 'rm', '-r', os.path.join('CMakeBuild', dname)] + util.subproc_check_call_flushed(git_argv) + if svnimportprops_modified or git_cmakebuild_dirs: + # Need a git commit if '.svnimportprops' has been updated or git rm -r has been launched. + git_comment = [] + if git_cmakebuild_dirs: + git_comment.append("rm -r CMakeBuild/{}".format(','.join(git_cmakebuild_dirs))) + if svnimportprops_modified: + git_comment.append("modifying {}".format('.svnimportprops')) + git_argv = [self._git_executable, 'commit', '-am', '{}: {}'.format(self._prog_name, ', '.join(git_comment))] + util.subproc_check_call_flushed(git_argv) + + # Check again to get rid of any python cache files + cmakebuild_dirs.extend(git_cmakebuild_dirs) + for dname in cmakebuild_dirs: + dname_path = os.path.join(params.top_dir, 'CMakeBuild', dname) + if os.path.exists(dname_path): + util.rmtree(dname_path) + + print("{}: finished updating CMakeBuild in {} to {}".format(self._prog_name, params.top_dir, params.cmakebuild_tag)) + + if self._list_summary: + print("\n{0:^80}".format("Summary")) + print("{0:^80}".format("=======")) + for line in self._summary_lines: + print(line) + finally: + pass + os.chdir(initial_work_dir) + + def _parse_command_line(self, argv): + + params = CMakeBuildUpdateAppParams() + + parser = argparse.ArgumentParser(usage=self._usage, epilog=self._epilog, formatter_class=argparse.RawDescriptionHelpFormatter) + + parser.add_argument("top_dir", action="store", nargs='?', default=None, + help="specifies a Git workspace to work on. By default the scripts installation path will be used to deduce the workspace.") + + util.app_args_add_log_level(parser) + + parser.add_argument("-t", "--tag", action="store", dest="cmakebuild_tag", metavar="TAG", + help="specifies a CMakeBuild tag to be used. If omitted the latest release tag will be used.") + + parser.add_argument("--cmakebuild-repo", action="store", dest="cmakebuild_repo", metavar="REPO", default=params.cmakebuild_repo, + help="specifies an alternative CMakeBuild repository overriding %(default)s." ) + + parser.add_argument("--update", action="store_true", dest="update", default=False, + help="execute cmakebuild update, internal option reserved for the os.execv() machinery.") + + args = parser.parse_args(argv) + + # configure the python logger + util.app_configure_logging(args.log_level) + + if args.top_dir: + params.top_dir = os.path.normpath(os.path.abspath(args.top_dir)) + if args.cmakebuild_tag: + params.cmakebuild_tag = args.cmakebuild_tag + if args.cmakebuild_repo: + params.cmakebuild_repo = args.cmakebuild_repo + if args.update: + params.update_prepare = False + + return params + + def _check_params(self, params): + params.cmakebuild_repo = self._check_git_url(params.cmakebuild_repo) + if params.top_dir: + if not os.path.exists(params.top_dir): + raise InvalidInputParameterError("Git workspace {} does not exist.".format(params.top_dir)) + if not os.path.exists(os.path.join(params.top_dir, '.git')): + raise InvalidInputParameterError("Workspace {} does not seem to be a Git workspace.".format(params.top_dir)) + return params + + def _check_git_url(self, git_url): + vcs_url = vcsutil.VcsUrl(git_url) + proto = vcs_url.get_protocol() + if proto in ['ssh', 'https']: + # Normalize a remote Git URL to end with .git even if specified without the extension. + res_path = vcs_url.get_resource_path() + if not res_path.endswith('.git'): + vcs_url.set_resource_path("{}.git".format(res_path)) + else: + raise InvalidInputParameterError("Git URL {0} is not supported yet.".format(git_url)) + # Normalize all URLs. + git_url = str(vcs_url) + self._logger.debug("returning url={0}".format(git_url)) + return git_url + + def _install_self(self, install_dir): + script_installer = self._create_script_installer() + # print("py_mod_list:", self._py_mod_list) + script_installer.install_script(install_dir, self._prog_name_full, self._py_mod_list) + + def _create_script_installer(self): + import pyhhi.build.common.bldtools + script_installer = pyhhi.build.common.bldtools.BuildScriptInstaller(verbose=True) + return script_installer + + def _get_current_cmakebuild_version(self, top_dir): + assert os.path.exists(top_dir) + cmakebuild_top_dir = os.path.join(top_dir, 'CMakeBuild') + if not os.path.exists(cmakebuild_top_dir): + return None + re_version_dir = re.compile(r'^\d+[0-9.]+-\d+$') + version_list = [] + for fname in os.listdir(cmakebuild_top_dir): + if os.path.isdir(os.path.join(cmakebuild_top_dir, fname)): + if re_version_dir.match(fname) and os.path.exists(os.path.join(cmakebuild_top_dir, fname, 'CMakeBuild', 'bin', 'cmake.py')): + version_list.append(ver.version_tuple_from_str(fname)) + if not version_list: + return None + if len(version_list) > 1: + raise InvalidInputParameterError("Workspace {} contains multiple CMakeBuild versions, please update manually.".format(top_dir)) + self._logger.debug("found CMakeBuild {} in {}".format(ver.version_tuple_to_str(version_list[0]), top_dir)) + return version_list[0] + + def _get_git_cmakebuild_dirs(self, top_dir): + assert os.path.exists(top_dir) + cmakebuild_top_dir = os.path.join(top_dir, 'CMakeBuild') + if not os.path.exists(cmakebuild_top_dir): + return [] + + re_version_dir = re.compile(r'^\d+[0-9.]+-\d+$') + git_cmakebuild_version_dirs = [] + cmakebuild_version_dirs = [] + for fname in os.listdir(cmakebuild_top_dir): + if os.path.isdir(os.path.join(cmakebuild_top_dir, fname)): + if re_version_dir.match(fname): + git_argv = [self._git_executable, 'ls-files', os.path.join('CMakeBuild', fname)] + retv = subprocess.check_output(git_argv, universal_newlines=True) + retv = retv.lstrip().rstrip() + if retv != '': + git_cmakebuild_version_dirs.append(fname) + else: + cmakebuild_version_dirs.append(fname) + return git_cmakebuild_version_dirs, cmakebuild_version_dirs + + def _is_workspace_clean(self, top_dir=None): + if top_dir: + initial_work_dir = os.getcwd() + os.chdir(top_dir) + else: + initial_work_dir = None + top_dir = os.getcwd() + git_argv = [self._git_executable, 'status', '-b', '--porcelain'] + retv = subprocess.check_output(git_argv, universal_newlines=True) + retv = retv.lstrip().rstrip() + status_lines = retv.splitlines() + if status_lines[0].startswith('## HEAD (no branch)'): + raise InvalidInputParameterError("Git workspace {} has detached HEAD, not upgradable.".format(top_dir)) + if len(status_lines) > 1: + raise InvalidInputParameterError("Git workspace {} is not clean, please check.".format(top_dir)) + if initial_work_dir: + os.chdir(initial_work_dir) + return True + + def _add_cmakebuild_to_git_repo(self, cmakebuild_tag, cmakebuild_repo): + + self._logger.info("using CMakeBuild tag {} as subtree.".format(cmakebuild_tag)) + # + # Extra annoying step to convince git subtree the working dir is clean + # + git_argv = [self._git_executable, 'checkout'] + self._git_helper.trace_git_command(git_argv) + util.subproc_check_call_flushed(git_argv) + + subtree_prefix = "CMakeBuild/{0}".format(cmakebuild_tag) + git_argv = [self._git_executable, 'subtree', 'add', '-P', subtree_prefix, '--squash', '-m', "{0}: creates subtree -P {1} tag={2}".format(self._prog_name, subtree_prefix, cmakebuild_tag), cmakebuild_repo, cmakebuild_tag] + util.subproc_check_call_flushed(git_argv) + + def _update_svnimportprops(self, svnimportprops_file, cmakebuild_tag, svnimportprops_file_new=None): + svnimportprops_modified = False + if not os.path.exists(svnimportprops_file): + return svnimportprops_modified + svnprop_file_parser = vcsutil.SvnPropFileParser() + svnprops = svnprop_file_parser.parse_property_file(svnimportprops_file) + if not svnprops.has_property('svn:externals'): + svnimportprops_modified = True + svnprops.add_property('svn:externals', ["/svn/svn_CMakeBuild/tags/{}/CMakeBuild CMakeBuild".format(cmakebuild_tag)]) + else: + svnprop_externals = svnprops.get_property('svn:externals') + re_external_cmakebuild = re.compile(r'^/svn/svn_CMakeBuild/tags/([^/]+)/CMakeBuild\s+') + svnprop_externals_new = [] + for line in svnprop_externals: + if (line == '') or line.isspace(): + continue + self._logger.debug("processing line {}".format(line)) + re_match = re_external_cmakebuild.match(line) + if re_match: + cmakebuild_tag_existing = re_match.group(1) + self._logger.debug("{}: found CMakeBuild tag {}".format(svnimportprops_file, cmakebuild_tag_existing)) + if cmakebuild_tag_existing != cmakebuild_tag: + svnimportprops_modified = True + svnprop_externals_new.append("/svn/svn_CMakeBuild/tags/{}/CMakeBuild CMakeBuild".format(cmakebuild_tag)) + else: + svnprop_externals_new.append(line) + else: + svnprop_externals_new.append(line) + if svnimportprops_modified: + svnprops.update_property('svn:externals', svnprop_externals_new) + if svnimportprops_modified: + self._logger.debug("{}: updating changed svn:externals".format(svnimportprops_file)) + if svnimportprops_file_new is None: + svnimportprops_file_new = svnimportprops_file + with open(svnimportprops_file_new, 'w') as f: + svnprops_str = str(svnprops) + f.write(svnprops_str) + return svnimportprops_modified + + def _append_item_to_summary(self, item, value): + self._summary_lines.append("{0:<30} {1}".format(item, value)) diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmk.py b/cmake/CMakeBuild/bin/pyhhi/build/app/cmk.py old mode 100644 new mode 100755 similarity index 69% rename from cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmk.py rename to cmake/CMakeBuild/bin/pyhhi/build/app/cmk.py index 179c0b01a6394f1f5fc86e0067f126d2119e41cd..eb351881c9571586e19549ccacfbbf37fb571abc --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmk.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/app/cmk.py @@ -1,16 +1,19 @@ + from __future__ import print_function import argparse import logging import os import re +import shutil import sys import pyhhi.build.common.system as system import pyhhi.build.common.util as util import pyhhi.build.common.ver as ver -import pyhhi.cmbuild.cmksupp as cmksupp -from pyhhi.build.common.bldtools import MsvcToolsetSpecDict, BuildScriptInstaller +import pyhhi.build.cmksupp as cmksupp +from pyhhi.build.common.bldtools import BuildScriptInstaller +from pyhhi.build.common.error import InvalidCommandLineArgumentError class CMakeLauncherApp(object): @@ -21,12 +24,14 @@ class CMakeLauncherApp(object): self._cmake_launcher = None self._dict_generator_choice = {'linux': ['umake', 'ninja'], 'macosx': ['xcode', 'umake', 'ninja'], - 'windows': ['vs15', 'vs14', 'vs12', 'vs11', 'vs10', 'mgwmake', 'ninja']} - self._msvc_dict = MsvcToolsetSpecDict() + 'windows': ['vs15', 'vs14', 'vs12', 'vs11', 'vs10', 'umake', 'mgwmake', 'ninja']} self._top_dir = None - self._cmake_mod_list = ['pyhhi.cmbuild.app.cmk', + self._cmake_mod_list = ['pyhhi.build.app.cmk', + 'pyhhi.build.cmkfnd', + 'pyhhi.build.cmksupp', 'pyhhi.build.common.bldtools', - 'pyhhi.cmbuild.cmksupp', + 'pyhhi.build.common.cmbldver', + 'pyhhi.build.common.error', 'pyhhi.build.common.system', 'pyhhi.build.common.util', 'pyhhi.build.common.ver'] @@ -41,12 +46,16 @@ class CMakeLauncherApp(object): top_dir = util.get_top_dir() os.chdir(top_dir) script_dir = util.get_script_dir() - script_installer = BuildScriptInstaller(top_dir, verbose=True) - #if ver.version_compare(self._sys_info.get_python_version(), (3, 0)) >= 0: - # script_installer.install_script(params.install_dir, os.path.join(script_dir, 'cmake3.py'), self._cmake_mod_list, rename='cmake.py') - #else: - # script_installer.install_script(params.install_dir, os.path.join(script_dir, 'cmake.py'), self._cmake_mod_list) + # print("sys.path: ", sys.path) + script_installer = BuildScriptInstaller(verbose=True) script_installer.install_script(params.install_dir, os.path.join(script_dir, 'cmake.py'), self._cmake_mod_list) + elif params.py_cache_dirs: + for dname in params.py_cache_dirs: + if not os.path.exists(dname): + continue + if not os.path.isdir(dname): + continue + self._remove_pycache(dname) else: # Apply additional checks on params. self._check_params(params) @@ -57,10 +66,7 @@ class CMakeLauncherApp(object): self._cmake_launcher.launch(params, cmake_argv) def _check_params(self, params): - if params.toolset_str and params.toolset_str.startswith('msvc-'): - # Let's check an msvc-x.y toolset specification in case the user is not aware of the difference - # between Boost.Build and cmake.py. - params.toolset_str = self._msvc_dict.transform_bbuild_to_cmake(params.toolset_str) + pass def _print_env(self): env_var_list = list(os.environ.keys()) @@ -94,7 +100,7 @@ arguments: variant: debug if not specified link: static if not specified toolset: default c++ compiler if not specified - examples/windows: msvc-19.12, msvc-19.0, msvc-18.0, msvc-17.0, msvc-16.0, intel + examples/windows: msvc-19.13, msvc-19.0, msvc-18.0, msvc-17.0, msvc-16.0, intel, gcc examples/linux: gcc-4.9, gcc-5, gcc-6, clang, intel address-model=32: windows: builds 32 bit binaries instead of 64 bit binaries @@ -120,10 +126,14 @@ usage examples: """ parser = argparse.ArgumentParser(usage=_usage, epilog=_epilog, formatter_class=argparse.RawDescriptionHelpFormatter) - parser.add_argument("-g","-G", action="store", dest="generator", choices=self._dict_generator_choice[self._sys_info.get_platform()], + parser.add_argument("--cmake-bin-dir", action="store", dest="cmk_bin_dir", + help="specify a directory to search for CMake overriding the default CMake search path.") + + parser.add_argument("-g", "-G", action="store", dest="generator", choices=self._dict_generator_choice[self._sys_info.get_platform()], help="""specify a cmake generator the script has special support for. Supported generators: ninja, umake, mgwmake, vs15, vs14, vs12, vs11, vs10, xcode. - The choices accepted are platform and installation dependent.""") + The choices accepted are platform and installation dependent. The environment variable + DEFAULT_CMAKE_GENERATOR may be used to override the default value.""") parser.add_argument("-D", action="append", dest="cache_entries", help="specify a cmake cache entry. The option will be ignored if a build tree already exists.") @@ -137,7 +147,7 @@ usage examples: parser.add_argument("-j", action="store", dest="build_jobs", type=int, nargs='?', default=1, const=str(self._get_optimal_number_cmake_jobs()), help="""specify the number of parallel build jobs. If you omit the numeric argument, - cmake --build ... will be invoked with -j<number_of_processors>.""") + cmake --build ... will be invoked with -j%(const)s.""") parser.add_argument("--target", action="store", dest="build_target", help="specify a build target overriding the default target.") @@ -146,13 +156,19 @@ usage examples: help="build target clean first, then build the active target.") parser.add_argument("--verbosity", action="store", dest="build_verbosity", choices=['quiet', 'minimal', 'normal', 'detailed', 'diagnostic'], default='minimal', - help="specify msbuild verbosity level [default: minimal].") - - parser.add_argument("-i", action="store", dest="install_dir", nargs='?', const=os.path.join(self._sys_info.get_home_dir(), 'bin'), - help="install this script and exit. The default destination directory is $HOME/bin.") + help="specify msbuild verbosity level [default: %(default)s].") util.app_args_add_log_level(parser) + g = parser.add_argument_group("advanced options") + g.add_argument("-i", action="store", dest="install_dir", nargs='?', const=os.path.join(self._sys_info.get_home_dir(), 'bin'), + help="install this script and exit. The default destination directory is %(const)s.") + + g.add_argument("--py-cache-clean", action="store", dest="py_cache_dirs", nargs='+', + help="search for Python cache files in one or more directory trees, remove them and exit. This special option is intended " + "for cross-platform Makefiles to clean up the source tree as python cache files are stored next to the source and " + "not in the build tree.") + # -j may be followed by a non-numeric argument which the parser is not able to handle. if '-j' in argv: i = argv.index('-j') @@ -184,15 +200,20 @@ usage examples: launcher_params.install_dir = cmake_py_options.install_dir else: launcher_params.install_dir = os.path.abspath(cmake_py_options.install_dir) + elif cmake_py_options.py_cache_dirs: + launcher_params.py_cache_dirs = [] + for dname in cmake_py_options.py_cache_dirs: + launcher_params.py_cache_dirs.append(os.path.normpath(os.path.abspath(dname))) self._top_dir = os.getcwd() - if cmake_py_options.install_dir: + if cmake_py_options.install_dir or launcher_params.py_cache_dirs: return launcher_params, cmake_args # if args_left: # print("cmake args", args_left) # Assign cmake.py options to attributes of CMakeLauncherParams. + launcher_params.cmk_bin_dir = cmake_py_options.cmk_bin_dir launcher_params.cmk_build = cmake_py_options.build launcher_params.cmk_build_jobs = cmake_py_options.build_jobs launcher_params.clean_first = cmake_py_options.clean_first @@ -216,8 +237,7 @@ usage examples: # A toolset=<something>.cmake expression is supposed to be a toolchain file to enable # some kind of cross compilation. if not os.path.exists(arg_value): - print("cmake.py: error: toolchain file=" + arg_value + " does not exist.") - sys.exit(1) + raise InvalidCommandLineArgumentError("toolchain file={} does not exist.".format(arg_value)) launcher_params.toolset_str = os.path.abspath(arg_value) else: launcher_params.toolset_str = self._normalize_toolset_spec(arg_value) @@ -225,15 +245,13 @@ usage examples: build_configs = arg_value.split(',') for cfg in build_configs: if cfg not in ['release', 'debug', 'relwithdebinfo', 'minsizerel']: - print("cmake.py: error: " + arg + " is not understood.") - sys.exit(1) + raise InvalidCommandLineArgumentError("argument {} is not understood.".format(arg)) launcher_params.build_configs = build_configs elif arg_key == 'link': link_variants = arg_value.split(',') for lnk in link_variants: if lnk not in ['static', 'shared']: - print("cmake.py: error: " + arg + " is not understood.") - sys.exit(1) + raise InvalidCommandLineArgumentError("argument {} is not understood.".format(arg)) launcher_params.link_variants = link_variants elif arg_key == 'address-model': if arg_value == '32': @@ -241,18 +259,15 @@ usage examples: elif arg_value == '64': launcher_params.target_arch = 'x86_64' else: - print("cmake.py: error: " + arg + " is not understood.") - sys.exit(1) + raise InvalidCommandLineArgumentError("argument {} is not understood.".format(arg)) else: - print("cmake.py: error: " + arg + " is not understood.") - sys.exit(1) + raise Exception("argument {} is not understood.".format(arg)) continue if arg == '--': # Semantics seems to be tricky and I haven't seen a convincing use case yet. # In configuration mode all unknown arguments are passed verbatim to cmake and in build mode # all unknown arguments are really build tool arguments and are passed verbatim to the build tool. - print("cmake.py: error: argument '--' encountered, this is not yet supported, please contact the maintainer.") - sys.exit(1) + raise InvalidCommandLineArgumentError("argument '--' encountered, this is not yet supported, please contact the maintainer.") # all other arguments are passed on to cmake verbatim. cmake_args.append(arg) return launcher_params, cmake_args @@ -267,7 +282,11 @@ usage examples: # looks like a cross compiler specification which requires a toolchain file matching the toolset spec and the linux system. toolset_spec_norm = self._find_toolchain_file(toolset_spec_norm) elif self._sys_info.is_windows(): - pass + # msvc-19.00 -> normalized to 19.0 + re_match = re.match(r'msvc-(\d+)\.(\d+)', toolset_spec) + if re_match: + minor_version = int(re_match.group(2)) + toolset_spec_norm = "msvc-{0}.{1:d}".format(re_match.group(1), minor_version) elif self._sys_info.is_macosx(): pass else: @@ -277,22 +296,31 @@ usage examples: def _find_toolchain_file(self, toolset_spec): toolchain_file = None - toolchains_dir = os.path.join(self._get_workspace_folder(), 'CMakeBuild', 'cmake', 'toolchains') - if self._sys_info.is_linux(): - toolchain_file_suffix = '-' + self._sys_info.get_os_distro_short() - if self._sys_info.get_os_distro_short() == 'ubuntu': - os_version_str = ver.ubuntu_version_tuple_to_str(self._sys_info.get_os_version()) - else: - os_version_str = self._sys_info.get_os_version() - toolchain_file_suffix += os_version_str.replace('.', '') + '.cmake' - if os.path.exists(os.path.join(toolchains_dir, toolset_spec + toolchain_file_suffix)): - toolchain_file = os.path.join(toolchains_dir, toolset_spec + toolchain_file_suffix) + toolchains_dir = self._find_toolchains_dir() + if toolchains_dir is not None: + if self._sys_info.is_linux(): + toolchain_file_suffix = '-' + self._sys_info.get_os_distro_short() + if self._sys_info.get_os_distro_short() == 'ubuntu': + os_version_str = ver.ubuntu_version_tuple_to_str(self._sys_info.get_os_version()) + else: + os_version_str = self._sys_info.get_os_version() + toolchain_file_suffix += os_version_str.replace('.', '') + '.cmake' + if os.path.exists(os.path.join(toolchains_dir, toolset_spec + toolchain_file_suffix)): + toolchain_file = os.path.join(toolchains_dir, toolset_spec + toolchain_file_suffix) if toolchain_file is None: msg = "toolset=" + toolset_spec + " cannot be mapped to a default toolchain file automatically. Please use a toolchain file or " msg += "contact technical support." raise Exception(msg) return toolchain_file + def _find_toolchains_dir(self): + toolchains_dir = os.path.join(util.get_script_dir(), '..', 'cmake', 'toolchains') + if not os.path.exists(toolchains_dir): + self._logger.warning("toolchains dir {} does not exist.".format(toolchains_dir)) + return None + toolchains_dir = os.path.normpath(toolchains_dir) + return toolchains_dir + def _get_workspace_folder(self): assert self._top_dir is not None return self._top_dir @@ -306,3 +334,16 @@ usage examples: cmake_jobs = cmake_max_jobs assert cmake_jobs >= 1 return cmake_jobs + + def _remove_pycache(self, py_dir_root): + os.chdir(py_dir_root) + re_pyc_file = re.compile(r'.+\.pyc$', re.IGNORECASE) + for root, dirs, files in os.walk(py_dir_root): + if '__pycache__' in dirs: + self._logger.info("rm -rf {0}".format(os.path.join(root,'__pycache__'))) + shutil.rmtree(os.path.join(root, '__pycache__')) + dirs.remove('__pycache__') + for fname in files: + if re_pyc_file.match(fname): + self._logger.info("rm {0}".format(os.path.join(root, fname))) + os.remove(os.path.join(root, fname)) diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmkdocapp.py b/cmake/CMakeBuild/bin/pyhhi/build/app/cmkdocapp.py old mode 100644 new mode 100755 similarity index 76% rename from cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmkdocapp.py rename to cmake/CMakeBuild/bin/pyhhi/build/app/cmkdocapp.py index c2a4d0795e6ab548369b94a902c1497a8022019b..cc37765f460be229348861d6e60a7dc248b952a2 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmkdocapp.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/app/cmkdocapp.py @@ -1,3 +1,4 @@ + from __future__ import print_function import argparse @@ -6,7 +7,9 @@ import os.path import sys import pyhhi.build.common.util as util -import pyhhi.cmbuild.cmkdoc as cmkdoc +import pyhhi.build.cmkdoc as cmkdoc + +from pyhhi.build.common.error import InvalidCommandLineArgumentError, InvalidInputParameterError class CMakeDocUtilApp(object): @@ -19,6 +22,10 @@ class CMakeDocUtilApp(object): def main(self, argv): params = self._parse_command_line(argv) + self.update_cmake_manual_docs(params) + + def update_cmake_manual_docs(self, params): + self._check_params(params) cmkdocutil = cmkdoc.CMakeManualRstUtil(dry_run=params.dry_run) if params.update_action == 'add': cmkdocutil.add_extension_modules(params.rst_module_filenm, params.extension_module_names, @@ -30,19 +37,28 @@ class CMakeDocUtilApp(object): else: assert False + def _check_params(self, params): + assert params.rst_module_filenm is not None + if not os.path.exists(params.rst_module_filenm): + raise InvalidInputParameterError("CMake doc module file {} does not exist.".format(params.rst_module_filenm)) + def _parse_command_line(self, argv): + + params = cmkdoc.CMakeRstUtilParams() + parser = argparse.ArgumentParser() + + parser.add_argument("input", action="store", help="specifies the CMake RST module file to be updated.") + parser.add_argument("-m", action="append", dest="module_names", help="specifies an extension module name, the option must be repeated for each extension module.") parser.add_argument("-R", action="store_true", dest="remove_all", default=False, help="remove all non-standard module sections.") parser.add_argument("-r", action="store_true", dest="remove", default=False, help="remove a single non-standard module section.") - parser.add_argument("-f", action="store", dest="rst_filenm", required=True, - help="specifies the CMake RST file to be updated.") parser.add_argument("-o", action="store", dest="output_rst_filenm") - parser.add_argument("-s", action="store", dest="section_title", default="Extension Modules", - help="specifies the section to be updated [default: Extension Modules]") + parser.add_argument("-s", action="store", dest="section_title", default=params.extension_section_title, + help="specifies the section to be updated [default: %(default)s]") parser.add_argument("--dry-run", action="store_true", dest="dry_run", default=False) util.app_args_add_log_level(parser) @@ -52,9 +68,8 @@ class CMakeDocUtilApp(object): # configure the python logger asap util.app_configure_logging(args.log_level) - params = cmkdoc.CMakeRstUtilParams() params.dry_run = args.dry_run - params.rst_module_filenm = os.path.abspath(args.rst_filenm) + params.rst_module_filenm = os.path.abspath(args.input) if args.module_names: params.update_action = 'add' @@ -64,8 +79,7 @@ class CMakeDocUtilApp(object): elif args.remove: params.update_action = 'remove' else: - print("No update action specified, use -m, -R or -r.") - sys.exit(1) + raise InvalidCommandLineArgumentError("no update action specified, use -m, -R or -r.") if args.section_title: params.extension_section_title = args.section_title if args.output_rst_filenm: diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/cmkdoc.py b/cmake/CMakeBuild/bin/pyhhi/build/cmkdoc.py old mode 100644 new mode 100755 similarity index 72% rename from cmake/CMakeBuild/bin/pyhhi/cmbuild/cmkdoc.py rename to cmake/CMakeBuild/bin/pyhhi/build/cmkdoc.py index 8f7123cdecd48f07fff1c41e93f32506e774ef87..178cc382ae5496422817bd5bfabf8b8916355980 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/cmkdoc.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/cmkdoc.py @@ -1,9 +1,12 @@ + from __future__ import print_function import logging import re import os +from pyhhi.build.common.error import InvalidInputParameterError + class CMakeRstUtilParams(object): @@ -32,6 +35,7 @@ class CMakeManualRstUtil(object): self._dry_run = dry_run self._section_title_cmake_modules_orig = "All Modules" self._section_title_cmake_modules = "Standard Modules" + self._reserved_section_titles = [self._section_title_cmake_modules, self._section_title_cmake_modules_orig, "Legacy CPack Modules"] self._section_title_marker = '=' self._is_cmake_source_tree = False # Location of <module>.rst @@ -44,18 +48,24 @@ class CMakeManualRstUtil(object): return self._is_cmake_source_tree def add_extension_modules(self, rst_module_filenm, extension_module_names, section_title="Extension Modules", output_rst_filenm=None): + if not os.path.exists(rst_module_filenm): - raise Exception("CMake RST module file " + rst_module_filenm + " does not exist.") + raise InvalidInputParameterError("CMake RST module file {} does not exist.".format(rst_module_filenm)) if output_rst_filenm is None: + # in-place replacement output_rst_filenm = rst_module_filenm # Empty sections are not permitted, use one of the remove_xxx() methods to get rid of a section. assert extension_module_names self._detect_cmake_source_tree(rst_module_filenm) self._check_section_title(section_title) (module_file_header, section_list) = self._parse_rst_module_file(rst_module_filenm) + if len(section_list) > 0: + # CMake's original module file has one or more sections. All extension sections are inserted in front of + # section titled "All Modules" or "Standard Modules". The latter title is used after the first extension section has been inserted. + # Get cmake module names - cmake_module_names_set = self._get_cmake_module_names(section_list[-1]) + cmake_module_names_set = self._get_cmake_module_names(section_list) # Extension module names must not replace existing cmake module names extension_module_names_set = set(extension_module_names) if not cmake_module_names_set.isdisjoint(extension_module_names_set): @@ -75,13 +85,16 @@ class CMakeManualRstUtil(object): # print("new content lines:") # self._dump_section_list(section_list[0:-1]) # Change title of the CMake module section from "All Modules" to "Standard Modules". - section = section_list[-1] - if section.section_title == self._section_title_cmake_modules_orig: - section.section_title = self._section_title_cmake_modules - section.section_title_marker_line = '{0:=>{width}}'.format(self._section_title_marker, width=len(section.section_title)) + for section in section_list: + if section.section_title == self._section_title_cmake_modules_orig: + section.section_title = self._section_title_cmake_modules + section.section_title_marker_line = '{0:=>{width}}'.format(self._section_title_marker, width=len(section.section_title)) + break + section_list = self._sort_section_list(section_list) # Save top-level RST module file self._save_rst_module_file(output_rst_filenm, module_file_header, section_list) + # Remove RST extension module wrapper files not belonging to this section anymore. outdated_extension_module_names = [] for mod_nm in existing_extension_module_names: @@ -101,30 +114,27 @@ class CMakeManualRstUtil(object): self._check_section_title(section_title) (module_file_header, section_list) = self._parse_rst_module_file(rst_module_filenm) assert len(section_list) > 0 - if len(section_list) <= 1: - return + # Get a list of RST extension module wrapper files belonging to section "section_title". existing_extension_module_names = self._get_extension_module_names(section_list, section_title) if existing_extension_module_names: self._logger.debug('existing extensions: %s', ' '.join(existing_extension_module_names)) + modified = False new_section_list = [] - for sect in section_list[0:-1]: + for sect in section_list: if section_title == sect.section_title: modified = True else: new_section_list.append(sect) - # Any extensions left? - if new_section_list: - new_section_list = self._sort_section_list(new_section_list) - new_section_list.append(section_list[-1]) - if len(new_section_list) == 1: - sect = new_section_list[-1] - if sect.section_title != self._section_title_cmake_modules_orig: - modified = True - # Recover the original section title - sect.section_title = self._section_title_cmake_modules_orig - sect.section_title_marker_line = '{0:=>{width}}'.format(self._section_title_marker, width=len(sect.section_title)) + assert len(new_section_list) > 0 + sect = new_section_list[0] + if sect.section_title == self._section_title_cmake_modules: + modified = True + # Recover the original section title + sect.section_title = self._section_title_cmake_modules_orig + sect.section_title_marker_line = '{0:=>{width}}'.format(self._section_title_marker, width=len(sect.section_title)) + if modified: # Save top-level RST module file self._save_rst_module_file(output_rst_filenm, module_file_header, new_section_list) @@ -142,18 +152,25 @@ class CMakeManualRstUtil(object): if existing_extension_module_names: self._logger.debug('existing extensions: %s', ' '.join(existing_extension_module_names)) modified = False - if len(section_list) > 1: - modified = True - # Get and keep the last section, it's supposed to be the original CMake module section. - section = section_list[-1] - if section.section_title != self._section_title_cmake_modules_orig: - modified = True - # recover the original section title - section.section_title = self._section_title_cmake_modules_orig - section.section_title_marker_line = '{0:=>{width}}'.format(self._section_title_marker, width=len(section.section_title)) + + while section_list: + sect = section_list[0] + if sect.section_title == self._section_title_cmake_modules: + # Found first original section + modified = True + sect.section_title = self._section_title_cmake_modules_orig + sect.section_title_marker_line = '{0:=>{width}}'.format(self._section_title_marker, width=len(sect.section_title)) + break + elif sect.section_title == self._section_title_cmake_modules_orig: + # Found first original section + break + else: + modified = True + section_list.pop(0) + assert len(section_list) > 0 if modified: # Save top-level RST module file - self._save_rst_module_file(output_rst_filenm, module_file_header, [section]) + self._save_rst_module_file(output_rst_filenm, module_file_header, section_list) # Remove all RST extension module wrapper files self._remove_rst_extension_module_files(existing_extension_module_names) @@ -174,8 +191,8 @@ class CMakeManualRstUtil(object): return os.path.normpath(rst_module_dir) def _check_section_title(self, section_title): - if section_title in [self._section_title_cmake_modules_orig, self._section_title_cmake_modules]: - raise Exception("section " + section_title + " is protected and cannot be modified, please contact technical support.") + if section_title in self._reserved_section_titles: + raise InvalidInputParameterError("section {} is protected and cannot be modified, please contact technical support.".format(section_title)) def _check_extension_module_names(self, extension_module_names): if not self.is_cmake_source_tree(): @@ -183,7 +200,7 @@ class CMakeManualRstUtil(object): for mod_nm in extension_module_names: rst_module_file = os.path.join(self._cmake_help_module_dir, mod_nm + '.rst') if not os.path.exists(rst_module_file): - raise Exception("file " + rst_module_file + " does not exist.") + raise Exception("file {} does not exist.".format(rst_module_file)) def _update_section(self, section_list, section_title, extension_module_names): section = None @@ -231,57 +248,79 @@ class CMakeManualRstUtil(object): return modified def _sort_section_list(self, section_list): - # Sort section list by title and keep the last section at the end. + """Sort section list by title and keep CMake's original sections at the end.""" + + section_list_ext = [] + while section_list: + sect = section_list[0] + if sect.section_title in [self._section_title_cmake_modules_orig, self._section_title_cmake_modules]: + break + else: + section_list_ext.append(sect) + section_list.pop(0) + section_title_dict = {} section_list_sorted = [] - for sect in section_list[0:-1]: + for sect in section_list_ext: section_title_dict[sect.section_title] = sect title_list = list(section_title_dict.keys()) title_list.sort() for title in title_list: section_list_sorted.append(section_title_dict[title]) - # and preserve the position of the last element. - section_list_sorted.append(section_list[-1]) + + # and append CMake's original sections. + section_list_sorted.extend(section_list) return section_list_sorted def _parse_rst_module_file(self, rst_module_filenm): - section_list = [] + module_file_header = [] - re_section_title = re.compile(r'^[a-zA-Z][a-zA-Z0-9 -]+') - # re_section_content = re.compile(r'\s+/module/') - re_rst_directive = re.compile(r'^\s*\.\.\s+[a-zA-Z0-9-]+') + section_list = [] + section = None + previous_line = None re_empty_line = re.compile(r'^\s*$') + with open(rst_module_filenm) as f: for line in f: line = line.rstrip() if not section_list: # Processing lines in front of the first section header - if re_rst_directive.match(line): - module_file_header.append(line) - elif re_empty_line.match(line): - module_file_header.append(line) - elif line.startswith('cmake-modules') or line.startswith('***'): - module_file_header.append(line) - elif re_section_title.match(line): - # print("found 1st section: " + line) + if line.startswith(self._section_title_marker): section = RstModuleSection() - section.section_title = line + section.section_title = previous_line + section.section_title_marker_line = line + self._logger.debug("found section: {}".format(previous_line)) section_list.append(section) - # Remove the last empty line from the module header to simplify saving sections later on. + # Remove the title line from the module header. module_file_header.pop() + if module_file_header and re_empty_line.match(module_file_header[-1]): + # Remove the last empty line from the module header to simplify saving sections later on. + module_file_header.pop() + else: + module_file_header.append(line) else: - if line.startswith(self._section_title_marker): - section.section_title_marker_line = line - elif re_section_title.match(line): - # Start of a new section - # print("found new section: " + line) - section = RstModuleSection() - section.section_title = line - section_list.append(section) - elif self._re_section_content.match(line): - section.section_content.append(line) - elif not section.section_content: - section.section_header.append(line) + if section.section_content: + if self._re_section_content.match(line): + section.section_content.append(line) + else: + section = RstModuleSection() + else: + # No section content found yet. + if not section.section_title: + if line.startswith(self._section_title_marker): + section.section_title = previous_line + section.section_title_marker_line = line + section_list.append(section) + self._logger.debug("found section: {}".format(previous_line)) + else: + pass + else: + if self._re_section_content.match(line): + section.section_content.append(line) + else: + section.section_header.append(line) + previous_line = line + # self._dump_module_file_header(module_file_header) # self._dump_section_list(section_list) return module_file_header, section_list @@ -298,19 +337,29 @@ class CMakeManualRstUtil(object): extension_module_names.append(re_match.group(1)) return extension_module_names - def _get_cmake_module_names(self, sect): + def _get_cmake_module_names(self, section_list): + cmake_module_names = set() - for line in sect.section_content: - re_match = self._re_section_content.match(line) - if re_match: - cmake_module_names.add(re_match.group(1)) + section_all_modules_fnd = False + + for sect in section_list: + if not section_all_modules_fnd: + if sect.section_title in [self._section_title_cmake_modules_orig, self._section_title_cmake_modules]: + section_all_modules_fnd = True + else: + # One of the extension sections in front of "All Modules" or "Standard Modules" + continue + for line in sect.section_content: + re_match = self._re_section_content.match(line) + if re_match: + cmake_module_names.add(re_match.group(1)) return cmake_module_names def _save_rst_module_file(self, output_rst_filenm, module_file_header, section_list): if self._dry_run: self._logger.debug("leaving without saving anything to %s", output_rst_filenm) return - print("Saving updated content to " + output_rst_filenm) + self._logger.debug("saving updated content to %s", output_rst_filenm) with open(output_rst_filenm, "w") as f: for line in module_file_header: f.write(line + '\n') diff --git a/cmake/CMakeBuild/bin/pyhhi/build/cmkfnd.py b/cmake/CMakeBuild/bin/pyhhi/build/cmkfnd.py new file mode 100755 index 0000000000000000000000000000000000000000..057d5c1b83254fb8d5bce4223df9a63a59faa729 --- /dev/null +++ b/cmake/CMakeBuild/bin/pyhhi/build/cmkfnd.py @@ -0,0 +1,113 @@ + +from __future__ import print_function + +import logging +import os +import re +import subprocess + +import pyhhi.build.common.util as util +import pyhhi.build.common.ver as ver +from pyhhi.build.common.system import SystemInfo + + +class CMakeFinder(object): + + def __init__(self, sys_info=None): + self._logger = logging.getLogger(__name__) + if sys_info is None: + self._sys_info = SystemInfo() + else: + self._sys_info = sys_info + self._cmake_prog = None + self._cmake_version = None + self._cmake_search_path = self._sys_info.get_path() + if self._sys_info.is_windows(): + cmake_dir_list = [] + cmake_inst_dir = self._query_winreg_cmake_inst_dir() + if cmake_inst_dir is None: + # cmake 3.6.1 is 64 bit but earlier cmake versions are 32 bit only. + if self._sys_info.get_os_arch() == 'x86_64': + cmake_dir_list.append(os.path.join(self._sys_info.get_program_dir('x86_64'), 'CMake', 'bin')) + cmake_dir_list.append(os.path.join(self._sys_info.get_program_dir('x86'), 'CMake', 'bin')) + for cmake_dir in cmake_dir_list: + if os.path.exists(cmake_dir): + if cmake_dir not in self._cmake_search_path: + self._cmake_search_path.append(cmake_dir) + else: + # Append cmake install directory picked up from the registry (3.8.0 or higher). + self._cmake_search_path.append(cmake_inst_dir) + elif self._sys_info.is_macosx(): + # The default installation path is /Applications/CMake.app/Contents/bin on MacOSX. + cmake_dir = os.path.join('/Applications', 'CMake.app', 'Contents', 'bin') + if os.path.exists(cmake_dir): + if cmake_dir not in self._cmake_search_path: + self._cmake_search_path.append(cmake_dir) + elif self._sys_info.is_linux(): + pass + else: + assert False + + def set_cmake_search_path(self, search_path): + if search_path: + self._cmake_search_path = search_path[:] + self._logger.debug("cmake search path changed to: %s", ';'.join(self._cmake_search_path)) + + def find_cmake(self): + """Returns the absolute path of a cmake executable.""" + if self._cmake_prog is None: + self._logger.debug("cmake search path: %s", ';'.join(self._cmake_search_path)) + self._cmake_prog = util.find_tool_on_path('cmake', must_succeed=True, search_path=self._cmake_search_path) + self._cmake_version = self._query_cmake_version(self._cmake_prog) + return self._cmake_prog + + def is_cmake_installed(self): + return self.find_cmake() is not None + + def get_cmake_version(self): + assert self._cmake_version is not None + return self._cmake_version + + def _query_cmake_version(self, cmake_cmd): + retv = subprocess.check_output([cmake_cmd, '--version'], universal_newlines=True) + return self._parse_cmake_version_retv(retv) + + def _parse_cmake_version_retv(self, retv): + version_response = retv.rstrip() + lines = version_response.splitlines() + # Possible version information: + # cmake version 3.7.2 + # cmake version 3.8.0-rc2 + # cmake3 version 3.6.3 # redhat 7.x cmake3 + re_version_match = re.match(r'cmake\d*\s+version\s+([0-9]+\.[0-9]+\.[0-9]+)', lines[0], re.IGNORECASE) + if not re_version_match: + raise Exception("cmake has returned an unsupported version string. Please contact technical support.") + self._logger.debug("cmake version: %s", re_version_match.group(1)) + return ver.version_tuple_from_str(re_version_match.group(1)) + + def _query_winreg_cmake_inst_dir(self): + cmake_install_dir = None + if self._sys_info.is_python3(): + import winreg + win_registry = winreg + else: + import _winreg + win_registry = _winreg + + reg_section = "SOFTWARE\\Kitware\\CMake" + + try: + # rkey must be initialized in case OpenKey() does not return but raises an exception. + rkey = None + rkey = win_registry.OpenKey(win_registry.HKEY_LOCAL_MACHINE, reg_section) + install_dir = win_registry.QueryValueEx(rkey, 'InstallDir')[0] + if os.path.exists(os.path.join(install_dir, 'bin', 'cmake.exe')): + cmake_install_dir = os.path.join(install_dir, 'bin') + except WindowsError: + if rkey is not None: + win_registry.CloseKey(rkey) + if cmake_install_dir: + self._logger.debug("cmake install dir (winreg): %s", cmake_install_dir) + else: + self._logger.debug("cmake install dir (winreg): %s", "not found") + return cmake_install_dir diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/cmksupp.py b/cmake/CMakeBuild/bin/pyhhi/build/cmksupp.py old mode 100644 new mode 100755 similarity index 83% rename from cmake/CMakeBuild/bin/pyhhi/cmbuild/cmksupp.py rename to cmake/CMakeBuild/bin/pyhhi/build/cmksupp.py index 3e61fe17a248cd1c54a45e3864b9821853625408..ff45f35c671434cd8cff976d5a3872560c514987 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/cmksupp.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/cmksupp.py @@ -1,112 +1,16 @@ + from __future__ import print_function import logging import os import re -import subprocess import sys import pyhhi.build.common.bldtools as bldtools import pyhhi.build.common.util as util import pyhhi.build.common.ver as ver from pyhhi.build.common.system import SystemInfo - - -class CMakeFinder(object): - - def __init__(self, sys_info=None): - self._logger = logging.getLogger(__name__) - if sys_info is None: - self._sys_info = SystemInfo() - else: - self._sys_info = sys_info - self._cmake_prog = None - self._cmake_version = None - self._cmake_search_path = self._sys_info.get_path() - if self._sys_info.is_windows(): - cmake_dir_list = [] - cmake_inst_dir = self._query_winreg_cmake_inst_dir() - if cmake_inst_dir is None: - # cmake 3.6.1 is 64 bit but earlier cmake versions are 32 bit only. - if self._sys_info.get_os_arch() == 'x86_64': - cmake_dir_list.append(os.path.join(self._sys_info.get_program_dir('x86_64'), 'CMake', 'bin')) - cmake_dir_list.append(os.path.join(self._sys_info.get_program_dir('x86'), 'CMake', 'bin')) - for cmake_dir in cmake_dir_list: - if os.path.exists(cmake_dir): - if cmake_dir not in self._cmake_search_path: - self._cmake_search_path.append(cmake_dir) - else: - # Append cmake install directory picked up from the registry (3.8.0 or higher). - self._cmake_search_path.append(cmake_inst_dir) - elif self._sys_info.is_macosx(): - # The default installation path is /Applications/CMake.app/Contents/bin on MacOSX. - cmake_dir = os.path.join('/Applications', 'CMake.app', 'Contents', 'bin') - if os.path.exists(cmake_dir): - if cmake_dir not in self._cmake_search_path: - self._cmake_search_path.append(cmake_dir) - elif self._sys_info.is_linux(): - pass - else: - assert False - - def find_cmake(self): - """Returns the absolute path of a cmake executable.""" - if self._cmake_prog is None: - self._logger.debug("cmake search path: %s", ';'.join(self._cmake_search_path)) - self._cmake_prog = util.find_tool_on_path('cmake', must_succeed=True, search_path=self._cmake_search_path) - self._cmake_version = self._query_cmake_version(self._cmake_prog) - return self._cmake_prog - - def is_cmake_installed(self): - return self.find_cmake() is not None - - def get_cmake_version(self): - assert self._cmake_version is not None - return self._cmake_version - - def _query_cmake_version(self, cmake_cmd): - retv = subprocess.check_output([cmake_cmd, '--version'], universal_newlines=True) - return self._parse_cmake_version_retv(retv) - - def _parse_cmake_version_retv(self, retv): - version_response = retv.rstrip() - lines = version_response.splitlines() - # Possible version information: - # cmake version 3.7.2 - # cmake version 3.8.0-rc2 - # cmake3 version 3.6.3 # redhat 7.x cmake3 - re_version_match = re.match(r'cmake\d*\s+version\s+([0-9]+\.[0-9]+\.[0-9]+)', lines[0], re.IGNORECASE) - if not re_version_match: - raise Exception("cmake has returned an unsupported version string. Please contact technical support.") - self._logger.debug("cmake version: %s", re_version_match.group(1)) - return ver.version_tuple_from_str(re_version_match.group(1)) - - def _query_winreg_cmake_inst_dir(self): - cmake_install_dir = None - if self._sys_info.is_python3(): - import winreg - win_registry = winreg - else: - import _winreg - win_registry = _winreg - - reg_section = "SOFTWARE\\Kitware\\CMake" - - try: - # rkey must be initialized in case OpenKey() does not return but raises an exception. - rkey = None - rkey = win_registry.OpenKey(win_registry.HKEY_LOCAL_MACHINE, reg_section) - install_dir = win_registry.QueryValueEx(rkey, 'InstallDir')[0] - if os.path.exists(os.path.join(install_dir, 'bin', 'cmake.exe')): - cmake_install_dir = os.path.join(install_dir, 'bin') - except WindowsError: - if rkey is not None: - win_registry.CloseKey(rkey) - if cmake_install_dir: - self._logger.debug("cmake install dir (winreg): %s", cmake_install_dir) - else: - self._logger.debug("cmake install dir (winreg): %s", "not found") - return cmake_install_dir +from pyhhi.build.cmkfnd import CMakeFinder class CMakeLauncherParams(object): @@ -115,6 +19,8 @@ class CMakeLauncherParams(object): self.dry_run = False self.cmk_build = False self.clean_first = False + # cmk_bin_dir override the default CMake search path. + self.cmk_bin_dir = None self.cmk_build_jobs = 1 self.cmk_build_target = None #msbuild: verbosity levels: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] @@ -130,6 +36,8 @@ class CMakeLauncherParams(object): self.link_variants = tuple(['static']) # Assigned if the script and its modules are to be installed. self.install_dir = None + # Python directories to search for cache files/directories. + self.py_cache_dirs = [] class CMakeCompilerInfo(object): @@ -144,6 +52,7 @@ class CMakeCompilerInfo(object): self.target_arch = None self.cmake_cxx_compiler = None self.cmake_c_compiler = None + self.mingw = False def is_cross_compiler(self): return self.cmake_toolchain_file is not None @@ -159,8 +68,6 @@ class CMakeCompilerInfo(object): if self.cmake_cxx_compiler: s += "cmake cxx compiler: %s\n" % self.cmake_cxx_compiler s += "cmake c compiler: %s\n" % self.cmake_c_compiler - # if self.build_dirs: - # s += "build dir: %s\n" % self.build_dirs return s @@ -193,7 +100,10 @@ class CMakeBuildTreeInfo(object): build_dir_dict[cfg + '.' + 'shared'] = os.path.join(build_root, cfg + '-shared') else: target_arch = compiler_info.target_arch - toolset_dir = compiler_info.compiler_family + '-' + ver.version_tuple_to_str(compiler_info.version_major_minor) + if compiler_info.mingw: + toolset_dir = "{}-mingw-{}".format(compiler_info.compiler_family, ver.version_tuple_to_str(compiler_info.version_major_minor)) + else: + toolset_dir = "{}-{}".format(compiler_info.compiler_family, ver.version_tuple_to_str(compiler_info.version_major_minor)) if self.is_multi_configuration_generator(): for cfg in build_configs: build_dir_dict[cfg + '.' + 'static'] = os.path.join(self._build_root, generator_alias, toolset_dir, target_arch) @@ -279,6 +189,9 @@ class CMakeLauncher(object): assert False def launch(self, params, cmake_argv): + + if params.cmk_bin_dir: + self._cmake_finder.set_cmake_search_path([params.cmk_bin_dir]) # Is cmake installed? if not self._cmake_finder.is_cmake_installed(): return @@ -376,10 +289,15 @@ class CMakeLauncher(object): # print("launch_config(): cmake_args", cmake_argv) # print("build dir:", b_dir) # print("top dir:", self._top_dir) - os.chdir(b_dir) - cmake_argv.append(os.path.relpath(self._top_dir)) - retv = self.launch_cmake(cmake_argv) - os.chdir(cur_dir) + if (not self._sys_info.is_windows()) and (ver.version_compare(self._cmake_finder.get_cmake_version(), (3, 13, 0)) >= 0): + # Not done for windows yet avoiding potential issues with command line length limits. + cmake_argv.extend(['-S', self._top_dir, '-B', b_dir]) + retv = self.launch_cmake(cmake_argv) + else: + os.chdir(b_dir) + cmake_argv.append(os.path.relpath(self._top_dir)) + retv = self.launch_cmake(cmake_argv) + os.chdir(cur_dir) if retv != 0: sys.exit(1) @@ -424,7 +342,7 @@ class CMakeLauncher(object): joiner = ' ' cmd_line = joiner.join(argv) print("Launching: " + cmd_line) - retv = subprocess.call(argv) + retv = util.subproc_call_flushed(argv) if retv < 0: self._logger.debug("child was terminated by signal: %d", -retv) else: @@ -436,14 +354,17 @@ class CMakeLauncher(object): def _check_cmake_params(self, params): if params.cmk_generator_alias is None: - params.cmk_generator_alias = self._get_default_cmake_generator() + if self._sys_info.is_windows_msys() and (params.toolset_str is not None) and (params.toolset_str == 'gcc'): + params.cmk_generator_alias = 'umake' + else: + params.cmk_generator_alias = self._get_default_cmake_generator() if params.toolset_str is None: if self._sys_info.get_platform() == 'linux': params.toolset_str = 'gcc' elif self._sys_info.get_platform() == 'macosx': params.toolset_str = 'clang' elif self._sys_info.get_platform() == 'windows': - if params.cmk_generator_alias == 'mgwmake': + if params.cmk_generator_alias in ['mgwmake', 'umake']: params.toolset_str = 'gcc' else: params.toolset_str = self._dict_generator_alias_to_msvc_toolsets[params.cmk_generator_alias][0] @@ -476,6 +397,11 @@ class CMakeLauncher(object): raise Exception("CMake cache entry expression " + cache_opt + " is unsupported, please contact technical support." ) def _get_default_cmake_generator(self): + if 'DEFAULT_CMAKE_GENERATOR' in os.environ: + generator_alias = os.environ['DEFAULT_CMAKE_GENERATOR'] + if generator_alias not in self._dict_to_cmake_generator: + raise Exception("CMake generator " + generator_alias + " defined by environment variable DEFAULT_CMAKE_GENERATOR is unsupported.") + return generator_alias if self._sys_info.get_platform() == 'linux': generator_alias = 'umake' elif self._sys_info.get_platform() == 'macosx': @@ -562,6 +488,7 @@ class CMakeLauncher(object): pass elif compiler_info.compiler_family == 'gcc': # MinGW as native compiler: 64 bit and 32 bit default targets are possible. + compiler_info.mingw = bb_toolset_info.is_mingw() compiler_info.target_arch = bb_toolset_info.get_platform_info(0).get_target_arch(0) elif compiler_info.compiler_family == 'intel': compiler_info.target_arch = bb_toolset_info.get_platform_info(0).get_target_arch(0) @@ -614,14 +541,25 @@ class CMakeLauncher(object): cmake_argv.append('--clean-first') def _add_cmake_build_jobs_option(self, cmake_argv, generator_alias, build_jobs): - if build_jobs < 2: - return - if generator_alias in ['umake', 'ninja']: - self._add_cmake_build_tool_options(cmake_argv, ['-j' + str(build_jobs)]) - elif generator_alias.startswith('vs'): - self._add_cmake_build_tool_options(cmake_argv, ['/maxcpucount:' + str(build_jobs)]) - elif generator_alias == 'xcode': - self._add_cmake_build_tool_options(cmake_argv, ['-parallelizeTargets', '-jobs', str(build_jobs)]) + cmake_version = self._cmake_finder.get_cmake_version() + if ver.version_compare(cmake_version, (3, 12)) >= 0: + assert len(cmake_argv) >= 2 + if build_jobs >= 2: + if generator_alias.startswith('vs'): + self._add_cmake_build_tool_options(cmake_argv, ['/maxcpucount:' + str(build_jobs)]) + else: + cmake_argv.insert(2, str(build_jobs)) + cmake_argv.insert(2, '--parallel') + elif build_jobs == 0: + # Use the build engine's native number of jobs. + cmake_argv.insert(2, '--parallel') + elif build_jobs >= 2: + if generator_alias in ['umake', 'ninja']: + self._add_cmake_build_tool_options(cmake_argv, ['-j' + str(build_jobs)]) + elif generator_alias.startswith('vs'): + self._add_cmake_build_tool_options(cmake_argv, ['/maxcpucount:' + str(build_jobs)]) + elif generator_alias == 'xcode': + self._add_cmake_build_tool_options(cmake_argv, ['-parallelizeTargets', '-jobs', str(build_jobs)]) def _add_cmake_build_verbosity_option(self, cmake_argv, generator_alias, verbosity_level): if generator_alias.startswith('vs'): diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/__init__.py b/cmake/CMakeBuild/bin/pyhhi/build/common/__init__.py old mode 100644 new mode 100755 diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/android.py b/cmake/CMakeBuild/bin/pyhhi/build/common/android.py old mode 100644 new mode 100755 index ff30ba8d18f8726be77a323ccbb30ab9c59841b8..a994d395da5ee13d8e0f921e404ae46d7c8bb8d0 --- a/cmake/CMakeBuild/bin/pyhhi/build/common/android.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/android.py @@ -134,7 +134,7 @@ class NdkFinder(object): print("Launching: " + ' '.join(mk_toolchain_args)) # and launch the script to create the new toolchain - subprocess.check_call(mk_toolchain_args) + util.subproc_check_call_flushed(mk_toolchain_args) if hash_bang_missing: if os.path.exists(mk_toolchain_script): diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/bldtools.py b/cmake/CMakeBuild/bin/pyhhi/build/common/bldtools.py old mode 100644 new mode 100755 index 5b7ed4c0d2fb3f7d9aec7358921f81fb205305c3..7db8ae7f1e1f4497ae2203e7114d1ca0578d5c02 --- a/cmake/CMakeBuild/bin/pyhhi/build/common/bldtools.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/bldtools.py @@ -7,6 +7,7 @@ import platform import re import shutil import subprocess +import sys import tempfile import textwrap @@ -15,36 +16,6 @@ import pyhhi.build.common.util as util import pyhhi.build.common.ver as ver -class MsvcToolsetSpecDict(object): - - def __init__(self): - # Mapping between CMake VC toolsets and Boost.Build VC toolsets if unique. - # VS 2017 updates cl to 19.11.x whereas Boost.Build detects 19.10.x and 19.11.x as msvc-14.1, hence - # no mapping anymore. - self._dict_cmake_msvc_bbuild_msvc = {'msvc-19.0': 'msvc-14.0', - 'msvc-18.0': 'msvc-12.0', - 'msvc-17.0': 'msvc-11.0', - 'msvc-16.0': 'msvc-10.0'} - - # Mapping between Boost.Build VC toolsets and CMake VC toolsets. - self._dict_bbuild_msvc_cmake_msvc = {'msvc-14.0': 'msvc-19.0', - 'msvc-12.0': 'msvc-18.0', - 'msvc-11.0': 'msvc-17.0', - 'msvc-10.0': 'msvc-16.0'} - - def transform_bbuild_to_cmake(self, toolset): - if toolset in self._dict_bbuild_msvc_cmake_msvc: - return self._dict_bbuild_msvc_cmake_msvc[toolset] - else: - return toolset - - def transform_cmake_to_bbuild(self, toolset): - if toolset in self._dict_cmake_msvc_bbuild_msvc: - return self._dict_cmake_msvc_bbuild_msvc[toolset] - else: - return toolset - - class MsvcRegistry(object): class __MsvcRegistry(object): @@ -80,11 +51,6 @@ class MsvcRegistry(object): self._do_inventory_vc141() self._do_inventory() - def _get_devnull(self): - if not hasattr(self, '_devnull'): - self._devnull = os.open(os.devnull, os.O_RDWR) - return self._devnull - def get_compiler_command(self, version=None): if version is None: version = self.get_latest_version() @@ -196,14 +162,7 @@ class MsvcRegistry(object): versionf.write(textwrap.dedent("""\ #pragma message(_MSC_FULL_VER _MSC_BUILD) """.format())) - python_version = ver.get_python_version() - if ver.version_compare(python_version, (3,3)) >= 0: - # subprocess.DEVNULL since python 3.3 - retv = subprocess.check_output([cl_cmd, '/EP', version_file], stderr=subprocess.DEVNULL, universal_newlines=True).lstrip() - else: - self._logger.debug("attribute subprocess.DEVNULL not available (python < 3.3), using os.devnull instead") - devnull = self._get_devnull() - retv = subprocess.check_output([cl_cmd, '/EP', version_file], stderr=devnull, universal_newlines=True).lstrip() + retv = subprocess.check_output([cl_cmd, '/EP', version_file], stderr=self._sys_info.get_subprocess_devnull(), universal_newlines=True).lstrip() # print("_query_msvc_compiler_versionf(): retv=" + retv) re_match = re.match(r'#pragma\s+message\(([0-9][0-9])([0-9][0-9])([0-9]+)\s+([0-9]+)\)', retv) if re_match: @@ -1283,7 +1242,7 @@ class FatBinaryTool(object): # and launch lipo to create the universal binary file. cmd_line = ' '.join(lipo_argv) print("Launching: " + cmd_line) - retv = subprocess.call(lipo_argv) + retv = util.subproc_call_flushed(lipo_argv) if retv != 0: raise Exception("Creating a universal file failed -> " + cmd_line) else: @@ -1386,7 +1345,7 @@ class DyLibInstallNameInfoInspector(object): argv.append(depends_dict[key]) argv.append(dylib) #print("modify_depends(): ", argv) - subprocess.check_call(argv) + util.subproc_check_call_flushed(argv) def change_rpaths(self, dylib, rpaths_dict): argv = ['install_name_tool'] @@ -1396,7 +1355,7 @@ class DyLibInstallNameInfoInspector(object): argv.append(rpaths_dict[key]) argv.append(dylib) #print("change_rpaths(): ", argv) - subprocess.check_call(argv) + util.subproc_check_call_flushed(argv) def delete_rpaths(self, dylib, rpath_list): argv = ['install_name_tool'] @@ -1405,36 +1364,26 @@ class DyLibInstallNameInfoInspector(object): argv.append(rpath) argv.append(dylib) #print("change_rpaths(): ", argv) - subprocess.check_call(argv) + util.subproc_check_call_flushed(argv) def modify_install_name(self, dylib, install_name): argv = ['install_name_tool', '-id', install_name, dylib] - subprocess.check_call(argv) + util.subproc_check_call_flushed(argv) class BuildScriptInstaller(object): - def __init__(self, top_dir=None, verbose=False): + def __init__(self, verbose=False): self._logger = logging.getLogger(__name__) # print("BuildScriptInstaller.__init__(): __name__=" + __name__) self._verbose = verbose - self._sys_info = system.SystemInfo() - if top_dir is None: - top_dir = os.getcwd() - else: - assert os.path.exists(top_dir) - self._top_dir = top_dir def set_verbose(self, verbose): self._verbose = verbose - def get_top_dir(self): - return self._top_dir - - def install_script(self, inst_dir, script, modules, rename=None): + def install_script(self, inst_dir, script, modules): assert inst_dir is not None script = os.path.abspath(script) - src_dir = os.path.dirname(script) module_flist = [] package_dir_set = set() # python modules are specified in import syntax like "<package>.<name>". @@ -1460,16 +1409,27 @@ class BuildScriptInstaller(object): # make sure all files exist before trying to copy anything. if not os.path.exists(script): raise Exception("file " + script + " does not exist.") + # key = module_file_path, value = file system path + # e.g. pyhhi/build/common/ver.py must be mapped to a directory listed by sys.path. + module_flist_src_dict = {} for f in module_flist: - fpath = os.path.join(src_dir, f) - if not os.path.exists(fpath): - raise Exception("file " + fpath + " does not exist.") + for pth in sys.path: + fpath = os.path.join(pth, f) + if os.path.exists(fpath): + module_flist_src_dict[f] = fpath + break + else: + fpath = None + if fpath is None: + raise Exception("module file {0} not found.".format(fpath)) + # create destination directory if not os.path.exists(inst_dir): os.makedirs(inst_dir) for f in module_flist: - fpath_src = os.path.join(src_dir, f) + assert f in module_flist_src_dict + fpath_src = module_flist_src_dict[f] dname = os.path.dirname(f) dst_dir = os.path.join(inst_dir, dname) #print("cp " + fpath_src + " -> " + os.path.join(dst_dir, dname)) @@ -1481,12 +1441,7 @@ class BuildScriptInstaller(object): shutil.copy(fpath_src, dst_dir) # copy the script to <inst_dir> - if rename is None: - if self._verbose: - print("copying %-15s %s" % (os.path.basename(script), inst_dir)) - shutil.copy(script, inst_dir) - else: - if self._verbose: - print("copying %-15s %s" % (os.path.basename(script), os.path.join(inst_dir, rename))) - shutil.copy2(script, os.path.join(inst_dir, rename)) + if self._verbose: + print("copying %-15s %s" % (os.path.basename(script), inst_dir)) + shutil.copy(script, inst_dir) diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/cmbldver.py b/cmake/CMakeBuild/bin/pyhhi/build/common/cmbldver.py new file mode 100755 index 0000000000000000000000000000000000000000..d065c13a0878ef863fceb52428fd41791ee74447 --- /dev/null +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/cmbldver.py @@ -0,0 +1,7 @@ + +#-- WARNING -- +# This file is automatically generated by CMake. +# Any manual changes here will be overridden by the next build. +#------------- + +CMAKE_BUILD_VERSION_STR = "3.13.0.2" diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/error.py b/cmake/CMakeBuild/bin/pyhhi/build/common/error.py new file mode 100755 index 0000000000000000000000000000000000000000..e1822f3d2a6d462012263bb11edb1d5635ab9ee1 --- /dev/null +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/error.py @@ -0,0 +1,30 @@ + + +class BaseError(Exception): + """Base exception with a hint whether to list traceback information or not. + + Attributes: + msg -- explanation of the error + list_traceback -- hint to an application level exception handler whether to list traceback information or not. + """ + + def __init__(self, msg, list_traceback=True): + self.msg = msg + self.list_traceback = list_traceback + + def __str__(self): + return self.msg + + +class InvalidInputParameterError(BaseError): + """Exception raised for invalid input parameters.""" + + def __init__(self, msg, list_traceback=False): + BaseError.__init__(self, msg, list_traceback) + + +class InvalidCommandLineArgumentError(BaseError): + """Exception raised for invalid command line arguments.""" + + def __init__(self, msg, list_traceback=False): + BaseError.__init__(self, msg, list_traceback) diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/system.py b/cmake/CMakeBuild/bin/pyhhi/build/common/system.py old mode 100644 new mode 100755 index 0d5e9f4eb007247756f304d92bb6828bf7899bea..69b02ea583eccf03b5874e87fad9041468c27a9e --- a/cmake/CMakeBuild/bin/pyhhi/build/common/system.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/system.py @@ -1,15 +1,7 @@ -# -# Copyright: -# 2016 Fraunhofer Institute for Telecommunications, Heinrich-Hertz-Institut (HHI) -# The copyright of this software source code is the property of HHI. -# This software may be used and/or copied only with the written permission -# of HHI and in accordance with the terms and conditions stipulated -# in the agreement/contract under which the software has been supplied. -# The software distributed under this license is distributed on an "AS IS" basis, -# WITHOUT WARRANTY OF ANY KIND, either expressed or implied. -# + from __future__ import print_function +import multiprocessing import logging import platform import os @@ -41,6 +33,7 @@ class SystemInfo(object): self._os_distro = platform.platform() # self._os_distro_short = platform.platform() self._win32api_installed = False + self._windows_msys = False self._redhat_system = False self._debian_system = False self._suse_system = False @@ -50,7 +43,7 @@ class SystemInfo(object): self._os_codename = 'unknown' self._os_arch = 'x86_64' self._os_version = (0, 0, 0) - self._num_processors = 1 + self._num_processors = multiprocessing.cpu_count() platform_system = platform.system().lower() self._platform_system = platform_system @@ -71,13 +64,10 @@ class SystemInfo(object): # there's no portable way in python to obtain the linux version. self._query_linux_distro_info() - # there's no portable way in python to obtain the number of installed processors. - self._query_linux_num_cpus() - if self.is_debian(): self._pkg_fmt = 'deb' self._pkg_arch = subprocess.check_output(['dpkg', '--print-architecture'], universal_newlines=True).rstrip() - elif (self.is_redhat() or self.is_suse()): + elif self.is_redhat() or self.is_suse(): self._pkg_fmt = 'rpm' self._pkg_arch = subprocess.check_output(['rpm', '--eval', '%_arch'], universal_newlines=True).rstrip() else: @@ -91,20 +81,13 @@ class SystemInfo(object): self._program_dir = None self._program_data_dir = None + if 'MSYSTEM' in os.environ: + self._windows_msys = True + # obtain additional version information # windows 7: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free') self._os_version = ver.version_tuple_from_str(platform.win32_ver()[1]) - try: - import win32api - - # great, win32api module is installed. - self._win32api_installed = True - except ImportError: - # we don't have any dependencies on the win32 extensions anymore but some scripts might have and can - # figure out whether the extensions are available or not. - pass - # Hm, win32api not installed/available -> system detection may not by accurate and includes some guessing. if platform.architecture()[0] != '64bit': self._python_arch = 'x86' @@ -113,9 +96,6 @@ class SystemInfo(object): # 32 bit python interpreter and 64 bit windows self._os_arch = 'x86_64' - if 'NUMBER_OF_PROCESSORS' in os.environ: - self._num_processors = int(os.getenv('NUMBER_OF_PROCESSORS')) - if self._os_arch == 'x86_64': if self._python_arch == 'x86': self._program_dir = os.getenv('PROGRAMW6432') @@ -130,8 +110,12 @@ class SystemInfo(object): assert False assert self._program_dir is not None self._program_data_dir = os.getenv('PROGRAMDATA') - if os.path.exists(os.path.join(r'C:\Windows', 'py.exe')): + + if self._windows_msys: + pass + elif os.path.exists(os.path.join(r'C:\Windows', 'py.exe')): self._python_launcher = os.path.join(r'C:\Windows', 'py.exe') + # probe the registry to ensure the shell will pass additional arguments to the # registered python interpreter. # if pywin_check: @@ -147,7 +131,8 @@ class SystemInfo(object): '10.10': 'yosemite', '10.11': 'el capitan', '10.12': 'sierra', - '10.13': 'high sierra'} + '10.13': 'high sierra', + '10.14': 'mojave'} # replace darwin by macosx self._platform_system = 'macosx' # e.g. ('10.7.4', ('', '', ''), 'x86_64') @@ -162,9 +147,6 @@ class SystemInfo(object): self._os_arch = mac_ver[2] # python architecture is the same as the macosx architecture self._python_arch = self._os_arch - # obtain the number of processors - retv = subprocess.check_output(["/usr/sbin/sysctl", "hw.ncpu"], universal_newlines=True) - self._num_processors = int(retv.rstrip().split()[1], 10) else: raise Exception('unsupported platform detected: ' + platform_system) self._query_home_dir() @@ -234,6 +216,9 @@ class SystemInfo(object): def is_windows8(self): return self.is_windows() and (self._os_version[0] == 6) and (self._os_version[1] == 2) + def is_windows_msys(self): + return self._windows_msys + def check_pywin_registry(self): assert self.is_windows() # Create a temporary script and invoke it to see whether argument passing works or not. @@ -265,9 +250,6 @@ class SystemInfo(object): raise Exception(msg) return True - def is_win32api_installed(self): - return self._win32api_installed - def check_os_detection(self, todo_list): if (self._os_version[0] == 0) and self.is_linux(): if not os.path.exists('/usr/bin/lsb_release'): @@ -380,6 +362,19 @@ class SystemInfo(object): if (comspec is None) or (not os.path.exists(comspec)): raise Exception("The environment variable COMSPEC must be fixed, please contact technical support.") + def get_subprocess_devnull(self): + if ver.version_compare(self._python_version, (3,3)) >= 0: + devnull = subprocess.DEVNULL + else: + self._logger.debug("attribute subprocess.DEVNULL not available (python < 3.3), using os.devnull instead") + devnull = self._get_devnull() + return devnull + + def _get_devnull(self): + if not hasattr(self, '_devnull'): + self._devnull = os.open(os.devnull, os.O_RDWR) + return self._devnull + def _query_linux_distro_info(self): if 'CRAYOS_VERSION' in os.environ: self._os_distro = 'cray' @@ -440,22 +435,6 @@ class SystemInfo(object): if re.match(r'(suse)|(opensuse)', self._os_distro): self._suse_system = True - def _query_linux_num_cpus(self): - """Query the system for the number of enabled processor cores.""" - re_processor = re.compile(r'^processor\s*:\s*\d+\s*', re.IGNORECASE) - num_procs = 0 - - with open("/proc/cpuinfo") as f: - for line in f: - if re_processor.match(line): - num_procs = num_procs + 1 - - if num_procs > 0: - self._num_processors = num_procs - else: - # last resort, something seems to be broken in the loop above. - self._num_processors = 1 - def _query_home_dir(self): home_dir = os.path.expanduser('~') # make sure the user's home directory exists diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/util.py b/cmake/CMakeBuild/bin/pyhhi/build/common/util.py old mode 100644 new mode 100755 index c8652be0d3bf5a9fddfb35ec0fe3bdd581ddfbec..a8b2719e182660ef6765b53dbf4058f4859a1dbd --- a/cmake/CMakeBuild/bin/pyhhi/build/common/util.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/util.py @@ -1,19 +1,38 @@ from __future__ import print_function +import inspect import logging import os -import sys -import re import platform +import re +import shutil +import stat +import subprocess +import sys import traceback -import inspect + + +# imports a base exception with an attribute to enable or disable traceback information. +from pyhhi.build.common.error import BaseError def exec_main_default_try(main_fnc, sys_exit_err=1, finally_action=None): """Execute main_fnc inside a try block and dump the callstack in case of exceptions.""" exit_error = False + prog_name = os.path.basename(sys.argv[0]) try: main_fnc() + # except (InvalidInputParameterError, InvalidCommandLineArgumentError) BaseError as e: + except BaseError as e: + exit_error = True + if e.list_traceback: + exc_type, exc_value, exc_traceback = sys.exc_info() + lines = traceback.format_exception(exc_type, exc_value, exc_traceback) + for line in lines[:-1]: + print(line.rstrip()) + print('-----') + print("{0}: error: {1}".format(prog_name, e.msg)) + except KeyboardInterrupt: exit_error = True #print("Keyboard interrupt signaled") @@ -35,8 +54,8 @@ def exec_main_default_try(main_fnc, sys_exit_err=1, finally_action=None): def app_args_add_log_level(parser): - parser.add_argument("--log-level", action="store", dest="log_level", choices=['warning', 'debug'], default="warning", - help="configure the log level [default: warning]") + parser.add_argument("--log-level", action="store", dest="log_level", choices=['warning', 'info', 'debug'], default="warning", + help="configure the log level [default: %(default)s]") def app_configure_logging(log_level): @@ -64,6 +83,13 @@ def normalize_path(fpath): return os.path.normpath(fpath) +def to_posix_path(fpath): + fpath = normalize_path(fpath) + if platform.system().lower() == 'windows': + fpath = fpath.replace('\\', '/') + return fpath + + def find_tool_on_path(tool, must_succeed=False, search_path=None): """Find a tool on the search path and return the full path.""" if os.path.isabs(tool): @@ -132,18 +158,26 @@ def get_top_dir(): def is_top_dir(top_dir): - if os.path.exists(os.path.join(top_dir, 'CMakeBuild', 'bin', 'cmake.py')): - return True - if os.path.exists(os.path.join(top_dir, 'BoostBuild', 'bin', 'bjam.py')) or os.path.exists(os.path.join(top_dir, 'BoostBuild', 'bin', 'bjam3.py')): + if not os.path.exists(top_dir): + return False + # Path check returns true if CMakeBuild is a top-level SVN external or Git submodule. + if not os.path.exists(os.path.join(top_dir, 'CMakeBuild')): + return False + if os.path.exists(os.path.join(top_dir, 'CMakeBuild', 'bin', 'cmake.py')) or os.path.exists(os.path.join(top_dir, 'CMakeBuild', 'CMakeBuild', 'bin', 'cmake.py')): return True + + # Check for CMakeBuild versioned subtree + cmakebuild_dir = os.path.join(top_dir, 'CMakeBuild') + for fname in os.listdir(cmakebuild_dir): + if os.path.isdir(os.path.join(cmakebuild_dir, fname)): + if os.path.exists(os.path.join(cmakebuild_dir, fname, 'CMakeBuild', 'bin', 'cmake.py')): + return True return False def get_script_dir(): py_util_fname = inspect.getfile(get_script_dir) # <top>/CMakeBuild/bin/pyhhi/build/common/util.py - # or - # <top>/BoostBuild/bin/pyhhi/build/common/util.py script_dir = os.path.normpath(os.path.join(os.path.dirname(py_util_fname), '..', '..', '..')) return script_dir @@ -193,3 +227,50 @@ def find_repo_name_from_src_path(src_path): repo_path = drive_path_comps[1] return repo_path.lstrip(os.path.sep).split(os.path.sep)[-1] + +def subproc_call_flushed(*popenargs, **kwargs): + """Run command with arguments. Wait for command to complete or + timeout, then return the returncode attribute. + + The arguments are the same as for the Popen constructor. Example: + + retcode = call(["ls", "-l"]) + """ + sys.stdout.flush() + return subprocess.call(*popenargs, **kwargs) + + +def subproc_check_call_flushed(*popenargs, **kwargs): + """Run command with arguments. Wait for command to complete. If + the exit code was zero then return, otherwise raise + CalledProcessError. The CalledProcessError object will have the + return code in the returncode attribute. + + The arguments are the same as for the call function. Example: + + check_call(["ls", "-l"]) + """ + sys.stdout.flush() + return subprocess.check_call(*popenargs, **kwargs) + + +def rmtree(directory): + """On Windows invokes rmtree_readonly() and on other platforms shutil.rmtree(). + This convenience function may be used as an replacement of shutil.rmtree(directory) + to be able to remove directory trees on Windows containing some readonly files. + """ + if sys.platform.startswith('win'): + rmtree_readonly(directory) + else: + shutil.rmtree(directory) + + +def rmtree_readonly(directory): + """Remove a directory tree on Windows where some files are readonly.""" + + def remove_readonly(func, path, _excinfo): + "Clear the readonly bit and reattempt the removal" + os.chmod(path, stat.S_IWRITE) + func(path) + + shutil.rmtree(directory, onerror=remove_readonly) diff --git a/cmake/CMakeBuild/bin/pyhhi/build/common/ver.py b/cmake/CMakeBuild/bin/pyhhi/build/common/ver.py old mode 100644 new mode 100755 index 6b97315ea81bf3a89051541c1d3db3e70c0b35c4..90e80eee8dc9a89cc7b3dcb30308265e344294b4 --- a/cmake/CMakeBuild/bin/pyhhi/build/common/ver.py +++ b/cmake/CMakeBuild/bin/pyhhi/build/common/ver.py @@ -1,3 +1,4 @@ + from __future__ import print_function import platform @@ -5,8 +6,15 @@ import re import os.path import plistlib import subprocess +import functools + import pyhhi.build.common.util as util +import pyhhi.build.common.cmbldver as cmbldver + + +def get_cmake_build_version(): + return version_tuple_from_str(cmbldver.CMAKE_BUILD_VERSION_STR) def _get_python_version_numeric(): @@ -99,44 +107,22 @@ def version_compare(version1, version2): def version_list_sort(version_list): - """Return a list of version tuples in ascending order.""" - return sorted(version_list, key=_version_tuple_key_fnc(version_compare)) - - -def _version_tuple_key_fnc(cmp_fnc): - """Convert a cmp= function into a key= function""" - class K(object): - def __init__(self, obj, *args): - self.obj = obj - - def __lt__(self, other): - return cmp_fnc(self.obj, other.obj) < 0 - def __gt__(self, other): - return cmp_fnc(self.obj, other.obj) > 0 + # Written for Python 2.7 and 3.x: functools.cmp_to_key() requires 2.7 or higher. - def __eq__(self, other): - return cmp_fnc(self.obj, other.obj) == 0 - - def __le__(self, other): - return cmp_fnc(self.obj, other.obj) <= 0 - - def __ge__(self, other): - return cmp_fnc(self.obj, other.obj) >= 0 - - def __ne__(self, other): - return cmp_fnc(self.obj, other.obj) != 0 - return K + # Notes: python 2.x supports a second argument cmp to specify the comparision function but + # python 3.x does not. + return sorted(version_list, key=functools.cmp_to_key(version_compare)) def version_str_to_rpm_version_tuple(version): re_match = re.match(r'([^-]+)-(\S+)', version) if re_match: - return (re_match.group(1), re_match.group(2)) + return re_match.group(1), re_match.group(2) else: re_match = re.match(r'([\d.-]+)[-.](\d+)', version) if re_match: - return (re_match.group(1), re_match.group(2)) + return re_match.group(1), re_match.group(2) raise Exception("The version string '" + version + "' is not a valid RPM version string.") @@ -165,29 +151,36 @@ def _parse_version_h_file(version_file, verbatim=False): if not os.path.exists(version_file): raise Exception("version file '" + version_file + "' does not exist.") - # convert it into an absolute path so that we can get the directory name, which is required for the parser logic below. - version_file = os.path.abspath(version_file) - if platform.system().lower() == 'windows': - drive_path_comps = os.path.splitdrive(version_file) - path_comps = os.path.split(drive_path_comps[1]) - else: - path_comps = os.path.split(version_file) - - dir = path_comps[0].split(os.path.sep)[-1] - version_tag = dir.upper() + '_VERSION' - re_version_str = re.compile(r'^#define\s+' + version_tag + r'\s+"([^"]+)') - re_version_str2 = re.compile(r'^#define\s+' + version_tag + r'\s+(\d+)') + re_version_expr = re.compile(r'(^#if\s+![ ]*defined\(.*)|(^#\s*define\s+\S+_VERSION\s+)') + re_version_tag_expr = re.compile(r'^#if\s+!\s*defined\(\s*([a-zA-Z0-9_]+)\s*\)') + version_tag = None with open(version_file) as f: for line in f: - re_match = re_version_str.match(line) + re_match = re_version_expr.match(line) if not re_match: - re_match = re_version_str2.match(line) - if re_match: - if verbatim: - return re_match.group(1) - else: - return version_tuple_from_str(re_match.group(1)) + continue + # print("version.h: found cpp line: {}".format(line)) + if version_tag is None: + re_match = re_version_tag_expr.match(line) + if re_match: + version_tag = re_match.group(1) + # print("found version tag: {}".format(version_tag)) + re_version_str = re.compile(r'^#define\s+{}\s+"([^"]+)'.format(version_tag)) + re_version_str2 = re.compile(r'^#define\s+{}\s+(\d+)'.format(version_tag)) + continue + else: + # print("checking cpp line: {}".format(line)) + # version tag found + re_match = re_version_str.match(line) + if not re_match: + re_match = re_version_str2.match(line) + if re_match: + if verbatim: + return re_match.group(1) + else: + return version_tuple_from_str(re_match.group(1)) + raise Exception("No version ID found in file '" + version_file + "'.") diff --git a/cmake/CMakeBuild/bin/pyhhi/build/vcsutil.py b/cmake/CMakeBuild/bin/pyhhi/build/vcsutil.py new file mode 100755 index 0000000000000000000000000000000000000000..409e3b7c6b0543e2ebb4dfe3756a883ac895fc70 --- /dev/null +++ b/cmake/CMakeBuild/bin/pyhhi/build/vcsutil.py @@ -0,0 +1,896 @@ + +from __future__ import print_function + +import logging +import os +import posixpath +import re +import shutil +import subprocess +import sys +import tempfile + +import pyhhi.build.common.ver as ver +import pyhhi.build.common.util as util + +from pyhhi.build.common.system import SystemInfo + + +class VcsCommandTracer(object): + + def __init__(self, enable_command_history=True): + self._logger = logging.getLogger(__name__) + if self._logger.isEnabledFor(logging.DEBUG): + self._verbosity_level = 1 + else: + self._verbosity_level = 0 + self._prog_name = os.path.basename(sys.argv[0]) + self._command_history = [] + self._enable_command_history = enable_command_history + + def add_to_command_history(self, cmd_argv): + if self._enable_command_history: + self._command_history.append(' '.join(cmd_argv)) + + def get_command_history(self): + return self._command_history + + def clear_command_history(self): + self._command_history = [] + + def trace_command(self, cmd_argv): + if self._verbosity_level > 0: + print("Launching: %s" % ' '.join(cmd_argv)) + self.add_to_command_history(cmd_argv) + + +class VcsUrl(object): + + def __init__(self, url_str=None): + self._sys_info = SystemInfo() + self._proto = None + self._username = None + self._host = None + self._resource_path = None + self._re_scp_url = re.compile(r'^([^@/\\:]+)@([^:]+):([^/].+)$') + + if url_str: + (self._proto, self._username, self._host, self._resource_path) = self.parse_from_string(url_str) + + def get_protocol(self): + return self._proto + + def get_hostname(self): + return self._host + + def get_username(self): + return self._username + + def get_resource_path(self, native=False): + if self._resource_path: + if native and (self._proto is not None) and (self._proto == 'file') and self._sys_info.is_windows(): + # Convert the resource path to a native file system path. + if self._resource_path.startswith('/'): + assert len(self._resource_path) > 1 + return os.path.normpath(self._resource_path[1:]) + elif re.match(r'^[a-zA-Z]:', self._resource_path): + assert len(self._resource_path) > 2 + return os.path.normpath(self._resource_path) + return self._resource_path + + def set_resource_path(self, res_path): + self._resource_path = res_path + + def parse_from_string(self, url_str): + proto = None + username = None + host = None + resource_path = None + + re_match = self._re_scp_url.match(url_str) + if re_match: + # Split scp URL + proto = 'ssh' + username = re_match.group(1) + host = re_match.group(2) + resource_path = re_match.group(3) + else: + # Check for proto:// + re_match = re.match(r'^([a-z][^:/]+)://(.+)$', url_str) + if re_match: + proto = re_match.group(1) + if proto == 'file': + # A relative path will be converted into an absolute path. + resource_path = re_match.group(2) + if self._sys_info.is_windows(): + fs_path_native = os.path.abspath(os.path.normpath(resource_path)) + resource_path = util.to_posix_path(fs_path_native) + else: + resource_path = os.path.abspath(resource_path) + else: + host_res_path = re_match.group(2) + re_match = re.match(r'^([^/]+)/(.+)$', host_res_path) + if re_match: + host_part = re_match.group(1) + host = host_part + resource_path = re_match.group(2) + if proto == 'ssh': + # Analyze the host_part + re_match = re.match(r'([^@]+)@([^@]+)$', host_part) + if re_match: + username = re_match.group(1) + host = re_match.group(2) + else: + # Unsupported URL + raise Exception("Unsupported URL: {0}".format(url_str)) + else: + # Assume a native file system path. + proto = 'file' + fpath_abs = os.path.abspath(url_str) + # On windows backslashes are converted to slashes. + resource_path = util.to_posix_path(fpath_abs) + + self._proto = proto + self._username = username + self._host = host + if resource_path is None: + self._resource_path = resource_path + else: + if proto != 'file': + # Windows file URLs start with a driver letter and are not supported by posixpath. + # Example file://C:/Users/user -> resource path C:/Users/user. + resource_path = posixpath.normpath(resource_path) + self._resource_path = resource_path + + return proto, username, host, resource_path + + def __str__(self): + if self._proto == 'file': + s = "{0}://{1}".format(self._proto, self._resource_path) + elif (self._proto == 'ssh') and (self._username is not None): + s = "{0}://{1}@{2}/{3}".format(self._proto, self._username, self._host, self._resource_path) + else: + s = "{0}://{1}/{2}".format(self._proto, self._host, self._resource_path) + return s + + +class VcsUtil(object): + + def __init__(self, cmd_tracer=None): + self._logger = logging.getLogger(__name__) + self._sys_info = SystemInfo() + self._remove_tmp_files = True + if self._logger.isEnabledFor(logging.DEBUG): + self._remove_tmp_files = False + self._re_empty_line = re.compile(r'^\s*$') + self._prog_name = os.path.basename(sys.argv[0]) + if cmd_tracer is None: + self._cmd_tracer = VcsCommandTracer() + else: + self._cmd_tracer = cmd_tracer + + def get_subprocess_devnull(self): + return self._sys_info.get_subprocess_devnull() + + def strip_empty_comment_lines(self, comment_lines): + """Strip empty lines at the beginning and from the end of comment lines passed and return them.""" + + if not comment_lines: + return comment_lines + while len(comment_lines) > 0: + if self._re_empty_line.match(comment_lines[0]): + comment_lines.pop(0) + else: + break + while len(comment_lines) > 0: + if self._re_empty_line.match(comment_lines[-1]): + comment_lines.pop() + else: + break + return comment_lines + + def save_comment_lines_tmpf(self, comment_lines, add_final_newline=True): + assert len(comment_lines) > 0 + (tmp_fh, tmp_fname) = tempfile.mkstemp(text=True) + tmp_file = os.fdopen(tmp_fh, 'w') + tmp_file.write('\n'.join(comment_lines)) + if add_final_newline: + # and one newline to terminate the last line. + tmp_file.write('\n') + tmp_file.close() + return tmp_fname + + def remove_tmp_file(self, fname): + if not os.path.exists(fname): + return + if self._remove_tmp_files: + os.remove(fname) + else: + print("Keeping temporary file: ", fname) + + +class GitHelper(VcsUtil): + + def __init__(self, cmd_tracer=None): + VcsUtil.__init__(self, cmd_tracer) + self._logger = logging.getLogger(__name__) + # git-svn-id: https://visvn.fe.hhi.de/svn/svn_CMakeBuild/tags/3.11.2-1@791 a315372b-2729-4e68-a986-494f0c48443b + self._re_svn_import_id = re.compile(r'^(git-svn-id|svntogit-id):\s*([^@]+)@([0-9]+)\s+(\S+)') + # Attribute _git_executable reserved for future extensions. + self._git_executable = util.find_tool_on_path('git', must_succeed=True) + self._git_version = self._discover_git_version() + + def _discover_git_version(self): + git_argv = [self._git_executable, '--version'] + retv = subprocess.check_output(git_argv, universal_newlines=True) + lines = retv.splitlines() + re_match = re.search(r'[0-9.]+\.\d+', lines[0]) + if re_match: + git_version = ver.version_tuple_from_str(re_match.group(0)) + return git_version + else: + raise Exception("git --version returned: '{0}' - version expression not understood.".format(retv)) + + def get_git_executable(self): + return self._git_executable + + def get_git_version(self): + return self._git_version + + def get_command_history(self): + return self._cmd_tracer.get_command_history() + + def clear_command_history(self): + self._cmd_tracer.clear_command_history() + + def is_empty_repo(self, repo_dir=None): + git_argv = [self._git_executable, 'show-ref', '-q'] + # Save initial current working directory + cur_dir = os.getcwd() + if repo_dir is None: + assert os.path.exists(os.path.join(cur_dir, '.git')) + self.trace_git_command(git_argv) + retv = util.subproc_call_flushed(git_argv) + else: + assert os.path.exists(os.path.join(repo_dir, '.git')) + os.chdir(repo_dir) + self.trace_git_command(git_argv) + retv = util.subproc_call_flushed(git_argv) + # Recover initial current working directory + os.chdir(cur_dir) + return retv != 0 + + def get_local_branches(self): + local_branches = [] + git_argv = [self._git_executable, 'branch'] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + re_expr = re.compile(r'^\*?\s+(\S+)') + for line in retv.splitlines(): + l = line.rstrip() + re_match = re_expr.match(l) + if re_match: + local_branches.append(re_match.group(1)) + return local_branches + + def get_remote_branches(self, repo='origin'): + remote_branches = [] + git_argv = [self._git_executable, 'ls-remote', '--heads', repo] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + re_expr = re.compile(r'\S+\s+refs/heads/(\S+)') + for line in retv.splitlines(): + l = line.rstrip().lstrip() + re_match = re_expr.match(l) + if re_match: + remote_branches.append(re_match.group(1)) + return remote_branches + + def get_local_tags(self): + local_tags = [] + git_argv = [self._git_executable, 'tag'] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + for line in retv.splitlines(): + l = line.rstrip().lstrip() + if re.match(r'^\S+', l): + local_tags.append(l) + return local_tags + + def get_remote_tags(self, repo='origin'): + remote_tags = [] + git_argv = [self._git_executable, 'ls-remote', '--tags', '--refs', repo] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + # 5acba4bba0159c921d3e9de82a450d0e48092d1f refs/tags/3.10.1-1 + re_expr = re.compile(r'\S+\s+refs/tags/(\S+)') + for line in retv.splitlines(): + l = line.rstrip().lstrip() + re_match = re_expr.match(l) + if re_match: + remote_tags.append(re_match.group(1)) + return remote_tags + + def get_submodule_paths(self): + submd_paths = [] + if not os.path.exists('.gitmodules'): + # If .gitmodules does not exist, we don't have any submodules. + # If it does exist, we may have some provided the file is not empty. + return submd_paths + elif os.stat('.gitmodules').st_size == 0: + # Check for empty .gitmodules + return submd_paths + + if ver.version_compare(self._git_version, (2, 7)) < 0: + raise Exception("git version {0} is too old, please update to 2.7 or higher".format(ver.version_tuple_to_str(self._git_version))) + git_argv = [self._git_executable, 'submodule--helper', 'list'] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + for line in retv.splitlines(): + if self._re_empty_line.match(line): + continue + l = line.rstrip().lstrip() + fields = l.split() + if fields: + self._logger.debug("found submodule path {0}".format(fields[-1])) + submd_paths.append(fields[-1]) + return submd_paths + + def get_tag_log(self, tag, strip_git_svn_id=False, strip_empty_lines=True): + tag_log = [] + git_argv = [self._git_executable, 'tag', '-l', '--format=%(contents)', tag] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + log_lines = retv.splitlines() + for line in log_lines: + if strip_git_svn_id and (line.startswith('git-svn-id:') or line.startswith('svntogit-id:')): + continue + tag_log.append(line) + if strip_empty_lines: + tag_log = self.strip_empty_comment_lines(tag_log) + return tag_log + + def get_commit_hash(self, tag=None): + git_argv = [self._git_executable, 'rev-list', '-n', '1'] + if tag is None: + git_argv.append('HEAD') + else: + git_argv.append(tag) + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + return retv.lstrip().rstrip() + + def parse_svn_import_id(self, comment_lines): + for line in comment_lines: + re_match = self._re_svn_import_id.match(line) + if re_match: + svn_url = re_match.group(2) + svn_rev = int(re_match.group(3)) + svn_repo_uuid = re_match.group(4) + return svn_url, svn_rev, svn_repo_uuid + return None + + def get_wc_commit_log(self, strip_git_svn_id=True, strip_empty_lines=True): + commit_log = [] + # List commit message preserving newlines. + git_argv = [self._git_executable, 'log', '--pretty=tformat:%B', '-n', '1'] + self.trace_git_command(git_argv) + retv = subprocess.check_output(git_argv, universal_newlines=True) + log_lines = retv.splitlines() + for line in log_lines: + if strip_git_svn_id and line.startswith('git-svn-id:'): + continue + commit_log.append(line) + if strip_empty_lines: + # Strip leading and trailing empty lines + commit_log = self.strip_empty_comment_lines(commit_log) + return commit_log + + def trace_git_command(self, git_argv): + self._cmd_tracer.trace_command(git_argv) + + def get_latest_cmakebuild_tag(self, cmakebuild_repo): + cmakebuild_tags = self.get_remote_tags(cmakebuild_repo) + cmakebuild_version_list = [] + cmakebuild_release_tag_map = {} + re_expr_release_tag = re.compile(r'^[0-9.-]+$') + for tag in cmakebuild_tags: + if re_expr_release_tag.match(tag): + # Release tag found + cmakebuild_version = ver.version_tuple_from_str(tag) + cmakebuild_version_list.append(cmakebuild_version) + cmakebuild_version_str = ver.version_tuple_to_str(cmakebuild_version) + # Adds a mapping from a normalized version string to the tag: e.g. 3.12.3.4 -> 3.12.3-4 + cmakebuild_release_tag_map[cmakebuild_version_str] = tag + else: + self._logger.info("ignoring CMakeBuild tag {} - it does not match the release pattern.".format(tag)) + if not cmakebuild_version_list: + raise Exception("No CMakeBuild release tag found.") + cmakebuild_version_list = ver.version_list_sort(cmakebuild_version_list) + cmakebuild_version = cmakebuild_version_list[-1] + cmakebuild_tag = cmakebuild_release_tag_map[ver.version_tuple_to_str(cmakebuild_version)] + self._logger.info("selecting CMakeBuild tag {}".format(cmakebuild_tag)) + return cmakebuild_tag + + +class SvnProperties(object): + + def __init__(self): + self._svn_prop_list = [] + # key = svn property, value = list of property values + self._svn_prop_value_dict = {} + + def is_empty(self): + return len(self._svn_prop_list) == 0 + + def clear(self): + self._svn_prop_list = [] + self._svn_prop_value_dict = {} + + def add_property(self, prop, prop_values): + # Each property must have at least one associated value. + assert len(prop_values) >= 1 + self._svn_prop_list.append(prop) + self._svn_prop_value_dict[prop] = prop_values + + def update_property(self, prop, prop_values): + # Each property must have at least one associated value. + assert len(prop_values) >= 1 + assert self.has_property(prop) + self._svn_prop_value_dict[prop] = prop_values + + def get_property_list(self): + return self._svn_prop_list + + def has_property(self, prop): + if prop in self._svn_prop_value_dict: + return True + else: + return False + + def get_property(self, prop): + return self._svn_prop_value_dict[prop] + + def remove_property(self, prop): + if not self.has_property(prop): + return + self._svn_prop_list.remove(prop) + self._svn_prop_value_dict.pop(prop) + + def __str__(self): + if self.is_empty(): + return '' + lines = [] + for prop in self._svn_prop_list: + # lines.append("{0:>2}{1}".format(' ', prop)) + lines.append(prop) + for prop_value in self._svn_prop_value_dict[prop]: + # lines.append("{0:>4}{1}".format(' ', prop_value)) + lines.append("{0:>2}{1}".format(' ', prop_value)) + # SVN seems to be in favor of a newline terminating multivalue properties + if len(self._svn_prop_value_dict[prop]) > 1: + lines.append('\n') + # Serialize svn properties into a single string and avoid a duplicate newline after + # a multivalue property; e.g. + props_str = '' + for ln in lines: + if ln != '\n': + props_str += "{}\n".format(ln) + else: + # a newline value must not be duplicated. + props_str += ln + return props_str + + +class SvnPropFileParser(object): + + def __init__(self): + self._logger = logging.getLogger(__name__) + + def parse_property_file(self, filenm): + if not os.path.exists(filenm): + raise Exception("SVN property file {0} does not exist.".format(filenm)) + svn_prop_lines = [] + with open(filenm) as svnpropf: + for line in svnpropf: + l = line.rstrip() + svn_prop_lines.append(l) + svn_prop = self.parse_property_file_content(svn_prop_lines) + return svn_prop + + def parse_gitignore_file(self, filenm): + if not os.path.exists(filenm): + raise Exception("gitignore file {0} does not exist.".format(filenm)) + gitignore_lines = [] + with open(filenm) as svnpropf: + for line in svnpropf: + l = line.rstrip() + gitignore_lines.append(l) + svn_prop = self.parse_gitignore_file_content(gitignore_lines) + return svn_prop + + def parse_property_file_content(self, svn_prop_lines): + svn_prop = SvnProperties() + prop_name = None + prop_value_list = [] + re_prop_name = re.compile(r'^(\s*)(\S+)') + re_discard_line = re.compile(r'(^\s*$)|(^#.*$)|(^Properties on.*$)') + line_cnt = 1 + while len(svn_prop_lines) > 0: + line = svn_prop_lines[0] + if not re_discard_line.match(line): + # print(line) + if prop_name is None: + # This line is supposed to contain a property like svn:ignore, leading ws is supported. + re_match = re_prop_name.match(line) + if re_match: + leading_ws_prop_name = re_match.group(1) + prop_name = re_match.group(2) + prop_value_list = [] + else: + raise Exception("SVN property parsing error at line {0:d}: {1}".format(line_cnt, line)) + else: + # Next property value or next property name? + if line.startswith(' ' + leading_ws_prop_name): + prop_value = line.lstrip() + prop_value_list.append(prop_value) + else: + if prop_value_list: + svn_prop.add_property(prop_name, prop_value_list) + else: + self._logger.debug("ignoring empty SVN property: {0}".format(prop_name)) + # print("new property: {0} -> {1}".format(prop_name, ' '.join(prop_value_list))) + prop_name = None + prop_value_list = [] + # This line must be reparsed, it's the next property. + continue + else: + self._logger.debug("ignoring line: {0}".format(line)) + svn_prop_lines.pop(0) + line_cnt = line_cnt + 1 + + if prop_name is not None: + if prop_value_list: + svn_prop.add_property(prop_name, prop_value_list) + # print("new property: {0} -> {1}".format(prop_name, ' '.join(prop_value_list))) + #if not svn_prop.is_empty(): + # print(svn_prop) + return svn_prop + + def parse_gitignore_file_content(self, gitignore_lines, svn_prop=None): + svn_ignores = [] + re_discard_line = re.compile(r'(^\s*$)|(^#.*$)') + re_top_folder = re.compile(r'^/([^/]+)/$') + re_folder = re.compile(r'^([^/]+)/$') + + for line in gitignore_lines: + if re_discard_line.match(line): + continue + ln_trimmed = line.lstrip().rstrip() + if '/' in ln_trimmed: + re_match = re_top_folder.match(ln_trimmed) + if re_match: + svn_ignores.append(re_match.group(1)) + continue + re_match = re_folder.match(ln_trimmed) + if re_match: + svn_ignores.append(re_match.group(1)) + continue + else: + svn_ignores.append(ln_trimmed) + + if svn_ignores: + if svn_prop is None: + svn_prop = SvnProperties() + svn_prop.add_property('svn:ignore', svn_ignores) + return svn_prop + + +class SvnHelper(VcsUtil): + + def __init__(self, cmd_tracer=None): + VcsUtil.__init__(self, cmd_tracer) + self._logger = logging.getLogger(__name__) + self._dry_run = False + + self._svn_repo_std_layout = True + # Not really useful right now but added for future extensions to deal with platforms + # which don't have svn on the search path (e.g. windows or macOS). + self._svn_executable = util.find_tool_on_path('svn', must_succeed=True) + self._svnadmin_executable = self._find_svnadmin() + self._svnmucc_executable = self._find_svnmucc() + + def _find_svnadmin(self): + if os.path.isabs(self._svn_executable): + svn_prog = self._svn_executable + else: + svn_prog = util.find_tool_on_path('svn', must_succeed=True) + svn_dir = os.path.dirname(svn_prog) + if self._sys_info.is_windows(): + svnadmin = os.path.join(svn_dir, 'svnadmin.{0}'.format('exe')) + else: + svnadmin = os.path.join(svn_dir, 'svnadmin') + return svnadmin + + def _find_svnmucc(self): + if os.path.isabs(self._svn_executable): + svn_prog = self._svn_executable + else: + svn_prog = util.find_tool_on_path('svn', must_succeed=True) + svn_dir = os.path.dirname(svn_prog) + if self._sys_info.is_windows(): + svnmucc = os.path.join(svn_dir, 'svnmucc.{0}'.format('exe')) + else: + svnmucc = os.path.join(svn_dir, 'svnmucc') + if not os.path.exists(svnmucc): + svnmucc = None + return svnmucc + + def set_dry_run(self, dry_run=True): + self._dry_run = dry_run + + def get_svn_executable(self): + return self._svn_executable + + def get_svnadmin_executable(self): + return self._svnadmin_executable + + def create_empty_repository(self, repo_path, std_layout=True): + repo_path = os.path.normpath(os.path.abspath(repo_path)) + if os.path.exists(repo_path): + raise Exception("SVN repository path {} already exists.".format(repo_path)) + repo_dir = os.path.dirname(repo_path) + if not os.path.exists(repo_dir): + os.makedirs(repo_dir) + svn_argv = [self._svnadmin_executable, 'create', repo_path] + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + if std_layout: + svn_repo_path_posix = util.to_posix_path(repo_path) + for pth in ['trunk', 'branches', 'tags']: + svn_url = "file://{0}/{1}".format(svn_repo_path_posix, pth) + svn_argv = [self._svn_executable, 'mkdir', '-m', 'creating folder {}'.format(pth), svn_url] + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + + def has_svnmucc(self): + return self._svnmucc_executable is not None + + def get_svnmucc_executable(self): + return self._svn_executable + + def get_command_history(self): + return self._cmd_tracer.get_command_history() + + def clear_command_history(self): + self._cmd_tracer.clear_command_history() + + def get_tag_url(self, svn_repo, tag): + assert self._svn_repo_std_layout + return "{0}/tags/{1}".format(svn_repo, tag) + + def get_branch_url(self, svn_repo, branch): + assert self._svn_repo_std_layout + if branch == 'trunk': + return "{0}/{1}".format(svn_repo, branch) + else: + return "{0}/branches/{1}".format(svn_repo, branch) + + def get_tags(self, svn_repo, with_rev=False): + tags = self.get_svn_folders(svn_repo + '/tags', with_rev) + return tags + + def get_latest_tag(self, svn_repo): + tags = self.get_tags(svn_repo) + if not tags: + return None + tag_rev_list = [] + for tag in tags: + svn_tag_url = self.get_tag_url(svn_repo, tag) + tag_rev = self.get_svn_rev(svn_tag_url) + tag_rev_list.append(tuple([tag, tag_rev])) + # Sort by revision + tag_rev_list = sorted(tag_rev_list, key=lambda tag_rev: tag_rev[1]) + (latest_tag, tag_rev) = tag_rev_list[-1] + return latest_tag + + def get_branches(self, svn_repo, with_rev=False): + branches = self.get_svn_folders(svn_repo + '/branches', with_rev) + return branches + + def get_svn_folders(self, svn_url, with_rev=False): + svn_folders = [] + svn_argv = [self._svn_executable, 'list', svn_url] + self.trace_svn_command(svn_argv) + retv = subprocess.check_output(svn_argv, universal_newlines=True) + re_trailing_slash = re.compile(r'^(.+)/$') + for line in retv.splitlines(): + l = line.rstrip().lstrip() + re_match = re_trailing_slash.match(l) + if re_match: + svn_folder = re_match.group(1) + if with_rev: + rev = self.get_svn_rev("{0}/{1}".format(svn_url, svn_folder)) + svn_folder += "@{0:d}".format(rev) + svn_folders.append(svn_folder) + return svn_folders + + def get_svn_rev(self, svn_url): + svn_argv = [self._svn_executable, 'info', '--show-item', 'last-changed-revision', svn_url] + self.trace_svn_command(svn_argv) + retv = subprocess.check_output(svn_argv, universal_newlines=True) + retv = retv.rstrip() + rev = int(retv) + return rev + + def get_repo_uuid(self, svn_repo): + svn_argv = [self._svn_executable, 'info', '--show-item', 'repos-uuid', svn_repo] + self.trace_svn_command(svn_argv) + retv = subprocess.check_output(svn_argv, universal_newlines=True) + retv = retv.lstrip().rstrip() + return retv + + def get_svn_log_msg(self, svn_url): + # svn log -l 1 https://visvn.fe.hhi.de/svn/svn_CMakeBuild/tags/3.11.0-1 + svn_argv = [self._svn_executable, 'log', '-l', '1', svn_url] + self.trace_svn_command(svn_argv) + retv = subprocess.check_output(svn_argv, universal_newlines=True) + comment_lines = retv.splitlines() + assert len(comment_lines) >= 3 + assert comment_lines[0].startswith('---') + comment_lines.pop(0) + # Drop rXXXX ... + comment_lines.pop(0) + assert comment_lines[-1].startswith('---') + comment_lines.pop() + comment_lines = self.strip_empty_comment_lines(comment_lines) + return comment_lines + + def svn_save_property_values_tmpf(self, prop_values): + tmp_fname = self.save_comment_lines_tmpf(prop_values) + return tmp_fname + + def svn_save_properties(self, svn_props, fname, header_lines=None): + svn_props_serialized = str(svn_props) + with open(fname, "w") as propf: + if header_lines: + header = '\n'.join(header_lines) + propf.write(header) + propf.write('\n') + propf.write(svn_props_serialized) + + def svn_read_properties(self, svn_res_path): + svn_argv = [self._svn_executable, 'proplist', '--verbose', svn_res_path] + self.trace_svn_command(svn_argv) + retv = subprocess.check_output(svn_argv, universal_newlines=True) + prop_lines = retv.splitlines() + prop_file_parser = SvnPropFileParser() + return prop_file_parser.parse_property_file_content(prop_lines) + + def svn_commit_wc(self, comment_lines, wc_dir): + tmp_fname = self.save_comment_lines_tmpf(comment_lines) + svn_argv = [self._svn_executable, 'ci', '-F', tmp_fname, wc_dir] + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + + def svn_import_wc(self, comment_lines, wc_dir, svn_url, global_ignores=None, quiet=False): + # svn import -F <file> --auto-props --config-option config:miscellany:global-ignores=.git wc_dir svn_url + # e.g. svn_url = https://visvn.fe.hhi.de/svn/svn_CMakeBuildClone/branches/imports/3.10.1-1 + tmp_fname = self.save_comment_lines_tmpf(comment_lines) + svn_argv = [self._svn_executable, 'import', '-F', tmp_fname, '--auto-props'] + # Add any global ignores. + if global_ignores: + svn_argv.extend(['--config-option', 'config:miscellany:global-ignores=' + ' '.join(global_ignores)]) + if quiet: + svn_argv.append('-q') + # finalize the command line + svn_argv.extend([wc_dir, svn_url]) + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + + def svn_set_properties_url(self, svn_url, svn_props, work_dir=None): + if svn_props.is_empty(): + return + if self.has_svnmucc(): + self._svn_set_properties_url_svnmucc(svn_url, svn_props) + else: + raise Exception("svn_set_properties_url() requires svnmucc which is not available.") + + def _svn_set_properties_url_svnmucc(self, svn_url, svn_props): + if svn_props.is_empty(): + return + tmp_files = [] + try: + svn_argv = [self._svnmucc_executable] + (svn_url_prefix, svn_path) = self.svn_split_url(svn_url) + for prop in svn_props.get_property_list(): + prop_values = svn_props.get_property(prop) + if len(prop_values) > 1: + tmp_fname = self.svn_save_property_values_tmpf(prop_values) + tmp_files.append(tmp_fname) + svn_argv.extend(['propsetf', prop, tmp_fname, svn_path]) + else: + svn_argv.extend(['propset', prop, prop_values[0], svn_path]) + svn_argv.append('-m') + svn_argv.append("Properties inserted by {0}".format(self._prog_name)) + svn_argv.extend(['-U', svn_url_prefix]) + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + finally: + for pth in tmp_files: + if os.path.exists(pth): + os.remove(pth) + + def svn_set_properties_wc(self, svn_props, work_dir): + if svn_props.is_empty(): + return + tmp_files = [] + try: + for prop in svn_props.get_property_list(): + prop_values = svn_props.get_property(prop) + if len(prop_values) > 1: + tmp_fname = self.svn_save_property_values_tmpf(prop_values) + tmp_files.append(tmp_fname) + svn_argv = [self._svn_executable, 'propset', prop, '-F', tmp_fname, work_dir] + else: + svn_argv = [self._svn_executable, 'propset', prop, prop_values[0], work_dir] + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + finally: + for pth in tmp_files: + if os.path.exists(pth): + os.remove(pth) + + def svn_remote_copy(self, comment_lines, svn_url_src, svn_url_dst, create_intermediate_folders=True): + tmp_fname = self.save_comment_lines_tmpf(comment_lines) + svn_argv = [self._svn_executable, 'copy', '-F', tmp_fname] + if create_intermediate_folders: + svn_argv.append('--parents') + svn_argv.extend([svn_url_src, svn_url_dst]) + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + self.remove_tmp_file(tmp_fname) + + def svn_remote_rm(self, svn_url, comment_lines): + tmp_fname = self.save_comment_lines_tmpf(comment_lines) + svn_argv = [self._svn_executable, 'rm', '-F', tmp_fname, svn_url] + self.trace_svn_command(svn_argv) + if self._dry_run: + self._logger.warning("dry run: {0}".format(' '.join(svn_argv))) + else: + util.subproc_check_call_flushed(svn_argv) + self.remove_tmp_file(tmp_fname) + + def svn_split_url(self, svn_url): + svn_url_norm = svn_url.rstrip('/') + re_match = re.match(r'^(.+)/([^/]+)$', svn_url_norm) + if re_match: + svn_root_url = re_match.group(1) + svn_url_path = "/{}".format(re_match.group(2)) + else: + raise Exception("SVN URL {0} not supported.".format(svn_url)) + return svn_root_url, svn_url_path + + def trace_svn_command(self, svn_argv): + self._cmd_tracer.trace_command(svn_argv) diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/__init__.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/__init__.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/androidapp.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/androidapp.py deleted file mode 100644 index a767db05c0587c6c768ce5ba585e940e055f13ae..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/androidapp.py +++ /dev/null @@ -1,113 +0,0 @@ -from __future__ import print_function - -import argparse -import os.path -import sys - -import pyhhi.build.common.android -import pyhhi.build.common.util as util -import pyhhi.build.common.ver as ver - - -class NdkInfoApp(object): - - def __call__(self): - parser = argparse.ArgumentParser() - - parser.add_argument("-v", action="store_true", dest="verbose", default=False, - help="enable verbose output suitable for humans. The default format is intended for scripting frameworks like Boost.Build.") - parser.add_argument("--ignore-env-vars", action="store_false", dest="use_env", default=True, - help="disable environment variable ANDROID_NDK_ROOT in finding the desired NDK.") - - util.app_args_add_log_level(parser) - - args = parser.parse_args() - - # configure the python logger - util.app_configure_logging(args.log_level) - - ndk_finder = pyhhi.build.common.android.NdkFinder(args.use_env) - if args.verbose: - print('%-42s %s' % ('NDK root:', ndk_finder.get_ndk_root())) - print('%-42s %s' % ('NDK version:', ver.version_tuple_to_str(ndk_finder.get_ndk_version()))) - print('%-42s %s' % ('NDK-SA root:', ndk_finder.get_ndksa_root(None))) - print('%-42s %s' % ('Avail. platforms:', ndk_finder.get_ndk_platforms())) - toolchains = ndk_finder.get_ndksa_toolchains('gnustl') - if toolchains: - print('%-42s %s' % ('Avail. standalone toolchains using gnustl:', toolchains)) - toolchains = ndk_finder.get_ndksa_toolchains('libc++') - if toolchains: - print('%-42s %s' % ('Avail. standalone toolchains using libc++:', toolchains)) - - -class CreateNdkToolchainApp(object): - - def __call__(self): - self.main(sys.argv[1:]) - - def main(self, argv): - - _description = """ -This script creates a standalone NDK toolchain to be used with Boost.Build or another build system -outside of the Android SDK/NDK build environment. - - """ - - _epilog = """ -Examples: - - # create a default set of standalone toolchains - %(prog)s - - # override the default API level - %(prog)s --api-level=21 - """ - parser = argparse.ArgumentParser(description=_description, epilog=_epilog, formatter_class=argparse.RawDescriptionHelpFormatter) - - util.app_args_add_log_level(parser) - parser.add_argument("--unified-headers", action="store_true", dest="unified_headers", default=False, - help="enable unified headers [valid for NDK r14 and higher, enabled for NDK r15]." ) - parser.add_argument("--api-level", action="store", dest="api_level", type=int, - help="override the default Android API level [default: latest].") - parser.add_argument("--stl", action="store", dest="stl", choices=['gnustl', 'libc++'], default='gnustl', - help="--stl=libc++ overrides the default c++ runtime, [default: gnustl to be compatible with Qt].") - parser.add_argument("--inst-dir", action="store", dest="inst_dir", - help="specify the directory to save the toolchain, [default: $HOME/bin/ndksa].") - parser.add_argument("toolchain", action="store", nargs='?', - help="specify the NDK toolchain to be converted into a standalone toolchain." - " Use default to create toolchains for all supported architectures.") - - args = parser.parse_args(argv) - - # configure the python logger - util.app_configure_logging(args.log_level) - # create the NDK finder - ndk_finder = pyhhi.build.common.android.NdkFinder() - ndk_version = ndk_finder.get_ndk_version() - if ver.version_compare(ndk_version, (15, 0)) >= 0: - args.unified_headers = True - if (args.toolchain is None) or (args.toolchain == 'default'): - for toolchain in ['arm-linux-androideabi-4.9', 'aarch64-linux-android-4.9', 'x86-4.9', 'x86_64-4.9']: - ndk_finder.create_ndksa_toolchain(toolchain, api_level=args.api_level, ndk_stl=args.stl, inst_dir=args.inst_dir, - unified_headers=args.unified_headers) - else: - # create the NDK standalone toolchain - ndk_finder.create_ndksa_toolchain(args.toolchain, api_level=args.api_level, ndk_stl=args.stl, inst_dir=args.inst_dir, - unified_headers=args.unified_headers) - - # list available toolchains - print('%-42s %s' % (' ', 'Summary')) - if args.inst_dir is None: - print('%-42s %s' % ('NDK-SA root:', ndk_finder.get_ndksa_root(None))) - ndksa_toolchains = ndk_finder.get_ndksa_toolchains(args.stl) - if ndksa_toolchains: - print('%-42s %s' % ('Avail. standalone toolchains using ' + args.stl + ':', ' '.join(ndksa_toolchains))) - if ver.version_compare(ndk_version, (11, 0)) >= 0: - compiler_flavor = 'clang++' - else: - compiler_flavor = 'g++' - if args.inst_dir is None: - print('\nExample: boost_install.py toolset=' + ndksa_toolchains[0] + '-' + compiler_flavor) - else: - print('\nExample: boost_install.py toolset=' + os.path.join(args.inst_dir, 'bin', ndksa_toolchains[0] + '-' + compiler_flavor)) - print('\n') diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/boost.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/boost.py deleted file mode 100644 index 4655ca6b57525718cb5f0dcb2729b38d37302960..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/boost.py +++ /dev/null @@ -1,249 +0,0 @@ -from __future__ import print_function - -import argparse -import os -import re -import sys - -import pyhhi.build.common.system as system -import pyhhi.build.common.util as util -import pyhhi.build.common.ver as ver -import pyhhi.cmbuild.boostbld as boostbld -from pyhhi.build.common.bldtools import MsvcToolsetSpecDict - - -class BoostInstallApp(object): - - def __init__(self): - # creates the system info object and performs python version checks - self._sys_info = system.SystemInfo(True) - # Mapping between CMake VC toolsets and Boost.Build VC toolsets. - self._msvc_dict = MsvcToolsetSpecDict() - - def __call__(self): - self.main(sys.argv[1:]) - - def main(self, argv): - (boost_build_params, boost_dir, cxx_std) = self._parse_command_line(argv) - # Change the current working directory to the top level directory in case the caller has moved - # into CMakeBuild or bin to invoke boost_install.py. - top_dir = util.get_top_dir() - os.chdir(top_dir) - msg_list_summary = [] - msg_list_summary.append('%-25s %s' % ('python version:', ver.version_tuple_to_str(self._sys_info.get_python_version()))) - msg_list_summary.append('%-25s %s' % ('python executable:', self._sys_info.get_python_executable())) - msg_list_summary.append('%-25s %s' % ('platform:', self._sys_info.get_platform_long())) - msg_list_todo = [] - self._sys_info.check_os_detection(msg_list_todo) - - if boost_dir is None: - print("boost_install.py: no boost directory specified, use option --boost-dir.") - sys.exit(1) - else: - boost_build_params.boost_dir = boost_dir - - if boost_build_params.boost_dir.startswith('/usr/include'): - # system layout -> don't try to build the boost SDK and just extract the boost version - msg_list_summary.append('%-25s %s' % ('boost version:', ver.version_tuple_to_str(boostbld.get_boost_version(boost_build_params.boost_dir)))) - else: - # create the BoostBuilder - boost_builder = boostbld.BoostBuilder(self._sys_info) - - if cxx_std: - boost_build_params.cxx_std = cxx_std - else: - re_match = re.match(r'.*-(c\+\+[0-9]+)$', boost_dir) - if re_match: - boost_build_params.cxx_std = re_match.group(1) - else: - boost_build_params.cxx_std = 'c++11' - - # launch Boost building with the current set of build options. - boost_builder.build_boost(boost_build_params) - - # compose the summary - msg_list_summary.append('%-25s %s' % ('boost root:', boost_dir)) - msg_list_summary.append('%-25s %s' % ('boost version:', ver.version_tuple_to_str(boost_builder.get_boost_version()))) - if boost_build_params.targets: - msg_list_summary.append('%-25s %s' % ('boost toolset:', boost_builder.get_toolset().get_toolset_info_short(boost_build_params.targets[0]))) - bjam_cmd_lines = boost_builder.get_bjam_cmd_lines() - if bjam_cmd_lines: - msg_list_summary.append('bjam command(s):') - msg_list_summary.extend(boost_builder.get_bjam_cmd_lines()) - - if msg_list_summary: - print() - print(" SUMMARY ") - print(" ======= ") - print() - for msg in msg_list_summary: - print(msg) - print() - - if msg_list_todo: - print("\nTODO List:") - for msg in msg_list_todo: - print(msg) - print() - print("boost_install.py finished successfully.\n") - - def _parse_command_line(self, argv): - _usage_header = "%(prog)s [options] [toolset=msvc-x.y|gcc|gcc-x[.y]|clang|intel[-msvc-x.y] [target-os=iphone|iphonesimulator]" - _description = """ - -%(prog)s builds BOOST libraries from source, use option --boost-dir to specify the location of the BOOST SDK. -If the BOOST directory ends with -c++03, -c++11, -c++14, or -c++17, this suffix will be used as the c++ standard -unless option --std is specified. If neither condition is true, c++11 will be used. - -Notes on Intel Compiler Selection: - - No support for side-by-side installation of multiple Intel compilers yet - - No support for 32 bit builds on any platform - - On Windows the latest MSVC runtime/IDE will be used unless overridden by a suffix -msvc-x.y". - -""" - - parser = argparse.ArgumentParser(usage=_usage_header, description=_description, formatter_class=argparse.RawDescriptionHelpFormatter) - - parser.add_argument("buildprops", action="store", nargs='*', - help="one or more build properties specified as key=value, e.g. toolset=msvc-12.0") - - parser.add_argument("--boost-dir", action="store", dest="boost_dir", required=True, - help="required option to specify the location of the BOOST SDK.") - - parser.add_argument("--std", action="store", dest="cxx_std", choices=['c++03', 'c++11', 'c++14', 'c++17'], - help="overrides the c++ standard which is deduced from the boost directory if it ends with " - "one of the supported c++ standards prefixed by a hyphen.") - - parser.add_argument("--target", action="append", dest="targets", - help="override the toolset's default target. Typically used to build 32 bit libraries on Windows; " - "example: --target x86 toolset=msvc-14.0") - - parser.add_argument("--rebuild", action="store_true", dest="rebuild_all", default=False, - help="force a rebuild of all boost libraries") - - group = parser.add_argument_group("MacOSX Options") - - g = group.add_mutually_exclusive_group() - g.add_argument("--macosx-version-min", action="store", dest="macosx_version_min", - help="add backward compatibility down to the given MacOSX release.") - - g.add_argument("--ios-version-min", action="store", dest="macosx_version_min", metavar="IOS_VERSION_MIN", - help="add backward compatibility down to the given IOS release.") - - group = parser.add_argument_group("Advanced Options") - - group.add_argument("--c++-runtime", action="store", dest="cxx_runtime", choices=['shared', 'static', 'gnustl', 'libc++', 'libstdc++'], - help="overrides the default c++ runtime, supported for mingw, msvc, clang and Android.") - - group.add_argument("--with-mpi", action="store_true", dest="build_mpi", default=False, - help="enable Boost MPI (message passing interface) [default:off]") - - group.add_argument("--with-python", action="store_true", dest="build_python", default=False, - help="enable Boost Python [default:off]. If enabled, Boost MPI may not build.") - - group.add_argument("--use-user-config", action="store_true", dest="use_user_config", default=False, - help="enable the use of $HOME/user-config.jam [default:off].") - - util.app_args_add_log_level(group) - - group.add_argument("--dry-run", action="store_true", dest="dry_run", default=False, - help="check which libraries are missing, list the update actions but don't start the build.") - - group.add_argument("--debug-configuration", action="store_true", dest="debug_configuration", default=False, - help="invoke b2 with --debug-configuration, disables removal of temporary files.") - - group.add_argument("--jobs", action="store", type=int, dest="bjam_jobs", - help="specifies the number of parallel bjam jobs explicitly [default: number of processors]") - - args = parser.parse_args(argv) - - # configure the python logger - util.app_configure_logging(args.log_level) - - boost_build_params = boostbld.BoostBuildParams(self._sys_info) - re_toolset = re.compile(r'toolset=(\S+)') - re_address_model = re.compile(r'address-model=(\S+)') - re_target_os = re.compile(r'target-os=(\S+)') - for arg in args.buildprops: - arg_parsed = False - re_match = re_toolset.match(arg) - if re_match: - boost_build_params.toolset = re_match.group(1) - if boost_build_params.toolset.startswith('msvc-'): - boost_build_params.toolset = self._msvc_dict.transform_cmake_to_bbuild(boost_build_params.toolset) - elif boost_build_params.toolset.startswith('intel-'): - re_match_intel = re.match(r'intel-(msvc-\d+\.\d+)$', boost_build_params.toolset) - if re_match_intel: - boost_build_params.toolset = 'intel' - boost_build_params.msvc_rt = re_match_intel.group(1) - else: - print("boost_install.py: argument", arg, " not understood, try --help to get more usage information.") - sys.exit(1) - arg_parsed = True - re_match = re_address_model.match(arg) - if re_match: - arg_parsed = True - if re_match.group(1) == '32': - args.targets = ['x86'] - elif re_match.group(1) == '64': - args.targets = ['x86_64'] - else: - print("boost_install.py: argument", arg, " not understood, try --help to get more usage information.") - sys.exit(1) - re_match = re_target_os.match(arg) - if re_match: - arg_parsed = True - if re_match.group(1) == 'iphone': - boost_build_params.platform_index = 1 - elif re_match.group(1) == 'iphonesimulator': - boost_build_params.platform_index = 2 - else: - print("boost_install.py: argument", arg, " not understood, try --help to get more usage information.") - sys.exit(1) - if not arg_parsed: - print("boost_install.py: argument", arg, " not understood, try --help to get more usage information.") - sys.exit(1) - - boost_dir = None - if args.boost_dir: - # boost_dir must be transformed before changing cwd. - boost_dir = util.normalize_path(os.path.abspath(args.boost_dir)) - - boost_build_params.targets = self._set_build_targets(boost_build_params.toolset, args.targets) - - if args.cxx_std: - cxx_std = args.cxx_std - else: - cxx_std = None - if args.cxx_runtime: - boost_build_params.cxx_runtime = args.cxx_runtime - - boost_build_params.dry_run = args.dry_run - boost_build_params.debug_configuration = args.debug_configuration - boost_build_params.build_mpi = args.build_mpi - boost_build_params.build_python = args.build_python - boost_build_params.bjam_jobs = args.bjam_jobs - boost_build_params.custom_user_config = args.use_user_config - - # options to select what to build - boost_build_params.rebuild_all = args.rebuild_all - - if self._sys_info.is_macosx(): - # handle --macosx-version-min option, it will apply to MacOSX and iOS - if args.macosx_version_min is not None: - boost_build_params.macosx_version_min = ver.version_tuple_from_str(args.macosx_version_min) - - return boost_build_params, boost_dir, cxx_std - - def _set_build_targets(self, toolset, targets): - if not self._sys_info.is_windows(): - return targets - build_targets = [] - if (toolset is None) or toolset.startswith('msvc'): - if targets: - # user has specified one or more targets - build_targets = targets - else: - # no targets specified, use x86_64 - build_targets = [self._sys_info.get_os_arch()] - return build_targets diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmimport.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmimport.py deleted file mode 100644 index 16ebf9c9ec062e4cad430d0dc60767a0cf401fe0..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/app/cmimport.py +++ /dev/null @@ -1,224 +0,0 @@ -from __future__ import print_function - -import sys -import os -import re -import argparse -import shutil -import subprocess - -import pyhhi.build.common.system as system -import pyhhi.build.common.ver as ver - - -class CmPackageFileInfo(object): - def __init__(self, cm_file, dst_dir): - self.cm_file = cm_file - self.dst_dir = dst_dir - - -class CmSvnImporter(object): - def __init__(self, cm_download_dir, svn_import_dir, dry_run=False, cm_version=None): - self._cm_download_dir = cm_download_dir - self._svn_import_dir = svn_import_dir - self._dry_run = dry_run - self._cm_version = None - self._re_axprotector = re.compile(r'axprotector', re.IGNORECASE) - self._re_fname_ignore = re.compile(r'(.*\.tar\.gz)|(CmSamples.*\.dmg)|(CodeMeterSDK32\.exe)', re.IGNORECASE) - self._re_fname_doc = re.compile(r'.*\.pdf$', re.IGNORECASE) - self._re_fname_axdev = re.compile(r'(axprotector-dev_)|(axprotector-devel-)', re.IGNORECASE) - self._re_fname_dev = re.compile(r'(codemeter64-dev)|(codemeter-dev)|(codemetersdk)|(cmdevkit_)', re.IGNORECASE) - - # and perform an inventory to prepare the import later on. - self._pkg_file_list = self._inventory(cm_download_dir) - if cm_version: - self._cm_version = cm_version - - def cm_import(self, svn_url): - assert self._cm_version is not None - dst_dir_base = os.path.join(self._svn_import_dir, ver.version_tuple_to_str(self._cm_version)) - - # remove the destination directory to get rid of any existing files - if os.path.exists(dst_dir_base): - shutil.rmtree(dst_dir_base) - os.makedirs(dst_dir_base) - - for file_info in self._pkg_file_list: - # print("Copying " + file_info.cm_file + " -> " + file_info.dst_dir) - dst_dir = os.path.join(dst_dir_base, file_info.dst_dir) - if not os.path.exists(dst_dir): - os.makedirs(dst_dir) - print("Copying " + os.path.basename(file_info.cm_file) + " -> " + dst_dir) - shutil.copy(file_info.cm_file, dst_dir) - - svn_import_args = ['svn', 'import', '--no-ignore', '-m'] - # add a standard import comment - svn_import_args.append("cmsvn_import.py: importing CodeMeter software " + ver.version_tuple_to_str(self._cm_version)) - svn_import_args.append(self._svn_import_dir) - svn_import_args.append(svn_url) - - # print("svn import command:", svn_import_args) - # print("cmsvn_import.py: starting the import ... ") - if self._dry_run: - print("\n*** DRY RUN ***\n" + ' '.join(svn_import_args) + "\n") - else: - retv = subprocess.call(svn_import_args) - if retv != 0: - raise Exception("svn import failed, please contact technical support.") - - if os.path.exists(self._svn_import_dir): - shutil.rmtree(self._svn_import_dir) - - def _inventory(self, cm_download_dir): - if not os.path.exists(cm_download_dir): - raise Exception("The CodeMeter download directory '" + cm_download_dir + " does not exist.") - - pkg_file_list = [] - category_dict = {'rt': 'CodeMeterRuntime', 'dev': 'CodeMeterDev', 'axrt': 'AxProtectorRuntime', 'axdev': 'AxProtectorDev'} - re_version_fname = re.compile(r'codemeter6?4?_([0-9.]+)_amd64.deb') - re_admin_guide = re.compile(r'CodeMeter_AdminManual') - for fname in os.listdir(cm_download_dir): - if os.path.isdir(os.path.join(cm_download_dir, fname)): - if self._re_axprotector.match(fname): - ax_download_dir = os.path.join(cm_download_dir, fname) - for fname2 in os.listdir(ax_download_dir): - # print("processing axprotector file " + fname2) - category = self._get_file_category(fname2) - if category == 'ignore': - continue - if os.path.isfile(os.path.join(ax_download_dir, fname2)): - if category == 'doc': - file_info = CmPackageFileInfo(os.path.join(ax_download_dir, fname2), os.path.join(category_dict['axdev'], 'doc')) - pkg_file_list.append(file_info) - else: - # print("processing axprotector file " + fname2) - # analyze the axprotector filename - (platform, arch) = self._get_target_platform(fname2) - if platform: - file_info = CmPackageFileInfo(os.path.join(ax_download_dir, fname2), os.path.join(category_dict[category], platform, arch)) - pkg_file_list.append(file_info) - else: - print("CmSvnImporter: warning: ignoring file " + os.path.join(ax_download_dir, fname2)) - else: - category = self._get_file_category(fname) - if category == 'ignore': - continue - if os.path.isfile(os.path.join(cm_download_dir, fname)): - if category == 'doc': - if re_admin_guide.match(fname): - file_info = CmPackageFileInfo(os.path.join(cm_download_dir, fname), os.path.join(category_dict['rt'], 'doc')) - else: - file_info = CmPackageFileInfo(os.path.join(cm_download_dir, fname), os.path.join(category_dict['dev'], 'doc')) - pkg_file_list.append(file_info) - else: - # analyze the codemeter filename - (platform, arch) = self._get_target_platform(fname) - if platform: - re_match = re_version_fname.match(fname) - if re_match: - self._cm_version = ver.version_tuple_from_str(re_match.group(1)) - # print("CmSvnImporter: inventory: " + fname + " -> " + platform + "/" + arch) - # analyze the file type - if platform == 'all': - pass - assert False - else: - # binary file - if arch == 'any': - file_info = CmPackageFileInfo(os.path.join(cm_download_dir, fname), os.path.join(category_dict[category], platform)) - else: - file_info = CmPackageFileInfo(os.path.join(cm_download_dir, fname), os.path.join(category_dict[category], platform, arch)) - # print("file_info: " + file_info.cm_file + " -> " + file_info.dst_dir) - pkg_file_list.append(file_info) - else: - print("CmSvnImporter: warning: ignoring file " + os.path.join(cm_download_dir, fname)) - return pkg_file_list - - def _get_target_platform(self, fname): - platform = None - arch = None - (fname_root, fname_ext) = os.path.splitext(fname) - fname_ext = fname_ext.lower() - - if fname_ext in ['.pdf', '.gz']: - platform = 'all' - arch = 'any' - elif fname_ext == '.exe': - platform = 'windows' - re_win32 = re.compile(r'.*32\.exe$', re.IGNORECASE) - re_win64 = re.compile(r'.*64\.exe$', re.IGNORECASE) - if re_win32.match(fname): - arch = 'x86' - elif re_win64.match(fname): - arch = 'x86_64' - else: - arch = 'any' - elif (fname_ext == '.dmg') or (fname == 'AxProtectorMacX'): - platform = 'macosx' - arch = 'x86_64' - elif (fname_ext == '.rpm') or (fname_ext == '.deb'): - platform = 'linux' - re_linux_x86 = re.compile(r'.*i386\....$') - re_linux_x86_64 = re.compile(r'.*(amd64|x86_64)\....$') - # print("fname: " + fname) - if re_linux_x86.match(fname): - arch = 'x86' - elif re_linux_x86_64.match(fname): - arch = 'x86_64' - else: - assert False - - return (platform, arch) - - def _get_file_category(self, fname): - if self._re_fname_ignore.match(fname): - category = 'ignore' - elif self._re_fname_doc.match(fname): - category = 'doc' - elif self._re_axprotector.match(fname): - # All axprotector packages start with 'axprotector'. - if self._re_fname_axdev.match(fname): - category = 'axdev' - else: - category = 'axrt' - else: - if self._re_fname_dev.match(fname): - category = 'dev' - else: - category = 'rt' - return category - - -class CmSvnImportApp(object): - - def __init__(self): - self._sys_info = system.SystemInfo() - assert not self._sys_info.is_windows() - - def __call__(self): - dflt_download_dir = os.path.join(self._sys_info.get_home_dir(), 'Downloads', 'CodeMeter') - - parser = argparse.ArgumentParser() - - parser.add_argument("--download-dir", action="store", dest="download_dir", metavar="dir", default=dflt_download_dir, - help="the download directory containing CodeMeter packages [default: $HOME/Downloads/CodeMeter]") - parser.add_argument("--dry-run", action="store_true", dest="dry_run", default=False, - help="copy the downloaded CodeMeter files into import area but don't issue the final svn import [default: off]") - parser.add_argument("--cm-version", action="store", dest="cm_version", - help="overrides the CodeMeter version which is picked up from the ubuntu package file by default.") - parser.add_argument("codemeter_version_folder", action="store", - help="codemeter version folder to import into subversion.") - - args = parser.parse_args() - if args.cm_version: - # convert into a version tuple - args.cm_version = ver.version_tuple_from_str(args.cm_version) - cm_download_dir = os.path.abspath(os.path.join(args.download_dir, args.codemeter_version_folder)) - if not os.path.exists(cm_download_dir): - print("cmsvn_import.py: error: the download directory '" + cm_download_dir + "' does not exist.") - sys.exit(1) - - print("download dir:", cm_download_dir) - svn_import_dir = os.path.join(os.getcwd(), 'svn_import') - svn_importer = CmSvnImporter(cm_download_dir, svn_import_dir, args.dry_run, args.cm_version) - svn_importer.cm_import("https://bslinux3.hhi.fraunhofer.de/svn/svn_CodeMeterSoftware/branches/import") diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/bjambld.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/bjambld.py deleted file mode 100644 index 04eacbed2960320b74f280d23dd6e09fb5dbbb17..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/bjambld.py +++ /dev/null @@ -1,172 +0,0 @@ -from __future__ import print_function - -import os -import shutil -import subprocess -import logging - -import pyhhi.build.common.ver as ver -import pyhhi.build.common.bldtools as bldtools -from pyhhi.build.common.system import SystemInfo - - -class BjamBuilder(object): - """The BjamBuilder class supports building a new bjam executable.""" - - def __init__(self, sys_info, top_dir, bb_version): - self._logger = logging.getLogger(__name__) - bjam_src_tree_list = [] - - self._sys_info = sys_info - self._bjam_src_dir = None - self._top_dir = top_dir - self._bb_version = bb_version - self._toolset = None - self._tmp_dirs = [] - - if self._sys_info.is_windows(): - self._bjam_names = ('b2.exe', 'bjam.exe') - else: - self._bjam_names = ('b2', 'bjam') - - if sys_info.is_windows(): - build_script = 'build.bat' - else: - build_script = 'build.sh' - - # the bjam source is supposed to come from the boost source tree. - assert bb_version is not None - boost_tools_dir = os.path.join(self._top_dir, 'tools') - bjam_src_tree_list.append(os.path.join(boost_tools_dir, 'build', 'src', 'engine')) - bjam_src_tree_list.append(os.path.join(boost_tools_dir, 'build', 'v2', 'engine')) - bjam_src_tree_list.append(os.path.join(boost_tools_dir, 'build', 'v2', 'engine', 'src')) - bjam_src_tree_list.append(os.path.join(boost_tools_dir, 'jam', 'src')) - - for d in bjam_src_tree_list: - # check for the build script to figure out which source location holds the bjam source files. - if os.path.exists(os.path.join(d, build_script)): - self._bjam_src_dir = d - break - - if self._bjam_src_dir is not None: - # create a new bldtools suitable to build bjam on this platform. - self._toolset = bldtools.BjamToolset(sys_info, bb_version) - - def build(self, target_arch='x86_64'): - """Builds the b2 executable from source and returns the full path to the executable.""" - assert self._bjam_src_dir is not None - if self._sys_info.is_windows() and (ver.version_compare(self._bb_version, (1, 66, 0)) >= 0): - target_arch = 'x86' - # create a new list of temporary directories to be removed after the bjam executable has been installed. - self._tmp_dirs = [] - - bjam_bin_dir = os.path.join(self._bjam_src_dir, self._get_bjam_bin_dir_folder(target_arch)) - self._tmp_dirs.append(bjam_bin_dir) - - b2_prog_path = os.path.join(bjam_bin_dir, self._bjam_names[0]) - bjam_prog_path = os.path.join(bjam_bin_dir, self._bjam_names[1]) - - bootstrap_dir = os.path.join(self._bjam_src_dir, 'bootstrap') - self._tmp_dirs.append(bootstrap_dir) - - if os.path.exists(bootstrap_dir): - # in case a previous build failed to remove the temporary files, remove bootstrap completely. - shutil.rmtree(bootstrap_dir) - - cur_dir = os.getcwd() - os.chdir(self._bjam_src_dir) - - print("========================================================") - print("Start building bjam in", self._bjam_src_dir, "...") - print("========================================================") - - build_script_args = [] - if self._sys_info.is_windows(): - build_script = os.path.join(self._bjam_src_dir, 'build.bat') - build_script_args.append(build_script) - bjam_toolset_arg = self._toolset.get_bjam_toolset(build_script_format=True) - build_script_args.append(bjam_toolset_arg) - - if target_arch == 'x86_64': - # build.bat builds a 32 bit b2 executable by default but we prefer a native b2. - if bjam_toolset_arg in ['vc141', 'vc14']: - build_script_args.append('amd64') - else: - build_script_args.append('x86_amd64') - else: - build_script = os.path.join(self._bjam_src_dir, 'build.sh') - build_script_args.append(build_script) - - retv = subprocess.call(build_script_args) - if retv != 0: - raise Exception("Building bjam failed. Please contact technical support.") - - # restore the previous current working directory - os.chdir(cur_dir) - - if os.path.exists(b2_prog_path): - return b2_prog_path - elif os.path.exists(bjam_prog_path): - return bjam_prog_path - else: - assert False - return None - - def remove_tmp_files(self): - """Removes all temporary files created by the bjam build script.""" - for d in self._tmp_dirs: - if os.path.exists(d): - try: - shutil.rmtree(d) - except WindowsError as exc: - print("WARNING: ignoring spurious windows error [" + str(exc.winerror) + "]: " + exc.strerror + " raised by shutil.rmtree().") - if os.path.exists(d): - file_list = os.listdir(d) - if file_list: - print("The directory '" + d + "' is not empty for unknown reason: ", file_list) - self._tmp_dirs = [] - - def _get_bjam_bin_dir_folder(self, target_arch='x86_64'): - if self._sys_info.is_windows(): - bin_dir = 'bin.nt' + target_arch - elif self._sys_info.is_linux(): - bin_dir = 'bin.linux' + target_arch - elif self._sys_info.is_macosx(): - bin_dir = 'bin.macosx' + target_arch - else: - assert False - return bin_dir - - -class BjamLauncher(object): - - def __init__(self, sys_info=None, verbosity=1): - self._logger = logging.getLogger(__name__) - if sys_info is None: - sys_info = SystemInfo() - self._sys_info = sys_info - self._verbosity_level = verbosity - - def get_optimal_number_bjam_jobs(self): - """Returns the optimal number of bjam jobs.""" - bjam_jobs = self._sys_info.get_number_processors() - if 'BJAM_MAX_JOBS' in os.environ: - bjam_max_jobs = int(os.environ['BJAM_MAX_JOBS'], 10) - if bjam_jobs > bjam_max_jobs: - bjam_jobs = bjam_max_jobs - assert bjam_jobs >= 1 - return bjam_jobs - - def launch(self, argv): - """Launch a bjam build and block until it terminates.""" - if self._verbosity_level > 0: - # assemble the bjam command line for logging purposes - joiner = ' ' - cmd_line = joiner.join(argv) - print("Launching: " + cmd_line) - retv = subprocess.call(argv) - if retv < 0: - self._logger.debug("child was terminated by signal: %d", -retv) - else: - self._logger.debug("child returned: %d", retv) - return retv diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/boostbld.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/boostbld.py deleted file mode 100644 index 002d952e3702f4ef18becd68b041cf0ad96415a0..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/boostbld.py +++ /dev/null @@ -1,834 +0,0 @@ -from __future__ import print_function - -import glob -import logging -import os -import re -import shutil -import filecmp - -import pyhhi.cmbuild.bjambld as bjambld -import pyhhi.build.common.bldtools as bldtools -import pyhhi.build.common.ver as ver -import pyhhi.build.common.util as util - - -def get_boost_version(boost_dir): - """Returns the boost version as a version tuple.""" - if (not os.path.exists(boost_dir)) or (not os.path.isdir(boost_dir)): - raise Exception("The boost directory " + boost_dir + " does not exist.") - - boost_dir = os.path.abspath(boost_dir) - - version_file = os.path.join(boost_dir, 'boost', 'version.hpp') - if not os.path.exists(version_file): - raise Exception("The directory " + boost_dir + " does not appear to be a boost directory.") - - # #define BOOST_VERSION 105300 - re_boost_version = re.compile(r'#define\s+BOOST_VERSION\s+([0-9]+)') - with open(version_file) as f: - for line in f: - re_match = re_boost_version.match(line) - if re_match: - version_number = int(re_match.group(1), 10) - boost_version = [] - boost_version.append(version_number // 100000) - boost_version.append((version_number // 100) % 1000) - boost_version.append(version_number % 100) - return tuple(boost_version) - - raise Exception(version_file + ": does not contain a supported boost version string.") - - - - -class BoostBuildParams(object): - - def __init__(self, sys_info): - self.boost_dir = None - self.toolset = None - - # On Windows the Intel compiler may be used with different MSVC IDEs which provide - # the C++ runtime, platform SDK, predefined macros. - self.msvc_rt = None - - # Some toolsets support multiple platforms and the platform index selects the active platform; - # example: clang supports macosx, iphone and iphonesimulator - self.platform_index = 0 - - self.cxx_std = "c++03" # "c++11" "c++14", "c++17" - self.cxx_runtime = "default" # 'static', 'shared', 'gnustl', 'libc++', 'libstdc++' - # Some toolsets support multiple targets; e.g. msvc, clang on macosx, or android arm cross compilers. - self.targets = [] - - self.dry_run = False - self.bjam_jobs = None - self.debug_configuration = False - self.custom_user_config = False - # macosx stuff - self.macosx_version_min = None # a version tuple to add -mmacosx-version-min=x.y - self.max_install_names = True - - self.build_mpi = False - self.build_python = False - self.rebuild_all = False - - # a list of boost libraries to be built instead of the default set. - # e.g. [python] - self.boost_with_list = [] - - def __str__(self): - s = "boost_dir: %s\n" % self.boost_dir - s += "toolset: %s\n" % self.toolset - s += "platform index: %d\n" % self.platform_index - if self.targets: - s += "targets: %s\n" % self.targets - s += "dry run: %s\n" % self.dry_run - return s - - -class BoostBuilder(object): - - def __init__(self, sys_info): - self._logger = logging.getLogger(__name__) - self._sys_info = sys_info - self._min_boost_version = (1, 40, 0) - self._boost_version = None - self._toolset = None - self._bjam_cmd_lines = [] - self._boost_libs_android = ['system', 'serialization', 'filesystem', 'date_time', 'program_options', 'math'] - self._boost_libs_ios = ['system', 'serialization', 'filesystem', 'date_time', 'program_options', 'math'] - self._intel_msvc_suffix_dict = {'msvc-14.1': '-vs15', 'msvc-14.0': '-vs14', 'msvc-12.0': '-vs12'} - self._intel_msvc_suffix = None - - def get_boost_version(self): - return self._boost_version - - def get_toolset(self): - assert self._toolset is not None - return self._toolset - - def get_bjam_cmd_lines(self): - return self._bjam_cmd_lines - - def get_boost_bin_dir(self, boost_dir, toolset, platform_index, target): - platform_info = toolset.get_platform_info(platform_index) - assert platform_info.get_target_os() == 'windows' - if (toolset.get_toolset() == 'intel') and (platform_info.get_target_os() == 'windows'): - assert self._intel_msvc_suffix is not None - bin_dir = os.path.join(boost_dir, 'bin', toolset.get_compiler_tag() + self._intel_msvc_suffix, target) - else: - bin_dir = os.path.join(boost_dir, 'bin', toolset.get_compiler_tag(), target) - return bin_dir - - def get_boost_lib_dir(self, boost_dir, toolset, platform_index, target): - platform_info = toolset.get_platform_info(platform_index) - if platform_info.get_target_os() == 'android': - lib_dir = os.path.join(boost_dir, 'lib', toolset.get_compiler_tag(), - 'android-%d-%s' % (platform_info.get_api_level(), target)) - elif (platform_info.get_target_os() == 'iphone') or (platform_info.get_target_os() == 'iphonesimulator'): - if target == 'combined': - lib_dir = os.path.join(boost_dir, 'lib', toolset.get_compiler_tag(), platform_info.get_target_os()) - else: - lib_dir = os.path.join(boost_dir, 'lib', toolset.get_compiler_tag(), - '%s-%s' % (platform_info.get_target_os(), target)) - elif (toolset.get_toolset() == 'intel') and (platform_info.get_target_os() == 'windows'): - assert self._intel_msvc_suffix is not None - lib_dir = os.path.join(boost_dir, 'lib', toolset.get_compiler_tag() + self._intel_msvc_suffix, target) - else: - lib_dir = os.path.join(boost_dir, 'lib', toolset.get_compiler_tag(), target) - return lib_dir - - def build_boost(self, build_params): - #print("BoostBuilder.build_boost() starting ...") - - # extract the boost version - boost_version = get_boost_version(build_params.boost_dir) - self._boost_version = boost_version - - # print("BoostBuilder: boost version:", boost_version) - - # check the boost version against the minimal version we support - if ver.version_compare(boost_version, self._min_boost_version) < 0: - raise Exception("The boost version " + ver.version_tuple_to_str(boost_version) + " is not supported anymore, please contact technical support.") - - # construct a new toolset - toolset = bldtools.Toolset(self._sys_info, build_params.toolset, build_params.cxx_runtime) - - self._toolset = toolset - if toolset.get_toolset() == 'intel': - if self._sys_info.is_windows(): - # Update MSVC environment to be used with the Intel compiler - if build_params.msvc_rt is None: - # Use latest MSVC by default - msvc_registry = bldtools.MsvcRegistry() - msvc_version = msvc_registry.get_latest_version() - build_params.msvc_rt = "msvc-%d.%d" % (msvc_version[0], msvc_version[1]) - # - self._intel_msvc_suffix = self._intel_msvc_suffix_dict[build_params.msvc_rt] - elif self._sys_info.is_macosx(): - if ver.version_compare(boost_version, (1, 66, 0)) == 0: - # Is intel-darwin.jam patched? - intel_darwin_boost = os.path.join(build_params.boost_dir, 'tools', 'build', 'src', 'tools', 'intel-darwin.jam') - intel_darwin_patched = os.path.join(util.get_top_dir(), 'CMakeBuild', 'patches', 'Boost', ver.version_tuple_to_str(boost_version), 'tools', 'build', 'src', 'tools', 'intel-darwin.jam') - assert os.path.exists(intel_darwin_boost) - assert os.path.exists(intel_darwin_patched) - if not filecmp.cmp(intel_darwin_boost, intel_darwin_patched, shallow=False): - raise Exception("""intel-darwin.jam requires a patch. Consider a manual update: - -cp %s %s - -or contact technical support. -""" % (intel_darwin_patched, intel_darwin_boost)) - - platform_info = toolset.get_platform_info(build_params.platform_index) - - if (platform_info.get_target_os() == 'macosx') and (build_params.macosx_version_min is None): - # At times Xcode ships with OSX SDK version > macosx version, this is not permitted by default. - if ver.version_compare(platform_info.get_sdk_version(), self._sys_info.get_os_version()) > 0: - build_params.macosx_version_min = self._sys_info.get_os_version()[:2] - - # check the optional target - if build_params.targets: - for target in build_params.targets: - if target not in platform_info.get_target_arch(): - raise Exception("The target " + target + " is not supported. Please check target and toolset.") - else: - # no target(s) specified, use the defaults - if toolset.get_toolset() == 'msvc': - build_params.targets = list(platform_info.get_target_arch()) - elif platform_info.get_target_os() in ['iphone', 'iphonesimulator']: - if build_params.macosx_version_min: - target_os_version = build_params.macosx_version_min - else: - target_os_version = platform_info.get_target_os_version() - if ver.version_compare(target_os_version, (11, 0)) >=0: - # No support for 32 bit IOS targets anymore. - if platform_info.get_target_os() == 'iphone': - build_params.targets = ['arm64'] - elif platform_info.get_target_os() == 'iphonesimulator': - build_params.targets = ['x86_64'] - else: - assert False - else: - if platform_info.get_target_os() == 'iphone': - build_params.targets = ['arm64', 'armv7'] - elif platform_info.get_target_os() == 'iphonesimulator': - build_params.targets = ['x86_64', 'x86'] - else: - assert False - else: - build_params.targets = [platform_info.get_target_arch(0)] - - # update the build parameters given the attributes of the toolset. - self._update_build_params(toolset, build_params) - - #print(build_params) - #return - - boost_lib_files_missing = False - lib_dir_list = [] - if build_params.rebuild_all: - boost_lib_files_missing = True - if not build_params.dry_run: - for target in build_params.targets: - if platform_info.get_target_os() == 'windows': - bin_dir = self.get_boost_bin_dir(build_params.boost_dir, toolset, build_params.platform_index, target) - if os.path.exists(bin_dir): - shutil.rmtree(bin_dir) - lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, target) - lib_dir_list.append(lib_dir) - if os.path.exists(lib_dir): - shutil.rmtree(lib_dir) - else: - for target in build_params.targets: - lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, target) - lib_dir_list.append(lib_dir) - if not os.path.exists(lib_dir): - boost_lib_files_missing = True - - if boost_lib_files_missing: - self._build_libs(boost_version, toolset, build_params) - if not build_params.dry_run: - if self._sys_info.is_macosx(): - if len(build_params.targets) > 1: - # create a fat binary/universal library file - fat_binary_tool = bldtools.FatBinaryTool() - platform_info = toolset.get_platform_info(build_params.platform_index) - assert ((platform_info.get_target_os() == 'iphone') or (platform_info.get_target_os() == 'iphonesimulator')) - src_lib_dirs = [] - for target in build_params.targets: - lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, target) - src_lib_dirs.append(lib_dir) - dst_lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, 'combined') - if os.path.exists(dst_lib_dir): - shutil.rmtree(dst_lib_dir) - fat_binary_tool.createLibs(src_lib_dirs, dst_lib_dir) - # - if ver.version_compare((1, 59, 0), self._boost_version) > 0: - platform_info = toolset.get_platform_info(build_params.platform_index) - if platform_info.get_target_os() == 'macosx': - lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, build_params.targets[0]) - print("Checking install names and dependencies in " + lib_dir) - dylib_list = glob.glob(lib_dir + '/*.dylib') - inst_name_inspector = bldtools.DyLibInstallNameInfoInspector() - for dylib in dylib_list: - inst_name_info = inst_name_inspector.create_install_name_info(dylib) - if not inst_name_info.inst_name.startswith('@rpath/'): - inst_name_inspector.modify_install_name(dylib, os.path.join('@rpath', inst_name_info.basename)) - # Walk the dependency list and change all boost libraries from libboost_NNN.dylib to @rpath/libboost_NNN.dylib. - depends_dict = {} - for libname in inst_name_info.depends_list: - if libname.startswith('libboost_'): - depends_dict[libname] = os.path.join('@rpath', libname) - if depends_dict: - print("Changing dependencies of " + os.path.basename(dylib)) - inst_name_inspector.modify_depends(dylib, depends_dict) - print("\n") - print("-------------------- Post build phase --------------------") - for lib_dir in lib_dir_list: - self._list_boost_components(lib_dir) - print("----------------------------------------------------------") - else: - print("No boost library directories are missing, skipping library build step.") - print("Use --rebuild if you intend to rebuild all libraries.") - # testing - #for lib_dir in lib_dir_list: - # self._list_boost_components(lib_dir) - - def _list_boost_components(self, lib_dir): - print("Enumerating Boost components in %s:" % lib_dir) - lib_file_list = glob.glob(os.path.join(lib_dir, '*.a')) - if not lib_file_list: - lib_file_list = glob.glob(os.path.join(lib_dir, '*.lib')) - boost_comp_set = set() - boost_comp_list = [] - re_boost_comp = re.compile(r'libboost_([^-]+).*$') - for lib_file in lib_file_list: - fname = os.path.basename(lib_file) - re_match = re_boost_comp.match(fname) - if re_match: - boost_comp = re_match.group(1) - if boost_comp not in boost_comp_set: - boost_comp_set.add(boost_comp) - boost_comp_list.append(boost_comp) - if boost_comp_list: - boost_comp_list.sort() - for boost_comp in boost_comp_list: - print(" %s" % boost_comp) - # print(" ".join(boost_comp_list)) - - def _update_build_params(self, toolset, build_params): - platform_info = toolset.get_platform_info(build_params.platform_index) - # modify the build parameters based on the toolset properties - if platform_info.get_target_os() == 'android': - if (toolset.get_toolset() == 'gcc') and (ver.version_compare(toolset.get_version(), (4, 8)) < 0): - raise Exception("This gcc version is not supported on android, use gcc 4.8 or higher to get decent c++11 support.") - build_params.cxx_std = 'c++11' - if not build_params.boost_with_list: - # use the standard boost library set for android - build_params.boost_with_list = self._boost_libs_android - # TODO: evaluate boost version and add some more libraries - elif (platform_info.get_target_os() == 'iphone') or (platform_info.get_target_os() == 'iphonesimulator'): - build_params.cxx_std = 'c++11' - if not build_params.boost_with_list: - # use the standard boost library set for ios - build_params.boost_with_list = self._boost_libs_ios - # TODO: evaluate boost version and add some more libraries - - def _is_boost_python_enabled(self, toolset, platform_index, target): - build_python = False - platform_info = toolset.get_platform_info(platform_index) - if toolset.is_mingw() or (platform_info.get_target_os() == 'android'): - return build_python - python_version = self._sys_info.get_python_version() - if platform_info.get_target_os() == 'linux': - # This is neither mingw or android - if target in ['x86_64', 'x86']: - python_header_file = os.path.join('/usr/include', 'python' + ver.version_tuple_to_str(python_version[:2]), 'Python.h') - if os.path.exists(python_header_file): - build_python = True - elif platform_info.get_target_os() == 'macosx': - #python_header_file = os.path.join('/usr/include', 'python' + ver.version_tuple_to_str(python_version[:2]), 'Python.h') - #if os.path.exists(python_header_file): - build_python = True - elif toolset.get_toolset() == 'msvc': - # This implies msvc and target either x86 or x86_64. - if self._sys_info.get_python_arch() == target: - build_python = True - return build_python - - def _build_libs(self, boost_version, toolset, build_params): - - bjam_builder = None - tmp_dirs = [] - remove_user_config = True - - user_config = os.path.join(self._sys_info.get_home_dir(), 'user-config.jam') - # check for $HOME/user-config.jam - if build_params.custom_user_config: - remove_user_config = False - else: - if os.path.exists(user_config): - raise Exception("$HOME/user-config.jam exists and may conflict with the current configured toolset to be used to compile the boost libraries.") - - platform_info = toolset.get_platform_info(build_params.platform_index) - try: - #print("Listing toolset attributes ...") - #print(toolset) - - # If we don't have a bjam program at this point, it's clear we must build it from the boost source. - # On windows the boost version matters because vc11 can only be used to build bjam for 1.50.0 or higher. - bjam_builder = bjambld.BjamBuilder(self._sys_info, top_dir=build_params.boost_dir, bb_version=self._boost_version) - if build_params.dry_run: - print("dry run: a temporary bjam has to be built from source.") - # just for the message summary and command lines - bjam_prog = "b2" - else: - bjam_target_arch = 'x86_64' - if self._sys_info.is_windows() and (ver.version_compare(boost_version, (1, 64, 0)) >= 0): - # Boost 1.64.0 and higher comes with build.bat which does not support building a 64 bit b2. - bjam_target_arch = 'x86' - bjam_prog = bjam_builder.build(bjam_target_arch) - # print("created temporary bjam:", bjam_prog) - - tmp_dirs.append(os.path.join(build_params.boost_dir, 'bin.v2' )) - # The next temporary directory exists in 1.58.0 but not in earlier versions. - tmp_dirs.append(os.path.join(build_params.boost_dir, 'libs', 'config', 'checks', 'architecture', 'bin' )) - tmp_dirs.append(os.path.join(build_params.boost_dir, 'tmp' )) - - # Remove temporary build trees, they might exist if a previous build was terminated by ctrl-c or the user tried a manual build. - for dir in tmp_dirs[:2]: - if os.path.exists(dir): - print("Removing '" + dir + "' ...") - shutil.rmtree(dir) - - bjam_launcher = bjambld.BjamLauncher(self._sys_info) - - if build_params.bjam_jobs is None: - build_params.bjam_jobs = bjam_launcher.get_optimal_number_bjam_jobs() - - # save the bjam command lines as a single string for logging - self._bjam_cmd_lines = [] - os.chdir(build_params.boost_dir) - - for target in build_params.targets: - (bjam_arg_list, user_config_content, setup_cmd_file, setup_cmd_content) = self._compose_bjam_arg_list(bjam_prog, toolset, build_params, target) - # Remember the complete command line to be included in the final summary message. - self._bjam_cmd_lines.append(' '.join(bjam_arg_list)) - if user_config_content: - if not build_params.dry_run: - self._write_tmp_user_config(user_config, user_config_content, setup_cmd_file, setup_cmd_content) - self._bjam_cmd_lines.append('<user-config.jam>') - self._bjam_cmd_lines.extend(user_config_content) - self._bjam_cmd_lines.append('</user-config.jam>') - if setup_cmd_file: - self._bjam_cmd_lines.append('<' + setup_cmd_file + '>') - self._bjam_cmd_lines.extend(setup_cmd_content) - self._bjam_cmd_lines.append('</' + setup_cmd_file + '>') - if not build_params.dry_run: - bjam_launcher.launch(bjam_arg_list) - if platform_info.get_target_os() == 'windows': - bin_dir = self.get_boost_bin_dir(build_params.boost_dir, toolset, build_params.platform_index, target) - lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, target) - self._move_boost_dlls(lib_dir, bin_dir, tmp_dirs[0]) - # Get rid of the binaries in case multiple targets are selected which may use the same build tree and config check tree. - for d in tmp_dirs[:2]: - if os.path.exists(d): - print("Removing '" + d + "' ...") - shutil.rmtree(d) - if os.path.exists(user_config) and remove_user_config: - os.remove(user_config) - finally: - if remove_user_config: - if os.path.exists(user_config): - os.remove(user_config) - if setup_cmd_file and os.path.exists(setup_cmd_file): - os.remove(setup_cmd_file) - if not build_params.debug_configuration: - for dir in tmp_dirs: - if os.path.exists(dir): - print("Removing '" + dir + "' ...") - shutil.rmtree(dir) - if bjam_builder is not None: - # get rid of the temporary bjam executable - bjam_builder.remove_tmp_files() - - def _compose_bjam_arg_list(self, bjam_prog, toolset, build_params, target_arch): - platform_info = toolset.get_platform_info(build_params.platform_index) - if platform_info.get_target_os() == 'android': - is_android = True - else: - is_android = False - cflags_list = [] - cxxflags_list = [] - linkflags_list = [] - - bjam_common_args = [bjam_prog] - - if build_params.bjam_jobs > 1: - bjam_common_args.append('-j' + str(build_params.bjam_jobs)) - if build_params.debug_configuration: - bjam_common_args.append('--debug-configuration') - bjam_common_args.append('--layout=versioned') - bjam_common_args.append('--prefix=tmp/dist') - #if toolset.get_toolset() == 'clang': - # if ver.version_compare(toolset.get_version(), (3, 2) ) >= 0: - # cxxflags_list.append('-ftemplate-depth=256') - if platform_info.get_target_os() in ['macosx', 'iphone', 'iphonesimulator']: - if build_params.max_install_names: - # macosx specific flag to help the install_name_tool - linkflags_list.append('-headerpad_max_install_names') - if build_params.macosx_version_min: - version_str = ver.version_tuple_to_str(build_params.macosx_version_min) - else: - version_str = None - target_os_ver = platform_info.get_target_os_version() - if platform_info.get_target_os() == 'macosx': - # deployment target cannot be larger than the macosx SDK version. - if ver.version_compare(target_os_ver, self._sys_info.get_os_version()) < 0: - version_str = ver.version_tuple_to_str(target_os_ver) - else: - # a version hint is required for all portable platforms. - version_str = ver.version_tuple_to_str(target_os_ver) - if version_str: - if platform_info.get_target_os() == 'macosx': - cflags_list.append('-mmacosx-version-min=' + version_str) - linkflags_list.append('-mmacosx-version-min=' + version_str) - elif platform_info.get_target_os() == 'iphone': - cflags_list.append('-miphoneos-version-min=' + version_str) - linkflags_list.append('-miphoneos-version-min=' + version_str) - elif platform_info.get_target_os() == 'iphonesimulator': - cflags_list.append('-mios-simulator-version-min=' + version_str) - linkflags_list.append('-mios-simulator-version-min=' + version_str) - else: - assert False - - if toolset.get_toolset() == 'clang': - # For backward compatibility the user may have overridden the default c++ runtime on macosx which is only - # sensible in c++03 mode. - # On linux libc++ overrides the default c++ runtime. - if self._sys_info.is_linux() and build_params.cxx_runtime in ['libc++']: - cxxflags_list.append('-stdlib=' + build_params.cxx_runtime) - linkflags_list.append('-stdlib=' + build_params.cxx_runtime) - elif self._sys_info.is_macosx() and build_params.cxx_runtime in ['libstdc++']: - cxxflags_list.append('-stdlib=' + build_params.cxx_runtime) - linkflags_list.append('-stdlib=' + build_params.cxx_runtime) - - if toolset.is_mingw(): - if build_params.cxx_runtime == 'shared': - linkflags_list.append('-shared-libstdc++') - linkflags_list.append('-shared-libgcc') - elif build_params.cxx_runtime == 'static': - linkflags_list.append('-static-libstdc++') - linkflags_list.append('-static-libgcc') - - bjam_common_args.append('variant=release,debug') - if is_android: - bjam_common_args.append('link=static') - elif platform_info.get_target_os() in ['iphone', 'iphonesimulator']: - bjam_common_args.append('link=static') - else: - if (toolset.get_toolset() == 'msvc') and (build_params.cxx_runtime == 'static'): - # Experimental feature to build the static boost libraries with dependency on the static MSVC runtime. - bjam_common_args.append('link=static') - bjam_common_args.append('runtime-link=static') - else: - bjam_common_args.append('link=static,shared') - bjam_common_args.append('install') - - if build_params.boost_with_list: - boost_with_list = list(build_params.boost_with_list) - else: - boost_with_list = [] - bjam_arg_list = [] - bjam_arg_list.extend(bjam_common_args) - - if toolset.get_toolset() == 'msvc': - # On windows msvc-x.y selects the VS compiler. - bjam_arg_list.append('toolset=' + toolset.get_toolset_versioned()) - else: - bjam_arg_list.append('toolset=' + toolset.get_toolset()) - - boost_lib_dir = self.get_boost_lib_dir(build_params.boost_dir, toolset, build_params.platform_index, target_arch) - boost_lib_dir = os.path.relpath(boost_lib_dir, build_params.boost_dir) - bjam_arg_list.append('--libdir=' + boost_lib_dir) - if is_android: - # The NDK cross compilers generate position independent code by default, some do -fpic and others -fPIC. - bjam_arg_list.append('target-os=android') - elif self._sys_info.is_linux(): - if toolset.get_toolset() == 'gcc': - if toolset.is_mingw(): - if ver.version_compare(self.get_boost_version(), (1, 66, 0)) >= 0: - # Boost 1.66.0 and higher - if target_arch == 'x86_64': - bjam_arg_list.append('address-model=64') - elif target_arch == 'x86': - bjam_arg_list.append('address-model=32') - bjam_arg_list.append('target-os=windows') - bjam_arg_list.append('threadapi=win32') - elif platform_info.get_target_arch(0) in ['arm', 'aarch64']: - # is this really supported by every arm compiler? - cflags_list.append('-fPIC') - else: - cflags_list.append('-fPIC') - assert self._sys_info.get_os_arch() == target_arch - elif toolset.get_toolset() == 'clang': - cflags_list.append('-fPIC') - elif toolset.get_toolset() == 'intel': - cflags_list.append('-fPIC') - else: - assert False - elif self._sys_info.is_windows(): - if ver.version_compare(self.get_boost_version(), (1, 66, 0)) >= 0: - # Boost 1.66.0 and higher - if target_arch == 'x86_64': - bjam_arg_list.append('address-model=64') - elif target_arch == 'x86': - bjam_arg_list.append('address-model=32') - else: - if toolset.is_mingw(): - if (target_arch == 'x86') and (target_arch != platform_info.get_target_arch(0)): - bjam_arg_list.append('address-model=32') - elif toolset.get_toolset() == 'msvc': - # Assume this compiler is a msvc-x.y variant. - if target_arch == 'x86_64': - bjam_arg_list.append('address-model=64') - elif self._sys_info.is_macosx(): - # target-os=iphonesimulator is undefined in Boost.Build inside the BOOST SDK tree. - # target-os=iphone does not define dylib as the shared library suffix inside the BOOST SDK tree. - #if platform_info.get_target_os() == 'iphone': - # bjam_arg_list.append('target-os=' + platform_info.get_target_os()) - pass - else: - assert False - - if build_params.cxx_std is not None: - re_std = re.compile(r'c\+\+(\d+)$') - re_match = re_std.match(build_params.cxx_std) - if not re_match: - raise Exception("C++ standard specification " + build_params.cxx_std + " is not supported.") - if toolset.get_toolset() in ['gcc', 'clang', 'intel']: - if ver.version_compare(self._boost_version, (1, 66, 0)) >= 0: - bjam_arg_list.append('cxxstd=' + re_match.group(1)) - else: - cxxflags_list.append('-std=' + build_params.cxx_std) - build_boost_python = False - if build_params.build_python: - build_boost_python = self._is_boost_python_enabled(toolset, build_params.platform_index, target_arch) - if boost_with_list: - for item in boost_with_list: - bjam_arg_list.append('--with-' + item) - else: - # add --without-xxx arguments which cannot be combined with --with-xxx - if toolset.is_mingw(): - bjam_arg_list.append('--without-locale') - if not build_boost_python: - bjam_arg_list.append('--without-python') - if not build_params.build_mpi: - bjam_arg_list.append('--without-mpi') - if build_params.custom_user_config: - user_config_content = [] - setup_cmd_file = None - setup_cmd_content = [] - else: - (user_config_content, setup_cmd_file, setup_cmd_content) = self._create_user_config_content(toolset, build_params.platform_index, target_arch, build_params.build_mpi, build_boost_python, - cppflags=cxxflags_list, cflags=cflags_list, lflags=linkflags_list, msvc_rt=build_params.msvc_rt) - return bjam_arg_list, user_config_content, setup_cmd_file, setup_cmd_content - - def _create_user_config_content(self, toolset, platform_index, target, build_boost_mpi, build_boost_python, cppflags=None, cflags=None, lflags=None, msvc_rt=None): - """Check the toolset attributes and determine whether a temporary user-config.jam is needed or not.""" - lines = [] - platform_info = toolset.get_platform_info(platform_index) - toolset_str = toolset.get_toolset() - toolset_version_str = ver.version_tuple_to_str(toolset.get_version()[:2]) - cxxflags = [] - compileflags = [] - linkflags = [] - rc = [] - using_line = None - setup_cmd_content = [] - setup_cmd = None - - if cppflags: - cxxflags.extend(cppflags) - if cflags: - compileflags.extend(cflags) - if lflags: - linkflags.extend(lflags) - - extra_cflags = platform_info.get_target_cflags(target) - if extra_cflags: - compileflags.extend(extra_cflags) - - if toolset_str == 'gcc': - using_line = "using %s : %s : %s" % (toolset_str, toolset_version_str, toolset.get_compiler_command()) - if toolset.is_mingw(): - if self._sys_info.is_linux(): - # mingw on linux is always a prefixed compiler and it does not figure out the path to windres by default. - compiler_dir = os.path.dirname(toolset.get_compiler_command()) - windres = os.path.join(compiler_dir, toolset.get_compiler_prefix() + '-windres') - rc.append(windres) - elif toolset_str == 'clang': - if platform_info.get_target_os() in ['android', 'linux']: - using_line = "using %s : %s : %s" % (toolset_str, toolset_version_str, toolset.get_compiler_command()) - elif platform_info.get_target_os() in ['macosx', 'iphone', 'iphonesimulator']: - using_line = "using %s : : %s" % (toolset_str, toolset.get_compiler_command()) - - isysroot = platform_info.get_isysroot() - assert isysroot is not None - compileflags.extend(['-isysroot', isysroot]) - if platform_info.get_target_os() == 'macosx': - # Add 3rd party native frameworks folder - compileflags.append('-F/Library/Frameworks') - linkflags.append('-F/Library/Frameworks') - else: - arch_flags = None - if platform_info.get_target_os() == 'iphone': - if target in ['armv7', 'arm64']: - arch_flags = ['-arch', target] - elif target == 'combined': - arch_flags = ['-arch', 'armv7', '-arch', 'arm64'] - else: - assert False - elif platform_info.get_target_os() == 'iphonesimulator': - if target == 'x86_64': - # Assume -arch x86_64 is the default - pass - elif target == 'x86': - arch_flags = ['-arch', 'i386'] - elif target == 'combined': - arch_flags = ['-arch', 'x86_64', '-arch', 'i386'] - else: - assert False - else: - assert False - if arch_flags: - compileflags.extend(arch_flags) - linkflags.extend(arch_flags) - else: - assert False - elif toolset_str == 'intel': - if self._sys_info.is_linux() or self._sys_info.is_macosx(): - using_line = "using %s : %s : %s" % (toolset_str, toolset_version_str, toolset.get_compiler_command()) - elif self._sys_info.is_windows(): - compiler_cmd = os.path.normpath(toolset.get_compiler_command()) - compiler_cmd_escaped = compiler_cmd.replace("\\", "\\\\") - assert msvc_rt is not None - re_match = re.match(r'msvc-(\d+\.\d+)$', msvc_rt) - if re_match: - msvc_version_str = re_match.group(1) - else: - assert False - using_line = 'using %s : %s : "%s" :' % (toolset_str, toolset_version_str, compiler_cmd_escaped) - #using_line += ' <rewrite-setup-scripts>off' - using_line += ' <compatibility>vc' + msvc_version_str - else: - assert False - elif toolset_str == 'msvc': - if toolset_version_str in ['14.0']: - msvc_registry = bldtools.MsvcRegistry() - if msvc_registry.is_vs2017_toolset(ver.version_tuple_from_str(toolset_version_str)): - # target ... - setup_cmd = os.path.normpath(os.path.join(self._sys_info.get_home_dir(), 'setup_vs2017_vc140.bat')) - # replace single backslashes with double backslashes - setup_cmd_escaped = setup_cmd.replace("\\", "\\\\") - using_line = 'using %s : %s : : <setup>"%s"' % (toolset_str, toolset_version_str, setup_cmd_escaped) - using_line += ' <rewrite-setup-scripts>off' - - # call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64 -vcvars_ver=14.0 - if target == 'x86_64': - setup_cmd_target = 'amd64' - elif target == 'x86': - setup_cmd_target = 'amd64_x86' - else: - assert False - setup_cmd_content.append('call "%s" %s -vcvars_ver=14.0' % (toolset.get_compiler_command(), setup_cmd_target)) - - if cxxflags or compileflags or linkflags or rc: - assert using_line is not None - using_line += " :" - if cxxflags: - using_line += ' <cxxflags>"%s"' % ' '.join(cxxflags) - if compileflags: - using_line += ' <compileflags>"%s"' % ' '.join(compileflags) - if linkflags: - using_line += ' <linkflags>"%s"' % ' '.join(linkflags) - if rc: - using_line += ' <rc>"%s"' % ' '.join(rc) - - if using_line: - lines.append(using_line + " ;") - - if build_boost_python: - python_config_file = os.path.join(self._sys_info.get_home_dir(), 'user-config-python.jam') - if os.path.exists(python_config_file): - with open(python_config_file) as f: - for line in f: - lines.append(line.rstrip()) - else: - python_version = self._sys_info.get_python_version() - if platform_info.get_target_os() == 'windows': - python_executable_short_path = self._sys_info.get_short_path_win(self._sys_info.get_python_executable()) - python_executable_cstring = python_executable_short_path.replace("\\", "\\\\") - lines.append('using python : %d.%d : "%s" ;' % (python_version[0], python_version[1], python_executable_cstring)) - elif platform_info.get_target_os() == 'macosx': - lines.append('using python : %d.%d : %s ;' % (python_version[0], python_version[1], self._sys_info.get_python_executable())) - elif platform_info.get_target_os() == 'linux': - lines.append('using python : %d.%d : %s ;' % (python_version[0], python_version[1], self._sys_info.get_python_executable())) - - if build_boost_mpi: - mpi_config_file = os.path.join(self._sys_info.get_home_dir(), 'user-config-mpi.jam') - if os.path.exists(mpi_config_file): - with open(mpi_config_file) as f: - for line in f: - lines.append(line.rstrip()) - else: - lines.append("using mpi ;") - - return lines, setup_cmd, setup_cmd_content - - def _write_tmp_user_config(self, user_config_file, user_config_content, setup_cmd_file, setup_cmd_content): - if user_config_content: - if os.path.exists(user_config_file): - raise Exception( - "The file " + user_config_file + " already exists and may conflict with the current configured toolset. Please contact technical support.") - # and write the line(s) - with open(user_config_file, "w") as user_configf: - for line in user_config_content: - user_configf.write(line + "\n") - if setup_cmd_content: - with open(setup_cmd_file, "w") as setup_cmdf: - for line in setup_cmd_content: - setup_cmdf.write(line + "\n") - - def _find_boost_pdb_files(self, boost_dir): - pdb_info_dict = {} - re_pdb = re.compile(r'.*\.pdb$', re.IGNORECASE) - for dirpath, dirs, files in os.walk(boost_dir): - for f in files: - if re_pdb.match(f): - (fname, ext) = os.path.splitext(f) - pdb_info_dict[fname] = os.path.join(dirpath, f) - return pdb_info_dict - - def _move_boost_dlls(self, lib_dir, bin_dir, boost_build_dir): - - if not os.path.exists(lib_dir): - print("*** warning: the library directory does not exist, the build failed completely for some reason. ***") - return - if not os.path.exists(bin_dir): - os.makedirs(bin_dir) - # find pdb files which are not installed in lib_dir by BOOST SDK installer. - pdb_info_dict = self._find_boost_pdb_files(os.path.join(boost_build_dir, 'libs')) - re_dll = re.compile(r'.*\.dll$', re.IGNORECASE) - file_list = os.listdir(lib_dir) - for f in file_list: - if re_dll.match(f): - shutil.copy(os.path.join(lib_dir, f), bin_dir) - os.remove(os.path.join(lib_dir, f)) - # Do we have a PDB file? - (fname, ext) = os.path.splitext(f) - if fname in pdb_info_dict: - shutil.copy(pdb_info_dict[fname], bin_dir) - diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/__init__.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/helper.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/helper.py deleted file mode 100644 index e42ad418cfed4e90bea39e658005af156e8bc220..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/helper.py +++ /dev/null @@ -1,15 +0,0 @@ -import os.path -import pyhhi.build.common.util as util - - -def get_test_data_top_dir(): - """Returns the default test data directory based on the script directory - avoiding hardcoded paths while switching between BoostBuild and CMakeBuild.""" - - script_dir_up = os.path.normpath(os.path.join(util.get_script_dir(), '..')) - repo_name = os.path.basename(script_dir_up) - # repo_name: either BoostBuild or CMakeBuild - top_dir = util.get_top_dir() - test_data_dir = os.path.join(top_dir, 'TestData', repo_name) - assert os.path.exists(test_data_dir) - return test_data_dir diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_android.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_android.py deleted file mode 100644 index c4d1276956c30e64ad2561c35d66af712776e0b7..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_android.py +++ /dev/null @@ -1,34 +0,0 @@ -from __future__ import print_function - -import os.path -import re -import string -import sys -import unittest - -import pyhhi.build.common.android as android - - -@unittest.skipUnless(sys.platform.startswith('linux'), "requires linux") -class AndroidTestCase(unittest.TestCase): - - def setUp(self): - self._re_ndk_root = re.compile(r'android-ndk-r(\d+)([a-z]?)$') - self._ndk_root_dir_list = ['android-ndk-r10c', 'android-ndk-r10', 'android-ndk-r10e'] - - def test_re_ndk_root(self): - re_ndk_root = self._re_ndk_root - ndk_root_dir_list = self._ndk_root_dir_list - for d in ndk_root_dir_list: - self.assertTrue(re_ndk_root.match(d)) - - def test_ndk_finder(self): - ndk_finder = android.NdkFinder() - self.assertTrue(os.path.exists(ndk_finder.get_ndk_root())) - api_level = ndk_finder.get_api_level_from_platform('android-21') - # print("api_level:", api_level) - self.assertEqual(21, ndk_finder.get_api_level_from_platform('android-21')) - - def _get_ndk_patch_level_from_string(self, patch_level_str): - l = string.ascii_lowercase.index(patch_level_str) - return l diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_bldtools.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_bldtools.py deleted file mode 100644 index 9c5646a784a8246f4fee1a9e01e7f43e68a707b0..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_bldtools.py +++ /dev/null @@ -1,33 +0,0 @@ - -import unittest -import os.path -import pyhhi.build.common.bldtools as bldtools -import pyhhi.build.common.system as system - - -class BldToolsTestCase(unittest.TestCase): - - def setUp(self): - self._sys_info = system.SystemInfo() - - def test_normalize_toolset_spec(self): - # create a default toolset to be able to test _normalize_toolset_spec(). - ts = bldtools.Toolset(self._sys_info) - self.assertEqual(ts._normalize_toolset_spec('clang++'), 'clang') - self.assertEqual(ts._normalize_toolset_spec('clang++-3.5'), 'clang-3.5') - self.assertEqual(ts._normalize_toolset_spec('g++'), 'gcc') - self.assertEqual(ts._normalize_toolset_spec('g++-4.9'), 'gcc-4.9') - - def test_gcc_thread_model(self): - if self._sys_info.is_linux(): - ts = bldtools.Toolset(self._sys_info) - mingw_cmd = os.path.join('/usr', 'bin', 'x86_64-w64-mingw32-g++-win32') - if os.path.exists(mingw_cmd): - self.assertEqual(ts._get_gcc_thread_model(mingw_cmd), 'win32') - mingw_cmd = os.path.join('/usr', 'bin', 'x86_64-w64-mingw32-g++-posix') - if os.path.exists(mingw_cmd): - self.assertEqual(ts._get_gcc_thread_model(mingw_cmd), 'posix') - else: - mingw_cmd = os.path.join('/usr', 'bin', 'x86_64-w64-mingw32-g++') - if os.path.exists(mingw_cmd): - self.assertEqual(ts._get_gcc_thread_model(mingw_cmd), 'posix') diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_cmk.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_cmk.py deleted file mode 100644 index 032bdea6af410ad1b04023095472fdb844401b11..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_cmk.py +++ /dev/null @@ -1,48 +0,0 @@ -import unittest - -import pyhhi.build.common.ver as ver -import pyhhi.cmbuild.app.cmk as cmk -import pyhhi.cmbuild.cmksupp as cmksupp - - -class CMakeTestCase(unittest.TestCase): - - def setUp(self): - self._cmk_version_test_set = [("cmake version 3.7.2", "3.7.2"), - ("cmake version 3.8.0-rc2", "3.8.0"), - ("cmake3 version 3.6.3", "3.6.3")] - - def test_cmake_command_line_parser(self): - cmk_app = cmk.CMakeLauncherApp() - - for lnk_variant in ['static', 'shared']: - (params, cmake_argv) = cmk_app._parse_command_line(['link=' + lnk_variant]) - self.assertEqual(params.link_variants, [lnk_variant]) - (params, cmake_argv) = cmk_app._parse_command_line(['link=static,shared']) - self.assertEqual(params.link_variants, ['static', 'shared']) - - for bld_variant in ['debug', 'release', 'relwithdebinfo', 'minsizerel']: - (params, cmake_argv) = cmk_app._parse_command_line(['variant=' + bld_variant]) - self.assertEqual(params.build_configs, [bld_variant]) - (params, cmake_argv) = cmk_app._parse_command_line(['variant=release,debug']) - self.assertEqual(params.build_configs, ['release', 'debug']) - - (params, cmake_argv) = cmk_app._parse_command_line(['address-model=32']) - self.assertEqual(params.target_arch, 'x86') - (params, cmake_argv) = cmk_app._parse_command_line(['address-model=64']) - self.assertEqual(params.target_arch, 'x86_64') - - (params, cmake_argv) = cmk_app._parse_command_line(['toolset=gcc-4.9']) - self.assertEqual(params.toolset_str, 'gcc-4.9') - - (params, cmake_argv) = cmk_app._parse_command_line(['-DCMAKE_VAR=1', '-DCMAKE_VAR2:BOOL=ON', 'toolset=gcc-4.9']) - self.assertEqual(params.toolset_str, 'gcc-4.9') - self.assertEqual(params.cmk_cache_entries[0], '-DCMAKE_VAR=1') - self.assertEqual(params.cmk_cache_entries[1], '-DCMAKE_VAR2:BOOL=ON') - self.assertEqual(len(cmake_argv), 0) - - def test_cmake_version_parser(self): - cmk_finder = cmksupp.CMakeFinder() - for ver_tuple in self._cmk_version_test_set: - cmk_version = cmk_finder._parse_cmake_version_retv(ver_tuple[0]) - self.assertEqual(ver_tuple[1], ver.version_tuple_to_str(cmk_version)) diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_cmkdoc.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_cmkdoc.py deleted file mode 100644 index 56aa2c82520e8b5a2b5f56b3683f4d0e99efcdee..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_cmkdoc.py +++ /dev/null @@ -1,67 +0,0 @@ -from __future__ import print_function - -import filecmp -import os.path -import shutil -import tempfile -import unittest - -import pyhhi.cmbuild.app.cmkdocapp as cmkdocapp -import pyhhi.cmbuild.test.helper as helper - - -class CMakeDocUtilTestCase(unittest.TestCase): - - def setUp(self): - (filenm, ext) = os.path.splitext(os.path.basename(__file__)) - self._test_data_dir = os.path.join(helper.get_test_data_top_dir(), "py_unittests", filenm) - assert os.path.exists(self._test_data_dir) - self._remove_temp_dir = True - - def test_0_cmake_docutil(self): - pass - - def test_1_cmake_docutil(self): - #print("\n") - - temp_dir = tempfile.mkdtemp() - #print("Using temp_dir=" + temp_dir) - try: - app = cmkdocapp.CMakeDocUtilApp() - output_file = os.path.join(temp_dir, 'test.rst') - input_file = os.path.join(self._test_data_dir, 'cmake-modules.7.rst') - argv = ['-f', input_file, '-m', 'BBuildEnvLldb', '-o', output_file] - app.main(argv) - self.assertTrue(filecmp.cmp(output_file, os.path.join(self._test_data_dir, 'test1.rst'), False)) - - app = cmkdocapp.CMakeDocUtilApp() - argv = ['-f', output_file, '-m', 'FindCodeMeter', '-m', 'BBuildEnvLldb'] - app.main(argv) - self.assertTrue(filecmp.cmp(output_file, os.path.join(self._test_data_dir, 'test2.rst'), False)) - - app = cmkdocapp.CMakeDocUtilApp() - argv = ['-f', output_file, '-m', 'FindCodeMeterx', '-m', 'BBuildEnvLldbx', '-s', 'My Extensions'] - app.main(argv) - self.assertTrue(filecmp.cmp(output_file, os.path.join(self._test_data_dir, 'test3.rst'), False)) - - # revert to original -> removing two sections - app = cmkdocapp.CMakeDocUtilApp() - argv = ['-f', output_file, '-R'] - app.main(argv) - self.assertTrue(filecmp.cmp(output_file, os.path.join(self._test_data_dir, 'cmake-modules.7.rst'), False)) - - app = cmkdocapp.CMakeDocUtilApp() - argv = ['-f', output_file, '-m', 'FindCodeMeter', '-m', 'BBuildEnvLldb'] - app.main(argv) - self.assertTrue(filecmp.cmp(output_file, os.path.join(self._test_data_dir, 'test2.rst'), False)) - - # remove a single section - app = cmkdocapp.CMakeDocUtilApp() - argv = ['-f', output_file, '-r'] - app.main(argv) - self.assertTrue(filecmp.cmp(output_file, os.path.join(self._test_data_dir, 'cmake-modules.7.rst'), False)) - finally: - #pass - if self._remove_temp_dir and os.path.exists(temp_dir): - shutil.rmtree(temp_dir) - diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_util.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_util.py deleted file mode 100644 index c347f315514d9861b8a885924039c799008a55aa..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_util.py +++ /dev/null @@ -1,33 +0,0 @@ - -import unittest -import sys -import os.path -import pyhhi.build.common.util as util - -class UtilTestCase(unittest.TestCase): - - @unittest.skipUnless(sys.platform.startswith('win'), "requires windows") - def test_find_tool_on_path_win(self): - self.assertIsNotNone(util.find_tool_on_path('cmd')) - self.assertIsNotNone(util.find_tool_on_path('cmd.exe')) - self.assertIsNotNone(util.find_tool_on_path(os.path.join('C:\\Windows\\System32\\cmd'))) - self.assertIsNotNone(util.find_tool_on_path(os.path.join('C:\\Windows\\System32\\cmd.exe'))) - self.assertIsNone(util.find_tool_on_path('cmd-not-fnd')) - self.assertIsNone(util.find_tool_on_path(os.path.join('C:\\Windows\\System32\\cmd-not-fnd.exe'))) - - @unittest.skipIf(sys.platform.startswith('win'), "requires linux or macosx") - def test_find_tool_on_path(self): - ls_abs = os.path.join('/usr', 'bin', 'gcc') - self.assertEqual(ls_abs, util.find_tool_on_path('gcc')) - self.assertEqual(ls_abs, util.find_tool_on_path(ls_abs)) - self.assertIsNone(util.find_tool_on_path('gcc-not-fnd')) - self.assertRaises(Exception, util.find_tool_on_path, 'gcc-not-fnd', True) - self.assertIsNone(util.find_tool_on_path(ls_abs + '-not-fnd')) - self.assertRaises(Exception, util.find_tool_on_path, ls_abs + '-not-fnd', True) - - def test_normalize_path(self): - if sys.platform.startswith('win'): - self.assertEqual(os.path.join(r'C:\qt\4.5.0'), util.normalize_path("c:/qt/4.5.0/")) - else: - self.assertEqual('/bin', util.normalize_path("/usr/../bin/")) - diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_ver.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_ver.py deleted file mode 100644 index a04724dee0bc6c732db016e6ef2aaa110a024275..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/test_ver.py +++ /dev/null @@ -1,42 +0,0 @@ - -import unittest -import pyhhi.build.common.ver as ver - - -class VersionTestCase(unittest.TestCase): - - def test_ubuntu_version_tuple_to_str(self): - self.assertEqual("12.04", ver.ubuntu_version_tuple_to_str((12,4))) - - def test_version_list_sort(self): - self.assertEqual([(4,7), (4,8,0), (4,8,1)], ver.version_list_sort([(4,8,1), (4,7), (4,8,0)])) - self.assertEqual([(4,8,0), (4,8,1), (4,9)], ver.version_list_sort([(4,8,1), (4,9), (4,8,0)])) - - def test_version_tuple_from_str(self): - self.assertEqual((0, 1, 2, 3), ver.version_tuple_from_str('0.1.2-3beta-2')) - self.assertEqual(tuple([10]), ver.version_tuple_from_str('10')) - self.assertEqual(tuple([10]), ver.version_tuple_from_str('10rc2')) - self.assertEqual(tuple([10]), ver.version_tuple_from_str('10-rc2')) - self.assertEqual((10, 7, 4), ver.version_tuple_from_str('10.7.4')) - self.assertEqual((10, 7, 4), ver.version_tuple_from_str('10.7-4')) - self.assertEqual((10, 7, 4, 0), ver.version_tuple_from_str('10.7-4', 4)) - self.assertEqual((10, 7, 8, 9), ver.version_tuple_from_str('10.7.8.9-4, 4', 4)) - # - self.assertEqual(('1.2', '3'), ver.version_str_to_rpm_version_tuple('1.2-3')) - self.assertEqual(('1.2', '3'), ver.version_str_to_rpm_version_tuple('1.2.3')) - - def test_version_tuple_to_str(self): - self.assertEqual('10', ver.version_tuple_to_str(tuple([10]))) - self.assertEqual('10.2', ver.version_tuple_to_str((10, 2))) - - def test_boost_version_str(self): - self.assertEqual('1_56_0', ver.get_boost_version_str('1.56.0')) - - def test_version_compare(self): - self.assertEqual(0, ver.version_compare(ver.version_tuple_from_str('10.7.4'), ver.version_tuple_from_str('10.7.4'))) - self.assertEqual(1, ver.version_compare(ver.version_tuple_from_str('10.7.4'), ver.version_tuple_from_str('10.6.4'))) - self.assertEqual(-1, ver.version_compare(ver.version_tuple_from_str('10.6.4'), ver.version_tuple_from_str('10.7.4'))) - self.assertEqual(-1, ver.version_compare(ver.version_tuple_from_str('10.7'), ver.version_tuple_from_str('10.7.4'))) - self.assertEqual(1, ver.version_compare(ver.version_tuple_from_str('10.7.4'), ver.version_tuple_from_str('10.7'))) - self.assertEqual(0, ver.version_compare(ver.version_tuple_from_str('10.7.0'), ver.version_tuple_from_str('10.7'))) - diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/unittestrun.py b/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/unittestrun.py deleted file mode 100644 index c52ceae86f20cd4c95b4664a933369b0540a5e43..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuild/test/unittestrun.py +++ /dev/null @@ -1,120 +0,0 @@ -from __future__ import print_function - -import platform -import argparse -import unittest -import os -import sys -import glob -import pyhhi.build.common.util as util - - -class UnitTestApp(object): - - def __init__(self, ): - pass - - def __call__(self): - - parser = argparse.ArgumentParser() - util.app_args_add_log_level(parser) - parser.add_argument("-v", action="store", type=int, dest="verbosity_level", default=2, - help="change the default verbosity level of the python unit test framework.") - parser.add_argument("--with-android", action="store_true", dest="with_android", default=False, - help="include android tests.") - parser.add_argument("--with-cuda", action="store_true", dest="with_cuda", default=False, - help="include android tests.") - parser.add_argument("--with-vlc", action="store_true", dest="with_vlc", default=False, - help="include VLC tests.") - parser.add_argument("--with-all", action="store_true", dest="with_all", default=False, - help="include all optional tests.") - parser.add_argument("unit_tests", action="store", nargs='*', - help="specify one or more unit tests to run. By default all tests will be run.") - args = parser.parse_args() - - # configure the python logger asap - util.app_configure_logging(args.log_level) - - # print("verbosity_level:", args.verbosity_level) - - # get the workspace - top_dir = util.get_top_dir() - # change to top_dir - os.chdir(top_dir) - - # get the boost build script directory - script_dir = util.get_script_dir() - - test_loader = unittest.TestLoader() - - # All unit tests live in the package bb.test - test_package_prefix = 'pyhhi.build.test' - - py_module_nm_list = [] - if args.unit_tests: - # One or more test modules are specified. - for arg in args.unit_tests: - if arg.startswith('test_'): - py_module_nm_list.append(arg) - else: - py_module_nm_list.append('test_' + arg) - else: - # Construct the default test suite containing all test modules. - # test_suite = test_loader.discover(test_package_prefix, 'test_*.py') - for file in glob.glob(os.path.join(script_dir, 'pyhhi', 'build', 'test', 'test_*.py')): - (py_module_nm, ext) = os.path.splitext(os.path.basename(file)) - py_module_nm_list.append(py_module_nm) - for file in glob.glob(os.path.join(script_dir, 'pyhhi', 'cmbuild', 'test', 'test_*.py')): - (py_module_nm, ext) = os.path.splitext(os.path.basename(file)) - py_module_nm_list.append(py_module_nm) - py_module_nm_list = self._filter_module_list(args, py_module_nm_list) - - test_module_names = [] - for prefix in ['pyhhi.build.test', 'pyhhi.cmbuild.test']: - #prefix_path = os.path.join(script_dir, prefix.split('.')) - prefix_path = os.path.join(script_dir, prefix.replace('.', os.sep)) - for py_module_nm in py_module_nm_list: - if os.path.exists(os.path.join(prefix_path, py_module_nm + '.py')): - test_module_names.append(prefix + '.' + py_module_nm) - #test_module_names = [test_package_prefix + '.' + x for x in py_module_nm_list] - print("test module list: ", test_module_names) - - test_suite = test_loader.loadTestsFromNames(test_module_names) - # and run tests ... - test_runner = unittest.TextTestRunner(verbosity=args.verbosity_level) - test_runner.run(test_suite) - - def _filter_module_list(self, args, module_list): - module_list_1 = [] - for py_module in module_list: - if 'android' in py_module: - if args.with_android or args.with_all: - module_list_1.append(py_module) - else: - continue - elif 'cuda' in py_module: - if args.with_cuda or args.with_all: - module_list_1.append(py_module) - else: - continue - elif 'vlc' in py_module: - if args.with_vlc or args.with_all: - module_list_1.append(py_module) - else: - continue - else: - module_list_1.append(py_module) - # pass 2: filter out test_jam_* and put them at the end of the module list - module_list_2 = [] - jam_module_list = [] - for py_module in module_list_1: - if py_module.startswith('test_jam'): - if py_module == 'test_jam_if': - # somewhat a prerequisite for all other test_jam modules. - jam_module_list.insert(0, py_module) - else: - jam_module_list.append(py_module) - else: - module_list_2.append(py_module) - module_list_2.extend(jam_module_list) - return module_list_2 diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/__init__.py b/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/__init__.py b/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/sysapp.py b/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/sysapp.py deleted file mode 100644 index f536a1c95f58be4fcc8d8c71ebe15a768a802e98..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/sysapp.py +++ /dev/null @@ -1,81 +0,0 @@ -from __future__ import print_function - -import argparse -import sys -import os -import locale -import pyhhi.build.common.system -import pyhhi.build.common.ver as ver -import pyhhi.build.common.util as util - - -class SystemInfoApp(object): - - def __call__(self, argv=None): - if argv is None: - self.main(sys.argv[1:]) - else: - self.main(argv) - - def main(self, argv): - parser = argparse.ArgumentParser() - parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", - help="enable verbose output suitable for humans. The default format is intended for scripting frameworks like Boost.Build/bjam.") - parser.add_argument("--print-env", action="store_true", dest="print_env", help="print environment variables" ) - - util.app_args_add_log_level(parser) - args = parser.parse_args(argv) - # configure the python logger - util.app_configure_logging(args.log_level) - # creates the system info object and performs python version checks - sys_info = pyhhi.build.common.system.SystemInfo(True) - - if args.verbose: - print('%-30s %s' % ('python version:', ver.version_tuple_to_str(sys_info.get_python_version()))) - print('%-30s %s' % ('python executable:', sys_info.get_python_executable())) - if sys_info.is_windows(): - print('%-30s %s' % ('python executable (short path):', sys_info.get_short_path(sys_info.get_python_executable()))) - print('%-30s %s' % ('python launcher:', sys_info.get_python_launcher())) - print('%-30s %s' % ('python implementation:', sys_info.get_python_implementation())) - print('%-30s %s' % ('python architecture:', sys_info.get_python_arch())) - if sys_info.is_windows(): - print('%-30s %s' % ('python module win32api?:', str(sys_info.is_win32api_installed()))) - print('%-30s %s' % ('platform:', sys_info.get_platform_long())) - print('%-30s %s' % ('os distro:', sys_info.get_os_distro())) - if sys_info.is_linux(): - print('%-30s %s' % ('debian?:', str(sys_info.is_debian()))) - print('%-30s %s' % ('redhat?:', str(sys_info.is_redhat()))) - print('%-30s %s' % ('suse?:', str(sys_info.is_suse()))) - print('%-30s %s' % ('package format:', sys_info.get_pkg_fmt())) - print('%-30s %s' % ('package architecture:', sys_info.get_pkg_arch())) - elif sys_info.is_windows(): - print('%-30s %s' % ('windows8?:', str(sys_info.is_windows8()))) - print('%-30s %s' % ('os codename:', sys_info.get_os_codename())) - print('%-30s %s' % ('os version:', ver.version_tuple_to_str(sys_info.get_os_version()))) - print('%-30s %s' % ('os architecture:', sys_info.get_os_arch())) - print('%-30s %s' % ('locale.prefencoding:', locale.getpreferredencoding(False))) - print('%-30s %s' % ('number of processors:', sys_info.get_number_processors())) - print('%-30s %s' % ('home directory:', sys_info.get_home_dir())) - desktop_dir = sys_info.get_desktop_dir() - if desktop_dir is not None: - print('%-30s %s' % ('desktop:', desktop_dir)) - # get_program_dir(self, target_arch): - if sys_info.is_windows(): - program_dir = sys_info.get_program_dir(sys_info.get_os_arch()) - print('%-30s %s' % ('program dir:', program_dir)) - if sys_info.get_os_arch() == 'x86_64': - program_dir = sys_info.get_program_dir('x86') - print('%-30s %s' % ('program dir x86:', program_dir)) - label = 'path:' - for d in sys_info.get_path(): - print('%-30s %s' % (label, d)) - label = ' ' - elif args.print_env: - env_var_list = [] - for env_var in os.environ: - env_var_list.append(env_var) - env_var_list.sort() - for env_var in env_var_list: - print(env_var + '=' + os.getenv(env_var)) - else: - print(sys_info.get_system_info_full_str()) diff --git a/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/toolset.py b/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/toolset.py deleted file mode 100644 index 41d935dcfa62f6d6cd6c4a06f09ed3254086b253..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/pyhhi/cmbuilddev/app/toolset.py +++ /dev/null @@ -1,169 +0,0 @@ -from __future__ import print_function - -import argparse -import sys -import shutil -import os - -import pyhhi.build.common.system as system -import pyhhi.build.common.ver as ver -import pyhhi.build.common.util as util -import pyhhi.build.common.bldtools as bldtools - - -class ToolsetInfoApp(object): - - def __init__(self): - self._sys_info = system.SystemInfo() - - def __call__(self): - def lowercase_arg(string): return string.lower() - - _usage = """%(prog)s [options] [toolset] - -This script lists the toolset properties in a single line separated by a ';'. The description -can be easily parsed by Boost.Build jam code to simplify toolset setup. - -Examples: %(prog)s gcc - %(prog)s msvc-12.0 - %(prog)s gcc-4.9 - %(prog)s --target-os=iphone clang - %(prog)s --target-os=iphone --target-arch=armv7 clang - %(prog)s --target-os=iphonesimulator clang - %(prog)s arm-linux-androideabi-g++ - %(prog)s --api-level=19 arm-linux-androideabi-g++ - %(prog)s aarch64-linux-android-g++ - %(prog)s i686-linux-android-g++ - %(prog)s x86_64-linux-android-g++ -""" - - parser = argparse.ArgumentParser(usage=_usage) - parser.add_argument("toolset", action="store", nargs='?', - help="optional argument to override the default toolset.") - util.app_args_add_log_level(parser) - parser.add_argument("-v", action="store_true", dest="verbose", default=False, - help="enable verbose output suitable for humans. The default format is intended for scripting frameworks like Boost.Build/b2.") - parser.add_argument("--internal-version", action="store_true", dest="internal_version", default=False, - help="list toolset's internal version, supported by msvc-x.y.") - parser.add_argument("--api-level", action="store", dest="api_level", type=int, - help="override the default Android API level, the default is either the latest or fixed when the toolchain has been created.") - parser.add_argument("--target-os", action="store", dest="target_os", type=lowercase_arg, - help="add a target OS filter, by default all toolset information is emitted.") - parser.add_argument("--target-arch", action="store", dest="target_arch", type=lowercase_arg, - help="add a target ARCH filter, by default the complete toolset information is emitted.") - parser.add_argument("--short-path-name", action="store_true", dest="short_path_name", default=False, - help="translate the compiler path into a short path on windows.") - - args = parser.parse_args() - - # configure the python logger - util.app_configure_logging(args.log_level) - - if args.toolset: - ts = bldtools.Toolset(self._sys_info, args.toolset) - else: - ts = bldtools.Toolset(self._sys_info) - if args.api_level: - # Override the default Android API level - for platform_info in ts.get_platform_info(): - platform_info.set_api_level(args.api_level) - if args.verbose: - print(ts, "\n") - #print("Summary: " + ts.get_toolset_info_short()) - elif args.internal_version: - if ts.get_internal_version(): - print(ver.version_tuple_to_str(ts.get_internal_version())) - else: - if self._sys_info.is_windows() and args.short_path_name: - compiler_command = self._sys_info.get_short_path(ts.get_compiler_command()) - else: - compiler_command = ts.get_compiler_command() - if ts.get_toolset() == 'msvc': - tvl = list(ts.get_version()) - tvl.extend(ts.get_internal_version()) - toolset_version = tuple(tvl) - else: - toolset_version = ts.get_version() - toolset_info_list = [ts.get_toolset(), ver.version_tuple_to_str(toolset_version), compiler_command] - compiler_prefix = ts.get_compiler_prefix() - if compiler_prefix is None: - toolset_info_list.append('none') - else: - toolset_info_list.append(compiler_prefix) - - target_os_arch_list = [] - target_os_rtl_list = [] - for platform_info in ts.get_platform_info(): - target_os = platform_info.get_target_os() - if args.target_os and (target_os != args.target_os): - # filter out platforms by target_os; e.g. return just the iphone toolset information. - continue - isysroot = platform_info.get_isysroot() - for target_arch in platform_info.get_target_arch(): - if args.target_arch and (target_arch != args.target_arch): - # filter out target architectures if provided. - continue - if isysroot: - assert self._sys_info.is_macosx() - target_os_arch_list.append(target_os + '%' + target_arch + '%' + isysroot) - else: - if target_os == 'android': - target_os_arch_list.append('%s-%d%%%s' % (target_os, platform_info.get_api_level(), target_arch)) - else: - target_os_arch_list.append(target_os + '%' + target_arch) - if (target_os == 'windows') and (ts.get_toolset() == 'gcc'): - # mingw: add runtime library information if available. - runtime_libs = platform_info.get_target_runtime_libs(target_arch) - if runtime_libs: - target_os_rtl_list.append(target_arch + '%' + '@'.join(runtime_libs)) - toolset_info_list.append('!'.join(target_os_arch_list)) - if target_os_rtl_list: - toolset_info_list.append('!'.join(target_os_rtl_list)) - else: - toolset_info_list.append('none') - toolset_info_list.append(ts.get_compiler_tag()) - toolset_info_list.append(ts.get_boost_compiler_tag()) - print(";".join(toolset_info_list)) - - -class MakeIosUniveralApp(object): - - def __call__(self): - def lowercase_arg(string): - return string.lower() - - parser = argparse.ArgumentParser() - parser.add_argument("--rebuild", action="store_true", dest="rebuild_all", default=False, - help="force a rebuild of all universal libraries") - parser.add_argument("--target-os", action="store", dest="target_os", type=lowercase_arg, - help="specifies the IOS target OS [default: iphone iphonesimulator]") - parser.add_argument("lib_dir", action="store") - - args = parser.parse_args() - lib_dir = args.lib_dir - if not os.path.exists(lib_dir): - print("make_ios_universal.py: error: the directory " + lib_dir + " does not exists.") - sys.exit(1) - fat_binary_tool = bldtools.FatBinaryTool() - lib_dir = os.path.abspath(lib_dir) - if args.target_os: - platform_list = [args.target_os] - else: - platform_list = ['iphone', 'iphonesimulator'] - for platform in platform_list: - dst_lib_dir = os.path.join(lib_dir, platform) - if platform == 'iphone': - iphone_targets = ['armv7', 'arm64'] - else: - iphone_targets = ['x86_64', 'x86'] - src_lib_dirs = [] - for target in iphone_targets: - src_lib_dir = os.path.join(lib_dir, platform + '-' + target) - if os.path.exists(src_lib_dir): - src_lib_dirs.append(src_lib_dir) - if len(src_lib_dirs) >= 2: - if args.rebuild_all: - if os.path.exists(dst_lib_dir): - shutil.rmtree(dst_lib_dir) - fat_binary_tool.createLibs(src_lib_dirs, dst_lib_dir) - diff --git a/cmake/CMakeBuild/bin/rm_pycache.py b/cmake/CMakeBuild/bin/rm_pycache.py deleted file mode 100755 index 8be3bbb2e988eb92952264afdcfb26861e15a954..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/bin/rm_pycache.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python -# -# rm_pycache.py -# -from __future__ import print_function - -import argparse -import os -import sys -import re -import shutil - - -class CleanPyCacheApp(object): - - def __init__(self): - self._verbose = True - - def main(self): - python_dirs = self._parse_command_line(sys.argv[1:]) - #print("python_dirs", python_dirs) - for py_dir in python_dirs: - self._remove_pycache(py_dir) - - def _parse_command_line(self, argv): - python_dirs = [] - parser = argparse.ArgumentParser() - parser.add_argument("-q", action="store_true", dest="quiet", default=False, - help="suppress messages which cache file will be removed.") - parser.add_argument("python_dirs", action="store", nargs='+', - help="one or more top-level python directories to search for cache files recursively.") - args = parser.parse_args(argv) - if args.quiet: - self._verbose = False - for dname in args.python_dirs: - if not os.path.exists(dname): - print("Path %s does not exist." % dname) - sys.exit(1) - if not os.path.isdir(dname): - print("Path %s is not a directory." % dname) - sys.exit(1) - if not os.path.isabs(dname): - python_dirs.append(os.path.abspath(dname)) - else: - python_dirs.append(dname) - return python_dirs - - def _remove_pycache(self, py_dir_root): - os.chdir(py_dir_root) - re_pyc_file = re.compile(r'.+\.pyc$', re.IGNORECASE) - for root, dirs, files in os.walk(py_dir_root): - if '__pycache__' in dirs: - if self._verbose: - print("rm -rf %s" % os.path.join(root,'__pycache__')) - shutil.rmtree(os.path.join(root,'__pycache__')) - dirs.remove('__pycache__') - for fname in files: - if re_pyc_file.match(fname): - if self._verbose: - print("rm %s" % os.path.join(root, fname)) - os.remove(os.path.join(root, fname)) - - -if __name__ == '__main__': - app = CleanPyCacheApp() - app.main() diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake index 603abecf390b843c6ed382d3000352972663f8b6..202c7e309cea573fcd40af14889ffbbff742eff5 100644 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake +++ b/cmake/CMakeBuild/cmake/modules/BBuildEnv.cmake @@ -1,56 +1,289 @@ -#[[.rst: +#[===[.rst: BBuildEnv --------- -The module BBuildEnv provides a CMake build environment similar to Boost.Build with functions and macros -to access other external SDKs including AdobeSDK, CodeMeter, CUDASamples, Intel Performance Libraries, OfxSDK, and VLC +The module BBuildEnv provides a CMake build environment with functions and macros +to access other external SDKs including CodeMeter, CUDASamples, Intel Performance Libraries not yet supported by CMake natively. +Other macros ensure consistent build settings for multithreading and provide +an abstract CMake generator independent way to configure compiler warnings +depending on compiler family and version. + This module also provides some system information not yet available by CMake. +Unless explicitly disabled by configuration option ``BBuildEnv_EXCLUDE_MODULES`` +module ``BBuildEnv`` loads the following submodules to provide additional support +for Boost, Qt5, OpenCV, file downloads, MinGW and CPack: + +- :module:`BBuildEnvAddProject` provides macros and functions to add standard + subproject like console applications, libraries, samples, UTF tests and Qt + applications to a standard workspace. +- :module:`BBuildEnvBoost` adds a few utility functions and macros helping to + use locally built Boost libraries. +- :module:`BBuildEnvOpenCV` +- :module:`BBuildEnvQt5` +- :module:`BBuildEnvDownload` +- :module:`BBuildEnvVersionUtil` +- :module:`BBuildEnvCPack` adds a few utility functions helping to create binary + distribution packages. +- :module:`BBuildEnvMingw` adds helper functions to copy MinGW runtime DLLs. + + +Reserved Identifiers +^^^^^^^^^^^^^^^^^^^^ + +Avoiding name clashes in CMakeLists.txt or project specific CMake files all +projects including module ``BBuildEnv``, or any of its submodules, are advised +not to use CMake variables, functions or macros starting with:: + + BBuildEnv, _BBuildEnv, _bb_, bb_, BB_, _BB_ + +Users may use variables starting with ``BBuildEnv_<var>`` only to configure the +behavior of ``BuildEnv`` modules or submodules or evaluate properties of loaded +``BuildEnv`` modules or submodules exposed through documented variables +``BBuildEnv_<var>``. + + +Configuration Options +^^^^^^^^^^^^^^^^^^^^^ + +This module evaluates the following variables at load time allowing users to +customize its behavior: + +``BBuildEnv_DEBUG`` + Enable debugging messages. +``BBuildEnv_EXCLUDE_MODULES`` + List of submodules to be excluded from loading. Use ``ALL`` to disable + loading any submodule. + + How to Use ^^^^^^^^^^ Include the following statement(s) in your top-level CMakeLists.txt to load this module -and its submodules. The modification of CMAKE_MODULE_PATH makes a set of new or patched Find module available -as well and is therefore the recommended way to include BBuildEnv:: - - set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeBuild/cmake/modules" ) - # ... some other CMake statements ... +and its submodules. The modification of :variable:`CMAKE_MODULE_PATH` makes a set of new +or patched find modules available as well and is therefore the recommended way +to include ``BBuildEnv``. The logic below assumes assumes CMakeBuild is included +as an svn:external or as a versioned Git subtree: + +.. code-block:: cmake + + # Set module path to subversion or git layout based on the existence of + # ${CMAKE_SOURCE_DIR}/CMakeBuild/CMakeBuild/cmake/modules. + if( EXISTS "${CMAKE_SOURCE_DIR}/CMakeBuild/CMakeBuild/cmake/modules" ) + set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeBuild/CMakeBuild/cmake/modules" ) + set( USE_GIT_SUBPROJECTS OFF ) + else() + file( GLOB CMAKEBUILD_TAGS RELATIVE ${CMAKE_SOURCE_DIR}/CMakeBuild ${CMAKE_SOURCE_DIR}/CMakeBuild/*/CMakeBuild/cmake/modules/BBuildEnv.cmake ) + list( LENGTH CMAKEBUILD_TAGS NUM_OF_TAGS ) + if( ${NUM_OF_TAGS} EQUAL 1 ) + if( CMAKEBUILD_TAGS MATCHES "^([^/]+)/" ) + set( CMAKEBUILD_TAG ${CMAKE_MATCH_1} ) + endif() + if( EXISTS "${CMAKE_SOURCE_DIR}/CMakeBuild/${CMAKEBUILD_TAG}/CMakeBuild/cmake/modules" ) + set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeBuild/${CMAKEBUILD_TAG}/CMakeBuild/cmake/modules" ) + set( USE_GIT_SUBPROJECTS ON ) + else() + message( FATAL_ERROR "ERROR: CMakeBuild directory not found: ${CMAKE_SOURCE_DIR}/CMakeBuild/${CMAKEBUILD_TAG}/CMakeBuild/cmake/modules" ) + endif() + else() + message( FATAL_ERROR "ERROR: ${NUM_OF_TAGS} CMakeBuild directories found, exactly one is expected. Directories found: ${CMAKEBUILD_TAGS}" ) + endif() + endif() + + # Include a utility module providing functions, macros, and settings to customize the build environment. include( BBuildEnv ) -Projects without the need to modify their CMAKE_MODULE_PATH to get access to the supplemental/patched Find modules -may prefer the following include statement:: - include( "${CMAKE_SOURCE_DIR}/CMakeBuild/cmake/modules/BBuildEnv.cmake" ) +Provided Variables +^^^^^^^^^^^^^^^^^^ +``BBuildEnv_VERSION`` + Module's version in decimal dotted format with a maximum of four components. -Reserved Identifiers -^^^^^^^^^^^^^^^^^^^^ +``BBuildEnv_MSYS`` + Set to true when using MSYS. + +``BBuildEnv_ROOT_DIR`` + Optional root directory of CMakeBuild customization files. + +``BBuildEnv_SCRIPT_DIR`` + Optional path to non-cmake scripts. -Avoiding name clashes in CMakeLists.txt or project specific cmake files all projects including BBuildEnv.cmake -are advised not to use CMake variables, functions or macros starting with:: - _bb_, bb_, BB_, _BB_, BBuildEnv, _BBuildEnv +Provided Functions and Macros +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. command:: bb_multithreading + + The ``bb_multithreading()`` macro adds an imported target ``Threads::Threads`` + to enable multithreaded code generation. All multithreaded targets + shall have an explicit or implicit dependency on ``Threads::Threads``:: + + bb_multithreading() + + +.. command:: bb_enable_warnings + + The ``bb_enable_warnings()`` macro enables CXX compiler warnings in case the + selected CMake generator does not by default + and accepts parameters to configure warnings as errors and disable warnings given a + specific compiler version or compiler family:: + + bb_enable_warnings([<compiler>[-<compiler_version>]] [warnings-as-errors] [<warning_flag>...]) + + **Parameters:** + + ``compiler`` + The macro supports the following compiler families + ``gcc``, ``clang``, ``msvc`` and ``intel``. + + ``compiler_version`` + Compiler version specified as ``major_version`` or + ``major_version.minor_version`` to indicate which compiler version + the macro should configure. + + ``warnings-as-errors`` + Treat warnings as errors. + + ``warning_flag`` + Compiler specific flag to enable or disable a warning. -#]] -#BBuildEnv_DISABLE_PYTHON_DETECTION +.. command:: bb_set_external_dir + + The ``bb_set_external_dir()`` function searches for a directory given a + relative path using a fixed set of root paths. It's intended use is to find + a shared folder holding an external project + without searching any system paths or cross compiler specific paths:: + + bb_set_external_dir(<abs_path> <relative_path> [<OPTIONAL>]) + + **Parameters:** + + ``abs_path`` + Absolute path to ``relative_path`` found in one of the default locations. + + ``relative_path`` + Path to search for in one of the default locations. An absolute path + will be returned as-is. + + ``OPTIONAL`` + Search failure is not treated as an fatal error. + + **Search Path:** + + Search path in decreasing order of preference. All paths consisting of + undefined environment variables are silently ignored. + + ``$ENV{PROJ_HOME}`` + + ``${CMAKE_SOURCE_DIR}/..`` + + ``${CMAKE_SOURCE_DIR}/../..`` + + ``$ENV{HOME}/projects`` + Ignored on windows host systems. + + ``$ENV{USERPROFILE}/projects`` + Ignored on non-windows host systems. + + +.. command:: bb_add_subdirectory + + The ``bb_add_subdirectory()`` macro adds an external in-tree Git subproject. + The macro silently assumes the subproject is checked out to + ``${CMAKE_SOURCE_DIR}/ext/<subproject>``:: + + bb_add_subdirectory(<subproject>) + + **Parameters:** + + ``subproject`` + A relative path to an in-tree subproject; e.g. ``BoostAddon/src/lib/LoggerLib`` + + +#]===] + if( NOT CMAKE_VERSION VERSION_LESS 3.10 ) include_guard( GLOBAL ) endif() -macro( _bb_set_bbuildenv_version version_ ) - if( DEFINED BBuildEnv_VERSION ) - if( NOT BBuildEnv_VERSION VERSION_EQUAL ${version_} ) - message( STATUS "Updating BBuildEnv ${BBuildEnv_VERSION} to ${version_}" ) - set( BBuildEnv_VERSION ${version_} CACHE INTERNAL "BBuildEnv version" ) - endif() +include( "${CMAKE_CURRENT_LIST_DIR}/BBuildEnvVersion.cmake" ) + +# List of submodules to load by default. +set( _BBuildEnvSubmoduleList + BBuildEnvAddProject + # BBuildEnvDebug + BBuildEnvDownload + BBuildEnvMingw + BBuildEnvVersionUtil + BBuildEnvCPack + BBuildEnvBoost + BBuildEnvQt5 + BBuildEnvOpenCV + ) + +foreach( _cmod IN LISTS _BBuildEnvSubmoduleList ) + if( DEFINED BBuildEnv_EXCLUDE_MODULES ) + if( "${BBuildEnv_EXCLUDE_MODULES}" STREQUAL "ALL" ) + break() + endif() + if( NOT _cmod IN_LIST BBuildEnv_EXCLUDE_MODULES ) + include( "${CMAKE_CURRENT_LIST_DIR}/${_cmod}.cmake" OPTIONAL ) + endif() + else() + include( "${CMAKE_CURRENT_LIST_DIR}/${_cmod}.cmake" OPTIONAL ) + endif() +endforeach() + + +# this macro switches between subversion externals and git dependencies +macro( bb_add_subdirectory subdirectory_ ) + if( USE_GIT_SUBPROJECTS ) + string( REGEX REPLACE "([^/]+).*" "\\1" BASE_DIRECTORY ${subdirectory_} ) + add_subdirectory( ${CMAKE_SOURCE_DIR}/ext/${BASE_DIRECTORY}/${subdirectory_} ${CMAKE_BINARY_DIR}/${subdirectory_} ) + else() + add_subdirectory( ${subdirectory_} ) + endif() +endmacro() + + +macro( bb_save_find_context fnd_ctx ) + if( CMAKE_CROSSCOMPILING ) + # find_package must be told not to expect the BOOST libraries inside "CMAKE_FIND_ROOT_PATH". + foreach( _v INCLUDE LIBRARY PACKAGE ) + if( DEFINED CMAKE_FIND_ROOT_PATH_MODE_${_v} ) + # message( STATUS "bb_save_find_context(): CMAKE_FIND_ROOT_PATH_MODE_${_v}=${CMAKE_FIND_ROOT_PATH_MODE_${_v}}" ) + + set( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_${_v} ${CMAKE_FIND_ROOT_PATH_MODE_${_v}} ) + set( CMAKE_FIND_ROOT_PATH_MODE_${_v} NEVER ) + else() + unset( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_${_v} ) + endif() + endforeach() + endif() +endmacro() + + +macro( bb_restore_find_context fnd_ctx ) + if( CMAKE_CROSSCOMPILING ) + # Restore CMAKE_FIND_ROOT_PATH settings + foreach( _v INCLUDE LIBRARY PACKAGE ) + if( DEFINED ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_${_v} ) + set( CMAKE_FIND_ROOT_PATH_MODE_${_v} ${${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_${_v}} ) + unset( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_${_v} ) + + # message( STATUS "bb_restore_find_context(): CMAKE_FIND_ROOT_PATH_MODE_${_v}=${CMAKE_FIND_ROOT_PATH_MODE_${_v}}" ) + endif() + endforeach() endif() - set( BBuildEnv_VERSION ${version_} CACHE INTERNAL "BBuildEnv version" ) endmacro() + + + # # Internal macro to extract the CXX compiler's <major>.<minor> version. # @@ -121,6 +354,7 @@ macro( bb_multithreading ) if( TARGET Threads::Threads ) message( FATAL_ERROR "bb_multithreading(): target Threads::Threads already exists. Please contact technical support." ) endif() + unset( _bb_mt_prop_value ) if( MINGW ) # MinGW may be a native compiler or a cross compiler. find_package( Threads REQUIRED ) @@ -134,7 +368,6 @@ macro( bb_multithreading ) else() set_target_properties( Threads::Threads PROPERTIES INTERFACE_COMPILE_OPTIONS "-mthreads" ) endif() - unset( _bb_mt_prop_value ) elseif( CMAKE_CROSSCOMPILING ) find_package( Threads REQUIRED ) elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Cray" ) @@ -154,7 +387,6 @@ macro( bb_multithreading ) set_target_properties( Threads::Threads PROPERTIES INTERFACE_COMPILE_OPTIONS $<$<OR:$<COMPILE_LANGUAGE:CXX>,$<COMPILE_LANGUAGE:C>>:-pthread> ) endif() endif() - unset( _bb_mt_prop_value ) endif() endif() endmacro( bb_multithreading ) @@ -169,6 +401,7 @@ macro( bb_enable_warnings ) message( STATUS "bb_enable_warnings: ${toolset} -> updating warnings flags: ${_bb_warning_options}" ) foreach( _bb_warning_opt IN LISTS _bb_warning_options ) if( MSVC ) + # CMake 3.11.0 introduces support for generator expression COMPILE_LANGUAGE. # MSVC generator does not support the generator expression COMPILE_LANGUAGE yet. string( APPEND CMAKE_CXX_FLAGS " ${_bb_warning_opt}" ) string( APPEND CMAKE_C_FLAGS " ${_bb_warning_opt}" ) @@ -187,7 +420,13 @@ function( _bb_enable_warnings_helper warning_options_ ) if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) set( _bb_warning_compiler_id "gcc" ) elseif( CMAKE_CXX_COMPILER_ID MATCHES "^(AppleClang|Clang)$" ) - set( _bb_warning_compiler_id "clang" ) + if( MSVC ) + # No support for clang as MSVC toolset. + # message( STATUS "_bb_enable_warnings_helper(): no support for MSVC/clang toolsets yet." ) + return() + else() + set( _bb_warning_compiler_id "clang" ) + endif() elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" ) set( _bb_warning_compiler_id "msvc" ) elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) @@ -215,8 +454,17 @@ function( _bb_enable_warnings_helper warning_options_ ) if( "${_arg1}" MATCHES "^(gcc|clang|msvc|intel)" ) #message( STATUS "bb_enable_warnings(): found toolset argument ${ARGV0}" ) - if( "${_arg1}" MATCHES "^([a-z]+)-([0-9.]+)" ) - # strip version suffix; e.g. gcc-4.8 -> gcc + if( "${_arg1}" MATCHES "^([a-z]+)-([0-9]+)$" ) + # Strip version suffix; e.g. gcc-8 -> gcc + set( _bb_warning_toolset "${CMAKE_MATCH_1}" ) + # Save major version + set( _bb_warning_toolset_version "${CMAKE_MATCH_2}" ) + # Get compiler's minor version + if( CMAKE_CXX_COMPILER_VERSION MATCHES "^[0-9]+\\.([0-9]+)" ) + string( APPEND _bb_warning_toolset_version ".${CMAKE_MATCH_1}" ) + endif() + elseif( "${_arg1}" MATCHES "^([a-z]+)-([0-9]+\\.[0-9]+)" ) + # Strip version suffix; e.g. gcc-4.8 -> gcc set( _bb_warning_toolset "${CMAKE_MATCH_1}" ) set( _bb_warning_toolset_version "${CMAKE_MATCH_2}" ) else() @@ -282,9 +530,6 @@ function( _bb_enable_warnings_helper warning_options_ ) if( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) # Replace -XXX with /XXX avoiding the mix of both option specifications. string( REPLACE "-Q" "/Q" _bb_warning_options "${_bb_warning_options}" ) - else() - # Replace -XXX with /XXX avoiding the mix of both option specifications. - string( REPLACE "-" "/" _bb_warning_options "${_bb_warning_options}" ) endif() endif() set( ${warning_options_} ${_bb_warning_options} PARENT_SCOPE ) @@ -367,7 +612,7 @@ function( _bb_find_proj_home proj_home_ home_dir_ ) endfunction() # -# search path: $ENV{PROJ_HOME} ${CMAKE_SOURCE_DIR}/.. ${bb_home_dir}/projects +# search path: $ENV{PROJ_HOME} ${CMAKE_SOURCE_DIR}/.. ${CMAKE_SOURCE_DIR}/../.. ${bb_home_dir}/projects # function( bb_set_external_dir dir_var_ dir_ ) unset( _dir ) @@ -396,9 +641,12 @@ function( bb_set_external_dir dir_var_ dir_ ) file( TO_CMAKE_PATH "$ENV{PROJ_HOME}" _proj_home ) list( APPEND _search_path "${_proj_home}" ) endif() - #list( APPEND _search_path "${CMAKE_CURRENT_SOURCE_DIR}/.." ) - get_filename_component( _dir_norm "${CMAKE_SOURCE_DIR}/.." REALPATH ) - list( APPEND _search_path "${_dir_norm}" ) + foreach( _dir_tmp "${CMAKE_CURRENT_SOURCE_DIR}/.." "${CMAKE_CURRENT_SOURCE_DIR}/../.." ) + if( EXISTS "${_dir_tmp}" ) + get_filename_component( _dir_norm "${_dir_tmp}" REALPATH ) + list( APPEND _search_path "${_dir_norm}" ) + endif() + endforeach() if( EXISTS "${bb_home_dir}/projects" ) list( APPEND _search_path "${bb_home_dir}/projects" ) endif() @@ -422,10 +670,6 @@ function( bb_set_external_dir dir_var_ dir_ ) endif() endfunction() -# -# Mingw utilities -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvMingw.cmake ) # # Additional system information @@ -442,91 +686,6 @@ macro( bb_get_python_script_path script_path_ script_dir_ script_name_ ) endif() endmacro() -macro( bb_dump_cmake_system_info ) - message( STATUS "bb_dump_cmake_system_info() entering" ) - message( STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}" ) - message( STATUS "CMAKE_VERSION: ${CMAKE_VERSION}" ) - message( STATUS "CMAKE_ROOT: ${CMAKE_ROOT}" ) - message( STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}" ) - message( STATUS "CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}" ) - - if( MINGW ) - message( STATUS "MINGW: on" ) - endif() - - if( CMAKE_CROSSCOMPILING ) - message( STATUS "CMAKE_CROSSCOMPILING: on" ) - endif() - - # target operating system: Linux, Windows, Darwin, Android - message( STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}" ) - message( STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}" ) - message( STATUS "CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}" ) - - # examples: x86_64 (ubuntu 16.04, macosx 10.12) - # AMD64 (windows 7 64-bit, -A x64, -A Win32) - message( STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}" ) - message( STATUS "CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}" ) - - if( CMAKE_HOST_APPLE ) - message( STATUS "CMAKE_HOST_APPLE: on" ) - endif() - if( CMAKE_HOST_UNIX ) - message( STATUS "CMAKE_HOST_UNIX: on" ) - endif() - if( CMAKE_HOST_WIN32 ) - message( STATUS "CMAKE_HOST_WIN32: on" ) - endif() - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.10.0 ) - cmake_host_system_information( RESULT os_name QUERY OS_NAME ) - cmake_host_system_information( RESULT os_release QUERY OS_RELEASE ) - cmake_host_system_information( RESULT os_version QUERY OS_VERSION ) - cmake_host_system_information( RESULT os_platform QUERY OS_PLATFORM ) - message( STATUS "OS_NAME: ${os_name}" ) - message( STATUS "OS_RELEASE: ${os_release}" ) - message( STATUS "OS_VERSION: ${os_version}" ) - message( STATUS "OS_PLATFORM: ${os_platform}" ) - endif() - message( STATUS "CMAKE_PROGRAM_PATH: ${CMAKE_PROGRAM_PATH}" ) - message( STATUS "CMAKE_SYSTEM_PROGRAM_PATH: ${CMAKE_SYSTEM_PROGRAM_PATH}" ) - message( STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}" ) - if( CMAKE_CXX_COMPILER_LOADED ) - message( STATUS "CMAKE_CXX_COMPILER_LOADED: on" ) - endif() - # expected: GNU, Clang, AppleClang, MSVC, - message( STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}" ) - message( STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}" ) - message( STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}" ) - #message( STATUS "cxx compile features: ${CMAKE_CXX_COMPILE_FEATURES}" ) - - if( MSVC ) - message( STATUS "CMAKE_VS_PLATFORM_NAME: ${CMAKE_VS_PLATFORM_NAME}" ) - message( STATUS "CMAKE_VS_PLATFORM_TOOLSET: ${CMAKE_VS_PLATFORM_TOOLSET}" ) - message( STATUS "MSVC_VERSION: ${MSVC_VERSION}" ) - if( CMAKE_CSharp_COMPILER_WORKS ) - message( STATUS "CMAKE_CSharp_COMPILER_ID: ${CMAKE_CSharp_COMPILER_ID}" ) - message( STATUS "CMAKE_CSharp_COMPILER: ${CMAKE_CSharp_COMPILER}" ) - message( STATUS "CMAKE_CSharp_COMPILER_VERSION: ${CMAKE_CSharp_COMPILER_VERSION}" ) - endif() - endif() - if( XCODE ) - if( CMAKE_Swift_COMPILER_ID ) - message( STATUS "CMAKE_Swift_COMPILER_ID: ${CMAKE_Swift_COMPILER_ID}" ) - message( STATUS "CMAKE_Swift_COMPILER: ${CMAKE_Swift_COMPILER}" ) - message( STATUS "CMAKE_Swift_COMPILER_VERSION: ${CMAKE_Swift_COMPILER_VERSION}" ) - endif() - endif() - get_property( _bb_generator_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG ) - if( _bb_generator_is_multi_config ) - message( STATUS "CMAKE_CONFIGURATION_TYPES: ${CMAKE_CONFIGURATION_TYPES}" ) - else() - message( STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" ) - endif() - unset( _bb_generator_is_multi_config ) - #message( STATUS "bb_system_info: ${bb_system_info}" ) - message( STATUS "bb_dump_cmake_system_info() leaving" ) -endmacro( bb_dump_cmake_system_info ) - function( _bb_query_linux_pkg_arch pkg_arch_ ) if( bb_dpkg_cmd ) @@ -589,7 +748,7 @@ function( _bb_query_system_info system_info_ ) endif() elseif( CMAKE_HOST_APPLE ) set( _system_info "macosx" ) - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.10.0 ) + if( NOT CMAKE_VERSION VERSION_LESS 3.10.0 ) # sw_vers -productVersion cmake_host_system_information( RESULT _lsb_distro_version QUERY OS_RELEASE ) # sw_vers -buildVersion @@ -725,7 +884,11 @@ function( _bb_get_toolset_subdir toolset_subdir_ compiler_version_ ) # MinGW is either a cross compiler or a native compiler. set( _toolset_subdir "gcc-mingw-${compiler_version_}" ) elseif( CMAKE_CROSSCOMPILING ) - message( FATAL_ERROR "no support for this type of cross compiler, please contact technical support." ) + if( BBuildEnv_DEBUG ) + message( STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " + "cross compiling for ${CMAKE_SYSTEM_PROCESSOR} CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID} cxx_version=${compiler_version_}" ) + endif() + # message( FATAL_ERROR "no support for this type of cross compiler, please contact technical support." ) endif() if( DEFINED _toolset_subdir ) set( ${toolset_subdir_} "${_toolset_subdir}" PARENT_SCOPE ) @@ -740,9 +903,7 @@ endfunction() function( bb_get_target_arch target_arch_ ) list( GET bb_system_info 1 _target_arch ) if( MSVC ) - if( CMAKE_VS_PLATFORM_NAME STREQUAL "x64" ) - set( _target_arch "x86_64" ) - elseif( CMAKE_VS_PLATFORM_NAME STREQUAL "Win32" ) + if( CMAKE_SIZEOF_VOID_P EQUAL 4 ) set( _target_arch "x86" ) endif() elseif( MINGW ) @@ -788,19 +949,7 @@ function( bb_get_isysroot isysroot_ ) set( ${isysroot_} "${_isysroot}" PARENT_SCOPE ) endfunction() -function( bb_dump_target_properties target_ prop1_ ) - set( _prop_list ${prop1_} ) - list( APPEND _prop_list ${ARGN} ) - list( LENGTH _prop_list _prop_list_len ) - message( STATUS "bb_dump_target_properties: len=${_prop_list_len} ${_prop_list}" ) - foreach( _prop ${_prop_list} ) - get_target_property( _prop_value ${target_} ${_prop} ) - if( _prop_value ) - message( STATUS "bb_dump_target_properties: ${target_}: ${_prop}=${_prop_value}" ) - endif() - endforeach() - message( STATUS "bb_dump_target_properties: leaving" ) -endfunction() + function( bb_get_imp_targets_from_components target_list_ target_prefix_ config_ comp1_ ) set( _comp_list ${comp1_} ${ARGN} ) @@ -848,7 +997,7 @@ function( bb_get_dsos_from_imp_targets dso_list_ config_ target1_ ) # "IMPORTED_LOCATION" "IMPORTED_LOCATION_RELEASE" "IMPORTED_LOCATION_DEBUG" get_target_property( _prop_value ${_target} IMPORTED_LOCATION_${_config_uc} ) if( NOT _prop_value ) - message( WARNING "_bb_get_qt5_dlls(): no IMPORTED_LOCATION_${_configuration} for target ${_qt5_target}" ) + message( WARNING "bb_get_dsos_from_imp_targets(): no IMPORTED_LOCATION_${_config_uc} for target ${_target}" ) get_target_property( _prop_value ${_target} IMPORTED_LOCATION ) endif() if( _prop_value ) @@ -946,60 +1095,34 @@ function( bb_file action_ input_path_ output_path_ ) endfunction() -# -# Version file parsing utilities -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvVersionUtil.cmake ) - -# -# CPACK support -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvCPack.cmake ) - -# -# BOOST SDK utilities -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvBoost.cmake ) - -# -# Qt5 utilities -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvQt5.cmake ) - -# -# OpenCV utilities -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvOpenCV.cmake ) - # # Internal macro to setup the build environment. # macro( bb_build_env_setup ) - _bb_set_bbuildenv_version( 3.10.2.4 ) message( STATUS "Setting up BBuildEnv ${BBuildEnv_VERSION}" ) - if( NOT DEFINED BBuildEnv_DISABLE_PYTHON_DETECTION ) - set( BBuildEnv_DISABLE_PYTHON_DETECTION OFF ) + unset( BBuildEnv_ROOT_DIR ) + unset( BBuildEnv_SCRIPT_DIR ) + set( BBuildEnv_MSYS FALSE ) + + if( CMAKE_HOST_WIN32 ) + if( DEFINED ENV{MSYSTEM} ) + message( STATUS "BBuildEnv: MSYS[2] platform detected." ) + set( BBuildEnv_MSYS TRUE ) + endif() endif() - + bb_check_build_type() - if( EXISTS "${CMAKE_SOURCE_DIR}/CMakeBuild/bin" ) - # Helps migration as some detection code may still require Boost.Build python scripts. - set( bb_script_dir "${CMAKE_SOURCE_DIR}/CMakeBuild/bin" ) - endif() - - if( ( NOT BBuildEnv_DISABLE_PYTHON_DETECTION ) AND ( NOT PYTHONINTERP_FOUND ) ) - find_package( PythonInterp 3 QUIET MODULE ) - if( NOT PYTHONINTERP_FOUND ) - find_package( PythonInterp MODULE ) - endif() - if( PYTHONINTERP_FOUND ) - # message( STATUS "BBuildEnv: python interpreter found: ${PYTHON_EXECUTABLE} version ${PYTHON_VERSION_STRING}" ) + if( EXISTS "${CMAKE_CURRENT_LIST_DIR}/../.." ) + get_filename_component( BBuildEnv_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/../.." REALPATH ) + if( EXISTS "${BBuildEnv_ROOT_DIR}/bin" ) + set( BBuildEnv_SCRIPT_DIR "${BBuildEnv_ROOT_DIR}/bin" ) endif() endif() + _bb_query_system_info( bb_system_info ) # message( STATUS "bb_system_info: ${bb_system_info}" ) @@ -1007,8 +1130,7 @@ macro( bb_build_env_setup ) bb_get_home_dir( bb_home_dir ) _bb_find_proj_home( bb_proj_home "${bb_home_dir}" ) - - + # Add a cmake generator alias # -- # Visual Studio 15 2017 diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvBoost.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvBoost.cmake deleted file mode 100644 index 01db2e5e11aab5942953c9cf803d6f1053c5bd21..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvBoost.cmake +++ /dev/null @@ -1,480 +0,0 @@ -#[[.rst: -BBuildEnvBoost --------------- - -Functions and macros helping to find locally built Boost libraries and simplify their use on -certain platforms. - -#]] - - -# Boost -> CMake compatibility matrix -#set( boost_version_cmake_version_list -# 1_65_1-3.9.3 -# 1_65_0-3.9.3 -# 1_64_0-3.8.0 -# 1_63_0-3.7.2 -# 1_62_0-3.7.0 -# 1_61_0-3.5.1 -# ) - -# FindBoost.cmake does not add the proper defines to the imported targets Boost::<target> which breaks -# linking to shared boost libraries in some cases or platforms. - -# By default BOOST_<COMP>_DYN_LINK is defined if shared BOOST libraries are enabled but some -# BOOST libraries don't follow that naming convention. -set( _bb_boost_coroutine_defs_shared BOOST_COROUTINES_DYN_LINK ) - -set( _bb_boost_math_tr1f_defs_shared BOOST_MATH_TR1_DYN_LINK ) -set( _bb_boost_math_tr1l_defs_shared BOOST_MATH_TR1_DYN_LINK ) -set( _bb_boost_math_c99_defs_shared BOOST_MATH_TR1_DYN_LINK ) -set( _bb_boost_math_c99f_defs_shared BOOST_MATH_TR1_DYN_LINK ) -set( _bb_boost_math_c99l_defs_shared BOOST_MATH_TR1_DYN_LINK ) - -set( _bb_boost_unit_test_framework_defs_shared BOOST_TEST_DYN_LINK ) -set( _bb_boost_prg_exec_monitor_defs_shared BOOST_TEST_DYN_LINK ) - - -function( bb_find_boost_root boost_dir_ ) - #message( STATUS "bb_find_boost_root: home: ${bb_home_dir}" ) - #message( STATUS "bb_find_boost_root: proj_home: ${bb_proj_home}" ) - - set( _boost_root_required TRUE ) - if( ARGC GREATER 1 ) - # Process optional arguments - foreach( _arg IN LISTS ARGN ) - if( _arg STREQUAL "OPTIONAL" ) - set( _boost_root_required FALSE ) - endif() - endforeach() - endif() - - unset( _bb_boost_root ) - if( _boost_root_required ) - bb_set_external_dir( _bb_boost_root "${boost_dir_}" ) - else() - bb_set_external_dir( _bb_boost_root "${boost_dir_}" OPTIONAL ) - endif() - if( NOT DEFINED _bb_boost_root ) - return() - endif() - - # configure our BOOST library directory - bb_get_boost_toolset_subdir( _bb_boost_toolset ) - set( _bb_boost_librarydir "${_bb_boost_root}/lib/${_bb_boost_toolset}/${bb_platform_dir}" ) - - # FindBoost.cmake requires a hint to recognize certain compilers/platforms when searching for - # library names. - unset( _bb_boost_compiler ) - string( REGEX REPLACE "([0-9]+)\\.([0-9]+)([0-9.]+)?" "\\1\\2" _bb_compiler_version_majorminor ${CMAKE_CXX_COMPILER_VERSION} ) - - if( MINGW ) - # MinGW is either a native or a cross compiler. - set( _bb_boost_compiler "-mgw${_bb_compiler_version_majorminor}" ) - elseif( CMAKE_CROSSCOMPILING ) - # No cross compiling support yet -> MinGW is a special case - elseif( APPLE ) - # Assume Apple xcode/clang as the selected toolchain. - # No automatic boost find support implemented by cmake 3.7.0 yet, hence Boost_COMPILER is required - # helping cmake to find BOOST library files. - if( CMAKE_CXX_COMPILER_ID MATCHES "^(AppleClang|Clang)$" ) - set( _bb_boost_compiler "-clang-darwin42" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) - set( _bb_boost_compiler "-il${_bb_compiler_version_majorminor}" ) - endif() - elseif( MSVC ) - if( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) - set( _bb_boost_compiler "-iw" ) - endif() - elseif( UNIX ) - if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) - # Ubuntu 17.10: g++-7 emits just 7 via g++ -dumpversion which FindBoost.cmake uses instead of CMAKE_CXX_COMPILER_VERSION. - set( _bb_boost_compiler "-gcc${_bb_compiler_version_majorminor}" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" ) - # FindBoost.cmake has no support for clang/linux yet (cmake 3.7.0) - set( _bb_boost_compiler "-clang${_bb_compiler_version_majorminor}" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) - # FindBoost.cmake has no support for clang/linux yet (cmake 3.7.0) - set( _bb_boost_compiler "-il${_bb_compiler_version_majorminor}" ) - endif() - endif() - - # system paths usually contain outdated boost versions, disabled by design. - set( Boost_NO_SYSTEM_PATHS ON PARENT_SCOPE ) - # always enable MT - set( Boost_USE_MULTITHREAD ON PARENT_SCOPE ) - - # and export local variables the caller must know about - set( BOOST_ROOT ${_bb_boost_root} PARENT_SCOPE ) - set( BOOST_LIBRARYDIR ${_bb_boost_librarydir} PARENT_SCOPE ) - if( DEFINED _bb_boost_compiler ) - set( Boost_COMPILER ${_bb_boost_compiler} PARENT_SCOPE ) - endif() -endfunction( bb_find_boost_root ) - - -macro( bb_find_boost_save_fnd_context fnd_ctx ) - if( CMAKE_CROSSCOMPILING ) - # message( STATUS "bb_find_boost_save_fnd_context(): CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}" ) - # message( STATUS "bb_find_boost_save_fnd_context(): CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}" ) - - # find_package must be told not to expect the BOOST libraries inside "CMAKE_FIND_ROOT_PATH". - if( DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ) - set( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY} ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER ) - else() - unset( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ) - endif() - if( DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ) - set( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE} ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER ) - else() - unset( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ) - endif() - endif() -endmacro() - - -macro( bb_find_boost_restore_fnd_context fnd_ctx ) - if( CMAKE_CROSSCOMPILING ) - # Restore CMAKE_FIND_ROOT_PATH settings - if( DEFINED ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ) - set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ${${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY} ) - unset( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ) - endif() - if( DEFINED ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ) - set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ${${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE} ) - unset( ${fnd_ctx}_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ) - endif() - # message( STATUS "bb_find_boost_restore_fnd_context(): CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=${CMAKE_FIND_ROOT_PATH_MODE_LIBRARY}" ) - # message( STATUS "bb_find_boost_restore_fnd_context(): CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=${CMAKE_FIND_ROOT_PATH_MODE_INCLUDE}" ) - endif() -endmacro() - - -function( bb_get_boost_toolset_subdir toolset_ ) - - if( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" ) - - # Special handling of msvc as in Boost.Build the msvc version is related to the IDE but in cmake - # it's related to the compiler version. - if( MSVC_VERSION VERSION_GREATER_EQUAL 1910 ) - # VS 2017 updated cl to 19.11.x, 19.12.x which is also mapped to msvc-14.1 by Boost.Build/1.65.0 - set( _boost_toolset "msvc-14.1" ) - elseif( MSVC_VERSION VERSION_EQUAL 1900 ) - set( _boost_toolset "msvc-14.0" ) - elseif( MSVC_VERSION VERSION_EQUAL 1800 ) - set( _boost_toolset "msvc-12.0" ) - elseif( MSVC_VERSION VERSION_EQUAL 1700 ) - set( _boost_toolset "msvc-11.0" ) - elseif( MSVC_VERSION VERSION_EQUAL 1600 ) - set( _boost_toolset "msvc-10.0" ) - else() - message( FATAL_ERROR "bb_get_boost_toolset_subdir(): unsupported MSVC version ${MSVC_VERSION} found, please contact technical support." ) - endif() - else() - if( DEFINED bb_toolset_subdir ) - set( _boost_toolset ${bb_toolset_subdir} ) - else() - # message( FATAL_ERROR "bb_get_boost_toolset_subdir(): variable bb_toolset_subdir is undefined, please contact technical support." ) - _bb_get_cxx_compiler_version_major_minor( _compiler_version_major_minor ) - _bb_get_toolset_subdir( _boost_toolset ${_compiler_version_major_minor} ) - endif() - endif() - set( ${toolset_} ${_boost_toolset} PARENT_SCOPE ) -endfunction() - - -# Add missing Boost definitions -function( bb_add_boost_definitions boost_comp_ ) - - set( _boost_comps ${boost_comp_} ${ARGN} ) - #message( STATUS "bb_add_boost_definitions: ${_boost_comps}" ) - if( NOT "boost" IN_LIST _boost_comps ) - list( APPEND _boost_comps "boost" ) - endif() - - if( NOT Boost_FOUND ) - message( WARNING "bb_add_boost_definitions() called but Boost_FOUND=FALSE, is this intended?") - return() - endif() - - unset( _boost_targets ) - set( _add_target_boost_config FALSE ) - - if( MSVC ) - if( ( Boost_VERSION EQUAL 106600 ) AND ( MSVC_VERSION VERSION_GREATER 1911 ) ) - set( _add_target_boost_config TRUE ) - endif() - if( _add_target_boost_config ) - if( NOT TARGET Boost::config ) - _bb_get_boost_targets_recursive( _boost_targets ${_boost_comps} ) - add_library( Boost::config INTERFACE IMPORTED ) - set_target_properties( Boost::config PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE" ) - foreach( _tgt IN LISTS _boost_targets ) - # message( STATUS "processing target ${_tgt} to silence MSVC version warnings." ) - get_target_property( _prop_value ${_tgt} INTERFACE_LINK_LIBRARIES ) - if( _prop_value ) - # message( STATUS "${_tgt} has interface link libraries: ${_prop_value}" ) - list( APPEND _prop_value "Boost::config" ) - set_target_properties( ${_tgt} PROPERTIES INTERFACE_LINK_LIBRARIES "${_prop_value}" ) - else() - set_target_properties( ${_tgt} PROPERTIES INTERFACE_LINK_LIBRARIES "Boost::config" ) - endif() - endforeach() - #foreach( _tgt IN LISTS _boost_targets ) - # message( STATUS "checking target ${_tgt}" ) - # get_target_property( _prop_value ${_tgt} INTERFACE_LINK_LIBRARIES ) - # if( _prop_value ) - # message( STATUS "${_tgt} has interface link libraries: ${_prop_value}" ) - # endif() - #endforeach() - endif() - endif() - endif() - - if( Boost_USE_STATIC_LIBS ) - #message( STATUS "bb_add_boost_definitions: static boost libraries selected -> no extra definitions." ) - return() - endif() - - # expand BOOST component list via target list to deal with internal dependencies properly; e.g. filesystem depends on system - if( NOT DEFINED _boost_targets ) - _bb_get_boost_targets_recursive( _boost_targets ${_boost_comps} ) - endif() - - string( REPLACE "Boost::" "" _boost_comps "${_boost_targets}" ) - #message( STATUS "expanded boost component list: ${_boost_comps}" ) - - foreach( _comp IN LISTS _boost_comps ) - set( _target "Boost::${_comp}" ) - #message( STATUS "bb_add_boost_definitions: processing target ${_target} ..." ) - if( NOT TARGET ${_target} ) - message( FATAL_ERROR "bb_add_boost_definitions: target ${_target} does not exist." ) - else() - get_target_property( _prop_value ${_target} TYPE ) - if( _prop_value ) - # message( STATUS "target ${_target} is ${_prop_value}" ) - if( _prop_value STREQUAL "INTERFACE_LIBRARY" ) - #message( STATUS "bb_add_boost_definitions: skipping target ${_target}" ) - continue() - endif() - endif() - get_target_property( _prop_value ${_target} "INTERFACE_COMPILE_DEFINITIONS" ) - if( _prop_value ) - message( FATAL_ERROR "bb_add_boost_definitions: target ${_target} has unexpected INTERFACE_COMPILE_DEFINITIONS: ${_prop_value}" ) - else() - if( DEFINED _bb_boost_${_comp}_defs_shared ) - set( _new_comp_definitions ${_bb_boost_${_comp}_defs_shared} ) - else() - string( TOUPPER ${_comp} _comp_uc ) - set( _new_comp_definitions BOOST_${_comp_uc}_DYN_LINK ) - endif() - set_target_properties( ${_target} PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${_new_comp_definitions}" ) - #message( STATUS "bb_add_boost_definitions: target ${_target} -> INTERFACE_COMPILE_DEFINITIONS ${_new_comp_definitions}" ) - endif() - endif() - endforeach() -endfunction( bb_add_boost_definitions ) - - -function( bb_add_target_boost_asio ) - if( NOT Boost_FOUND ) - message( WARNING "bb_add_target_boost_asio() called but Boost_FOUND=FALSE, is this intended?" ) - return() - endif() - - if( NOT TARGET Boost::asio ) - if( NOT TARGET Boost::system ) - message( FATAL_ERROR "Boost::asio depends on Boost::system which is missing. Please check the list of components passed to find_package( Boost ...)" ) - return() - endif() - add_library( Boost::asio INTERFACE IMPORTED ) - if( MINGW ) - set_target_properties( Boost::asio PROPERTIES INTERFACE_LINK_LIBRARIES "Boost::system;ws2_32" ) - else() - set_target_properties( Boost::asio PROPERTIES INTERFACE_LINK_LIBRARIES "Boost::system" ) - endif() - - if( MSVC AND ( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) ) - if( Boost_VERSION EQUAL 106600 ) - set_target_properties( Boost::asio PROPERTIES INTERFACE_COMPILE_DEFINITIONS "BOOST_ASIO_MSVC=${MSVC_VERSION}" ) - endif() - endif() - endif() -endfunction() - - -# bb_add_target_CopyBoostRuntimeFiles( filesystem chrono ... ) -macro( bb_add_target_CopyBoostRuntimeFiles boost_comp_ ) - if( WIN32 AND NOT Boost_USE_STATIC_LIBS ) - if( NOT TARGET CopyQt5RuntimeFiles ) - bb_get_boost_dlls( _boost_bin_dir _boost_dll_list_release _boost_dll_list_debug ${ARGV} ) - unset( _boost_dll_file_list ) - foreach( _fname ${_boost_dll_list_release} ) - list( APPEND _boost_dll_file_list "$<$<NOT:$<CONFIG:Debug>>:${_fname}>" ) - endforeach() - foreach( _fname ${_boost_dll_list_debug} ) - list( APPEND _boost_dll_file_list "$<$<CONFIG:Debug>:${_fname}>" ) - endforeach() - message( STATUS "bb_add_target_CopyBoostRuntimeFiles: creating custom target" ) - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.8 ) - add_custom_target( CopyBoostRuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_boost_dll_file_list} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY ${_boost_bin_dir} - VERBATIM COMMAND_EXPAND_LISTS ) - else() - add_custom_target( CopyBoostRuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_boost_dll_file_list} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY ${_boost_bin_dir} ) - endif() - endif() - endif() -endmacro() - - -function( _bb_get_boost_targets_recursive boost_targets_ boost_comp_ ) - set( _boost_comp_list ${boost_comp_} ${ARGN} ) - unset( _boost_target_list ) - foreach( _comp ${_boost_comp_list} ) - list( APPEND _boost_target_list Boost::${_comp} ) - get_target_property( _prop_value Boost::${_comp} "INTERFACE_LINK_LIBRARIES" ) - if( _prop_value ) - foreach( _lnk_lib ${_prop_value} ) - if( _lnk_lib MATCHES "^Boost::[a-z_A-Z]" ) - list( APPEND _boost_target_list ${_lnk_lib} ) - endif() - endforeach() - endif() - endforeach() - list( REMOVE_DUPLICATES _boost_target_list ) - set( ${boost_targets_} ${_boost_target_list} PARENT_SCOPE ) -endfunction() - - -function( bb_get_boost_dlls boost_bin_dir_ boost_dll_list_release_ boost_dll_list_debug_ boost_comp_ ) - set( _boost_comp_list ${boost_comp_} ${ARGN} ) - # expand BOOST components into a list of BOOST targets including dependent boost DLLs. - _bb_get_boost_targets_recursive( _boost_targets ${_boost_comp_list} ) - - unset( _boost_bin_dir ) - unset( _boost_dll_list_release ) - unset( _boost_dll_list_debug ) - foreach( _tgt IN LISTS _boost_targets ) - # check for INTERFACE_LIBRARIES which must be skipped as they don't support a IMPORTED_LOCATION properties. - get_target_property( _prop_value ${_tgt} TYPE ) - if( _prop_value ) - # message( STATUS "target ${_tgt} is ${_prop_value}" ) - if( _prop_value STREQUAL "INTERFACE_LIBRARY" ) - #message( STATUS "bb_get_boost_dlls(): skipping target ${_tgt}" ) - continue() - endif() - else() - message( WARNING "target ${_tgt} does not have a TYPE property, looks like a bug." ) - endif() - # query release component paths and extract the DLL file name. - bb_boost_query_lib_component_path( _comp_paths ${_tgt} RELEASE ) - list( GET _comp_paths 0 _boost_dll_path ) - get_filename_component( _boost_dll_fname ${_boost_dll_path} NAME ) - list( APPEND _boost_dll_list_release ${_boost_dll_fname} ) - if( NOT DEFINED _boost_bin_dir ) - get_filename_component( _boost_bin_dir ${_boost_dll_path} DIRECTORY ) - endif() - # query debug component paths and extract the DLL file name. - bb_boost_query_lib_component_path( _comp_paths ${_tgt} DEBUG ) - list( GET _comp_paths 0 _boost_dll_path ) - get_filename_component( _boost_dll_fname ${_boost_dll_path} NAME ) - list( APPEND _boost_dll_list_debug ${_boost_dll_fname} ) - endforeach() - set( ${boost_bin_dir_} ${_boost_bin_dir} PARENT_SCOPE ) - set( ${boost_dll_list_release_} ${_boost_dll_list_release} PARENT_SCOPE ) - set( ${boost_dll_list_debug_} ${_boost_dll_list_debug} PARENT_SCOPE ) -endfunction() - -function( _bb_boost_guess_lib_component_dll_path dll_path_ lib_path_ ) - - #/home/rauthenberg/projects/Boost_1_63_0-c++11/lib/gcc-5.4/x86_64/libboost_system-gcc54-mt-d-1_63.lib [.dll.a] - # /bin/<toolset>/<target>/<libname>.dll - # message( STATUS "_bb_boost_guess_lib_component_dll_path: lib_path_=${lib_path_}" ) - get_filename_component( _libname "${lib_path_}" NAME_WE ) - # message( STATUS "_bb_boost_guess_lib_component_dll_path: _libname=${_libname}" ) - get_filename_component( _libdir "${lib_path_}" DIRECTORY ) - get_filename_component( _target_dir "${_libdir}" NAME ) - # message( STATUS "_bb_boost_guess_lib_component_dll_path: _target_dir=${_target_dir}" ) - get_filename_component( _libdir_tmp "${_libdir}/.." REALPATH ) - get_filename_component( _toolset_dir "${_libdir_tmp}" NAME ) - # message( STATUS "_bb_boost_guess_lib_component_dll_path: _toolset_dir=${_toolset_dir}" ) - get_filename_component( _bin_dir "${_libdir}/../../../bin/${_toolset_dir}/${_target_dir}" REALPATH ) - #message( STATUS "_bb_boost_guess_lib_component_dll_path: _bin_dir=${_bin_dir}" ) - set( ${dll_path_} "${_bin_dir}/${_libname}.dll" PARENT_SCOPE ) -endfunction() - -function( bb_boost_query_lib_component_path comp_paths_ target_ ) - set( _lib_configuration "RELEASE" ) - if( ${ARGC} GREATER 3 ) - message( FATAL_ERROR "bb_boost_query_lib_component_path() called with too many arguments." ) - elseif( ${ARGC} EQUAL 3 ) - set( _lib_configuration ${ARGV2} ) - endif() - - get_target_property( _prop_value ${target_} "IMPORTED_LOCATION_${_lib_configuration}" ) - if( _prop_value ) - #message( STATUS "${target_}: IMPORTED_LOCATION_${_lib_configuration}=${_prop_value}" ) - set( _imported_location "${_prop_value}" ) - else() - message( FATAL_ERROR "bb_boost_query_lib_component_path: IMPORTED_LOCATION_${_lib_configuration} not defined for target ${target_}." ) - endif() - - unset( _comp_paths ) - if( WIN32 ) - unset( _imported_implib ) - get_target_property( _prop_value ${target_} "IMPORTED_IMPLIB_${_lib_configuration}" ) - if( _prop_value ) - #message( STATUS "${target_}: IMPORTED_IMPLIB=${_prop_value}" ) - set( _imported_implib "${_prop_value}" ) - endif() - if( Boost_USE_STATIC_LIBS ) - if( DEFINED _imported_implib ) - set( _comp_paths "${_imported_implib}" ) - else() - set( _comp_paths "${_imported_location}" ) - endif() - else() - # shared Boost library: return -> dll_path;lib_path - if( NOT DEFINED _imported_implib ) - # findBoost() seems to ignore DLL paths and does not define IMPORTED_IMPLIB_<config> properties. - set( _imported_implib "${_imported_location}" ) - _bb_boost_guess_lib_component_dll_path( _imported_location "${_imported_implib}" ) - endif() - set( _comp_paths "${_imported_location}" "${_imported_implib}" ) - endif() - else() - set( _comp_paths "${_imported_location}" ) - endif() - if( DEFINED _comp_paths ) - set( ${comp_paths_} "${_comp_paths}" PARENT_SCOPE ) - endif() -endfunction( bb_boost_query_lib_component_path ) - -# -# Include functions and macros to build Boost libraries. -# -include( ${CMAKE_CURRENT_LIST_DIR}/BBuildEnvBuildBoost.cmake ) - - diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvBootstrap.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvBootstrap.cmake deleted file mode 100644 index c975bb836333edadffa1ecf84e3ed574d9e1c73d..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvBootstrap.cmake +++ /dev/null @@ -1,131 +0,0 @@ -#[[.rst: -BBuildEnvBootstrap ------------------- - -This module provides out-of-tree checkout and update support for CMakeBuild. - -How to Use -^^^^^^^^^^ - -Copy ``BBuildEnvBootstrap.cmake`` and ``BBuildEnvSvn.cmake`` to ``${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/cmake/bootstrap`` -and add the following section to the top of the top-level CMakeLists.txt. - -.. code-block:: cmake - - include( ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/cmake/bootstrap/BBuildEnvBootstrap.cmake ) - bb_svn_checkout_cmakebuild( ${CMAKE_SOURCE_DIR}/../CMakeBuild-3.10.2-4 "https://bslinux3.hhi.fraunhofer.de/svn/svn_CMakeBuild/tags/3.10.2-4" ) - - -#]] - -if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.10 ) - include_guard( GLOBAL ) -endif() - - -set( BBuildEnvBootstrap_VERSION 3.10.2.4 ) -message( STATUS "Loading BBuildEnvBootstrap ${BBuildEnvBootstrap_VERSION}" ) - - -macro( bb_svn_checkout_cmakebuild checkout_dir_ svn_url_ ) - - option( CHECKOUT_CMAKEBUILD_ONLY "checkout CMakeBuild only" OFF ) - - set( _cmakebuild_update_script "${CMAKE_BINARY_DIR}/ExtSrcDirs/CMakeBuild-svnupdate.cmake" ) - _bb_write_svn_co_cmakebuild_script( "${_cmakebuild_update_script}" ${checkout_dir_} ${svn_url_} ${ARGN} ) - - execute_process( - COMMAND ${CMAKE_COMMAND} -P ${_cmakebuild_update_script} - RESULT_VARIABLE error_code - ) - if( error_code ) - message( FATAL_ERROR "Failed to checkout or update: '${checkout_dir_}'" ) - endif() - - if( CHECKOUT_CMAKEBUILD_ONLY ) - return() - endif() -endmacro() - - -macro( bb_git_checkout_cmakebuild checkout_dir_ git_tag_ ) - - #message( STATUS "bb_git_checkout_cmakebuild(): entering: ${ARGV}" ) - - option( CHECKOUT_CMAKEBUILD_ONLY "checkout CMakeBuild only" OFF ) - - if( NOT Git_FOUND ) - find_package( Git MODULE REQUIRED ) - endif() - set( _cmakebuild_update_script "${CMAKE_BINARY_DIR}/ExtSrcDirs/CMakeBuild-gitupdate.cmake" ) - _bb_write_git_co_cmakebuild_script( "${_cmakebuild_update_script}" "${GIT_EXECUTABLE}" ${checkout_dir_} ${git_tag_} ${ARGN} ) - - execute_process( - COMMAND ${CMAKE_COMMAND} -P ${_cmakebuild_update_script} - RESULT_VARIABLE error_code - ) - if( error_code ) - message( FATAL_ERROR "Failed to checkout or update: '${checkout_dir_}'" ) - endif() - - #message( STATUS "bb_git_checkout_cmakebuild(): leaving" ) - - if( CHECKOUT_CMAKEBUILD_ONLY ) - return() - endif() -endmacro() - - -function( _bb_write_svn_co_cmakebuild_script script_filename_ checkout_dir_ svn_url_ ) - - set( _optional_args ${ARGN} ) - - get_filename_component( _script_dir "${script_filename_}" DIRECTORY ) - if( NOT EXISTS "${_script_dir}" ) - file( MAKE_DIRECTORY "${_script_dir}" ) - endif() - - set( _svn_cmake_script "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/cmake/bootstrap/BBuildEnvSvn.cmake" ) - if( NOT EXISTS "${_svn_cmake_script}" ) - message( FATAL_ERROR "${_svn_cmake_script} does not exist. \nYou may need to update ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/cmake/bootstrap" ) - endif() - - file( WRITE ${script_filename_} -"# Written by _bb_write_svn_co_cmakebuild_script ${BBuildEnvBootstrap_VERSION} -cmake_policy( VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} ) -if( NOT Subversion_FOUND ) - find_package( Subversion QUIET MODULE REQUIRED ) -endif() -include( \"${_svn_cmake_script}\" ) - -bb_svn_co_external_dir_helper( \"${checkout_dir_}\" ${svn_url_} ${_optional_args} ) -" ) - -endfunction() - - -function( _bb_write_git_co_cmakebuild_script script_filename_ git_EXECUTABLE_ checkout_dir_ git_tag_ ) - - set( _optional_args ${ARGN} ) - - get_filename_component( _script_dir "${script_filename_}" DIRECTORY ) - if( NOT EXISTS "${_script_dir}" ) - file( MAKE_DIRECTORY "${_script_dir}" ) - endif() - - set( _git_cmake_script "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/cmake/bootstrap/BBuildEnvGit.cmake" ) - if( NOT EXISTS "${_git_cmake_script}" ) - message( FATAL_ERROR "${_git_cmake_script} does not exist. \nYou may need to update ${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/cmake/bootstrap" ) - endif() - - file( WRITE ${script_filename_} -"# Written by _bb_write_git_co_cmakebuild_script ${BBuildEnvBootstrap_VERSION} -cmake_policy( VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} ) -include( \"${_git_cmake_script}\" ) - -bb_git_co_external_dir_helper( \"${git_EXECUTABLE_}\" \"${checkout_dir_}\" ${git_tag_} ${_optional_args} ) -" ) - -endfunction() - - diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvBuildBoost.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvBuildBoost.cmake deleted file mode 100644 index b4736e89400cbb5e294b047002d8b29cd957cde5..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvBuildBoost.cmake +++ /dev/null @@ -1,538 +0,0 @@ -#[[.rst: -BBuildEnvBuildBoost -------------------- - -Functions and macros to build Boost libraries from source. - -#]] - - -function( bb_boost_build_bjam bjam_prog_ boost_root_ ) - # Depending on the Boost version the b2 source files are stored in different directories. - set( _boost_tools_dir "${boost_root_}/tools" ) - set( _bjam_src_dir_list "${_boost_tools_dir}/build/src/engine" ) - list( APPEND _bjam_src_dir_list "${_boost_tools_dir}/build/v2/engine" ) - list( APPEND _bjam_src_dir_list "${_boost_tools_dir}/build/v2/engine/src" ) - list( APPEND _bjam_src_dir_list "${_boost_tools_dir}/jam/src" ) - - unset( _bjam_src_dir ) - foreach( _dir IN LISTS _bjam_src_dir_list ) - if( EXISTS "${_dir}" ) - set( _bjam_src_dir "${_dir}" ) - break() - endif() - endforeach() - - if( NOT DEFINED _bjam_src_dir ) - message( FATAL_ERROR "bb_boost_build_bjam(): cannot find b2 source directory inside ${boost_root_}, please contact technical support." ) - endif() - - if( EXISTS "${_bjam_src_dir}/bootstrap" ) - file( REMOVE_RECURSE "${_bjam_src_dir}/bootstrap" ) - endif() - - if( CMAKE_HOST_UNIX ) - set( _build_script_launcher "/bin/sh" ) - set( _build_script_cmd_line "${_bjam_src_dir}/build.sh" ) - elseif( CMAKE_HOST_WIN32 ) - set( _build_script_cmd_line "/c" ) - find_program( BB_SHELL_PROG "cmd.exe" ) - #message( STATUS "cmd.exe found: BB_SHELL_PROG=${BB_SHELL_PROG}" ) - bb_file( TO_NATIVE_PATH "${BB_SHELL_PROG}" _build_script_launcher ) - bb_file( TO_NATIVE_PATH "${_bjam_src_dir}/build.bat" _build_script ) - - string( APPEND _build_script_cmd_line " ${_build_script}" ) - - if( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" ) - if( MSVC_VERSION VERSION_GREATER_EQUAL 1910 ) - # VS 2017 updated cl to 19.11.x, 19.12.x which is also mapped to msvc-14.1 by Boost.Build/1.66.0 - set( _bjam_toolset "vc141" ) - elseif( MSVC_VERSION VERSION_EQUAL 1900 ) - set( _bjam_toolset "vc14" ) - elseif( MSVC_VERSION VERSION_EQUAL 1800 ) - set( _bjam_toolset "vc12" ) - elseif( MSVC_VERSION VERSION_EQUAL 1700 ) - set( _bjam_toolset "vc11" ) - elseif( MSVC_VERSION VERSION_EQUAL 1600 ) - set( _bjam_toolset "vc10" ) - else() - message( FATAL_ERROR "bb_boost_build_bjam(): unsupported MSVC version ${MSVC_VERSION} found, please contact technical support." ) - endif() - string( APPEND _build_script_cmd_line " ${_bjam_toolset}" ) - endif() - endif() - - separate_arguments( _build_script_args NATIVE_COMMAND "${_build_script_cmd_line}" ) - message( STATUS "Launching: ${_build_script_launcher} ${_build_script_cmd_line}" ) - execute_process( COMMAND "${_build_script_launcher}" ${_build_script_args} WORKING_DIRECTORY "${_bjam_src_dir}" RESULT_VARIABLE _retv ) - - if( _retv EQUAL 0 ) - if( CMAKE_HOST_APPLE ) - set( _bjam_bin_dir "${_bjam_src_dir}/bin.macosxx86_64" ) - elseif( CMAKE_HOST_UNIX ) - set( _bjam_bin_dir "${_bjam_src_dir}/bin.linuxx86_64" ) - elseif( CMAKE_HOST_WIN32 ) - set( _bjam_bin_dir "${_bjam_src_dir}/bin.ntx86" ) - endif() - - unset( _bjam_prog ) - if( CMAKE_HOST_WIN32 ) - set( _bjam_prog_list "b2.exe" "bjam.exe" ) - else() - set( _bjam_prog_list "b2" "bjam" ) - endif() - foreach( _prog IN LISTS _bjam_prog_list ) - if( EXISTS "${_bjam_bin_dir}/${_prog}" ) - set( _bjam_prog "${_bjam_bin_dir}/${_prog}" ) - break() - endif() - endforeach() - - if( ( DEFINED _bjam_prog ) AND ( EXISTS "${_bjam_prog}" ) ) - set( ${bjam_prog_} "${_bjam_prog}" PARENT_SCOPE ) - else() - set( ${bjam_prog_} "${bjam_prog_}-NOTFOUND" PARENT_SCOPE ) - endif() - else() - set( ${bjam_prog_} "${bjam_prog_}-NOTFOUND" PARENT_SCOPE ) - message( STATUS "bjam build failed: retv=${_retv}" ) - endif() - - if( EXISTS "${_bjam_src_dir}/bootstrap" ) - file( REMOVE_RECURSE "${_bjam_src_dir}/bootstrap" ) - endif() -endfunction( bb_boost_build_bjam ) - - -function( bb_boost_build_libs boost_root_ boost_lib_dir_ ) - - set( _dry_run FALSE ) - set( _rebuild FALSE ) - - #set( _dry_run TRUE ) - #set( _rebuild TRUE ) - - if( NOT EXISTS "${boost_root_}" ) - message( FATAL_ERROR "Boost root directory ${boost_root_} does not exist." ) - endif() - - if( NOT EXISTS "${boost_root_}/boost/version.hpp" ) - message( FATAL_ERROR "Directory ${boost_root_} does not seem to be a Boost root directory." ) - endif() - - if( NOT _rebuild ) - if( EXISTS "${boost_lib_dir_}" ) - return() - endif() - endif() - - _bb_get_boost_version( _boost_version "${boost_root_}/boost/version.hpp" ) - message( STATUS "bb_boost_build_libs(): found ${_boost_version} in ${boost_root_}" ) - - # Pick up the user's home directory - bb_get_home_dir( _home_dir ) - set( _user_config_file "${_home_dir}/user-config.jam" ) - - if( EXISTS "${_user_config_file}" ) - message( FATAL_ERROR "Found ${_user_config_file} which will interfere with the Boost build process." ) - endif() - - set( _tmp_dirs "${boost_root_}/bin.v2" "${boost_root_}/tmp" ) - # The next temporary directory exists in 1.58.0 and later. - list( APPEND _tmp_dirs "${boost_root_}/libs/config/checks/architecture/bin" ) - - #message( STATUS "bb_boost_build_libs(): CMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}" ) - - file( RELATIVE_PATH _lib_dir_rel "${boost_root_}" "${boost_lib_dir_}" ) - #message( STATUS "bb_boost_build_libs(): lib_dir_rel=${_lib_dir_rel}" ) - - string( REGEX REPLACE "^lib/" "bin/" _bin_dir_rel "${_lib_dir_rel}" ) - #message( STATUS "bb_boost_build_libs(): bin_dir_rel=${_bin_dir_rel}" ) - - set( _boost_bin_dir "${boost_root_}/${_bin_dir_rel}" ) - - unset( _user_config_content ) - _bb_boost_compose_b2_cmd_line( _b2_cmd_line _user_config_content ${boost_root_} ${_lib_dir_rel} ${_boost_version} ) - - if( DEFINED _user_config_content ) - _bb_boost_write_user_config_file( ${_user_config_file} "${_user_config_content}" ) - endif() - - if( _dry_run ) - if( CMAKE_HOST_WIN32 ) - file( TO_NATIVE_PATH "$ENV{USERPROFILE}/bin/PrintArgsTest.exe" _b2_prog ) - else() - set( _b2_prog "$ENV{HOME}/bin/PrintArgsTest" ) - endif() - else() - # Build b2 / bjam - bb_boost_build_bjam( _b2_prog "${boost_root_}" ) - endif() - - if( NOT _dry_run ) - # Remove any existing Windows DLLs - if( EXISTS "${_boost_bin_dir}" ) - message( STATUS "Removing ${_boost_bin_dir} ... " ) - file( REMOVE_RECURSE "${_boost_bin_dir}" ) - endif() - endif() - - # Remove any temporary directories inside the Boost source tree. - _bb_boost_remove_tmp_dirs( ${_tmp_dirs} ) - - separate_arguments( _b2_args UNIX_COMMAND "${_b2_cmd_line}" ) - message( STATUS "Launching: ${_b2_prog} ${_b2_cmd_line}" ) - if( EXISTS "${_b2_prog}" ) - # In dry run mode _b2_prog may not exist. - execute_process( COMMAND "${_b2_prog}" ${_b2_args} WORKING_DIRECTORY "${boost_root_}" RESULT_VARIABLE _retv ) - - if( NOT _retv EQUAL 0 ) - message( WARNING "At least some Boost libraries failed to build." ) - endif() - endif() - - # Get rid of the temporary user-config.jam as soon as possible. - if( EXISTS "${_user_config_file}" ) - file( REMOVE "${_user_config_file}" ) - endif() - - if( MSVC OR MINGW ) - _bb_boost_relocate_win_dlls( "${boost_root_}" "${boost_lib_dir_}" "${_boost_bin_dir}" ) - endif() - - # Remove any temporary directories inside the Boost source tree. - _bb_boost_remove_tmp_dirs( ${_tmp_dirs} ) - - # Get rid of the temporary b2 or bjam inside the Boost source tree. - _bb_boost_remove_bjam( "${_b2_prog}" ) - - # List all libraries - message( STATUS "Enumerating Boost components in ${boost_lib_dir_}:" ) - unset( _boost_comp_list ) - _bb_boost_list_components( _boost_comp_list "${boost_lib_dir_}" ) - if( DEFINED _boost_comp_list ) - foreach( _comp IN LISTS _boost_comp_list ) - message( STATUS " ${_comp}" ) - endforeach() - endif() - - message( STATUS "b2 command line: ${_b2_prog} ${_b2_cmd_line}" ) - if( DEFINED _user_config_content ) - message( STATUS "<user-config.jam>" ) - foreach( _line IN LISTS _user_config_content ) - message( STATUS "${_line} ;" ) - endforeach() - message( STATUS "</user-config.jam>" ) - endif() - message( STATUS "Finished building Boost: ${boost_root_}" ) -endfunction( bb_boost_build_libs ) - -function( _bb_get_boost_version boost_version_str_ boost_version_file_ ) - - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - set(Boost_VERSION 0) - set(Boost_LIB_VERSION "") - file(STRINGS "${boost_version_file_}" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") - set(_Boost_VERSION_REGEX "([0-9]+)") - set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") - foreach(v VERSION LIB_VERSION) - if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}") - set(Boost_${v} "${CMAKE_MATCH_1}") - endif() - endforeach() - unset(_boost_VERSION_HPP_CONTENTS) - - math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - - set( ${boost_version_str_} "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}" PARENT_SCOPE ) -endfunction() - -function( _bb_boost_list_components comp_list_ boost_lib_dir_ ) - if( NOT EXISTS "${boost_lib_dir_}" ) - message( STATUS "bb_boost_list_components(): library directory ${boost_lib_dir_} does not exist." ) - return() - endif() - - if( MSVC ) - file( GLOB _lib_file_list RELATIVE "${boost_lib_dir_}" "${boost_lib_dir_}/*.lib" ) - else() - file( GLOB _lib_file_list RELATIVE "${boost_lib_dir_}" "${boost_lib_dir_}/*.a" ) - endif() - - if( NOT _lib_file_list ) - # No library files found - #message( STATUS "bb_boost_list_components(): no library files found in ======== ====== ====== ===== ======= ==========> ${boost_lib_dir_}" ) - #message( STATUS "bb_boost_list_components(): no library files found in ======== ====== ====== ===== ======= ==========>" ) - return() - endif() - - # message( STATUS "_lib_file_list: ${_lib_file_list}" ) - - unset( _boost_comp_list ) - - foreach( _lib_file IN LISTS _lib_file_list ) - # _lib_file = libboost_thread-gcc54-mt-1_65_1.a - if( _lib_file MATCHES "^libboost_([^-]+)" ) - list( APPEND _boost_comp_list ${CMAKE_MATCH_1} ) - endif() - endforeach() - if( DEFINED _boost_comp_list ) - list( REMOVE_DUPLICATES _boost_comp_list ) - list( SORT _boost_comp_list ) - #message( STATUS "_boost_comp_list: ${_boost_comp_list}" ) - set( ${comp_list_} ${_boost_comp_list} PARENT_SCOPE ) - endif() -endfunction() - - -# -# Linux/native: -# /home/rauthenberg/bin/b2 -j16 --layout=versioned --prefix=tmp/dist cxxflags=-std=c++11 variant=release,debug link=static,shared install toolset=gcc --libdir=lib/gcc-5.4/x86_64 cflags=-fPIC -# Linux/mingw/x86_64: -# /home/rauthenberg/bin/b2 -j16 --layout=versioned --prefix=tmp/dist cxxflags=-std=c++11 variant=release,debug link=static,shared install toolset=gcc --libdir=lib/gcc-mingw-5.3/x86_64 target-os=windows threadapi=win32 --without-locale --without-python -# Linux/mingw/x86: -# /home/rauthenberg/bin/b2 -j16 --layout=versioned --prefix=tmp/dist cxxflags=-std=c++11 variant=release,debug link=static,shared install toolset=gcc --libdir=lib/gcc-mingw-5.3/x86 target-os=windows threadapi=win32 --without-locale --without-python -# -# MacOSX/native: requires user-config.jam -# /Users/rauthenberg/bin/b2 -j8 --layout=versioned --prefix=tmp/dist cxxflags=-ftemplate-depth=256 -std=c++11 linkflags=-headerpad_max_install_names -mmacosx-version-min=10.12 variant=release,debug link=static,shared install toolset=clang --libdir=lib/clang-9.0/x86_64 cflags=-mmacosx-version-min=10.12 -# - -# Internal function to compose the b2 command line to build Boost libraries. -function( _bb_boost_compose_b2_cmd_line cmd_line_ user_config_content_ boost_root_ lib_dir_rel_ boost_version_ ) - - unset( _user_config_content ) - unset( _cxxflags ) - unset( _compileflags ) - unset( _linkflags ) - unset( _rc ) - unset( _bb_toolset_version_major_minor ) - - set( _without_python TRUE ) - set( _without_mpi TRUE ) - - # cmake_host_system_information( RESULT _num_cores QUERY NUMBER_OF_PHYSICAL_CORES ) - cmake_host_system_information( RESULT _num_cores QUERY NUMBER_OF_LOGICAL_CORES ) - - set( _b2_cmd_line "-j${_num_cores} --layout=versioned --prefix=tmp/dist --libdir=${lib_dir_rel_} variant=release,debug link=static,shared" ) - - # Figure out the Boost toolset - _bb_get_cxx_compiler_version_major_minor( _bb_toolset_version_major_minor ) - if( MSVC ) - # Pick up the MSVC toolset argument supported by b2; e.g. toolset=msvc-14.1, toolset=msvc-14.0, ... - bb_get_boost_toolset_subdir( _bb_boost_toolset ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) - # -> b2 toolset=gcc ... - set( _bb_boost_toolset "gcc" ) - elseif( CMAKE_CXX_COMPILER_ID MATCHES "^(AppleClang|Clang)$" ) - # -> b2 toolset=clang ... - set( _bb_boost_toolset "clang" ) - endif() - - if( NOT MSVC ) - unset( _cxx_std ) - _bb_boost_get_cxx_std( _cxx_std "${boost_root_}" ) - if( DEFINED _cxx_std ) - if( ${boost_version_} VERSION_GREATER_EQUAL 1.66.0 ) - string( APPEND _b2_cmd_line " cxxstd=${_cxx_std}" ) - else() - list( APPEND _cxxflags "-std=c++${_cxx_std}" ) - endif() - endif() - endif() - - if( CMAKE_CROSSCOMPILING ) - if( CMAKE_HOST_APPLE ) - # todo: ios - message( FATAL_ERROR "No cross compile support on this platform yet, please contact technical support." ) - elseif( CMAKE_HOST_UNIX ) - if( MINGW ) - # MinGW cross compiling - string( APPEND _b2_cmd_line " --without-locale target-os=windows threadapi=win32" ) - - # CMAKE_CXX_COMPILER: /usr/bin/x86_64-w64-mingw32-g++-posix - get_filename_component( _cxx_compiler_basename "${CMAKE_CXX_COMPILER}" NAME ) - # Figure out the compiler prefix to be able to determine the resource compiler - if( _cxx_compiler_basename MATCHES "^(.+)-g\\+\\+.*$" ) - set( _mingw_tool_prefix ${CMAKE_MATCH_1} ) - else() - message( FATAL_ERROR "Internal error: cannot determine MinGW tool prefix given ${_cxx_compiler_basename}" ) - endif() - get_filename_component( _cxx_compiler_dir "${CMAKE_CXX_COMPILER}" DIRECTORY ) - #message( STATUS "<rc>${_cxx_compiler_dir}/${_mingw_tool_prefix}-windres" ) - set( _rc "${_cxx_compiler_dir}/${_mingw_tool_prefix}-windres" ) - set( _user_config_content "using ${_bb_boost_toolset} : ${_bb_toolset_version_major_minor} : ${CMAKE_CXX_COMPILER}" ) - else() - message( FATAL_ERROR "Unsupported cross compiler detected, please contact technical support." ) - endif() - else() - message( FATAL_ERROR "No cross compile support on this platform yet, please contact technical support." ) - endif() - else() - # ---------------- - # Native compiling - # ---------------- - if( CMAKE_HOST_WIN32 ) - if( MINGW ) - string( APPEND _b2_cmd_line " --without-locale" ) - set( _user_config_content "using ${_bb_boost_toolset} : ${_bb_toolset_version_major_minor} : ${CMAKE_CXX_COMPILER}" ) - endif() - elseif( CMAKE_HOST_APPLE ) - list( APPEND _cxxflags "-ftemplate-depth=256" ) - list( APPEND _linkflags "-headerpad_max_install_names" ) - # Add -mmacosx-version-min=<major>.<minor> in case the platform sdk is newer than the host OS. - bb_get_os_version( _os_version ) - if( _os_version MATCHES "^([0-9]+\\.[0-9]+)" ) - set( _os_version_major_minor ${CMAKE_MATCH_1} ) - list( APPEND _compileflags "-mmacosx-version-min=${_os_version_major_minor}" ) - list( APPEND _linkflags "-mmacosx-version-min=${_os_version_major_minor}" ) - endif() - # clang-darwin.jam does not setup -isysroot <path> which is essential to find header files, libs, development tools. - bb_get_isysroot( _macosx_isysroot ) - list( APPEND _compileflags "-isysroot" ${_macosx_isysroot} ) - # clang-darwin.jam does -dumpversion which emits 4.2 and not --version. - set( _user_config_content "using ${_bb_boost_toolset} : : ${CMAKE_CXX_COMPILER}" ) - elseif( CMAKE_HOST_UNIX ) - # Pass -fPIC - list( APPEND _compileflags "-fPIC" ) - set( _user_config_content "using ${_bb_boost_toolset} : ${_bb_toolset_version_major_minor} : ${CMAKE_CXX_COMPILER}" ) - endif() - endif() - - - if( ( DEFINED _cxxflags ) OR ( DEFINED _compileflags ) OR ( DEFINED _linkflags ) OR ( DEFINED _rc ) ) - if( DEFINED _user_config_content ) - string( APPEND _user_config_content " :" ) - else() - message( FATAL_ERROR "Logic error in composing user-config.jam. Please contact technical support." ) - endif() - - foreach( _build_flags cxxflags compileflags linkflags rc ) - if( DEFINED _${_build_flags} ) - #message( STATUS "_bb_boost_compose_b2_cmd_line(): ${_build_flags}=${_${_build_flags}}" ) - # Flags consisting of multiple arguments must be space concatenated and quoted. - list( LENGTH _${_build_flags} _len ) - if( _len GREATER 1 ) - string( REPLACE ";" " " _build_flags_args "${_${_build_flags}}" ) - string( APPEND _user_config_content " <${_build_flags}>\"${_build_flags_args}\"" ) - else() - string( APPEND _user_config_content " <${_build_flags}>${_${_build_flags}}" ) - endif() - endif() - endforeach() - endif() - - string( APPEND _b2_cmd_line " toolset=${_bb_boost_toolset}" ) - - if( ${boost_version_} VERSION_GREATER_EQUAL 1.66.0 ) - if( MSVC OR MINGW ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - string( APPEND _b2_cmd_line " address-model=64" ) - else() - string( APPEND _b2_cmd_line " address-model=32" ) - endif() - endif() - else() - if( MSVC AND ( CMAKE_SIZEOF_VOID_P EQUAL 8 ) ) - string( APPEND _b2_cmd_line " address-model=64" ) - endif() - endif() - - string( APPEND _b2_cmd_line " install" ) - - if( _without_python ) - string( APPEND _b2_cmd_line " --without-python" ) - endif() - - if( _without_mpi ) - string( APPEND _b2_cmd_line " --without-mpi" ) - endif() - - set( ${cmd_line_} ${_b2_cmd_line} PARENT_SCOPE ) - - if( DEFINED _user_config_content ) - set( ${user_config_content_} "${_user_config_content}" PARENT_SCOPE ) - endif() - -endfunction( _bb_boost_compose_b2_cmd_line ) - - -function( _bb_boost_write_user_config_file user_config_file_ user_config_content_ ) - set( _file_content "#<CMakeBuild> - automatically generated to build Boost libraries.\n" ) - - foreach( _line IN LISTS user_config_content_ ) - string( APPEND _file_content "${_line} ;\n" ) - endforeach() - - file( WRITE ${user_config_file_} "${_file_content}" ) -endfunction() - - -function( _bb_boost_get_cxx_std cxx_std_ boost_root_ ) - message( STATUS "_bb_boost_get_cxx_std(): boost_root=${boost_root_}" ) - # Guess the c++ standard the Boost libraries should be compiled for given the Boost root directory. - if( "${boost_root_}" MATCHES "-c\\+\\+([0-9]+)$" ) - set( ${cxx_std_} ${CMAKE_MATCH_1} PARENT_SCOPE ) - else() - # What's the default? - ##if( DEFINED CMAKE_CXX_STANDARD ) - ##else() - set( ${cxx_std_} "11" PARENT_SCOPE ) - ##endif() - endif() -endfunction() - - -function( _bb_boost_relocate_win_dlls boost_root_ boost_lib_dir_ boost_bin_dir_ ) - if( NOT EXISTS "${boost_bin_dir_}" ) - file( MAKE_DIRECTORY "${boost_bin_dir_}" ) - endif() - file( GLOB _boost_dlls "${boost_lib_dir_}/*.dll" ) - foreach( _dll IN LISTS _boost_dlls ) - #message( STATUS "bb_boost_relocated_win_dlls(): dll=${_dll}" ) - get_filename_component( _dll_basename "${_dll}" NAME ) - file( RENAME "${_dll}" "${boost_bin_dir_}/${_dll_basename}" ) - endforeach() - if( MSVC ) - file( GLOB_RECURSE _boost_pdbs "${boost_root_}/bin.v2/libs/boost*.pdb" ) - foreach( _pdb IN LISTS _boost_pdbs ) - #message( STATUS "bb_boost_relocated_win_dlls(): found ${_pdb}" ) - get_filename_component( _pdb_basename "${_pdb}" NAME ) - file( RENAME "${_pdb}" "${boost_bin_dir_}/${_pdb_basename}" ) - endforeach() - endif() -endfunction() - - -function( _bb_boost_remove_tmp_dirs dir1_ ) - set( _tmp_dirs ${dir1_} ${ARGN} ) - foreach( _dir IN LISTS _tmp_dirs ) - if( EXISTS "${_dir}" ) - message( STATUS "Removing ${_dir} ... " ) - file( REMOVE_RECURSE "${_dir}" ) - if( CMAKE_HOST_WIN32 ) - if( EXISTS "${_dir}" ) - message( STATUS "Retrying to remove ${_dir} ... " ) - file( REMOVE_RECURSE "${_dir}" ) - endif() - endif() - endif() - endforeach() -endfunction() - - -function( _bb_boost_remove_bjam b2_prog_ ) - if( EXISTS "${b2_prog_}" ) - get_filename_component( _b2_dir "${b2_prog_}" DIRECTORY ) - get_filename_component( _b2_basename "${b2_prog_}" NAME_WE ) - # Extra check to make sure this is really b2 or bjam. - if( _b2_basename MATCHES "^(b2|bjam)$" ) - # Get rid of temporary b2 and/or bjam including its directory. - message( STATUS "Removing ${_b2_dir}" ) - file( REMOVE_RECURSE "${_b2_dir}" ) - endif() - endif() -endfunction() - - diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvCPack.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvCPack.cmake deleted file mode 100644 index bf9c720e952c95656946f228397a15acac2c59a8..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvCPack.cmake +++ /dev/null @@ -1,144 +0,0 @@ -# BBuildEnvCPack.cmake -# - - -function( bb_get_default_cpack_generator cpack_gen_ ) - unset( _cpack_gen ) - if( CMAKE_HOST_APPLE ) - set( _cpack_gen "TGZ" ) - elseif( CMAKE_HOST_WIN32 ) - set( _cpack_gen "ZIP" ) - elseif( CMAKE_HOST_UNIX ) - bb_get_linux_pkg_fmt( _pkg_fmt ) # either deb or rpm - string( TOUPPER ${_pkg_fmt} _cpack_gen ) - else() - message( FATAL_ERROR "bb_get_default_cpack_generator(): not implemented on current platform yet." ) - endif() - if( DEFINED _cpack_gen ) - set( ${cpack_gen_} "${_cpack_gen}" PARENT_SCOPE ) - endif() -endfunction( bb_get_default_cpack_generator ) - - -function( bb_get_default_package_file_name pkg_file_name_ cpack_gen_ pkg_name_ pkg_version_ ) - - bb_get_os_version( _os_version ) - if( _os_version MATCHES "^([0-9]+)\\.([0-9]+).*" ) - # Use <major>.<minor> on all systems. - set( _os_version_major_minor "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" ) - endif() - - bb_get_target_arch( _target_arch ) # x86_64 - - set( _re_cpack_archive_fmts "^(TGZ|ZIP|7Z)$" ) - if( CMAKE_HOST_WIN32 ) - set( _pkg_file_name "${pkg_name_}-${pkg_version_}-windows-${_os_version_major_minor}-${_target_arch}" ) - if( ${cpack_gen_} MATCHES "${_re_cpack_archive_fmts}" ) - set( ${pkg_file_name_} ${_pkg_file_name} PARENT_SCOPE ) - elseif( ${cpack_gen_} STREQUAL "DEB" ) - set( ${pkg_file_name_} "${_pkg_file_name}.deb" PARENT_SCOPE ) - elseif( ${cpack_gen_} STREQUAL "RPM" ) - set( ${pkg_file_name_} "${_pkg_file_name}.rpm" PARENT_SCOPE ) - else() - message( FATAL_ERROR "bb_get_default_package_file_name(): CPACK_GENERATOR ${cpack_gen_} not supported yet." ) - endif() - elseif( CMAKE_HOST_APPLE ) - set( _pkg_file_name "${pkg_name_}-${pkg_version_}-macosx-${_os_version_major_minor}" ) - if( ${cpack_gen_} MATCHES "${_re_cpack_archive_fmts}" ) - set( ${pkg_file_name_} ${_pkg_file_name} PARENT_SCOPE ) - elseif( ${cpack_gen_} STREQUAL "DEB" ) - set( ${pkg_file_name_} "${_pkg_file_name}.deb" PARENT_SCOPE ) - elseif( ${cpack_gen_} STREQUAL "RPM" ) - set( ${pkg_file_name_} "${_pkg_file_name}.rpm" PARENT_SCOPE ) - else() - message( FATAL_ERROR "bb_get_default_package_file_name(): CPACK_GENERATOR ${cpack_gen_} not supported yet." ) - endif() - else() - bb_get_linux_distro_name( _distro_name ) - if( ${ARGC} GREATER 4 ) - set( _pkg_arch "${ARGV4}" ) - else() - bb_get_linux_pkg_arch( _pkg_arch ) - endif() - if( ${cpack_gen_} STREQUAL "DEB" ) - set( ${pkg_file_name_} "${pkg_name_}_${pkg_version_}_${_distro_name}-${_os_version_major_minor}_${_pkg_arch}.deb" PARENT_SCOPE ) - elseif( ${cpack_gen_} STREQUAL "RPM" ) - set( ${pkg_file_name_} "${pkg_name_}-${pkg_version_}-${_distro_name}-${_os_version_major_minor}.${_pkg_arch}.rpm" PARENT_SCOPE ) - elseif( ${cpack_gen_} MATCHES "${_re_cpack_archive_fmts}" ) - set( ${pkg_file_name_} "${pkg_name_}-${pkg_version_}-${_distro_name}-${_os_version_major_minor}-${_target_arch}" PARENT_SCOPE ) - else() - message( FATAL_ERROR "bb_get_default_package_file_name(): CPACK_GENERATOR ${cpack_gen_} not supported yet." ) - endif() - endif() - -endfunction( bb_get_default_package_file_name ) - -# Optional arguments: SRC -function( bb_get_default_sdk_filename sdk_filename_ sdk_basename_ version_h_file_ ) - - set( _make_src_sdk_filename OFF ) - - if( ${ARGC} GREATER 4 ) - message( FATAL_ERROR "bb_get_default_sdk_filename(): called with too many arguments." ) - elseif( ${ARGC} EQUAL 4 ) - if( NOT ${ARGV3} STREQUAL "SRC" ) - message( FATAL_ERROR "bb_get_default_sdk_filename(): 4th argument ${ARGV3} not understood, expected SRC." ) - endif() - set( _make_src_sdk_filename ON ) - endif() - - bb_get_version_from_h_file( _version ${version_h_file_} ) - - if( _make_src_sdk_filename ) - if( CMAKE_HOST_WIN32 ) - set( _host_system_suffix "windows" ) - elseif( CMAKE_HOST_APPLE ) - set( _host_system_suffix "macosx" ) - else() - set( _host_system_suffix "linux" ) - endif() - set( ${sdk_filename_} "${sdk_basename_}-${_version}-src-${_host_system_suffix}" PARENT_SCOPE ) - else() - - bb_get_os_version( _os_version ) - if( _os_version MATCHES "^([0-9]+)\\.([0-9]+).*" ) - # Use <major>.<minor> on all systems. - set( _os_version_major_minor "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" ) - endif() - - bb_get_target_arch( _target_arch ) # x86_64 or x86 - - _bb_get_cxx_compiler_version_major_minor( _compiler_version_major_minor ) - - if( MINGW ) - set( _compiler_suffix "gcc-mingw-${_compiler_version_major_minor}" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) - set( _compiler_suffix "gcc-${_compiler_version_major_minor}" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" ) - set( _compiler_suffix "msvc-${_compiler_version_major_minor}" ) - elseif( CMAKE_CXX_COMPILER_ID MATCHES "^(AppleClang|Clang)$" ) - set( _compiler_suffix "clang-${_compiler_version_major_minor}" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Intel" ) - set( _compiler_suffix "intel-${_compiler_version_major_minor}" ) - elseif( CMAKE_CXX_COMPILER_ID STREQUAL "Cray" ) - set( _compiler_suffix "cray-${_compiler_version_major_minor}" ) - endif() - - if( CMAKE_HOST_WIN32 ) - set( _host_system_suffix "windows-${_os_version_major_minor}" ) - elseif( CMAKE_HOST_APPLE ) - set( _host_system_suffix "macosx-${_os_version_major_minor}" ) - else() - bb_get_linux_distro_name( _distro_name ) - set( _host_system_suffix "${_distro_name}-${_os_version_major_minor}" ) - endif() - set( ${sdk_filename_} "${sdk_basename_}-${_version}-${_host_system_suffix}-${_compiler_suffix}-${_target_arch}" PARENT_SCOPE ) - endif() - -endfunction( bb_get_default_sdk_filename ) - -macro( bb_find_inno_setup inno_setup_cmd_ ) - bb_get_program_files_x86( _inno_setup_progfiles_x86_dir ) - find_program( ${inno_setup_cmd_} "iscc" PATHS "${_inno_setup_progfiles_x86_dir}/Inno Setup 5" ) - unset( _inno_setup_progfiles_x86_dir ) -endmacro() diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvDebug.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvDebug.cmake new file mode 100644 index 0000000000000000000000000000000000000000..40de4dad5071bdb71e889d7408a789e43bd07585 --- /dev/null +++ b/cmake/CMakeBuild/cmake/modules/BBuildEnvDebug.cmake @@ -0,0 +1,134 @@ +#[===[.rst: +BBuildEnvDebug +-------------- + +Internal module providing macros and functions for debugging. It won't be included by BBuildEnv by default. + +#]===] + + +if( NOT CMAKE_VERSION VERSION_LESS 3.10 ) + include_guard( GLOBAL ) +endif() + + +function( bb_dump_cmake_system_info ) + message( STATUS "bb_dump_cmake_system_info() entering" ) + message( STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}" ) + message( STATUS "CMAKE_VERSION: ${CMAKE_VERSION}" ) + message( STATUS "CMAKE_ROOT: ${CMAKE_ROOT}" ) + message( STATUS "CMAKE_SOURCE_DIR: ${CMAKE_SOURCE_DIR}" ) + message( STATUS "CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}" ) + + if( MINGW ) + message( STATUS "MINGW: on" ) + endif() + + if( CMAKE_CROSSCOMPILING ) + message( STATUS "CMAKE_CROSSCOMPILING: on" ) + endif() + + # target operating system: Linux, Windows, Darwin, Android + message( STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}" ) + message( STATUS "CMAKE_HOST_SYSTEM: ${CMAKE_HOST_SYSTEM}" ) + message( STATUS "CMAKE_SYSTEM_VERSION: ${CMAKE_SYSTEM_VERSION}" ) + + # examples: x86_64 (ubuntu 16.04, macosx 10.12) + # AMD64 (windows 7 64-bit, -A x64, -A Win32) + message( STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}" ) + message( STATUS "CMAKE_HOST_SYSTEM_PROCESSOR: ${CMAKE_HOST_SYSTEM_PROCESSOR}" ) + + if( CMAKE_HOST_APPLE ) + message( STATUS "CMAKE_HOST_APPLE: on" ) + endif() + if( CMAKE_HOST_UNIX ) + message( STATUS "CMAKE_HOST_UNIX: on" ) + endif() + if( CMAKE_HOST_WIN32 ) + message( STATUS "CMAKE_HOST_WIN32: on" ) + endif() + if( NOT CMAKE_VERSION VERSION_LESS 3.10.0 ) + cmake_host_system_information( RESULT os_name QUERY OS_NAME ) + cmake_host_system_information( RESULT os_release QUERY OS_RELEASE ) + cmake_host_system_information( RESULT os_version QUERY OS_VERSION ) + cmake_host_system_information( RESULT os_platform QUERY OS_PLATFORM ) + message( STATUS "OS_NAME: ${os_name}" ) + message( STATUS "OS_RELEASE: ${os_release}" ) + message( STATUS "OS_VERSION: ${os_version}" ) + message( STATUS "OS_PLATFORM: ${os_platform}" ) + endif() + message( STATUS "CMAKE_PROGRAM_PATH: ${CMAKE_PROGRAM_PATH}" ) + message( STATUS "CMAKE_SYSTEM_PROGRAM_PATH: ${CMAKE_SYSTEM_PROGRAM_PATH}" ) + message( STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}" ) + if( CMAKE_CXX_COMPILER_LOADED ) + message( STATUS "CMAKE_CXX_COMPILER_LOADED: on" ) + endif() + # expected: GNU, Clang, AppleClang, MSVC, + message( STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}" ) + message( STATUS "CMAKE_CXX_COMPILER: ${CMAKE_CXX_COMPILER}" ) + message( STATUS "CMAKE_CXX_COMPILER_VERSION: ${CMAKE_CXX_COMPILER_VERSION}" ) + #message( STATUS "cxx compile features: ${CMAKE_CXX_COMPILE_FEATURES}" ) + if( CMAKE_CXX_COMPILER_ARCHITECTURE_ID ) + # CMAKE_CXX_COMPILER_ARCHITECTURE_ID is defined but empty on Linux + message( STATUS "CMAKE_CXX_COMPILER_ARCHITECTURE_ID: ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" ) + endif() + if( MSVC ) + message( STATUS "CMAKE_VS_PLATFORM_NAME: ${CMAKE_VS_PLATFORM_NAME}" ) + message( STATUS "CMAKE_VS_PLATFORM_TOOLSET: ${CMAKE_VS_PLATFORM_TOOLSET}" ) + message( STATUS "MSVC_VERSION: ${MSVC_VERSION}" ) + if( NOT CMAKE_VERSION VERSION_LESS 3.12.0 ) + message( STATUS "MSVC_TOOLSET_VERSION: ${MSVC_TOOLSET_VERSION}" ) + endif() + if( CMAKE_CSharp_COMPILER_WORKS ) + message( STATUS "CMAKE_CSharp_COMPILER_ID: ${CMAKE_CSharp_COMPILER_ID}" ) + message( STATUS "CMAKE_CSharp_COMPILER: ${CMAKE_CSharp_COMPILER}" ) + message( STATUS "CMAKE_CSharp_COMPILER_VERSION: ${CMAKE_CSharp_COMPILER_VERSION}" ) + endif() + endif() + if( XCODE ) + if( CMAKE_Swift_COMPILER_ID ) + message( STATUS "CMAKE_Swift_COMPILER_ID: ${CMAKE_Swift_COMPILER_ID}" ) + message( STATUS "CMAKE_Swift_COMPILER: ${CMAKE_Swift_COMPILER}" ) + message( STATUS "CMAKE_Swift_COMPILER_VERSION: ${CMAKE_Swift_COMPILER_VERSION}" ) + endif() + endif() + get_property( _bb_generator_is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG ) + if( _bb_generator_is_multi_config ) + message( STATUS "CMAKE_CONFIGURATION_TYPES: ${CMAKE_CONFIGURATION_TYPES}" ) + else() + message( STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" ) + endif() + unset( _bb_generator_is_multi_config ) + + message( STATUS "bb_system_info: ${bb_system_info}" ) + bb_get_target_arch( _bb_value ) + message( STATUS "bb_get_target_arch: ${_bb_value}" ) + bb_get_home_dir( _bb_value ) + message( STATUS "bb_get_home_dir: ${_bb_value}" ) + + if( CMAKE_HOST_WIN32 ) + bb_get_program_files_x86( _bb_value ) + message( STATUS "bb_get_program_files_x86: ${_bb_value}" ) + bb_get_program_files( _bb_value ) + message( STATUS "bb_get_program_files: ${_bb_value}" ) + bb_get_program_data( _bb_value ) + message( STATUS "bb_get_program_data: ${_bb_value}" ) + endif() + message( STATUS "bb_dump_cmake_system_info() leaving" ) +endfunction( bb_dump_cmake_system_info ) + + +function( bb_dump_target_properties target_ prop1_ ) + set( _prop_list ${prop1_} ) + list( APPEND _prop_list ${ARGN} ) + list( LENGTH _prop_list _prop_list_len ) + message( STATUS "bb_dump_target_properties: len=${_prop_list_len} ${_prop_list}" ) + foreach( _prop ${_prop_list} ) + get_target_property( _prop_value ${target_} ${_prop} ) + if( _prop_value ) + message( STATUS "bb_dump_target_properties: ${target_}: ${_prop}=${_prop_value}" ) + endif() + endforeach() + message( STATUS "bb_dump_target_properties: leaving" ) +endfunction() + diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvGit.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvGit.cmake deleted file mode 100644 index 693746c62565cc1bdf86695bf08d5966ce721e70..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvGit.cmake +++ /dev/null @@ -1,498 +0,0 @@ -#[[.rst: -BBuildEnvGit ------------- - -The BBuildEnvGit provides out-of-tree checkout and update support for GIT repositories. - -Provided Macros -^^^^^^^^^^^^^^^ - -:: - - bb_git_co_external_dir(<checkout_dir> <tag> [GIT_REPOSITORY <url>] [GIT_REMOTE_NAME <remote>] [GIT_CONFIG <key=value>]) - -Macro bb_git_co_external_dir clones ``url`` to ``checkout_dir`` if the checkout directory does not exist or updates it to the -specified tag or branch. Remote tracking branches are updated using fetch and rebase. If this behavior is not intended, use a local branch. - -#]] - -if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.10 ) - include_guard( GLOBAL ) -endif() - -if( NOT DEFINED BBuildEnvGit_DEBUG_LEVEL ) - set( BBuildEnvGit_DEBUG_LEVEL 0 ) -endif() - -macro( bb_git_dbg_msg msg ) - if( BBuildEnvGit_DEBUG_LEVEL GREATER 0 ) - message( STATUS "${msg}" ) - endif() -endmacro() - - -macro( bb_git_co_external_dir checkout_dir_ git_tag_ ) - - #message( STATUS "bb_git_co_external_dir(): entering: ${ARGV}" ) - bb_git_dbg_msg( "bb_git_co_external_dir(): entering: ${ARGV}" ) - - if( NOT Git_FOUND ) - find_package( Git MODULE REQUIRED ) - endif() - bb_git_co_external_dir_helper( "${GIT_EXECUTABLE}" ${checkout_dir_} ${git_tag_} ${ARGN} ) - - bb_git_dbg_msg( "bb_git_co_external_dir(): leaving." ) - -endmacro() - - - -function( _bb_git_co_external_dir_parse_args git_repo_ git_remote_name_ git_clone_options_ arg1 ) - - unset( _git_repo ) - unset( _git_remote_name ) - unset( _git_clone_options ) - unset( _git_config_options ) - - if( DEFINED ${git_clone_options_} ) - set( _git_clone_options "${${git_clone_options_}}" ) - endif() - - set( _optional_args ${arg1} ${ARGN} ) - set( _optional_args_input ${_optional_args} ) - - bb_git_dbg_msg( "_bb_git_co_external_dir_parse_args(): processing optional arguments: ${_optional_args}" ) - - # Possible optional arguments: GIT_REPOSITORY <url>, GIT_REMOTE_NAME <name>, GIT_PROGRESS <bool>, GIT_CONFIG <key=value> ... - list( LENGTH _optional_args _num_optional_args ) - - # Search for GIT_REPOSITORY <value> - list( FIND _optional_args GIT_REPOSITORY _pos_keyword ) - if( NOT _pos_keyword EQUAL -1 ) - math( EXPR _pos_value "${_pos_keyword} + 1" ) - if( _num_optional_args LESS_EQUAL ${_pos_value} ) - message( FATAL_ERROR "Optional argument GIT_REPOSITORY must be followed by a value." ) - else() - list( GET _optional_args ${_pos_value} _git_repo ) - set( ${git_repo_} ${_git_repo} PARENT_SCOPE ) - endif() - list( REMOVE_AT _optional_args ${_pos_keyword} ${_pos_value} ) - list( LENGTH _optional_args _num_optional_args ) - endif() - - # Search for GIT_REMOTE_NAME <value> - list( FIND _optional_args GIT_REMOTE_NAME _pos_keyword ) - if( NOT _pos_keyword EQUAL -1 ) - math( EXPR _pos_value "${_pos_keyword} + 1" ) - if( _num_optional_args LESS_EQUAL ${_pos_value} ) - message( FATAL_ERROR "Optional argument GIT_REMOTE_NAME must be followed by a value." ) - else() - list( GET _optional_args ${_pos_value} _git_remote_name ) - set( ${git_remote_name_} ${_git_remote_name} PARENT_SCOPE ) - endif() - list( REMOVE_AT _optional_args ${_pos_keyword} ${_pos_value} ) - list( LENGTH _optional_args _num_optional_args ) - endif() - - # Search for GIT_PROGRESS <bool> - list( FIND _optional_args GIT_PROGRESS _pos_keyword ) - if( NOT _pos_keyword EQUAL -1 ) - math( EXPR _pos_value "${_pos_keyword} + 1" ) - if( _num_optional_args LESS_EQUAL ${_pos_value} ) - message( FATAL_ERROR "Optional argument GIT_PROGRESS must be followed by a boolean value." ) - else() - # Found GIT_PROGRESS, remove it from git_clone_options - if( DEFINED _git_clone_options ) - list( REMOVE_ITEM _git_clone_options "--progress" ) - endif() - list( GET _optional_args ${_pos_value} _git_progress ) - if( _git_progress ) - list( APPEND _git_clone_options "--progress" ) - endif() - endif() - list( REMOVE_AT _optional_args ${_pos_keyword} ${_pos_value} ) - list( LENGTH _optional_args _num_optional_args ) - endif() - - # Search for GIT_CONFIG <key=value> ... - list( FIND _optional_args GIT_CONFIG _pos_keyword ) - if( NOT _pos_keyword EQUAL -1 ) - math( EXPR _pos_value "${_pos_keyword} + 1" ) - if( _num_optional_args LESS_EQUAL ${_pos_value} ) - message( FATAL_ERROR "Optional argument GIT_CONFIG must be followed by one or more <key=value> expressions." ) - else() - list( REMOVE_AT _optional_args ${_pos_keyword} ) - set( _pos_value ${_pos_keyword} ) - math( EXPR _num_optional_args "${_num_optional_args} - 1" ) - while( _pos_value LESS ${_num_optional_args} ) - list( GET _optional_args ${_pos_value} _git_config_value ) - if( _git_config_value MATCHES "^GIT_" ) - # Looks like another argument keyword, bail out here. - break() - endif() - list( APPEND _git_config_options "--config" "${_git_config_value}" ) - list( REMOVE_AT _optional_args ${_pos_value} ) - math( EXPR _num_optional_args "${_num_optional_args} - 1" ) - endwhile() - if( DEFINED _git_config_options ) - #set( ${git_config_options_} "${_git_config_options}" PARENT_SCOPE ) - list( APPEND _git_clone_options "${_git_config_options}" ) - endif() - endif() - endif() - - if( _num_optional_args GREATER 0 ) - message( FATAL_ERROR "_bb_git_co_external_dir_parse_args(): optional arguments ${_optional_args_input} not understood." ) - endif() - - if( DEFINED _git_clone_options ) - set( ${git_clone_options_} "${_git_clone_options}" PARENT_SCOPE ) - endif() -endfunction() - - -function( bb_git_co_external_dir_helper git_EXECUTABLE_ checkout_dir_ git_tag_ ) - - bb_git_dbg_msg( "bb_git_co_external_dir_helper(): entering ${ARGV}" ) - - set( git_remote_name "origin" ) - unset( git_repo ) - unset( git_submodules ) - unset( git_options ) - unset( git_clone_options ) - - set( git_clone_options "--progress" ) - - if( ARGC GREATER 3 ) - _bb_git_co_external_dir_parse_args( git_repo git_remote_name git_clone_options ${ARGN} ) - message( STATUS "git_repo=${git_repo} git_remote_name=${git_remote_name} git_clone_options=${git_clone_options}" ) - #unset( git_clone_options ) - endif() - - # Normalize checkout directory. - get_filename_component( checkout_dir_ "${checkout_dir_}" REALPATH ) - - #bb_git_dbg_msg( "bb_git_co_external_dir_helper(): normalized checkout dir: ${checkout_dir_}" ) - - get_filename_component( _checkout_dir_parent "${checkout_dir_}" DIRECTORY ) - get_filename_component( _checkout_dir_base "${checkout_dir_}" NAME ) - - - if( NOT EXISTS "${checkout_dir_}" ) - - if( NOT DEFINED git_repo ) - message( FATAL_ERROR "checkout directory '${checkout_dir_}' does not exists and no GIT repository specified to clone from." ) - endif() - - if( NOT EXISTS "${_checkout_dir_parent}" ) - file( MAKE_DIRECTORY "${_checkout_dir_parent}" ) - endif() - - execute_process( - COMMAND "${git_EXECUTABLE_}" ${git_options} clone ${git_clone_options} --origin "${git_remote_name}" "${git_repo}" ${_checkout_dir_base} - WORKING_DIRECTORY "${_checkout_dir_parent}" - RESULT_VARIABLE error_code - ) - if( error_code ) - message(FATAL_ERROR "Failed to clone repository: '${git_repo}'") - endif() - - execute_process( - COMMAND "${git_EXECUTABLE_}" ${git_options} checkout ${git_tag_} -- - WORKING_DIRECTORY "${checkout_dir_}" - RESULT_VARIABLE error_code - ) - if( error_code ) - message(FATAL_ERROR "Failed to checkout tag: '${git_tag_}'") - endif() - - else() - _bb_do_gitupdate( "${git_EXECUTABLE_}" ${git_tag_} ${git_remote_name} "${checkout_dir_}" ) - endif() -endfunction() - - - -function( _bb_do_gitupdate git_EXECUTABLE git_tag git_remote_name work_dir ) - - bb_git_dbg_msg( "_bb_do_gitupdate(): entering git_tag=${git_tag} work_dir=${work_dir}" ) - - execute_process( - COMMAND "${git_EXECUTABLE}" rev-list --max-count=1 HEAD - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - OUTPUT_VARIABLE head_sha - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(error_code) - message(FATAL_ERROR "Failed to get the hash for HEAD in: '${work_dir}'") - endif() - - execute_process( - COMMAND "${git_EXECUTABLE}" show-ref ${git_tag} - WORKING_DIRECTORY "${work_dir}" - OUTPUT_VARIABLE show_ref_output - ) - # If a remote ref is asked for, which can possibly move around, - # we must always do a fetch and checkout. - if( "${show_ref_output}" MATCHES "remotes" ) - set(is_remote_ref 1) - else() - set(is_remote_ref 0) - endif() - - # Tag is in the form <remote>/<tag> (i.e. origin/master) we must strip - # the remote from the tag. - if( "${show_ref_output}" MATCHES "refs/remotes/${git_tag}") - string(REGEX MATCH "^([^/]+)/(.+)$" _unused "${git_tag}") - set(git_remote "${CMAKE_MATCH_1}") - set(git_tag "${CMAKE_MATCH_2}") - else() - set(git_remote "${git_remote_name}") - set(git_tag "${git_tag}") - endif() - - bb_git_dbg_msg( "git_remote=${git_remote} git_tag=${git_tag} is_remote_ref=${is_remote_ref}" ) - - # This will fail if the tag or branch does not exist (it probably has not been fetched - # yet). - execute_process( - COMMAND "${git_EXECUTABLE}" rev-list --max-count=1 ${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - OUTPUT_VARIABLE tag_sha - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - - if( error_code ) - set( _git_tag_unknown TRUE ) - message( STATUS "git rev-list failed for ${git_tag}" ) - else() - set( _git_tag_unknown FALSE ) - endif() - - if( error_code OR is_remote_ref OR ( NOT ( "${tag_sha}" STREQUAL "${head_sha}" ) ) ) - - bb_git_dbg_msg( "Executing git fetch in: '${work_dir}'" ) - execute_process( - COMMAND "${git_EXECUTABLE}" fetch - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to fetch in: '${work_dir}'") - endif() - - if( _git_tag_unknown ) - if( "${git_tag}" MATCHES "^tags/" ) - #message( STATUS "git_tag=${git_tag} looks like a tag, ignoring any remote branches." ) - set( _rm_branches "" ) - else() - execute_process( - COMMAND "${git_EXECUTABLE}" branch -r - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - - OUTPUT_VARIABLE _rm_branches - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(error_code) - message(FATAL_ERROR "git branch -r failed in: '${work_dir}'") - endif() - - bb_git_dbg_msg( "Discovered remote branches: '${_rm_branches}'" ) - endif() - - if( "${_rm_branches}" MATCHES "${git_remote_name}/${git_tag}" ) - bb_git_dbg_msg( "Found remote branch ${git_tag}" ) - - execute_process( - COMMAND "${git_EXECUTABLE}" checkout -b ${git_tag} ${git_remote_name}/${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to checkout: '${git_tag}'") - endif() - else() - # Unknown tag ??? - bb_git_dbg_msg( "Trying to checkout ${git_tag} - previous fetch may have picked it up." ) - execute_process( - COMMAND "${git_EXECUTABLE}" checkout ${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to checkout tag: '${git_tag}'") - endif() - endif() - else() - # tag_sha is valid -> deal with remote tracking branches first. - if( is_remote_ref ) - bb_git_dbg_msg( "${git_tag} refers to a remote tracking branch." ) - # check head whether it is on the tracking branch. - execute_process( - COMMAND "${git_EXECUTABLE}" status -b --porcelain - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - OUTPUT_VARIABLE _git_status - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(error_code) - message(FATAL_ERROR "Failed to get status: '${work_dir}'") - endif() - - bb_git_dbg_msg( "Retrieved status of '${work_dir}': '${_git_status}'" ) - if( NOT ( _git_status MATCHES "^## ${git_tag}\\.\\.\\." ) ) - # Change to the tracking branch, head points to something else. - execute_process( - COMMAND "${git_EXECUTABLE}" checkout ${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to checkout tag: '${git_tag}'") - endif() - - # Updating head_sha to reflect the previous change which is needed by rebase. - execute_process( - COMMAND "${git_EXECUTABLE}" rev-list --max-count=1 HEAD - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - OUTPUT_VARIABLE head_sha - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(error_code) - message(FATAL_ERROR "Failed to get the hash for HEAD") - endif() - endif() - - bb_git_dbg_msg( "Updating remote tracking branch using rebase ... " ) - _bb_do_gitrebase( "${git_EXECUTABLE}" ${head_sha} ${git_tag} ${git_remote} "${work_dir}" ) - - else() - # Local branch or tag and tag_hash != head_hash. - execute_process( - COMMAND "${git_EXECUTABLE}" checkout ${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to checkout tag: '${git_tag}'") - endif() - endif() - endif() - else() - # Local branch or tag and tag_hash==head_hash. The checkout is needed when switching from a commit with detached head to a branch - # pointing to the same commit. - execute_process( - COMMAND "${git_EXECUTABLE}" checkout ${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to checkout tag: '${git_tag}'") - endif() - #message( STATUS "_bb_do_gitupdate(): ${git_tag} is up-to-date." ) - endif() - - bb_git_dbg_msg( "_bb_do_gitupdate(): leaving." ) - -endfunction() - - - -function( _bb_do_gitrebase git_EXECUTABLE head_sha git_tag git_remote work_dir ) - bb_git_dbg_msg( "_bb_do_gitrebase(): entering: ${ARGV}" ) - - if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6) - set(git_stash_save_options --all --quiet ) - else() - set(git_stash_save_options --quiet) - endif() - - # Check if stash is needed - execute_process( - COMMAND "${git_EXECUTABLE}" status --porcelain - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - OUTPUT_VARIABLE repo_status - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(error_code) - message(FATAL_ERROR "Failed to get the status") - endif() - string(LENGTH "${repo_status}" need_stash) - - # If not in clean state, stash changes in order to be able to be able to - # perform git pull --rebase - if(need_stash) - bb_git_dbg_msg( "_bb_do_gitrebase(): need stash!!" ) - execute_process( - COMMAND "${git_EXECUTABLE}" stash save ${git_stash_save_options} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - message(FATAL_ERROR "Failed to stash changes in: '${work_dir}'") - endif() - endif() - - # Pull changes from the remote branch - bb_git_dbg_msg( "Trying git rebase ${git_remote}/${git_tag}" ) - execute_process( - COMMAND "${git_EXECUTABLE}" rebase ${git_remote}/${git_tag} - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - # Rebase failed: Restore previous state. - message( STATUS "Rebase failed -> trying to restore previous state ..." ) - execute_process( - COMMAND "${git_EXECUTABLE}" rebase --abort - WORKING_DIRECTORY "${work_dir}" - ) - if(need_stash) - execute_process( - COMMAND "${git_EXECUTABLE}" stash pop --index --quiet - WORKING_DIRECTORY "${work_dir}" - ) - endif() - message(FATAL_ERROR "\nFailed to rebase in: '${work_dir}'.\nYou will have to resolve the conflicts manually.") - endif() - - if(need_stash) - bb_git_dbg_msg( "Trying to recover stashed changes." ) - execute_process( - COMMAND "${git_EXECUTABLE}" stash pop --index --quiet - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - # Stash pop --index failed: Try again dropping the index - execute_process( - COMMAND "${git_EXECUTABLE}" reset --hard --quiet - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - execute_process( - COMMAND "${git_EXECUTABLE}" stash pop --quiet - WORKING_DIRECTORY "${work_dir}" - RESULT_VARIABLE error_code - ) - if(error_code) - # Stash pop failed: Restore previous state. - execute_process( - COMMAND "${git_EXECUTABLE}" reset --hard --quiet ${head_sha} - WORKING_DIRECTORY "${work_dir}" - ) - execute_process( - COMMAND "${git_EXECUTABLE}" stash pop --index --quiet - WORKING_DIRECTORY "${work_dir}" - ) - message(FATAL_ERROR "\nFailed to unstash changes in: '${work_dir}'.\nYou will have to resolve the conflicts manually.") - endif() - endif() - endif() - bb_git_dbg_msg( "_bb_do_gitrebase(): leaving." ) -endfunction() diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvLldb.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvLldb.cmake index cffd9c7fe31655dfd54c9cdb31005d15fa89e0ac..08834b646e4e7ab6134c978d531b1cf7501ef84c 100644 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvLldb.cmake +++ b/cmake/CMakeBuild/cmake/modules/BBuildEnvLldb.cmake @@ -17,6 +17,10 @@ # Remove the section labeled with ``marker`` from file ``lldbinit_file``. # +if( NOT CMAKE_VERSION VERSION_LESS 3.10 ) + include_guard( GLOBAL ) +endif() + function( bb_lldbinit_update action_ lldbinit_file_ marker_ ) set( _fnc_name "bb_lldbinit_update" ) #message( STATUS "${_fnc_name}: entering" ) diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvMingw.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvMingw.cmake index 86ace29b386cf98b62cd7409492bc7b455f0cf0d..5e3a015cbe7847cdf51716022cd3093a562a2d6b 100644 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvMingw.cmake +++ b/cmake/CMakeBuild/cmake/modules/BBuildEnvMingw.cmake @@ -1,5 +1,19 @@ -# BBuildEnvMingw.cmake -# +#[[.rst: +BBuildEnvMingw +-------------- + +Functions and macros supporting MinGW development. + +.. command:: bb_add_target_CopyMingwRuntimeFiles + + The ``bb_add_target_CopyMingwRuntimeFiles()`` macro adds a custom target ``CopyMingwRuntimeFiles`` + to copy MinGW dlls to :variable:`CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG>`. + +#]] + +if( NOT CMAKE_VERSION VERSION_LESS 3.10 ) + include_guard( GLOBAL ) +endif() macro( bb_add_target_CopyMingwRuntimeFiles ) if( MINGW AND CMAKE_CROSSCOMPILING ) @@ -9,7 +23,7 @@ macro( bb_add_target_CopyMingwRuntimeFiles ) No MinGW runtime files defined, check your toolchain file and define bb_MINGW_RUNTIME_FILES or don't call bb_add_target_CopyMingwRuntimeFiles()." ) endif() - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.8 ) + if( NOT CMAKE_VERSION VERSION_LESS 3.8 ) add_custom_target( CopyMingwRuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> @@ -35,4 +49,5 @@ macro( bb_add_target_CopyMingwRuntimeFiles ) endif() endif() endif() -endmacro( bb_add_target_CopyMingwRuntimeFiles ) +endmacro() + diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvOpenCV.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvOpenCV.cmake deleted file mode 100644 index 437bbd48c679abb6aa44abc8dd9da242173950f8..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvOpenCV.cmake +++ /dev/null @@ -1,107 +0,0 @@ -#[[.rst: -BBuildEnvOpenCV ---------------- - -Functions and macros supporting OpenCV development. - -#]] - -# Copy OpenCV Windows DLLs given the list of OpenCV components as supported by find_package( OpenCV ). -# The macro autodetects a shared OpenCV configuration and does nothing if static OpenCV libraries are enabled. -macro( bb_add_target_CopyOpenCVRuntimeFiles opencv_comp1_ ) - if( MSVC ) - if( NOT TARGET CopyOpenCVRuntimeFiles ) - # Autodection of static or shared OpenCV based on target property IMPORTED_LOCATION_RELEASE - get_target_property( _prop_value "opencv_core" IMPORTED_LOCATION_RELEASE ) - if( _prop_value ) - get_filename_component( _opencv_lib_ext ${_prop_value} EXT ) - if( _opencv_lib_ext MATCHES "^\\.(dll|DLL)$" ) - unset( _opencv_dll_list_release ) - unset( _opencv_dll_list_debug ) - _bb_find_opencv_dlls( _opencv_bin_dir _opencv_dll_list_release _opencv_dll_list_debug ${ARGV} ) - if( NOT _opencv_dll_list_release ) - message( FATAL_ERROR "bb_add_target_CopyOpenCVRuntimeFiles( ${ARGV} ): installation or configuration error: no release DLLs found." ) - endif() - if( NOT _opencv_dll_list_debug ) - message( FATAL_ERROR "bb_add_target_CopyOpenCVRuntimeFiles( ${ARGV} ): installation or configuration error: no debug DLLs found." ) - endif() - #message( STATUS "bb_add_target_CopyOpenCVRuntimeFiles: ${_opencv_bin_dir}" ) - #message( STATUS "bb_add_target_CopyOpenCVRuntimeFiles: ${_opencv_dll_list_release}" ) - #message( STATUS "bb_add_target_CopyOpenCVRuntimeFiles: ${_opencv_dll_list_debug}" ) - unset( _opencv_files ) - foreach( _opencv_dll_fname ${_opencv_dll_list_debug} ) - list( APPEND _opencv_files "$<$<CONFIG:Debug>:${_opencv_dll_fname}>" ) - endforeach() - foreach( _opencv_dll_fname ${_opencv_dll_list_release} ) - list( APPEND _opencv_files "$<$<NOT:$<CONFIG:Debug>>:${_opencv_dll_fname}>" ) - endforeach() - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.8 ) - add_custom_target( CopyOpenCVRuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_opencv_files} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY ${_opencv_bin_dir} - VERBATIM COMMAND_EXPAND_LISTS ) - else() - add_custom_target( CopyOpenCVRuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_opencv_files} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY ${_opencv_bin_dir} ) - endif() - else() - #message( STATUS "bb_add_target_CopyOpenCVRuntimeFiles(): OpenCV static libraries configured, no need to copy DLLs" ) - endif() - else() - message( FATAL_ERROR "bb_add_target_CopyOpenCVRuntimeFiles(): target opencv_core does not have property IMPORTED_LOCATION_RELEASE." ) - endif() - endif() - endif() -endmacro() - -function( _bb_find_opencv_dlls opencv_bin_dir_ opencv_dll_list_release_ opencv_dll_list_debug_ opencv_comp1_ ) - set( _opencv_comp_list ${opencv_comp1_} ${ARGN} ) - unset( _opencv_target_list ) - unset( _opencv_dll_list ) - unset( _opencv_dll_fname_list ) - bb_get_imp_targets_from_components( _opencv_target_list "opencv_" RELEASE ${_opencv_comp_list} ) - if( DEFINED _opencv_target_list ) - bb_get_dsos_from_imp_targets( _opencv_dll_list RELEASE ${_opencv_target_list} ) - if( _opencv_dll_list ) - list( GET _opencv_dll_list 0 _libopencv ) - # message( STATUS "_bb_find_qt5_dlls(): first libqt5=${_libqt5}" ) - get_filename_component( _opencv_bin_dir ${_libopencv} DIRECTORY ) - set( ${opencv_bin_dir_} ${_opencv_bin_dir} PARENT_SCOPE ) - endif() - foreach( _lib IN LISTS _opencv_dll_list ) - get_filename_component( _lib_fname ${_lib} NAME ) - list( APPEND _opencv_dll_fname_list ${_lib_fname} ) - endforeach() - set( ${opencv_dll_list_release_} ${_opencv_dll_fname_list} PARENT_SCOPE ) - endif() - - unset( _opencv_target_list ) - unset( _opencv_dll_list ) - unset( _opencv_dll_fname_list ) - bb_get_imp_targets_from_components( _opencv_target_list "opencv_" DEBUG ${_opencv_comp_list} ) - if( DEFINED _opencv_target_list ) - bb_get_dsos_from_imp_targets( _opencv_dll_list DEBUG ${_opencv_target_list} ) - foreach( _lib IN LISTS _opencv_dll_list ) - get_filename_component( _lib_fname ${_lib} NAME ) - list( APPEND _opencv_dll_fname_list ${_lib_fname} ) - endforeach() - set( ${opencv_dll_list_debug_} ${_opencv_dll_fname_list} PARENT_SCOPE ) - endif() -endfunction() diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvQt5.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvQt5.cmake deleted file mode 100644 index 8a67caa5e48c12a49510b349b1514c0e6f9e39b5..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvQt5.cmake +++ /dev/null @@ -1,368 +0,0 @@ -#[[.rst: -BBuildEnvQt5 ------------- - -Functions and macros supporting Qt5 development. - -#]] - - - -# -# bb_find_qt5_dir( qt5_dir qt5_version... [qt5_root] [OPTIONAL]) -# -# 2nd signature is reserved for future extensions and a noop for the time being. -# bb_find_qt5_dir( qt5_dir SYSTEM ) -# -function( bb_find_qt5_dir qt5_dir_ qt_version_ ) - - set( _qt5_dir_required TRUE ) - - if( "${qt_version_}" STREQUAL "SYSTEM" ) - if( NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - message( FATAL_ERROR "bb_find_qt5_dir(): bb_find_qt5_dir( ${qt5_dir_} ${qt_version_} is not supported." ) - endif() - # Linux: Qt5 system directories are supposed to be found without any additional hints. - return() - endif() - - # Initialize Qt root directory before analyzing function arguments. - if( WIN32 ) - set( _qt_root_dir "C:/Qt" ) - elseif( UNIX ) - # works for Linux and MacOSX - set( _qt_root_dir "$ENV{HOME}/Qt" ) - endif() - - set( _qt_version_list ${qt_version_} ) - # Collect any optional arguments - foreach( _arg IN LISTS ARGN ) - if( _arg STREQUAL "OPTIONAL" ) - set( _qt5_dir_required FALSE ) - else() - list( APPEND _qt_version_list ${_arg} ) - endif() - endforeach() - - if( ${ARGC} GREATER_EQUAL 3 ) - # Analyze the last element of _qt_version_list, it may be a version, qt5_root or the flag OPTIONAL - list( GET _qt_version_list -1 _last_arg ) - if( NOT _last_arg MATCHES "^[0-9.]+$" ) - # not a version -> qt5_root specified - set( _qt_root_dir ${_last_arg} ) - list( REMOVE_AT _qt_version_list -1 ) - endif() - endif() - - if( MSVC ) - if( CMAKE_VS_PLATFORM_NAME STREQUAL "x64" ) - set( _qt_msvc_64 "_64" ) - else() - unset( _qt_msvc_64 ) - endif() - endif() - - unset( _qt5_dir ) - if( EXISTS "${_qt_root_dir}" ) - foreach( _ver IN LISTS _qt_version_list ) - if( MSVC ) - if( MSVC_VERSION VERSION_GREATER_EQUAL 1910 ) - set( _qt5_dir "${_qt_root_dir}/${_ver}/msvc2017${_qt_msvc_64}/lib/cmake/Qt5" ) - elseif( MSVC_VERSION VERSION_EQUAL 1900 ) - set( _qt5_dir "${_qt_root_dir}/${_ver}/msvc2015${_qt_msvc_64}/lib/cmake/Qt5" ) - elseif( MSVC_VERSION VERSION_EQUAL 1800 ) - set( _qt5_dir "${_qt_root_dir}/${_ver}/msvc2013${_qt_msvc_64}/lib/cmake/Qt5" ) - endif() - elseif( APPLE ) - set( _qt5_dir "${_qt_root_dir}/${_ver}/clang_64/lib/cmake/Qt5" ) - elseif( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - set( _qt5_dir "${_qt_root_dir}/${_ver}/gcc_64/lib/cmake/Qt5" ) - else() - message( FATAL_ERROR "bb_find_qt5_dir(): this platform and/or toolset is not yet supported." ) - endif() - if( EXISTS "${_qt5_dir}" ) - # message( FATAL_ERROR "bb_find_qt5_dir(): ${_qt5_dir} does not exist, check Qt5 installation paths and the version requested." ) - break() - endif() - unset( _qt5_dir ) - endforeach() - endif() - - if( NOT DEFINED _qt5_dir ) - if( _qt5_dir_required ) - message( FATAL_ERROR "bb_find_qt5_dir(): no suitable Qt5 directory found, check ${_qt_root_dir}." ) - else() - message( STATUS "bb_find_qt5_dir(): no suitable Qt5 directory found in ${_qt_root_dir}." ) - endif() - else() - set( ${qt5_dir_} "${_qt5_dir}" PARENT_SCOPE ) - endif() -endfunction( bb_find_qt5_dir ) - - -macro( bb_add_target_CopyQt5RuntimeFiles qt5_comp1_ ) - if( MSVC ) - if( NOT TARGET CopyQt5RuntimeFiles ) - _bb_find_qt5_dlls( _qt5_bin_dir _qt5_dll_list_release _qt5_dll_list_debug ${ARGV} ) - #message( STATUS "bb_add_target_CopyQt5RuntimeFiles: ${_qt5_bin_dir}" ) - #message( STATUS "bb_add_target_CopyQt5RuntimeFiles: ${_qt5_dll_list_release}" ) - #message( STATUS "bb_add_target_CopyQt5RuntimeFiles: ${_qt5_dll_list_debug}" ) - unset( _qt5_files ) - foreach( _qt5_dll_fname ${_qt5_dll_list_debug} ) - list( APPEND _qt5_files "$<$<CONFIG:Debug>:${_qt5_dll_fname}>" ) - endforeach() - foreach( _qt5_dll_fname ${_qt5_dll_list_release} ) - list( APPEND _qt5_files "$<$<NOT:$<CONFIG:Debug>>:${_qt5_dll_fname}>" ) - endforeach() - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.8 ) - add_custom_target( CopyQt5RuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_qt5_files} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY ${_qt5_bin_dir} - VERBATIM COMMAND_EXPAND_LISTS ) - else() - add_custom_target( CopyQt5RuntimeFiles ALL ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${_qt5_files} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY ${_qt5_bin_dir} ) - endif() - endif() - endif() -endmacro() - - -# Optional argument: NO_PDB_FILES RELEASE DEBUG ALL -function( bb_find_qt5_dsos qt5_dll_list_ ) - - set( _qt5_comp_list ${ARGN} ) - if( NO_PDB_FILES IN_LIST _qt5_comp_list ) - set( _no_pdb_files TRUE ) - list( REMOVE_ITEM _qt5_comp_list NO_PDB_FILES ) - else() - set( _no_pdb_files FALSE ) - endif() - set( _configuration "RELEASE" ) - if( RELEASE IN_LIST _qt5_comp_list ) - list( REMOVE_ITEM _qt5_comp_list RELEASE ) - endif() - if( DEBUG IN_LIST _qt5_comp_list ) - list( REMOVE_ITEM _qt5_comp_list DEBUG ) - set( _configuration "DEBUG" ) - endif() - - if( ALL IN_LIST _qt5_comp_list ) - # Linux only: collect all DSOs - bb_find_qt5_dsos_complete( _qt5_dll_list ${_configuration} ) - set( ${qt5_dll_list_} ${_qt5_dll_list} PARENT_SCOPE ) - return() - endif() - - unset( _qt5_target_list ) - bb_get_imp_targets_from_components( _qt5_target_list "Qt5::" ${_configuration} ${_qt5_comp_list} ) - #message( STATUS "bb_find_qt5_dsos(): ${_qt5_target_list}" ) - - unset( _qt5_bin_dir ) - unset( _qt5_dll_list ) - # Walk _qt5_target_list and collect paths to dlls. - foreach( _qt5_target ${_qt5_target_list} ) - # "IMPORTED_LOCATION" "IMPORTED_LOCATION_RELEASE" "IMPORTED_LOCATION_DEBUG" - get_target_property( _prop_value ${_qt5_target} "IMPORTED_LOCATION_${_configuration}" ) - if( NOT _prop_value ) - message( WARNING "_bb_get_qt5_dlls(): no IMPORTED_LOCATION_${_configuration} for target ${_qt5_target}" ) - get_target_property( _prop_value ${_qt5_target} "IMPORTED_LOCATION" ) - endif() - if( _prop_value ) - # message( STATUS "${_qt5_target}: IMPORTED_LOCATION_RELEASE=${_prop_value}" ) - if( NOT DEFINED _qt5_bin_dir ) - get_filename_component( _qt5_bin_dir ${_prop_value} DIRECTORY ) - endif() - list( APPEND _qt5_dll_list ${_prop_value} ) - if( _configuration STREQUAL "DEBUG" ) - if( WIN32 AND NOT ${_no_pdb_files} ) - # Add PDB file if available - get_filename_component( _filenm ${_prop_value} NAME_WE ) - if( EXISTS "${_qt5_bin_dir}/${_filenm}.pdb" ) - list( APPEND _qt5_dll_list "${_qt5_bin_dir}/${_filenm}.pdb" ) - endif() - endif() - endif() - endif() - if( _qt5_target STREQUAL "Qt5::Core" ) - if( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - # On Linux Qt5::Core depends on some libicu*.so files which are not defined as LINK dependencies. - _bb_find_qt5_additional_dsos( ${_qt5_bin_dir} _libicu_list ) - if( _libicu_list ) - list( APPEND _qt5_dll_list ${_libicu_list} ) - endif() - if( NOT DBus IN_LIST _qt5_comp_list ) - list( APPEND _qt5_dll_list "${_qt5_bin_dir}/libQt5DBus.so.${Qt5_VERSION}" ) - endif() - endif() - endif() - endforeach() - - if( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - # Collect symlinks representing the DSO's soname. - _bb_get_qt5_dso_symlinks( _qt5_symlink_list ${_qt5_dll_list} ) - if( _qt5_symlink_list ) - list( APPEND _qt5_dll_list ${_qt5_symlink_list} ) - endif() - endif() - - if( DEFINED _qt5_dll_list ) - set( ${qt5_dll_list_} ${_qt5_dll_list} PARENT_SCOPE ) - endif() -endfunction( bb_find_qt5_dsos ) - - -function( bb_find_qt5_dsos_complete qt5_dll_list_ ) - - if( NOT CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - message( FATAL_ERROR "bb_find_qt5_dsos_complete() not implemented on this platform, please contact technical support." ) - endif() - - if( NOT TARGET "Qt5::Core" ) - message( FATAL_ERROR "Target Qt5::Core does not exist." ) - endif() - unset( _qt5_dll_list ) - get_target_property( _prop_value "Qt5::Core" "IMPORTED_LOCATION_RELEASE" ) - if( _prop_value ) - get_filename_component( _qt5_bin_dir ${_prop_value} DIRECTORY ) - if( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - file( GLOB _file_list "${_qt5_bin_dir}/libQt5*.so.*" "${_qt5_bin_dir}/libicu*.so.*" ) - foreach( _file IN LISTS _file_list ) - if( NOT IS_SYMLINK ${_file} ) - list( APPEND _qt5_dll_list ${_file} ) - endif() - endforeach() - endif() - else() - message( FATAL_ERROR "Target Qt5::Core does not define property IMPORTED_LOCATION_RELEASE." ) - endif() - - if( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - # Collect symlinks representing the DSO's soname. - _bb_get_qt5_dso_symlinks( _qt5_symlink_list ${_qt5_dll_list} ) - if( _qt5_symlink_list ) - list( APPEND _qt5_dll_list ${_qt5_symlink_list} ) - endif() - endif() - - if( DEFINED _qt5_dll_list ) - set( ${qt5_dll_list_} ${_qt5_dll_list} PARENT_SCOPE ) - endif() -endfunction( bb_find_qt5_dsos_complete ) - - -function( _bb_find_qt5_dlls qt5_bin_dir_ qt5_dll_list_release_ qt5_dll_list_debug_ ) - unset( _qt5_dll_list_release ) - unset( _qt5_dll_list_debug ) - bb_find_qt5_dsos( _qt5_dll_list_release ${ARGN} ) - if( _qt5_dll_list_release ) - list( GET _qt5_dll_list_release 0 _libqt5 ) - # message( STATUS "_bb_find_qt5_dlls(): first libqt5=${_libqt5}" ) - get_filename_component( _qt5_bin_dir ${_libqt5} DIRECTORY ) - set( ${qt5_bin_dir_} ${_qt5_bin_dir} PARENT_SCOPE ) - endif() - - # Strip directory and return a list of basenames. - unset( _qt5_dll_list ) - if( DEFINED _qt5_dll_list_release ) - foreach( _lib IN LISTS _qt5_dll_list_release ) - get_filename_component( _lib_fname ${_lib} NAME ) - list( APPEND _qt5_dll_list ${_lib_fname} ) - endforeach() - set( ${qt5_dll_list_release_} ${_qt5_dll_list} PARENT_SCOPE ) - endif() - - bb_find_qt5_dsos( _qt5_dll_list_debug ${ARGN} DEBUG ) - - # Strip directory and return a list of basenames. - unset( _qt5_dll_list ) - if( DEFINED _qt5_dll_list_debug ) - foreach( _lib IN LISTS _qt5_dll_list_debug ) - get_filename_component( _lib_fname ${_lib} NAME ) - list( APPEND _qt5_dll_list ${_lib_fname} ) - endforeach() - set( ${qt5_dll_list_debug_} ${_qt5_dll_list} PARENT_SCOPE ) - endif() -endfunction( _bb_find_qt5_dlls ) - - -function( _bb_find_qt5_additional_dsos qt5_bin_dir_ qt5_additional_dso_list_ ) - if( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - file( GLOB _lib_add_glob_list "${qt5_bin_dir_}/libicu*.so.*" "${qt5_bin_dir_}/libQt5XcbQpa*.so.*" "${qt5_bin_dir_}/libQt5Egl*Device*.so.*" ) - if( _lib_add_glob_list ) - # message( STATUS "_bb_get_qt5_icu_dsos(): libicu=${_libicu_glob_list}" ) - # Get rid of any symbolic links - unset( _lib_add_list ) - foreach( _lib_add IN LISTS _lib_add_glob_list ) - if( NOT IS_SYMLINK ${_lib_add} ) - list( APPEND _lib_add_list ${_lib_add} ) - endif() - endforeach() - # message( STATUS "_bb_get_qt5_icu_dsos(): libicu(filtered)=${_libicu_list}" ) - if( DEFINED _lib_add_list ) - set( ${qt5_additional_dso_list_} ${_lib_add_list} PARENT_SCOPE ) - endif() - endif() - endif() -endfunction() - -function( _bb_get_qt5_dso_symlinks qt5_dso_symlink_list_ qt5_dso1_ ) - set( _qt5_dso_list ${qt5_dso1_} ${ARGN} ) - unset( _qt5_dso_symlink_list ) - foreach( _lib IN LISTS _qt5_dso_list ) - get_filename_component( _lib_dir ${_lib} DIRECTORY ) - get_filename_component( _lib_fname ${_lib} NAME ) - if( CMAKE_SYSTEM_NAME STREQUAL "Linux" ) - # libXXX.so.x.y.z -> soname=libXXX.so.x - # DON'T assume x==5 as some internal dsos have a complete different major version. - if( _lib_fname MATCHES "^(lib.*\\.so)+\\.([0-9]+)" ) - set( _lib_symlink_fname "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" ) - if( EXISTS ${_lib_dir}/${_lib_symlink_fname} ) - list( APPEND _qt5_dso_symlink_list ${_lib_dir}/${_lib_symlink_fname} ) - endif() - endif() - endif() - endforeach() - if( _qt5_dso_symlink_list ) - set( ${qt5_dso_symlink_list_} ${_qt5_dso_symlink_list} PARENT_SCOPE ) - endif() -endfunction() - -function( bb_get_qt5_plugin_dir plugin_dir_ ) - if( NOT TARGET Qt5::qmake ) - message( FATAL_ERROR "installation problem: target Qt5::qmake does not exist." ) - endif() - get_target_property( _qmake_cmd Qt5::qmake "IMPORTED_LOCATION" ) - if( _qmake_cmd ) - # message( STATUS "qmake=${_qmake_cmd}" ) - - execute_process( COMMAND ${_qmake_cmd} -query QT_INSTALL_PLUGINS - RESULT_VARIABLE _retv_child - OUTPUT_VARIABLE _plugin_dir - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if( _retv_child EQUAL 0 ) - set( ${plugin_dir_} ${_plugin_dir} PARENT_SCOPE ) - else() - message( FATAL_ERROR "${_qmake_cmd} -query QT_INSTALL_PLUGINS failed, retv=${_retv_child}" ) - endif() - endif() -endfunction() - - diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvSvn.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvSvn.cmake deleted file mode 100644 index 558b929509b6c4d8ed6ca18da9aa2469130f05ce..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvSvn.cmake +++ /dev/null @@ -1,141 +0,0 @@ -#[[.rst: -BBuildEnvSvn ------------- - -The BBuildEnvSvn provides out-of-tree checkout and update support for SVN repositories. - -Provided Macros -^^^^^^^^^^^^^^^ - -:: - - bb_svn_co_external_dir(<checkout_dir> <url> [REV <numeric_rev> | <HEAD>]) - -Macro bb_svn_co_external_dir checkouts SVN ``url`` to ``checkout_dir`` if the checkout directory does not exist or updates it to -the specified tag or branch. A revision argument is required to track a remote branch or use a specific revision. - -#]] - -if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.10 ) - include_guard( GLOBAL ) -endif() - -if( NOT DEFINED BBuildEnvSvn_DEBUG_LEVEL ) - set( BBuildEnvSvn_DEBUG_LEVEL 0 ) -endif() - -macro( bb_svn_dbg_msg msg ) - if( BBuildEnvSvn_DEBUG_LEVEL GREATER 0 ) - message( STATUS "${msg}" ) - endif() -endmacro() - - -macro( bb_svn_co_external_dir checkout_dir_ svn_url_ ) - - bb_svn_dbg_msg( "bb_svn_co_external_dir(): entering: ${ARGV}" ) - - if( NOT Subversion_FOUND ) - find_package( Subversion MODULE REQUIRED ) - endif() - - bb_svn_co_external_dir_helper( ${checkout_dir_} ${svn_url_} ${ARGN} ) - - bb_svn_dbg_msg( "bb_svn_co_external_dir(): leaving" ) - -endmacro() - - -function( _bb_svn_co_external_dir_parse_args svn_rev_ arg1 ) - - unset( _svn_rev ) - - set( _optional_args ${arg1} ${ARGN} ) - set( _optional_args_input ${_optional_args} ) - - bb_svn_dbg_msg( "_bb_svn_co_external_dir_parse_args(): processing optional arguments: ${_optional_args}" ) - - # Possible optional arguments: REV HEAD | nnnn - list( LENGTH _optional_args _num_optional_args ) - - # Search for REV <value> - list( FIND _optional_args REV _pos_keyword ) - if( NOT _pos_keyword EQUAL -1 ) - math( EXPR _pos_value "${_pos_keyword} + 1" ) - if( _num_optional_args LESS_EQUAL ${_pos_value} ) - message( FATAL_ERROR "Optional argument REV must be followed by a numeric value or HEAD." ) - else() - list( GET _optional_args ${_pos_value} _svn_rev ) - set( ${svn_rev_} ${_svn_rev} PARENT_SCOPE ) - endif() - list( REMOVE_AT _optional_args ${_pos_keyword} ${_pos_value} ) - list( LENGTH _optional_args _num_optional_args ) - if( _num_optional_args EQUAL 0 ) - return() - endif() - endif() - - if( _num_optional_args GREATER 0 ) - message( FATAL_ERROR "_bb_svn_co_external_dir_parse_args(): optional arguments ${_optional_args_input} not understood." ) - endif() -endfunction() - - -function( bb_svn_co_external_dir_helper checkout_dir_ svn_url_ ) - - unset( _svn_rev ) - unset( _svn_peg_rev ) - - if( ARGC GREATER 2 ) - _bb_svn_co_external_dir_parse_args( _svn_rev ${ARGN} ) - - if( DEFINED _svn_rev ) - set( _svn_peg_rev "@${_svn_rev}" ) - #message( STATUS "_svn_peg_rev=${_svn_peg_rev}" ) - endif() - endif() - - set( _svn_options "--non-interactive" "--ignore-externals" ) - - # Normalize checkout directory. - get_filename_component( checkout_dir_ "${checkout_dir_}" REALPATH ) - - if( NOT EXISTS ${checkout_dir_} ) - - execute_process( COMMAND - ${Subversion_SVN_EXECUTABLE} ${_svn_options} co ${svn_url_}${_svn_peg_rev} ${checkout_dir_} - ERROR_VARIABLE Subversion_svn_co_error - RESULT_VARIABLE Subversion_svn_co_result - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if( NOT Subversion_svn_co_result EQUAL 0 ) - message( FATAL_ERROR "Command \"${Subversion_SVN_EXECUTABLE} co \" failed with output:\n${Subversion_svn_co_error}" ) - endif() - else() - # Do we have to switch? - Subversion_WC_INFO( ${checkout_dir_} _bb_svn_info ) - bb_svn_dbg_msg( "_bb_svn_co_external_dir_helper(): ${_bb_svn_info_WC_URL}" ) - bb_svn_dbg_msg( "_bb_svn_co_external_dir_helper(): ${_bb_svn_info_WC_REVISION}" ) - - if( NOT _bb_svn_info_WC_URL STREQUAL ${svn_url_} ) - execute_process( COMMAND - ${Subversion_SVN_EXECUTABLE} ${_svn_options} sw ${svn_url_}${_svn_peg_rev} ${checkout_dir_} - ERROR_VARIABLE Subversion_svn_co_error - RESULT_VARIABLE Subversion_svn_co_result - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if( NOT Subversion_svn_co_result EQUAL 0 ) - message( FATAL_ERROR "Command \"${Subversion_SVN_EXECUTABLE} sw \" failed with output:\n${Subversion_svn_co_error}" ) - endif() - elseif( ( DEFINED _svn_rev ) AND ( NOT ${_svn_rev} STREQUAL ${_bb_svn_info_WC_REVISION} ) ) - # Same URL but different revision requested -> update required. - # Note HEAD nether compares equal to the all numeric WC_REVISION. - execute_process( COMMAND - ${Subversion_SVN_EXECUTABLE} ${_svn_options} -r ${_svn_rev} up ${checkout_dir_} - ERROR_VARIABLE Subversion_svn_co_error - RESULT_VARIABLE Subversion_svn_co_result - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if( NOT Subversion_svn_co_result EQUAL 0 ) - message( FATAL_ERROR "Command \"${Subversion_SVN_EXECUTABLE} up \" failed with output:\n${Subversion_svn_co_error}" ) - endif() - endif() - endif() -endfunction() diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvVersion.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvVersion.cmake new file mode 100644 index 0000000000000000000000000000000000000000..b4543a8d442aaf20971ec34d2c6bac56f587d6ee --- /dev/null +++ b/cmake/CMakeBuild/cmake/modules/BBuildEnvVersion.cmake @@ -0,0 +1,13 @@ +# +# WARNING: This file is automatically generated by CMake and any manual changes will +# be overridden by the next build. +# If you need to change anything here, please update the configure template BBuildEnvVersion.cmake.in. +# + +set( BBuildEnv_VERSION_MAJOR 3 ) +set( BBuildEnv_VERSION_MINOR 13 ) +set( BBuildEnv_VERSION_PATCH 0 ) +set( BBuildEnv_VERSION_TWEAK 2 ) + +# BBuildEnv version in decimal dotted format as supported by CMake's version compare operations. +set( BBuildEnv_VERSION "${BBuildEnv_VERSION_MAJOR}.${BBuildEnv_VERSION_MINOR}.${BBuildEnv_VERSION_PATCH}.${BBuildEnv_VERSION_TWEAK}" ) diff --git a/cmake/CMakeBuild/cmake/modules/BBuildEnvVersionUtil.cmake b/cmake/CMakeBuild/cmake/modules/BBuildEnvVersionUtil.cmake deleted file mode 100644 index f06422c233a95d13bde7def96112c47c115fb957..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/BBuildEnvVersionUtil.cmake +++ /dev/null @@ -1,134 +0,0 @@ -#[[.rst: -BBuildEnvVersionUtil --------------------- - -Version file parsing utilities and other version related functions and macros. - - -#]] - -function( bb_get_version_from_h_file version_ ) - - # set default values for optional arguments - set( _version_fmt "STD" ) - set( _header_file "${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/include/${PROJECT_NAME}/version.h" ) - - if( ${ARGC} GREATER 3 ) - message( FATAL_ERROR "bb_get_version_from_h_file() called with too many arguments." ) - elseif( ${ARGC} EQUAL 3 ) - get_filename_component( _header_file "${ARGV1}" ABSOLUTE ) - # Check for optional arguments: ONLY_DOTS -> replace "_" and "-" with "." - # message( "bb_get_version_from_h_file(): ARGC=${ARGC} ARGV2=${ARGV2}" ) - set( _version_fmt "${ARGV2}" ) - #message( STATUS "bb_get_version_from_h_file -> ${_version_fmt}" ) - if( NOT _version_fmt MATCHES "^(ONLY_DOTS|CMAKE_VERSION_FMT)$" ) - message( FATAL_ERROR "bb_get_version_from_h_file() called with an illegal argument ${_version_fmt}" ) - endif() - elseif( ${ARGC} EQUAL 2 ) - # The second argument is either a filename or a format option - if( "${ARGV1}" MATCHES "^(ONLY_DOTS|CMAKE_VERSION_FMT)$" ) - set( _version_fmt "${ARGV1}" ) - else() - get_filename_component( _header_file "${ARGV1}" ABSOLUTE ) - endif() - endif() - - if( NOT EXISTS ${_header_file} ) - message( FATAL_ERROR "bb_get_version_from_h_file(): input file ${_header_file} does not exist." ) - endif() - - # - # h_file: its directory in capital letters is the expected version prefix. - # example: <path>/BoostBuildTest/version.h -> prefix=BOOSTBUILDTEST_ - # #if !defined( BOOSTBUILDTEST_VERSION ) - # #define BOOSTBUILDTEST_VERSION "1.60.0-9" - # ... - # The version expression may either be a quoted string or a sequence of digits. - get_filename_component( _dir ${_header_file} DIRECTORY ) - get_filename_component( _parent_dir ${_dir} NAME ) - - #message( STATUS "bb_get_version_from_h_file(): _dir=${_dir} _parent_dir=${_parent_dir}" ) - - string( TOUPPER ${_parent_dir} _version_prefix ) - - set( _regex_version_def "^[\t ]*#[\t ]*define[\t ]+${_version_prefix}_VERSION[\t ]+" ) - - unset( _version ) - file( STRINGS "${_header_file}" _header_version_line REGEX "${_regex_version_def}" ) - #message( STATUS "version line: '${_header_version_line}'" ) - if( "${_header_version_line}" MATCHES "${_regex_version_def}\"([0-9._-]+[0-9]).*\"" ) - #message( STATUS "extracted version ID: ${CMAKE_MATCH_1}" ) - set( _version "${CMAKE_MATCH_1}" ) - elseif( "${_header_version_line}" MATCHES "${_regex_version_def}([0-9]+)[\t ]*" ) - #message( STATUS "extracted version ID: ${CMAKE_MATCH_1}" ) - set( _version "${CMAKE_MATCH_1}" ) - elseif( "${_header_version_line}" MATCHES "${_regex_version_def}0x([0-9a-f]+)[\t ]*" ) - # hex numbers shall be used with care, CMake has no builtin support for them. - #message( STATUS "extracted version ID: ${CMAKE_MATCH_1}" ) - set( _version "${CMAKE_MATCH_1}" ) - endif() - if( NOT DEFINED _version ) - message( FATAL_ERROR "${_header_file} does not seem to contain a supported version expression." ) - return() - endif() - if( _version_fmt MATCHES "^(ONLY_DOTS|CMAKE_VERSION_FMT)$" ) - string( REGEX REPLACE "[_-]" "." _version "${_version}" ) - endif() - if( _version_fmt STREQUAL "CMAKE_VERSION_FMT" ) - bb_to_cmake_version_format( ${_version} _version ) - endif() - set( ${version_} "${_version}" PARENT_SCOPE ) -endfunction( bb_get_version_from_h_file ) - -# cmake version expressions are limited to <major>[.<minor>[.<patch>[.<tweak>]]]. -function( bb_to_cmake_version_format version_in_ version_out_ ) - string( REGEX REPLACE "[-_.]" ";" _version_list "${version_in_}" ) - list( LENGTH _version_list _version_len ) - while( _version_len GREATER 4 ) - list( REMOVE_AT _version_list -1 ) - list( LENGTH _version_list _version_len ) - endwhile() - string( REPLACE ";" "." _version "${_version_list}" ) - set( ${version_out_} "${_version}" PARENT_SCOPE ) -endfunction() - -macro( bb_version_split version_in_ version_out_ ) - string( REGEX REPLACE "[-_.]" ";" ${version_out_} "${version_in_}" ) -endmacro() - -function( bb_to_rpm_version version_ rpm_version_ rpm_release_ ) - if( ${version_} MATCHES "^([0-9._]+)[-._]([0-9]+)" ) - set( ${rpm_version_} "${CMAKE_MATCH_1}" PARENT_SCOPE ) - set( ${rpm_release_} "${CMAKE_MATCH_2}" PARENT_SCOPE ) - else() - message( FATAL_ERROR "bb_to_rpm_version(): version ${version_} specification not supported." ) - endif() -endfunction() - - -function( bb_version_list_sort version_list_sorted_ version1_ ) - unset( _version_list_sorted ) - set( _version_list_in ${version1_} ${ARGN} ) - - list( LENGTH _version_list_in _version_len ) - while( _version_len GREATER 0 ) - list( GET _version_list_in 0 _version_cur ) - foreach( _v IN LISTS _version_list_in ) - if( ${_v} VERSION_GREATER ${_version_cur} ) - set( _version_cur ${_v} ) - endif() - endforeach() - # Note: list( REMOVE_ITEM ...) would remove all list elements of value ${_version_cur} which may - # be confusing if the list contains duplicate elements. - # list( REMOVE_ITEM _version_list_in ${_version_cur} ) - list( FIND _version_list_in ${_version_cur} _list_pos ) - if( NOT _list_pos EQUAL -1 ) - list( REMOVE_AT _version_list_in ${_list_pos} ) - endif() - - list( APPEND _version_list_sorted ${_version_cur} ) - list( LENGTH _version_list_in _version_len ) - endwhile() - set( ${version_list_sorted_} ${_version_list_sorted} PARENT_SCOPE ) -endfunction() - diff --git a/cmake/CMakeBuild/cmake/modules/CPackDeb.cmake b/cmake/CMakeBuild/cmake/modules/CPackDeb.cmake deleted file mode 100644 index 73c54786f13d496f69e024df0c2953733b7e0214..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/CPackDeb.cmake +++ /dev/null @@ -1,7 +0,0 @@ - -#if( CMAKE_VERSION VERSION_LESS 3.11 ) - message( "Loading patched CPackDeb.cmake to get component specific versioning." ) - include( ${CMAKE_CURRENT_LIST_DIR}/patched/CPackDeb.cmake ) -#else() -# include( ${CMAKE_ROOT}/Modules/CPackDeb.cmake ) -#endif() diff --git a/cmake/CMakeBuild/cmake/modules/CPackRPM.cmake b/cmake/CMakeBuild/cmake/modules/CPackRPM.cmake deleted file mode 100644 index 085dbe9118b8f5e5624310ffad4f98f46e0f1de5..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/CPackRPM.cmake +++ /dev/null @@ -1,6 +0,0 @@ -#if( CMAKE_VERSION VERSION_LESS 3.11 ) - message( "Loading patched CPackRPM.cmake to get component specific versioning." ) - include( ${CMAKE_CURRENT_LIST_DIR}/patched/CPackRPM.cmake ) -#else() -# include( ${CMAKE_ROOT}/Modules/CPackDeb.cmake ) -#endif() diff --git a/cmake/CMakeBuild/cmake/modules/FindAdobeSDK.cmake b/cmake/CMakeBuild/cmake/modules/FindAdobeSDK.cmake deleted file mode 100644 index 780d5823be0d6cbe5608b32b8a79c8083e62ac76..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindAdobeSDK.cmake +++ /dev/null @@ -1,406 +0,0 @@ -#.rst: -# FindAdobeSDK -# ------------ -# -# This module finds headers and plugin installation paths associated with -# an Adobe After Effects SDK. -# -# Default search path: -# ${CMAKE_SOURCE_DIR}/AdobeSDKs/include/AdobeSDKs/AE_CC<version>_SDK -# ${CMAKE_SOURCE_DIR}/AdobeSDKs/include/AdobeSDKs/AE_CS<version>_SDK -# -# AdobeSDK_DEBUG -# Optional boolean variable to enable additional trace messages. -# -# AdobeSDK_DIR -# Optional external hint to locate an AdobeSDK. If defined it will replace the -# default SDK search path and must be set before find_package() is called. -# -# AdobeSDK_USE_COMMON_PLUGIN_INSTALL_PATH -# Optional boolean value to switch between After Effects plugin path and a common plugin path. -# -# AdobeSDK_PLUGIN_INSTALL_PATH_SUFFIX -# Optional subdirectory to be appended to the plugin install path. It must be set before -# find_package() is called. -# -# AdobeSDK_ROOT_DIR -# Top level directory of the selected AdobeSDK. -# -# AdobeSDK_INCLUDE_DIR -# Top level include directory of the selected Adobe SDK. -# -# AdobeSDK_INCLUDE_DIRS -# Top level include directory of the selected Adobe SDK and its subdirectory SP. -# -# AdobeSDK_UTIL_DIR -# Contains the path to the Util directory inside the AdobeSDK. -# -# AdobeSDK_RESOURCE_DIR -# Contains the path to the Resources directory inside the AdobeSDK. -# -# AdobeSDK_VERSION -# Adobe SDK version; e.g. 5.5 -# -# Macro to add an AE plugin: -# ADOBESDK_ADD_AE_PLUGIN( <name> src_file1.cpp ... [file.rc] [file.r] [PIPL_EXTRA_INCLUDE_DIRS dir1 ...] ) -# ADOBESDK_ADD_AE_PLUGIN( <name> src_file1.cpp ... [file.rc] [file.r] ) -# - -# svn_AdobeSDKs stores a subset of different SDKs side-by-side at <_adobesdk_super_root>. -set( _adobesdk_super_root "${CMAKE_SOURCE_DIR}/AdobeSDKs/include/AdobeSDKs" ) - -# Just to show the support for multiple versions side-by-side. -# Use find_package( AdobeSDK 5.5 EXACT MODULE REQUIRED ) to tell the finder -# to search for 5.5 only. -set( _adobesdk_version_list 2017 6 5.5 5 4 ) - -# Source: Adobe After Effects CC 2017 SDK Guide, Table 2: API Versions -set( _adobe_ae_version_list - # Release Effect API Version (AE_EffectVers.h) - 14.0 # CC 2017 13.13 - 13.8 # CC 2015.3 13.11 - 13.7 # CC 2015 13.10 - 13.6 # CC 2015 13.10 - 13.5 13.5.1 # CC 2015 13.9 - 13.2 13.1 13.0 # CC 2014 13.7 - 12.2 # CC 12.2 13.6 - 12.1 # CC 12.1 13.5 - 12.0 # CC 12.0 13.4 - 11.0.1 # CS6.0.1 13.3 - 11.0 11 # CS6 13.2 - 10.5 # CS5.5 13.1 - 10.0 # CS5 13.0 - ) - -# map: api version -> sdk version -set( _adobesdk_api_sdk_version_map - v13.14 2017 - v13.13 2017 - v13.11 2015.3 - v13.10 2015 - v13.9 2015 - v13.7 2014 - v13.6 12.2 - v13.5 12.1 - v13.4 12.0 - v13.3 6.0.1 - v13.2 6 - v13.1 5.5 - v13.0 5 - ) - -# Fallback plugin path if no other installation information or hints are available. -set( _ae_plugin_install_path_fallback "${CMAKE_SOURCE_DIR}/ae-plugins" ) - -set( _adobesdk_required_vars AdobeSDK_ROOT_DIR AdobeSDK_INCLUDE_DIR AdobeSDK_UTIL_DIR AdobeSDK_RESOURCE_DIR ) -if( WIN32 ) - list( APPEND _adobesdk_required_vars AdobeSDK_PIPL_TOOL ) -endif() - -# Usage: -# ADOBESDK_ADD_AE_PLUGIN( SamplePlugin16Bit src_file1.cpp ... [file.rc] [file.r] [PIPL_EXTRA_INCLUDE_DIRS dir1 ...] ) -# ADOBESDK_ADD_AE_PLUGIN( SamplePlugin16Bit src_file1.cpp ... [file.rc] [file.r] ) -# -macro( ADOBESDK_ADD_AE_PLUGIN name_ src_file_ ) - set( _prfx "_add_ae_plugin_" ) - set( ${_prfx}tmp_vars ${_prfx}opt_args ${_prfx}src_files ${_prfx}pipl_src_file ${_prfx}pipl_src_fname ${_prfx}pipl_extra_include_dirs ${_prfx}pipl_include_dirs ) - - set( ${_prfx}opt_args ${src_file_} ${ARGN} ) - - _AdobeSDK_addAePluginHandleArgs( ${_prfx}src_files ${_prfx}pipl_src_file ${_prfx}pipl_extra_include_dirs ${${_prfx}opt_args} ) - - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: src_files=${${_prfx}src_files}" ) - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: pipl_src_file=${${_prfx}pipl_src_file}" ) - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: pipl_extra_include_dirs=${${_prfx}pipl_extra_include_dirs}" ) - - if( MSVC ) - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: pipl_file=${${_prfx}pipl_src_file}" ) - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: pipl_fname=${${_prfx}pipl_src_fname}" ) - set( ${_prfx}pipl_include_dirs "/I \"${AdobeSDK_INCLUDE_DIR}\"" ) - if( DEFINED ${_prfx}pipl_extra_include_dirs ) - foreach( _fpath ${${_prfx}pipl_extra_include_dirs} ) - if( IS_ABSOLUTE ${_fpath} ) - list( APPEND ${_prfx}pipl_include_dirs "/I \"${_fpath}\"" ) - else() - list( APPEND ${_prfx}pipl_include_dirs "/I \"${CMAKE_CURRENT_SOURCE_DIR}/${_fpath}\"" ) - endif() - endforeach() - endif() - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: pipl includes: ${${_prfx}pipl_include_dirs}" ) - - # get pipl basename without extension - get_filename_component( ${_prfx}pipl_src_fname ${${_prfx}pipl_src_file} NAME_WE ) - - add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${${_prfx}pipl_src_fname}.rc - COMMAND cl.exe ${${_prfx}pipl_include_dirs} /EP ${${_prfx}pipl_src_file} > ${${_prfx}pipl_src_fname}.rr - COMMAND ${AdobeSDK_PIPL_TOOL} ${CMAKE_CURRENT_BINARY_DIR}/${${_prfx}pipl_src_fname}.rr ${CMAKE_CURRENT_BINARY_DIR}/${${_prfx}pipl_src_fname}.rrc - COMMAND cl.exe /D MSWindows /EP ${CMAKE_CURRENT_BINARY_DIR}/${${_prfx}pipl_src_fname}.rrc > ${CMAKE_CURRENT_BINARY_DIR}/${${_prfx}pipl_src_fname}.rc - MAIN_DEPENDENCY ${${_prfx}pipl_src_file} ) - - add_library( ${name_} MODULE ${${_prfx}src_files} ${CMAKE_CURRENT_BINARY_DIR}/${${_prfx}pipl_src_fname}.rc ) - - elseif( XCODE ) - # xcode is supposed to know how to deal with *.r files. - add_library( ${name_} MODULE ${${_prfx}src_files} ${${_prfx}pipl_src_file} ) - endif() - - set_target_properties( ${name_} PROPERTIES PREFIX "" - SUFFIX ".aex" - LIBRARY_OUTPUT_DIRECTORY_DEBUG ${AdobeSDK_PLUGIN_INSTALL_PATH} - LIBRARY_OUTPUT_DIRECTORY_RELEASE ${AdobeSDK_PLUGIN_INSTALL_PATH} - LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${AdobeSDK_PLUGIN_INSTALL_PATH} - LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${AdobeSDK_PLUGIN_INSTALL_PATH} ) - - # get rid of temporary variables - foreach( _var ${${_prfx}tmp_vars} ) - if( DEFINED ${_var} ) - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: disposing var=${_var}" ) - unset( ${_var} ) - endif() - endforeach() - unset( _prfx ) -endmacro() - -# -function( _AdobeSDK_addAePluginHandleArgs src_files_ pipl_src_file_ pipl_extra_include_dirs_ ) - set( PIPL_EXTRA_INCLUDE_DIRS_FOUND OFF ) - unset( _pipl_include_dirs ) - unset( _pipl_src_file ) - unset( _src_files ) - - foreach( _arg ${ARGN} ) - #message( STATUS "_AdobeSDK_addAePluginHandleArgs: processing ${_arg}" ) - if( ${_arg} STREQUAL "PIPL_EXTRA_INCLUDE_DIRS" ) - set( PIPL_EXTRA_INCLUDE_DIRS_FOUND ON ) - #message( STATUS "ADOBESDK_ADD_AE_PLUGIN: PIPL_EXTRA_INCLUDE_DIRS found" ) - continue() - endif() - if( PIPL_EXTRA_INCLUDE_DIRS_FOUND ) - #message( STATUS "_AdobeSDK_addAePluginHandleArgs: processing pipl include dir=${_arg}" ) - if( IS_ABSOLUTE ${_arg} ) - list( APPEND _pipl_include_dirs ${_arg} ) - else() - list( APPEND _pipl_include_dirs ${CMAKE_CURRENT_SOURCE_DIR}/${_arg} ) - endif() - else() - get_filename_component( _fname_ext ${_arg} EXT ) - if( _fname_ext STREQUAL ".r" ) - if( WIN32 ) - if( IS_ABSOLUTE ${_arg} ) - set( _pipl_src_file ${_arg} ) - else() - get_filename_component( _pipl_src_file ${CMAKE_CURRENT_SOURCE_DIR}/${_arg} ABSOLUTE ) - endif() - elseif( APPLE ) - set( _pipl_src_file ${_arg} ) - endif() - else() - list( APPEND _src_files ${_arg} ) - endif() - endif() - endforeach() - if( DEFINED _src_files ) - set( ${src_files_} ${_src_files} PARENT_SCOPE ) - endif() - if( DEFINED _pipl_src_file ) - set( ${pipl_src_file_} ${_pipl_src_file} PARENT_SCOPE ) - endif() - if( DEFINED _pipl_include_dirs ) - set( ${pipl_extra_include_dirs_} ${_pipl_include_dirs} PARENT_SCOPE ) - endif() -endfunction() - -function( _AdobeSDK_findRootDir root_dir_ ) - unset( _root_dir ) - if( DEFINED AdobeSDK_DIR ) - if( NOT EXISTS ${AdobeSDK_DIR} ) - message( FATAL_ERROR "AdobeSDK_DIR=${AdobeSDK_DIR} does not exist." ) - else() - set( _root_dir "${AdobeSDK_DIR}" ) - endif() - else() - if( EXISTS ${_adobesdk_super_root} ) - if( AdobeSDK_FIND_VERSION_EXACT ) - #message( STATUS "FindAdobeSDK: searching for ${AdobeSDK_FIND_VERSION} exactly." ) - if( EXISTS "${_adobesdk_super_root}/AE_CC${AdobeSDK_FIND_VERSION}_SDK" ) - set( _root_dir "${_adobesdk_super_root}/AE_CC${AdobeSDK_FIND_VERSION}_SDK" ) - elseif( EXISTS "${_adobesdk_super_root}/AE_CS${AdobeSDK_FIND_VERSION}_SDK" ) - set( _root_dir "${_adobesdk_super_root}/AE_CS${AdobeSDK_FIND_VERSION}_SDK" ) - endif() - else() - foreach( _v ${_adobesdk_version_list} ) - if( EXISTS "${_adobesdk_super_root}/AE_CC${_v}_SDK" ) - set( _root_dir "${_adobesdk_super_root}/AE_CC${_v}_SDK" ) - elseif( EXISTS "${_adobesdk_super_root}/AE_CS${_v}_SDK" ) - set( _root_dir "${_adobesdk_super_root}/AE_CS${_v}_SDK" ) - endif() - if( DEFINED _root_dir ) - break() - endif() - endforeach() - endif() - endif() - endif() - if( DEFINED _root_dir ) - set( ${root_dir_} ${_root_dir} PARENT_SCOPE ) - else() - set( ${root_dir_} ${root_dir_}-NOTFOUND PARENT_SCOPE ) - endif() -endfunction() - -function( _AdobeSDK_getAeApiVersion ae_api_version_ header_file_ ) - unset( _version_list ) - set( _regex_version_def "^#define[\t ]+(PF_PLUG_IN_VERSION|PF_PLUG_IN_SUBVERS)[\t ]+([0-9]+)" ) - file( STRINGS "${header_file_}" _header_version_lines REGEX "${_regex_version_def}" ) - # message( STATUS "extracted header lines: ${_header_version_lines}" ) - foreach( _line ${_header_version_lines} ) - # message( STATUS "processing header line: ${_line}" ) - if( _line MATCHES "${_regex_version_def}" ) - # message( STATUS "${CMAKE_MATCH_1} -> ${CMAKE_MATCH_2}" ) - list( APPEND _version_list "${CMAKE_MATCH_2}" ) - endif() - endforeach() - #message( STATUS "_AdobeSDK_getAeApiVersion: version ${_version_list}" ) - if( DEFINED _version_list ) - # Compose a doted separated version string - string( REPLACE ";" "." _version_str "${_version_list}" ) - else() - message( FATAL_ERROR "_AdobeSDK_getAeApiVersion() failed to extract version information, please contact the maintainer for further support." ) - endif() - set( ${ae_api_version_} "${_version_str}" PARENT_SCOPE ) -endfunction() - -function( _AdobeSDK_getSdkVersion sdk_version_ sdk_root_dir_ sdk_include_dir_ ) - # Try to match sdk_root_dir_ to AE_CC<VERSION>_SDK or AE_CS<VERSION>_SDK. - get_filename_component( _ae_sdk_dir ${sdk_root_dir_} NAME ) - if( _ae_sdk_dir MATCHES "^AE_C[SC]([0-9.]+)_SDK$" ) - # message( STATUS "_AdobeSDK_getSdkVersion(): deriving version from ${_ae_sdk_dir}" ) - set( ${sdk_version_} ${CMAKE_MATCH_1} PARENT_SCOPE ) - else() - _AdobeSDK_getAeApiVersion( _ae_api_version "${sdk_include_dir_}/AE_EffectVers.h" ) - #message( STATUS "FindAdobeSDK: API VERSION=${_api_version}" ) - #message( STATUS "FindAdobeSDK: API VERSION MAP=${_adobesdk_api_sdk_version_map}" ) - list( FIND _adobesdk_api_sdk_version_map v${_ae_api_version} _index ) - if( _index EQUAL -1 ) - message( FATAL_ERROR "_AdobeSDK_getSdkVersion(): no mapping from AE API ${_ae_api_version} -> SDK version defined, please contact technical support." ) - else() - math( EXPR _index_next "${_index} + 1" ) - #message( STATUS "FindAdobeSDK: API VERSION=${_api_version} -> ${_index_next}" ) - list( GET _adobesdk_api_sdk_version_map ${_index_next} _sdk_version ) - set( ${sdk_version_} ${_sdk_version} PARENT_SCOPE ) - endif() - endif() -endfunction() - -function( _AdobeSDK_findPiplTool pipl_tool_ sdk_root_dir_ ) - if( EXISTS "${sdk_root_dir_}/Resources/PiPLtool.exe" ) - set( _pipl_tool "${sdk_root_dir_}/Resources/PiPLtool.exe" ) - else() - get_filename_component( _sdk_dir ${sdk_root_dir_} NAME ) - if( EXISTS "${sdk_root_dir_}/../../../bin/${_sdk_dir}/PiPLtool.exe" ) - get_filename_component( _pipl_tool "${sdk_root_dir_}/../../../bin/${_sdk_dir}/PiPLtool.exe" REALPATH ) - endif() - endif() - if( DEFINED _pipl_tool ) - set( ${pipl_tool_} ${_pipl_tool} PARENT_SCOPE ) - endif() -endfunction() - -function( _AdobeSDK_getPluginInstallPath plugin_install_path_ ) - #message( STATUS "_AdobeSDK_getPluginInstallPath: entering." ) - if( WIN32 ) - if( AdobeSDK_USE_COMMON_PLUGIN_INSTALL_PATH ) - set( _reg_sz_value CommonPluginInstallPath ) - else() - set( _reg_sz_value PluginInstallPath ) - endif() - foreach( _v ${_adobe_ae_version_list} ) - set( _plugin_install_path "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Adobe\\After Effects\\${_v};${_reg_sz_value}]" ) - get_filename_component( _ae_plugin_install_path ${_plugin_install_path} ABSOLUTE ) - if( AdobeSDK_DEBUG ) - message( STATUS "_AdobeSDK_getPluginInstallPath: processing registry path ${_plugin_install_path}" ) - if( NOT _ae_plugin_install_path STREQUAL "/registry" ) - message( STATUS "_AdobeSDK_getPluginInstallPath: resolved path ${_ae_plugin_install_path}" ) - endif() - endif() - if( EXISTS "${_ae_plugin_install_path}" ) - #message( STATUS "_AdobeSDK_getPluginPath: found plugin install path: ${_ae_plugin_install_path}" ) - break() - else() - unset( _ae_plugin_install_path ) - endif() - endforeach() - elseif( APPLE ) - # N.B. not tested at all - # - # CC 2015.3: Developers can find paths to the default location of plug-ins, scripts, and presets on Mac OS X - # in a new plist file (same as the paths in the Windows registry): /Library/Preferences/com.Adobe.After Effects.paths.plist - foreach( _v ${_adobe_ae_version_list} ) - set( _ae_plugin_install_path "/Applications/Adobe After Effects ${_v}/Plug-ins" ) - #CC 2017: Version is locked at 7.0 for all CC versions, or CSx for earlier versions. - #/Library/Application Support/Adobe/Common/Plug-ins/[version]/MediaCore - if( EXISTS "${_ae_plugin_install_path}" ) - # message( STATUS "_AdobeSDK_getPluginPath: found plugin install path: ${_ae_plugin_install_path}" ) - break() - else() - unset( _ae_plugin_install_path ) - endif() - endforeach() - endif() - if( NOT DEFINED _ae_plugin_install_path ) - set( _ae_plugin_install_path ${_ae_plugin_install_path_fallback} ) - if( AdobeSDK_DEBUG ) - message( STATUS "_AdobeSDK_getPluginInstallPath: using fallback plugin install path ${_ae_plugin_install_path}" ) - endif() - endif() - if( DEFINED AdobeSDK_PLUGIN_INSTALL_PATH_SUFFIX ) - set( _ae_plugin_install_path "${_ae_plugin_install_path}/${AdobeSDK_PLUGIN_INSTALL_PATH_SUFFIX}" ) - endif() - set( ${plugin_install_path_} "${_ae_plugin_install_path}" PARENT_SCOPE ) -endfunction() - - -if( DEFINED AdobeSDK_INCLUDE_DIR ) - message( FATAL_ERROR "FindAdobeSDK: AdobeSDK_INCLUDE_DIR already defined -> unexpected." ) -endif() - -if( MSVC OR XCODE ) - _AdobeSDK_findRootDir( AdobeSDK_ROOT_DIR ) - if( AdobeSDK_ROOT_DIR ) - # message( STATUS "FindAdobeSDK: AdobeSDK_ROOT_DIR=${AdobeSDK_ROOT_DIR}" ) - if( EXISTS "${AdobeSDK_ROOT_DIR}/AE_EffectVers.h" ) - set( AdobeSDK_INCLUDE_DIR ${AdobeSDK_ROOT_DIR} ) - elseif( EXISTS "${AdobeSDK_ROOT_DIR}/Headers/AE_EffectVers.h" ) - set( AdobeSDK_INCLUDE_DIR "${AdobeSDK_ROOT_DIR}/Headers" ) - endif() - if( DEFINED AdobeSDK_INCLUDE_DIR ) - _AdobeSDK_getSdkVersion( AdobeSDK_VERSION ${AdobeSDK_ROOT_DIR} ${AdobeSDK_INCLUDE_DIR} ) - #message( STATUS "FindAdobeSDK: AdobeSDK_VERSION=${AdobeSDK_VERSION}" ) - if( EXISTS "${AdobeSDK_INCLUDE_DIR}/SP" ) - set( AdobeSDK_INCLUDE_DIRS "${AdobeSDK_INCLUDE_DIR}" "${AdobeSDK_INCLUDE_DIR}/SP" ) - else() - set( AdobeSDK_INCLUDE_DIRS "${AdobeSDK_INCLUDE_DIR}" ) - endif() - endif() - if( EXISTS "${AdobeSDK_ROOT_DIR}/Util" ) - set( AdobeSDK_UTIL_DIR "${AdobeSDK_ROOT_DIR}/Util" ) - endif() - if( EXISTS "${AdobeSDK_ROOT_DIR}/Resources" ) - set( AdobeSDK_RESOURCE_DIR "${AdobeSDK_ROOT_DIR}/Resources" ) - endif() - if( NOT DEFINED AdobeSDK_PLUGIN_INSTALL_PATH ) - _AdobeSDK_getPluginInstallPath( _AdobeSDK_PLUGIN_INSTALL_PATH ) - set( AdobeSDK_PLUGIN_INSTALL_PATH ${_AdobeSDK_PLUGIN_INSTALL_PATH} CACHE PATH "Adobe After Effects plugin install path" ) - unset( _AdobeSDK_PLUGIN_INSTALL_PATH ) - # mark_as_advanced( AdobeSDK_PLUGIN_INSTALL_PATH ) - endif() - if( WIN32 ) - _AdobeSDK_findPiplTool( AdobeSDK_PIPL_TOOL ${AdobeSDK_ROOT_DIR} ) - endif() - endif() -else() - message( FATAL_ERROR "FindAdobeSDK: Adobe After Effects plugin development requires MSVC or XCODE. Please check your configuration." ) -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( AdobeSDK REQUIRED_VARS ${_adobesdk_required_vars} VERSION_VAR AdobeSDK_VERSION ) diff --git a/cmake/CMakeBuild/cmake/modules/FindBoost.cmake b/cmake/CMakeBuild/cmake/modules/FindBoost.cmake deleted file mode 100644 index da8a0d39ac556e2a1ad1c1e56683d2d72ae67ef7..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindBoost.cmake +++ /dev/null @@ -1,13 +0,0 @@ -# -# This module adds find support for Boost up to 1.66.0. -# Depending on the CMake version it will pull in a patched module or the original module. -# -# Wrapper to pull in a patched FindBoost.cmake depending on the CMake version. - - -#if( CMAKE_VERSION VERSION_LESS 3.11 ) - message( STATUS "Loading patched FindBoost.cmake to get Boost 1.66.0 support." ) - include( ${CMAKE_CURRENT_LIST_DIR}/patched/FindBoost.cmake ) -#else() -# include( ${CMAKE_ROOT}/Modules/FindBoost.cmake ) -#endif() diff --git a/cmake/CMakeBuild/cmake/modules/FindCUDASamples.cmake b/cmake/CMakeBuild/cmake/modules/FindCUDASamples.cmake deleted file mode 100644 index ebb12567c1876e743ad33b2951beb8f833ab80cf..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindCUDASamples.cmake +++ /dev/null @@ -1,182 +0,0 @@ -#[[.rst: -FindCUDASamples ---------------- - -Find CUDA samples associated with the selected CUDA toolkit. - -IMPORTED Targets -^^^^^^^^^^^^^^^^ - -This module defines the :prop_tgt:`IMPORTED` targets: - -``CUDASamples::helper`` - Defined if the CUDA samples are installed. -``CUDASamples::freeimage`` - Defined if the CUDA samples are installed and component FreeImage was requested. -``CUDASamples::utilnpp`` - Defined if the CUDA samples are installed and component UtilNPP was requested. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module sets the following variables: - -``CUDASamples_FOUND`` - True, if CUDA samples are installed. -``CUDASamples_ROOT_DIR`` - Path to CUDA samples directory. - -#]] - -if( FindCUDASamples_DEBUG ) - message( STATUS "${CMAKE_CURRENT_LIST_FILE}: entering." ) -endif() - - -function( CUDASamples_getVersion version_ ) - unset( _cuda_version ) - - if( DEFINED CMAKE_CUDA_COMPILER_VERSION ) - string( REGEX REPLACE "([0-9]+)\\.([0-9]+)([0-9.]+)?" "\\1.\\2" _cuda_version ${CMAKE_CUDA_COMPILER_VERSION} ) - elseif( CUDA_FOUND ) - set( _cuda_version ${CUDA_VERSION} ) - endif() - - if( DEFINED _cuda_version ) - set( ${version_} ${_cuda_version} PARENT_SCOPE ) - endif() -endfunction() - - -function( CUDASamples_findDirs root_dir_ include_dir_ cuda_version_ ) - - string( REGEX REPLACE "([0-9]+)\\.([0-9]+)([0-9.]+)?" "\\1.\\2" _cuda_version_major_minor ${cuda_version_} ) - if( WIN32 ) - file( TO_CMAKE_PATH "$ENV{ProgramData}/NVIDIA Corporation/CUDA Samples/v${_cuda_version_major_minor}" _cuda_samples_root_dir ) - else() - if( CUDA_FOUND ) - set( _cuda_samples_root_dir "${CUDA_TOOLKIT_ROOT_DIR}/samples" ) - else() - # FindCUDA.cmake hasn't been called or failed for some reason. Let's try standard installation paths. - if( APPLE ) - set( _cuda_samples_root_dir "/Developer/NVIDIA/CUDA-${_cuda_version_major_minor}/samples" ) - else() - # Linux assumed - set( _cuda_samples_root_dir "/usr/local/cuda-${_cuda_version_major_minor}/samples" ) - endif() - endif() - endif() - find_path( CUDASamples_common_inc helper_cuda.h PATHS "${_cuda_samples_root_dir}" PATH_SUFFIXES common/inc NO_DEFAULT_PATH ) - mark_as_advanced( CUDASamples_common_inc ) - if( CUDASamples_common_inc ) - set( ${root_dir_} "${_cuda_samples_root_dir}" PARENT_SCOPE ) - set( ${include_dir_} "${CUDASamples_common_inc}" PARENT_SCOPE ) - else() - set( ${root_dir_} "${root_dir_}-NOTFOUND" PARENT_SCOPE ) - set( ${include_dir_} "${include_dir_}-NOTFOUND" PARENT_SCOPE ) - endif() -endfunction( CUDASamples_findDirs ) - - -unset( CUDASamples_VERSION ) -unset( CUDASamples_ROOT_DIR ) -unset( CUDASamples_INCLUDE_DIR ) - -CUDASamples_getVersion( CUDASamples_VERSION ) - -if( DEFINED CUDASamples_VERSION ) - - if( CUDASamples_VERSION VERSION_GREATER_EQUAL 5.0 ) - CUDASamples_findDirs( CUDASamples_ROOT_DIR CUDASamples_INCLUDE_DIR ${CUDASamples_VERSION} ) - if( CUDASamples_INCLUDE_DIR ) - if( NOT TARGET CUDASamples::helper ) - add_library( CUDASamples::helper INTERFACE IMPORTED ) - set_target_properties( CUDASamples::helper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CUDASamples_INCLUDE_DIR}" ) - endif() - endif() - foreach( _comp ${CUDASamples_FIND_COMPONENTS} ) - if( _comp STREQUAL "UtilNPP" ) - if( EXISTS "${CUDASamples_ROOT_DIR}/7_CUDALibraries/common/UtilNPP" ) - set( CUDASamples_${_comp}_FOUND TRUE ) - set( CUDASamples_UtilNPP_INCLUDE_DIR "${CUDASamples_ROOT_DIR}/7_CUDALibraries/common/UtilNPP" ) - if( NOT TARGET CUDASamples::utilnpp ) - add_library( CUDASamples::utilnpp INTERFACE IMPORTED ) - set_target_properties( CUDASamples::utilnpp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CUDASamples_UtilNPP_INCLUDE_DIR}" ) - endif() - else() - set( CUDASamples_${_comp}_FOUND FALSE ) - endif() - elseif( _comp STREQUAL "FreeImage" ) - set( CUDASamples_${_comp}_FOUND FALSE ) - set( _CUDASamples_FreeImage_ROOT_DIR "${CUDASamples_ROOT_DIR}/7_CUDALibraries/common/FreeImage" ) - if( WIN32 ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - # In CUDA 9.1 NVIDIA changed FreeImage64.lib to FreeImage.lib. - find_library( CUDASamples_libfreeimage NAMES FreeImage64.lib FreeImage.lib PATHS "${_CUDASamples_FreeImage_ROOT_DIR}" PATH_SUFFIXES lib/x64 NO_DEFAULT_PATH ) - else() - find_library( CUDASamples_libfreeimage name FreeImage.lib PATHS "${_CUDASamples_FreeImage_ROOT_DIR}" PATH_SUFFIXES lib/Win32 NO_DEFAULT_PATH ) - endif() - if( CUDASamples_libfreeimage ) - get_filename_component( _CUDASamples_libfreeimage_dir ${CUDASamples_libfreeimage} DIRECTORY ) - get_filename_component( _CUDASamples_libfreeimage_fname ${CUDASamples_libfreeimage} NAME_WE ) - set( CUDASamples_libfreeimage_dll "${_CUDASamples_libfreeimage_dir}/${_CUDASamples_libfreeimage_fname}.dll" ) - endif() - elseif( APPLE ) - find_library( CUDASamples_libfreeimage name libfreeimage.a PATHS "${_CUDASamples_FreeImage_ROOT_DIR}" PATH_SUFFIXES lib/darwin NO_DEFAULT_PATH ) - elseif( UNIX ) - find_library( CUDASamples_libfreeimage name libfreeimage.a PATHS "${_CUDASamples_FreeImage_ROOT_DIR}" PATH_SUFFIXES lib/linux/x86_64 NO_DEFAULT_PATH ) - endif() - mark_as_advanced( CUDASamples_libfreeimage ) - if( CUDASamples_libfreeimage AND EXISTS "${_CUDASamples_FreeImage_ROOT_DIR}/include" ) - set( CUDASamples_${_comp}_FOUND TRUE ) - set( CUDASamples_FreeImage_INCLUDE_DIR "${_CUDASamples_FreeImage_ROOT_DIR}/include" ) - if( NOT TARGET CUDASamples::freeimage ) - if( WIN32 ) - add_library( CUDASamples::freeimage SHARED IMPORTED ) - set_target_properties( CUDASamples::freeimage PROPERTIES IMPORTED_IMPLIB "${CUDASamples_libfreeimage}" ) - if( EXISTS "${CUDASamples_libfreeimage_dll}" ) - set_target_properties( CUDASamples::freeimage PROPERTIES IMPORTED_LOCATION "${CUDASamples_libfreeimage_dll}" ) - if( CMAKE_VERSION VERSION_GREATER_EQUAL 3.8 ) - # message( STATUS "FindCUDASamples: using add_custom_target( ... VERBATIM COMMAND_EXPAND_LISTS )" ) - add_custom_target( Copy${_comp}RuntimeFiles ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CUDASamples_libfreeimage_dll} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - VERBATIM COMMAND_EXPAND_LISTS ) - else() - add_custom_target( Copy${_comp}RuntimeFiles ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CUDASamples_libfreeimage_dll} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> ) - endif() - add_dependencies( CUDASamples::freeimage Copy${_comp}RuntimeFiles ) - endif() - else() - add_library( CUDASamples::freeimage STATIC IMPORTED ) - set_target_properties( CUDASamples::freeimage PROPERTIES IMPORTED_LOCATION "${CUDASamples_libfreeimage}" ) - endif() - set_target_properties( CUDASamples::freeimage PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CUDASamples_FreeImage_INCLUDE_DIR}" ) - endif() - endif() - endif() - endforeach() - endif() -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( CUDASamples REQUIRED_VARS CUDASamples_ROOT_DIR CUDASamples_INCLUDE_DIR VERSION_VAR CUDASamples_VERSION HANDLE_COMPONENTS ) -if( FindCUDASamples_DEBUG ) - message( STATUS "${CMAKE_CURRENT_LIST_FILE}: leaving." ) -endif() diff --git a/cmake/CMakeBuild/cmake/modules/FindCodeMeter.cmake b/cmake/CMakeBuild/cmake/modules/FindCodeMeter.cmake deleted file mode 100644 index 52da3d7b4103c577100757c8527b081d8233be05..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindCodeMeter.cmake +++ /dev/null @@ -1,279 +0,0 @@ -#[[.rst: -FindCodeMeter -------------- - -Find the installed CodeMeter development kit. - -Result Variables -^^^^^^^^^^^^^^^^ - -This module sets the following variables: - -``CodeMeter_FOUND`` - True, if a CodeMeter development kit is found. -``CodeMeter_VERSION`` - Detected CodeMeter version. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module defines the :prop_tgt:`IMPORTED` targets: - -``CodeMeter::WibuCmHeaderOnly`` - This target defines a header-only library exposing the CodeMeter core API. A protected application or - code module is required to load the installed CodeMeter runtime component explicitly. -``CodeMeter::WibuCm`` - Defines a library target referring to the CodeMeter core API. - -#]] - -#set( _CodeMeter_required_vars CodeMeter_DevKit_ROOT_DIR ) - -function( CodeMeter_getDevKitVersion version_var_ header_file_ ) - - #message( STATUS "CodeMeter_get_devkit_version(): ${version_var} ${header_file}" ) - - #define CODEMETER_VERSION 630 - set( _regex_cm_version_def "#define[\t ]+CODEMETER_VERSION[\t ]+([0-9]+)([0-9][0-9])" ) - - file( STRINGS "${header_file_}" _cm_header_version_line REGEX "${_regex_cm_version_def}" ) - # message( STATUS "codemeter version line: '${_cm_header_version_line}'" ) - if( "${_cm_header_version_line}" MATCHES "${_regex_cm_version_def}") - # set(Boost_${v} "${CMAKE_MATCH_1}") - # message( STATUS "cm version (major.minor): ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}" ) - set( ${version_var_} "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" PARENT_SCOPE ) - endif() -endfunction( CodeMeter_getDevKitVersion ) - - -function( CodeMeter_findRuntimeFile runtime_file_ runtime_dir_root_ runtime_type_ ) - if( CMAKE_HOST_WIN32 OR MINGW ) - set( _runtime_file_list "${runtime_dir_root_}/windows/CodeMeterRuntime.exe" ) - elseif( CMAKE_HOST_APPLE ) - file( GLOB _runtime_file_list "${runtime_dir_root_}/macosx/x86_64/CmRuntimeUser*.dmg" ) - elseif( CMAKE_HOST_UNIX ) - bb_get_linux_pkg_fmt( _pkg_fmt ) - bb_get_target_arch( _target_arch ) - if( ${runtime_type_} STREQUAL "runtime_lite" ) - set( _runtime_lite_suffix "-lite" ) - endif() - if( _pkg_fmt STREQUAL "deb" ) - file( GLOB _runtime_file_list "${runtime_dir_root_}/linux/${_target_arch}/codemeter${_runtime_lite_suffix}_[1-9]*.deb" ) - else() - file( GLOB _runtime_file_list "${runtime_dir_root_}/linux/${_target_arch}/CodeMeter${_runtime_lite_suffix}-[1-9]*.rpm" ) - endif() - endif() - # - list( LENGTH _runtime_file_list _runtime_file_list_len ) - # message( STATUS "${_runtime_file_list} ${_runtime_file_list_len}" ) - if( _runtime_file_list_len EQUAL 1 ) - list( GET _runtime_file_list 0 _runtime_file ) - elseif( _runtime_file_list_len LESS 1 ) - set( ${runtime_file_} "${runtime_file_}-NOTFOUND" PARENT_SCOPE ) - return() - else() - message( FATAL_ERROR "FindCodeMeter: unexpected number of CodeMeter runtime files found, please contact technical support." ) - endif() - # message( STATUS "_runtime_file: ${_runtime_file}" ) - if( EXISTS "${_runtime_file}" ) - if( CodeMeter_ENABLE_RUNTIME_VERSION_CHECKS ) - CodeMeter_checkRuntimeVersion( ${CodeMeter_VERSION} "${_runtime_file}" ) - endif() - set( ${runtime_file_} "${_runtime_file}" PARENT_SCOPE ) - else() - set( ${runtime_file_} "${runtime_file_}-NOTFOUND" PARENT_SCOPE ) - endif() -endfunction( CodeMeter_findRuntimeFile ) - -macro( CodeMeter_addRuntimeTarget target_ runtime_dir_ runtime_type_ ) - CodeMeter_findRuntimeFile( _cm_runtime_file "${runtime_dir_}" ${runtime_type_} ) - list( APPEND CodeMeter_tmp_vars "_cm_runtime_file" ) - if( _cm_runtime_file ) - #message( STATUS "FindCodeMeter: runtime file=${_cm_runtime_file}" ) - add_custom_target( ${target_} ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/deploy - COMMAND ${CMAKE_COMMAND} -E copy ${_cm_runtime_file} ${CMAKE_SOURCE_DIR}/deploy - VERBATIM ) - if( CodeMeter_DEBUG ) - message( STATUS "Creating custom target ${target_}" ) - endif() - else() - message( FATAL_ERROR "FindCodeMeter: CodeMeter runtime redistributable cannot be found in ${runtime_dir_}" ) - endif() -endmacro() - -function( CodeMeter_checkRuntimeVersion cmdevkit_version_ cm_runtime_file_ ) - if( CMAKE_HOST_WIN32 OR MINGW ) - # cm runtime filename comes without a version number: CodeMeterRuntime.exe - # Workaround: linux filename. - unset( _cm_rt_basenm ) - get_filename_component( _cm_rt_dir "${cm_runtime_file_}" DIRECTORY ) - set( _cm_rt_linux_dir "${_cm_rt_dir}/../linux/x86_64" ) - if( EXISTS "${_cm_rt_linux_dir}" ) - file( GLOB _cm_rt_basenm_list RELATIVE ${_cm_rt_linux_dir} "${_cm_rt_linux_dir}/*amd64.deb" ) - #message( STATUS "CodeMeter_checkRuntimeVersion(): analyzing file ${_cm_rt_basenm_list} to guess version" ) - # In general, more than one filename may be returned but a single filename is needed below. - list( LENGTH _cm_rt_basenm_list _cm_rt_basenm_list_len ) - if( _cm_rt_basenm_list_len GREATER_EQUAL 1 ) - list( GET _cm_rt_basenm_list 0 _cm_rt_basenm ) - endif() - endif() - else() - #message( STATUS "FindCodeMeter: checking codemeter runtime version" ) - get_filename_component( _cm_rt_basenm "${cm_runtime_file_}" NAME ) - endif() - if( DEFINED _cm_rt_basenm ) - # message( STATUS "FindCodeMeter: checking codemeter runtime version using ${_cm_rt_basenm}" ) - # e.g. codemeter_6.40.2402.501_amd64.deb - # codemeter-lite_6.40.2402.501_amd64.deb - # CodeMeter-6.40.2402-501.x86_64.rpm - # CodeMeter-lite-6.40.2402-501.x86_64.rpm - # - # CmRuntimeUser_6.40.2402.501.dmg - if( _cm_rt_basenm MATCHES "^[^0-9]+([0-9]+\\.[0-9]+)" ) - #message( STATUS "CodeMeter runtime version <major.minor> extracted: ${CMAKE_MATCH_1}" ) - set( _cm_rt_version ${CMAKE_MATCH_1} ) - if( _cm_rt_version VERSION_GREATER ${cmdevkit_version_} ) - message( FATAL_ERROR "\ - - CodeMeter runtime intended for deployment is newer than the CodeMeter development kit ${cmdevkit_version_} - installed. Such a combination is disabled by default, please check the SVN externals, - the CodeMeter development kit installed or contact technical support for further assistance. -" ) - endif() - endif() - endif() -endfunction() - -# - -# end of functions and macros -# - - -if( CodeMeter_DEBUG ) - message( STATUS "${CMAKE_CURRENT_LIST_FILE}: starting ..." ) -endif() -unset( CodeMeter_tmp_vars ) -if( NOT DEFINED CodeMeter_DISABLE_VERSION_CHECKS ) - set( CodeMeter_DISABLE_VERSION_CHECKS FALSE ) -endif() -if( ( NOT DEFINED CodeMeter_ENABLE_RUNTIME_VERSION_CHECKS ) OR CodeMeter_DISABLE_VERSION_CHECKS ) - set( CodeMeter_ENABLE_RUNTIME_VERSION_CHECKS FALSE ) -endif() - - -if( CMAKE_HOST_WIN32 ) - bb_get_program_files_x86( _CodeMeter_progfiles_x86 ) - find_path( CodeMeter_DevKit_INCLUDE_DIR CodeMeter.h PATHS "${_CodeMeter_progfiles_x86}/CodeMeter/DevKit" PATH_SUFFIXES include NO_DEFAULT_PATH ) - list( APPEND CodeMeter_tmp_vars "_CodeMeter_progfiles_x86" ) -elseif( CMAKE_HOST_APPLE ) - find_path( CodeMeter_DevKit_INCLUDE_DIR CodeMeter.h PATHS "/Applications/WIBU-SYSTEMS DevKit/CodeMeter" PATH_SUFFIXES include NO_DEFAULT_PATH ) -elseif( CMAKE_HOST_UNIX ) - if( MINGW ) - find_path( CodeMeter_DevKit_INCLUDE_DIR CodeMeter.h PATHS /usr/include NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) - else() - find_path( CodeMeter_DevKit_INCLUDE_DIR CodeMeter.h PATHS /usr/include NO_DEFAULT_PATH ) - endif() -endif() - -mark_as_advanced( CodeMeter_DevKit_INCLUDE_DIR CodeMeter_LIBWIBUCM ) # hide cache variable - -if( CodeMeter_DevKit_INCLUDE_DIR ) - CodeMeter_getDevKitVersion( CodeMeter_VERSION "${CodeMeter_DevKit_INCLUDE_DIR}/CodeMeter.h" ) - # message( STATUS "CodeMeter Development Kit: ${CodeMeter_VERSION}" ) - #message( STATUS "CodeMeter include files found at: ${CodeMeter_DevKit_INCLUDE_DIR}" ) - - # Create CodeMeter_DevKit_ROOT_DIR - get_filename_component( CodeMeter_DevKit_ROOT_DIR "${CodeMeter_DevKit_INCLUDE_DIR}/.." REALPATH ) - - if( NOT TARGET CodeMeter::WibuCmHeaderOnly ) - - if( CMAKE_HOST_WIN32 ) - set( CodeMeter_INCLUDE_DIRS "${CodeMeter_DevKit_INCLUDE_DIR}" ) - if( NOT MINGW ) - # CodeMeter DevKit does not come with MinGW compliant import libraries and therefore CodeMeter_LIBRARY_DIRS is not - # defined for MinGW. - set( CodeMeter_LIBRARY_DIRS "${CodeMeter_DevKit_ROOT_DIR}/lib" ) - endif() - elseif( CMAKE_HOST_APPLE ) - set( CodeMeter_INCLUDE_DIRS "${CodeMeter_DevKit_INCLUDE_DIR}" ) - endif() - - add_library( CodeMeter::WibuCmHeaderOnly INTERFACE IMPORTED ) - set_target_properties( CodeMeter::WibuCmHeaderOnly PROPERTIES INTERFACE_COMPILE_DEFINITIONS NO_AUTO_LINKING_CODEMETER ) - if( CodeMeter_INCLUDE_DIRS ) - # message( STATUS "inserting cm include dir: ${CodeMeter_INCLUDE_DIRS}" ) - set_target_properties( CodeMeter::WibuCmHeaderOnly PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CodeMeter_INCLUDE_DIRS}" ) - endif() - - if( NOT MINGW ) - # WibuCmLib -> link at build time to CodeMeter; this won't work for mingw due to missing import libraries. - if( WIN32 ) - add_library( CodeMeter::WibuCm SHARED IMPORTED ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set_target_properties( CodeMeter::WibuCm PROPERTIES IMPORTED_IMPLIB "${CodeMeter_LIBRARY_DIRS}/WibuCm64.lib" ) - else() - set_target_properties( CodeMeter::WibuCm PROPERTIES IMPORTED_IMPLIB "${CodeMeter_LIBRARY_DIRS}/WibuCm32.lib" ) - endif() - elseif( APPLE ) - # WibuCmMacX - find_library( CodeMeter_LIBWIBUCM WibuCmMacX ) - if( CodeMeter_LIBWIBUCM ) - #message( STATUS "FindCodeMeter: CodeMeter_LIBWIBUCM=${CodeMeter_LIBWIBUCM}" ) - add_library( CodeMeter::WibuCm SHARED IMPORTED ) - set_target_properties( CodeMeter::WibuCm PROPERTIES IMPORTED_LOCATION "${CodeMeter_LIBWIBUCM}/WibuCmMacX" ) - endif() - else() - # Linux host system assumed - find_library( CodeMeter_LIBWIBUCM NAMES libwibucm.so libwibucmlin64.so ) - if( CodeMeter_LIBWIBUCM ) - #message( STATUS "FindCodeMeter: CodeMeter_LIBWIBUCM=${CodeMeter_LIBWIBUCM}" ) - add_library( CodeMeter::WibuCm SHARED IMPORTED ) - set_target_properties( CodeMeter::WibuCm PROPERTIES IMPORTED_LOCATION "${CodeMeter_LIBWIBUCM}" ) - endif() - endif() - if( TARGET CodeMeter::WibuCm AND CodeMeter_INCLUDE_DIRS ) - # message( STATUS "inserting cm include dir: ${CodeMeter_INCLUDE_DIRS}" ) - set_target_properties( CodeMeter::WibuCm PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CodeMeter_INCLUDE_DIRS}" ) - endif() - endif() - - foreach( _comp ${CodeMeter_FIND_COMPONENTS} ) - set( CodeMeter_${_comp}_FOUND FALSE ) - #message( STATUS "Processing component ${_comp}" ) - if( _comp MATCHES "^(runtime|runtime_lite)$" ) - set( CodeMeter_${_comp}_FOUND FALSE ) - set( _cm_runtime_dirs "${CMAKE_SOURCE_DIR}/CodeMeterRuntime" "${CMAKE_SOURCE_DIR}/../${PROJECT_NAME}-CodeMeterSoftware/CodeMeterRuntime" ) - list( APPEND CodeMeter_tmp_vars "_cm_runtime_dirs" ) - foreach( _cm_rtl_dir IN LISTS _cm_runtime_dirs ) - if( EXISTS "${_cm_rtl_dir}" ) - CodeMeter_addRuntimeTarget( CodeMeterCopyRuntime "${_cm_rtl_dir}" ${_comp} ) - set( CodeMeter_${_comp}_FOUND TRUE ) - break() - endif() - endforeach() - if( NOT CodeMeter_${_comp}_FOUND ) - if( CodeMeter_FIND_REQUIRED_${_comp} ) - message( WARNING "FindCodeMeter: requested component ${_comp} not found in ${_cm_runtime_dirs}." ) - endif() - endif() - endif() - endforeach() - endif() -endif() - -if( DEFINED CodeMeter_tmp_vars ) - # Dispose any temporary variables avoiding unwanted pollution of the calling namespace. - list( REMOVE_DUPLICATES CodeMeter_tmp_vars ) - foreach( _v ${CodeMeter_tmp_vars} ) - # message( STATUS "findCodeMeter: unsetting ${_v}" ) - unset( ${_v} ) - endforeach() - unset( CodeMeter_tmp_vars ) -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( CodeMeter REQUIRED_VARS CodeMeter_DevKit_ROOT_DIR CodeMeter_DevKit_INCLUDE_DIR VERSION_VAR CodeMeter_VERSION HANDLE_COMPONENTS ) - -if( CodeMeter_DEBUG ) - message( STATUS "${CMAKE_CURRENT_LIST_FILE}: leaving." ) -endif() - diff --git a/cmake/CMakeBuild/cmake/modules/FindIntelIPP.cmake b/cmake/CMakeBuild/cmake/modules/FindIntelIPP.cmake deleted file mode 100644 index f851773377cbc8f6f9040fd8730db1c8d42b33b2..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindIntelIPP.cmake +++ /dev/null @@ -1,214 +0,0 @@ -#[[.rst: -FindIntelIPP ------------- - -Find Intel Performance Primitives libraries (IPP) searching default system installation paths only. - - -Variables for using IPP -^^^^^^^^^^^^^^^^^^^^^^^ - -This module sets the following variables: - -``IntelIPP_FOUND`` - True, if IPP is found. -``IntelIPP_VERSION`` - Detected IPP version. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module defines the :prop_tgt:`IMPORTED` targets: - -``IntelIPP::cc`` - IPP color conversion library. -``IntelIPP::ch`` - IPP string operations library. -``IntelIPP::cv`` - IPP computer vision library. -``IntelIPP::dc`` - IPP data compression library. -``IntelIPP::i`` - IPP image processing library. -``IntelIPP::s`` - IPP signal processing library. -``IntelIPP::vm`` - IPP vector math library. -``IntelIPP::core`` - IPP core library. -``IntelIPP::iw`` - Integration wrappers available in IPP version 2018.0.0 or higher. - -#]] - -# Include some utility functions used by Intel performance library find modules. -include( ${CMAKE_CURRENT_LIST_DIR}/IntelPerfLibCommon.cmake ) - - -macro( IntelIPP_define_target_dependencies ipp_version_ ) - - # Add dependencies for all IPP targets: _IntelIPP_target_<domain>_depends = ... - # - # Domain Domain Code Depends on - # ---------------------------------------------- - # Color Conversion CC Core, VM, S, I - # String Operations CH Core, VM, S - # Computer Vision CV Core, VM, S, I - # Data Compression DC Core, VM, S - # Image Processing I Core, VM, S - # Signal Processing S Core, VM - # Vector Math VM Core - set( _IntelIPP_target_vm_depends IntelIPP::core ) - set( _IntelIPP_target_s_depends IntelIPP::vm IntelIPP::core ) - set( _IntelIPP_target_i_depends IntelIPP::s IntelIPP::vm IntelIPP::core ) - set( _IntelIPP_target_dc_depends IntelIPP::s IntelIPP::vm IntelIPP::core ) - set( _IntelIPP_target_cv_depends IntelIPP::i IntelIPP::s IntelIPP::vm IntelIPP::core ) - - set( _IntelIPP_target_ch_depends IntelIPP::s IntelIPP::vm IntelIPP::core ) - set( _IntelIPP_target_cc_depends IntelIPP::i IntelIPP::s IntelIPP::vm IntelIPP::core ) - - # >= 2018.0.0 - set( _IntelIPP_target_iw_depends IntelIPP::cc IntelIPP::cv IntelIPP::i IntelIPP::s IntelIPP::vm IntelIPP::core ) - - foreach( _v vm s i dc cv ch cc iw ) - list( APPEND _IntelIPP_tmp_vars _IntelIPP_target_${_v}_depends ) - endforeach() - -endmacro() - - -macro( IntelIPP_getLibDir lib_dir_ root_dir_ ) - if( WIN32 ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( ${lib_dir_} "${root_dir_}/lib/intel64_win" ) - else() - set( ${lib_dir_} "${root_dir_}/lib/ia32_win" ) - endif() - elseif( APPLE ) - set( ${lib_dir_} "${root_dir_}/lib" ) - else() - # Linux assumed - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( ${lib_dir_} "${root_dir_}/lib/intel64_lin" ) - else() - set( ${lib_dir_} "${root_dir_}/lib/ia32_lin" ) - endif() - endif() -endmacro() - -macro( IntelIPP_getLibName lib_name_ domain_ ) - if( ${domain_} STREQUAL "iw" ) - if( WIN32 ) - set( ${lib_name_} "ipp_${domain_}.lib" ) - else() - set( ${lib_name_} "libipp_${domain_}.a" ) - endif() - else() - if( WIN32 ) - set( ${lib_name_} "ipp${domain_}mt.lib" ) - else() - set( ${lib_name_} "libipp${domain_}.a" ) - endif() - endif() -endmacro() - -macro( IntelIPP_init ) - set( IntelIPP_USE_STATIC_LIBS ON ) - set( IntelIPP_USE_MULTITHREAD OFF ) - foreach( _v _IntelIPP_tmp_vars IntelIPP_ROOT_DIR IntelIPP_VERSION ) - if( DEFINED ${_v} ) - unset( ${_v} ) - endif() - endforeach() -endmacro() - - -function( IntelIPP_checkTargets target1_ ) - set( _target_list ${target1_} ) - list( APPEND _target_list ${ARGN} ) - foreach( _tgt IN LISTS _target_list ) - #message( STATUS "checking target IntelIPP::${_tgt}" ) - get_target_property( _prop_value IntelIPP::${_tgt} IMPORTED_LOCATION ) - if( _prop_value ) - if( NOT EXISTS "${_prop_value}" ) - message( FATAL_ERROR "Imported target IntelIPP::${_tgt} defines IMPORTED_LOCATION - ${_prop_value} - which does not exist. Please contact technical support." ) - endif() - endif() - endforeach() -endfunction() - - -# Setup internal variables and check user provided configuration options. -IntelIPP_init() - -# <package>_FIND_QUIETLY -#set( IntelIPP_ALL_FOUND FALSE ) - -set( _IntelIPP_tmp_vars _IntelIPP_root_dir_paths _IntelIPP_version_list ) - -# Enumerate all IPP installation paths and return version information for each path. -IntelPerfLib_getRootDirPaths( _IntelIPP_root_dir_paths _IntelIPP_version_list IPP ) -if( NOT _IntelIPP_root_dir_paths ) - # No IPP version installed. -else() - #message( STATUS "_ipp_root_dir_paths: ${_IntelIPP_root_dir_paths}" ) - #message( STATUS "_ipp_version_list: ${_IntelIPP_version_list}" ) - - # Select the correct version if find_package() has been called with version hints - if( DEFINED IntelIPP_FIND_VERSION ) - if( IntelIPP_FIND_VERSION_EXACT ) - IntelPerfLib_selectRootDir( IntelIPP_ROOT_DIR IntelIPP_VERSION "${_IntelIPP_root_dir_paths}" "${_IntelIPP_version_list}" ${IntelIPP_FIND_VERSION} EXACT ) - else() - IntelPerfLib_selectRootDir( IntelIPP_ROOT_DIR IntelIPP_VERSION "${_IntelIPP_root_dir_paths}" "${_IntelIPP_version_list}" ${IntelIPP_FIND_VERSION} ) - endif() - else() - IntelPerfLib_selectRootDir( IntelIPP_ROOT_DIR IntelIPP_VERSION "${_IntelIPP_root_dir_paths}" "${_IntelIPP_version_list}" ) - endif() - - if( IntelIPP_ROOT_DIR ) - # - set( _IntelIPP_INCLUDE_DIR "${IntelIPP_ROOT_DIR}/include" ) - IntelIPP_getLibDir( _IntelIPP_lib_dir "${IntelIPP_ROOT_DIR}" ) - - IntelIPP_define_target_dependencies( ${IntelIPP_VERSION} ) - # message( STATUS "_IntelIPP_tmp_vars=${_IntelIPP_tmp_vars}" ) - - set( _IntelIPP_target_list "core" "vm" "s" "i" "dc" "cv" "ch" "cc" ) - if( IntelIPP_VERSION VERSION_GREATER_EQUAL 2018.0.0 ) - list( APPEND _IntelIPP_target_list "iw" ) - endif() - - foreach( _tgt IN LISTS _IntelIPP_target_list ) - # message( STATUS "processing IPP target ${_tgt}" ) - if( NOT TARGET IntelIPP::${_tgt} ) - IntelIPP_getLibName( _IntelIPP_lib_name ${_tgt} ) - add_library( IntelIPP::${_tgt} STATIC IMPORTED ) - set_target_properties( IntelIPP::${_tgt} PROPERTIES IMPORTED_LOCATION "${_IntelIPP_lib_dir}/${_IntelIPP_lib_name}" ) - if( ${_tgt} STREQUAL "core" ) - set_target_properties( IntelIPP::${_tgt} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelIPP_INCLUDE_DIR}" ) - endif() - if( DEFINED _IntelIPP_target_${_tgt}_depends ) - set_target_properties( IntelIPP::${_tgt} PROPERTIES INTERFACE_LINK_LIBRARIES "${_IntelIPP_target_${_tgt}_depends}" ) - endif() - endif() - endforeach() - IntelIPP_checkTargets( ${_IntelIPP_target_list} ) - endif() -endif() - - -if( DEFINED _IntelIPP_tmp_vars ) - list( REMOVE_DUPLICATES _IntelIPP_tmp_vars ) - # Dispose any temporary variables avoiding unwanted pollution of the calling namespace. - foreach( _v ${_IntelIPP_tmp_vars} ) - # message( STATUS "FindIntelIPP.cmake: unsetting ${_v}" ) - unset( ${_v} ) - endforeach() - unset( _IntelIPP_tmp_vars ) -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( IntelIPP REQUIRED_VARS IntelIPP_ROOT_DIR VERSION_VAR IntelIPP_VERSION ) - diff --git a/cmake/CMakeBuild/cmake/modules/FindIntelMKL.cmake b/cmake/CMakeBuild/cmake/modules/FindIntelMKL.cmake deleted file mode 100644 index 098f88ac34bab114b9331516ca1f1afba81edcfa..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindIntelMKL.cmake +++ /dev/null @@ -1,251 +0,0 @@ -#[[.rst: -FindIntelMKL ------------- - -Find Intel Math Kernel Libraries (MKL) searching default system installation paths only. - -Variables for using MKL -^^^^^^^^^^^^^^^^^^^^^^^ - -This module sets the following variables: - -``IntelMKL_FOUND`` - True, if MKL is found. -``IntelMKL_VERSION`` - Detected MKL version. - -Imported Targets -^^^^^^^^^^^^^^^^ - -This module defines the :prop_tgt:`IMPORTED` targets: - -``IntelMKL::rt`` - Single dynamic MKL. - - -#]] - -# Include some utility functions used by Intel performance library find modules. -include( ${CMAKE_CURRENT_LIST_DIR}/IntelPerfLibCommon.cmake ) - - -macro( IntelMKL_getLibDir lib_dir_ root_dir_ ) - if( WIN32 ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( ${lib_dir_} "${root_dir_}/lib/intel64_win" ) - else() - set( ${lib_dir_} "${root_dir_}/lib/ia32_win" ) - endif() - elseif( APPLE ) - set( ${lib_dir_} "${root_dir_}/lib" ) - else() - # Linux assumed - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( ${lib_dir_} "${root_dir_}/lib/intel64_lin" ) - else() - set( ${lib_dir_} "${root_dir_}/lib/ia32_lin" ) - endif() - endif() -endmacro() - - -macro( IntelMKL_getLibName lib_name_ domain_ ) - if( WIN32 ) - set( ${lib_name_} "mkl_${domain_}.lib" ) - else() - if( IntelMKL_USE_STATIC_LIBS ) - set( ${lib_name_} "libmkl_${domain_}.a" ) - else() - if( APPLE ) - set( ${lib_name_} "libmkl_${domain_}.dylib" ) - else() - set( ${lib_name_} "libmkl_${domain_}.so" ) - endif() - endif() - endif() -endmacro() - - -macro( IntelMKL_init ) - #set( IntelMKL_USE_STATIC_LIBS ON ) - #set( IntelMKL_USE_MULTITHREAD OFF ) - foreach( _v _IntelMKL_tmp_vars IntelMKL_ROOT_DIR IntelMKL_VERSION ) - if( DEFINED ${_v} ) - unset( ${_v} ) - endif() - endforeach() -endmacro() - - -function( IntelMKL_findDlls mkl_dlls_ redist_dir_ redist_dir_compiler_ ) - # Assuming single dynamic MKL - unset( _mkl_dlls ) - - # Required DLLS - foreach( _dll rt core intel_thread avx avx2 def vml_avx vml_avx2 vml_def ) - if( EXISTS "${redist_dir_}/mkl_${_dll}.dll" ) - list( APPEND _mkl_dlls mkl_${_dll}.dll ) - else() - message( FATAL_ERROR "Required DLL '${redist_dir_}/mkl_${_dll}.dll' does not exist." ) - endif() - endforeach() - - # Optional DLLS - foreach( _dll avx512 vml_avx512 ) - if( EXISTS "${redist_dir_}/mkl_${_dll}.dll" ) - list( APPEND _mkl_dlls mkl_${_dll}.dll ) - endif() - endforeach() - - # Threading support - if( EXISTS "${redist_dir_compiler_}/libiomp5md.dll" ) - list( APPEND _mkl_dlls "${redist_dir_compiler_}/libiomp5md.dll" ) - if( EXISTS "${redist_dir_compiler_}/libiomp5md.pdb" ) - list( APPEND _mkl_dlls "${redist_dir_compiler_}/libiomp5md.pdb" ) - endif() - else() - message( FATAL_ERROR "Required DLL '${redist_dir_compiler_}/libiomp5md.dll' does not exist." ) - endif() - if( _mkl_dlls ) - set( ${mkl_dlls_} ${_mkl_dlls} PARENT_SCOPE ) - else() - set( ${mkl_dlls_} ${mkl_dlls_}-NOTFOUND PARENT_SCOPE ) - endif() -endfunction() - -# Setup internal variables and check user provided configuration options. -IntelMKL_init() - -set( _IntelMKL_tmp_vars _IntelMKL_root_dir_paths _IntelMKL_version_list ) - -# Enumerate all IPP installation paths and return version information for each path. -IntelPerfLib_getRootDirPaths( _IntelMKL_root_dir_paths _IntelMKL_version_list MKL ) -if( NOT _IntelMKL_root_dir_paths ) - # No MKL version installed. -else() - #message( STATUS "_ipp_root_dir_paths: ${_IntelMKL_root_dir_paths}" ) - #message( STATUS "_ipp_version_list: ${_IntelMKL_version_list}" ) - - # Select the correct version if find_package() has been called with version hints - if( DEFINED IntelMKL_FIND_VERSION ) - if( IntelMKL_FIND_VERSION_EXACT ) - IntelPerfLib_selectRootDir( IntelMKL_ROOT_DIR IntelMKL_VERSION "${_IntelMKL_root_dir_paths}" "${_IntelMKL_version_list}" ${IntelMKL_FIND_VERSION} EXACT ) - else() - IntelPerfLib_selectRootDir( IntelMKL_ROOT_DIR IntelMKL_VERSION "${_IntelMKL_root_dir_paths}" "${_IntelMKL_version_list}" ${IntelMKL_FIND_VERSION} ) - endif() - else() - IntelPerfLib_selectRootDir( IntelMKL_ROOT_DIR IntelMKL_VERSION "${_IntelMKL_root_dir_paths}" "${_IntelMKL_version_list}" ) - endif() - - if( IntelMKL_ROOT_DIR ) - - set( _IntelMKL_INCLUDE_DIR "${IntelMKL_ROOT_DIR}/include" ) - IntelMKL_getLibDir( _IntelMKL_lib_dir "${IntelMKL_ROOT_DIR}" ) - if( WIN32 ) - IntelPerfLib_getRedistDir( _IntelMKL_redist_dir "${IntelMKL_ROOT_DIR}" MKL ) - IntelPerfLib_getRedistDir( _IntelMKL_redist_dir_compiler "${IntelMKL_ROOT_DIR}" COMPILER ) - # list( APPEND( _IntelMKL_tmp_vars _IntelMKL_redist_dir _IntelMKL_redist_dir_compiler ) - endif() - - if( IntelMKL_USE_STATIC_LIBS ) - # NOT WORKING YET - # =============== - # # linux/x86_64/static/int32: -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_lp64.a ${MKLROOT}/lib/intel64/libmkl_intel_thread.a ${MKLROOT}/lib/intel64/libmkl_core.a -Wl,--end-group -liomp5 -lpthread -lm -ldl - - add_library( IntelMKL::core STATIC IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "core" ) - set_target_properties( IntelMKL::core PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - set_target_properties( IntelMKL::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - add_library( IntelMKL::intel_thread STATIC IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "intel_thread" ) - set_target_properties( IntelMKL::intel_thread PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - #set_target_properties( IntelMKL::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - add_library( IntelMKL::intel_lp64 STATIC IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "intel_lp64" ) - set_target_properties( IntelMKL::intel_lp64 PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - #set_target_properties( IntelMKL::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - IntelPerfLib_getRedistDir( _IntelMKL_redist_dir_compiler "${IntelMKL_ROOT_DIR}" COMPILER ) - add_library( IntelMKL::iomp5 SHARED IMPORTED ) - set_target_properties( IntelMKL::iomp5 PROPERTIES IMPORTED_LOCATION "${_IntelMKL_redist_dir_compiler}/libiomp5.so" ) - set_target_properties( IntelMKL::core PROPERTIES INTERFACE_LINK_LIBRARIES "IntelMKL::iomp5;-ldl" ) - elseif( IntelMKL_USE_SHARED_LIBS ) - # NOT WORKING YET - # =============== - add_library( IntelMKL::core SHARED IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "core" ) - set_target_properties( IntelMKL::core PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - set_target_properties( IntelMKL::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - add_library( IntelMKL::intel_thread SHARED IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "intel_thread" ) - set_target_properties( IntelMKL::intel_thread PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - #set_target_properties( IntelMKL::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - add_library( IntelMKL::intel_lp64 SHARED IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "intel_lp64" ) - set_target_properties( IntelMKL::intel_lp64 PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - #set_target_properties( IntelMKL::core PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - IntelPerfLib_getRedistDir( _IntelMKL_redist_dir_compiler "${IntelMKL_ROOT_DIR}" COMPILER ) - add_library( IntelMKL::iomp5 SHARED IMPORTED ) - set_target_properties( IntelMKL::iomp5 PROPERTIES IMPORTED_LOCATION "${_IntelMKL_redist_dir_compiler}/libiomp5.so" ) - set_target_properties( IntelMKL::core PROPERTIES INTERFACE_LINK_LIBRARIES "IntelMKL::iomp5;-ldl;-lm" ) - else() - # Use the single dynamic MKL. - if( NOT TARGET IntelMKL::rt ) - add_library( IntelMKL::rt SHARED IMPORTED ) - IntelMKL_getLibName( _IntelMKL_lib_name "rt" ) - if( WIN32 ) - set_target_properties( IntelMKL::rt PROPERTIES IMPORTED_LOCATION "${_IntelMKL_redist_dir}/mkl_rt.dll" - IMPORTED_IMPLIB "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - else() - set_target_properties( IntelMKL::rt PROPERTIES IMPORTED_LOCATION "${_IntelMKL_lib_dir}/${_IntelMKL_lib_name}" ) - endif() - set_target_properties( IntelMKL::rt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${_IntelMKL_INCLUDE_DIR}" ) - - if( APPLE ) - IntelPerfLib_getRedistDir( _IntelMKL_redist_dir_compiler "${IntelMKL_ROOT_DIR}" COMPILER ) - add_library( IntelMKL::iomp5 SHARED IMPORTED ) - set_target_properties( IntelMKL::iomp5 PROPERTIES IMPORTED_LOCATION "${_IntelMKL_redist_dir_compiler}/libiomp5.dylib" ) - set_target_properties( IntelMKL::rt PROPERTIES INTERFACE_LINK_LIBRARIES IntelMKL::iomp5 ) - endif() - - if( WIN32 ) - IntelMKL_findDlls( _IntelMKL_NEEDED_DLLS "${_IntelMKL_redist_dir}" "${_IntelMKL_redist_dir_compiler}" ) - - add_custom_target( CopyIntelMKLDlls ${CMAKE_COMMAND} -E make_directory - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${_IntelMKL_NEEDED_DLLS} - $<$<CONFIG:Debug>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG}> - $<$<CONFIG:Release>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE}> - $<$<CONFIG:RelWithDebInfo>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO}> - $<$<CONFIG:MinSizeRel>:${CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL}> - WORKING_DIRECTORY "${_IntelMKL_redist_dir}" ) - - add_dependencies( IntelMKL::rt CopyIntelMKLDlls ) - endif() - endif() - endif() - endif() -endif() - -if( DEFINED _IntelMKL_tmp_vars ) - list( REMOVE_DUPLICATES _IntelMKL_tmp_vars ) - # Dispose any temporary variables avoiding unwanted pollution of the calling namespace. - foreach( _v ${_IntelMKL_tmp_vars} ) - #message( STATUS "FindIntelMKL.cmake: unsetting ${_v}" ) - unset( ${_v} ) - endforeach() - unset( _IntelMKL_tmp_vars ) -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( IntelMKL REQUIRED_VARS IntelMKL_ROOT_DIR VERSION_VAR IntelMKL_VERSION ) - diff --git a/cmake/CMakeBuild/cmake/modules/FindOfxSDK.cmake b/cmake/CMakeBuild/cmake/modules/FindOfxSDK.cmake deleted file mode 100644 index 6f4561c0712d9808be9efd628ccab8e81a5bea24..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindOfxSDK.cmake +++ /dev/null @@ -1,152 +0,0 @@ -#.rst: -# FindOfxSDK -# ---------- -# -# This module finds headers and requested component libraries associated with -# an OFX SDK. -# -# OfxSDK_DIR -# Optional external hint to locate an OfxSDK. If defined it will replace the -# default SDK search path and must be set before find_package() is called. -# -# OfxSDK_ROOT_DIR -# -# OfxSDK::API -# Target to expose the OFX API header files. -# -# OfxSDK_VERSION -# OFX API version; e.g. 1.3 -# -# OFX_PLUGIN_PATH -# OFX plugin install path -# - -set( _ofxsdk_super_root "${CMAKE_SOURCE_DIR}/OfxSDK/include/OfxSDK" ) - -# Just to show the support for multiple versions side-by-side. -set( _ofx_api_version_list 1.4 1.3 ) - -set( _ofxsdk_required_vars OfxSDK_ROOT_DIR OfxSDK_INCLUDE_DIR ) - - -# Usage: -# OFX_ADD_PLUGIN( OfxPlugin1 src_file1.cpp src_file2.cpp ... ) -# -macro( OFX_ADD_PLUGIN name_ src_file_ ) - # define a prefix for temporary variables to make name clashes unlikely. - set( _prfx "_ofx_add_plugin_" ) - set( ${_prfx}src_files ${src_file_} ${ARGN} ) - - # create a shared library/module - add_library( ${name_} MODULE ${${_prfx}src_files} ) - - if( WIN32 ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( ${_prfx}platform_dir "Win64" ) - else() - set( ${_prfx}platform_dir "Win32" ) - endif() - elseif( APPLE ) - set( ${_prfx}platform_dir "MacOS" ) - elseif( UNIX ) - # Linux 64 bit assumed - set( ${_prfx}platform_dir "Linux-x86-64" ) - else() - message( FATAL_ERROR "Unsupported platform, please contact technical support." ) - endif() - - set_target_properties( ${name_} PROPERTIES PREFIX "" - SUFFIX ".ofx" - LIBRARY_OUTPUT_DIRECTORY_DEBUG ${OFX_PLUGIN_PATH}/${name_}.ofx.bundle/Contents/${${_prfx}platform_dir} - LIBRARY_OUTPUT_DIRECTORY_RELEASE ${OFX_PLUGIN_PATH}/${name_}.ofx.bundle/Contents/${${_prfx}platform_dir} - LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${OFX_PLUGIN_PATH}/${name_}.ofx.bundle/Contents/${${_prfx}platform_dir} - LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${OFX_PLUGIN_PATH}/${name_}.ofx.bundle/Contents/${${_prfx}platform_dir} ) - # remove temporary variables. - unset( ${_prfx}src_files ) - unset( ${_prfx}platform_dir ) -endmacro( OFX_ADD_PLUGIN ) - - -function( _OfxSDK_getPluginInstallPath plugin_install_path_ ) - message( STATUS "_OfxSDK_getPluginInstallPath: entering." ) - if( DEFINED ENV{OFX_PLUGIN_PATH} ) - set( ${plugin_install_path_} "$ENV{OFX_PLUGIN_PATH}" PARENT_SCOPE ) - else() - set( ${plugin_install_path_} "${CMAKE_SOURCE_DIR}/ofx-plugins" PARENT_SCOPE ) - #message( STATUS "environment variable OFX_PLUGIN_PATH does not exist, using plugin_path=${OFX_PLUGIN_PATH}" ) - endif() -endfunction() - - -function( _OfxSDK_findRootDir root_dir_ ) - unset( _root_dir ) - if( DEFINED OfxSDK_DIR ) - if( NOT EXISTS ${OfxSDK_DIR} ) - message( FATAL_ERROR "OfxSDK_DIR=${OfxSDK_DIR} does not exist." ) - else() - set( _root_dir "${OfxSDK_DIR}" ) - endif() - else() - if( EXISTS ${_ofxsdk_super_root} ) - if( OfxSDK_FIND_VERSION_EXACT ) - message( STATUS "FindOfxSDK: searching for ${OfxSDK_FIND_VERSION} exactly." ) - if( EXISTS "${_ofxsdk_super_root}/OFX_V${OfxSDK_FIND_VERSION}_SDK" ) - set( _root_dir "${_ofxsdk_super_root}/OFX_V${OfxSDK_FIND_VERSION}_SDK" ) - endif() - else() - foreach( _v ${_ofx_api_version_list} ) - if( EXISTS "${_ofxsdk_super_root}/OFX_V${_v}_API" ) - set( _root_dir "${_ofxsdk_super_root}/OFX_V${_v}_API" ) - endif() - if( DEFINED _root_dir ) - break() - endif() - endforeach() - endif() - endif() - endif() - if( DEFINED _root_dir ) - set( ${root_dir_} ${_root_dir} PARENT_SCOPE ) - else() - set( ${root_dir_} ${root_dir_}-NOTFOUND PARENT_SCOPE ) - endif() -endfunction() - -function( _OfxSDK_getVersion sdk_version_ sdk_root_dir_ sdk_include_dir_ ) - get_filename_component( _ofx_sdk_dir_name ${sdk_include_dir_} NAME ) - if( _ofx_sdk_dir_name MATCHES "^OFX_V([0-9.]+)_API$" ) - # message( STATUS "_OfxSDK_getVersion(): deriving version from ${_ae_sdk_dir}" ) - set( ${sdk_version_} ${CMAKE_MATCH_1} PARENT_SCOPE ) - else() - # no way yet to figure out the OFX API version automatically given the set of include files. - set( ${sdk_version_} 1.3 PARENT_SCOPE ) - endif() -endfunction() - - -if( DEFINED OfxSDK_INCLUDE_DIR ) - message( FATAL_ERROR "FindOfxSDK: OfxSDK_INCLUDE_DIR already defined -> unexpected." ) -endif() - -_OfxSDK_findRootDir( OfxSDK_ROOT_DIR ) -if( OfxSDK_ROOT_DIR ) - if( EXISTS "${OfxSDK_ROOT_DIR}/ofxCore.h" ) - set( OfxSDK_INCLUDE_DIR ${OfxSDK_ROOT_DIR} ) - if( OfxSDK_FIND_VERSION_EXACT ) - set( OfxSDK_VERSION ${OfxSDK_FIND_VERSION} ) - else() - _OfxSDK_getVersion( OfxSDK_VERSION ${OfxSDK_ROOT_DIR} ${OfxSDK_INCLUDE_DIR} ) - endif() - if( NOT TARGET OfxSDK::API ) - add_library( OfxSDK::API INTERFACE IMPORTED ) - set_target_properties( OfxSDK::API PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OfxSDK_INCLUDE_DIR}" ) - endif() - if( NOT DEFINED OFX_PLUGIN_PATH ) - _OfxSDK_getPluginInstallPath( _OFX_PLUGIN_PATH ) - set( OFX_PLUGIN_PATH "${_OFX_PLUGIN_PATH}" CACHE PATH "OFX plugin install path" ) - endif() - endif() -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( OfxSDK REQUIRED_VARS ${_ofxsdk_required_vars} VERSION_VAR OfxSDK_VERSION ) diff --git a/cmake/CMakeBuild/cmake/modules/FindVLC.cmake b/cmake/CMakeBuild/cmake/modules/FindVLC.cmake deleted file mode 100644 index be18402cf3255c8d4e3ea56f02d9394b638e9e94..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/FindVLC.cmake +++ /dev/null @@ -1,154 +0,0 @@ -# findVLC.cmake -# -# - -function( VLC_getRootDir root_dir_ ) - unset( _root_dir ) - if( CMAKE_HOST_WIN32 ) - # Assumes a native MinGW - if( CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$" ) - if( DEFINED ENV{VLC_ROOT64} ) - set( _root_dir "$ENV{VLC_ROOT64}" ) - else() - set( _root_dir "C:/Program Files/VideoLAN/VLC" ) - endif() - else() - if( DEFINED ENV{VLC_ROOT32} ) - set( _root_dir "$ENV{VLC_ROOT32}" ) - else() - set( _root_dir "C:/Program Files \(x86\)/VideoLAN/VLC" ) - endif() - endif() - elseif( APPLE ) - set( _root_dir /Applications/VLC.app/Contents/MacOS ) - elseif( CMAKE_HOST_UNIX ) - if( MINGW ) - if( DEFINED ENV{VLC_ROOT_WINDOWS} ) - set( _vlc_root_windows $ENV{VLC_ROOT_WINDOWS} ) - else() - set( _vlc_root_windows $ENV{HOME}/vlc-windows ) - endif() - if( CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64)$" ) - set( _root_dir ${_vlc_root_windows}/x86_64/vlc ) - else() - set( _root_dir ${_vlc_root_windows}/x86/vlc ) - endif() - else() - # native VLC build: system VLC or home brewed build. - if( DEFINED ENV{VLC_ROOT} ) - set( _root_dir $ENV{VLC_ROOT} ) - else() - set( _root_dir /usr ) - endif() - endif() - endif() - - if( DEFINED _root_dir AND EXISTS "${_root_dir}" ) - set( ${root_dir_} "${_root_dir}" PARENT_SCOPE ) - else() - set( ${root_dir_} "${root_dir_}-NOTFOUND" PARENT_SCOPE ) - endif() - -endfunction( VLC_getRootDir ) - -function( VLC_getIncludeDir include_dir_ root_dir_ ) - unset( _include_dir ) - if( MINGW ) - set( _include_dir ${root_dir_}/sdk/include ) - elseif( APPLE ) - set( _include_dir ${root_dir_}/include ) - elseif( CMAKE_HOST_UNIX ) - if( ${root_dir_} STREQUAL "/usr" ) - set( _include_dir ${root_dir_}/include ) - else() - set( _include_dir ${root_dir_}/include ) # or ${root_dir_)/sdk/include ? - endif() - endif() - - if( DEFINED _include_dir AND EXISTS "${_include_dir}/vlc/libvlc_version.h" ) - set( ${include_dir_} "${_include_dir}" PARENT_SCOPE ) - else() - set( ${include_dir_} "${include_dir_}-NOTFOUND" PARENT_SCOPE ) - endif() -endfunction() - -function( VLC_getVersion version_var_ header_file_ ) - # set( _regex_vlc_version_def "^#[ ]*define[\t ]+LIBVLC_VERSION_(MAJOR|MINOR|REVISION|EXTRA)[\t ]+[(]([0-9]+)" ) - set( _regex_vlc_version_def "^#[ ]*define[\t ]+LIBVLC_VERSION_(MAJOR|MINOR|REVISION)[\t ]+[(]([0-9]+)" ) - file( STRINGS "${header_file_}" _header_version_lines REGEX "${_regex_vlc_version_def}" ) - #message( STATUS "extracted header lines: ${_header_version_lines}" ) - unset( _vlc_version_list ) - foreach( _line ${_header_version_lines} ) - if( _line MATCHES "${_regex_vlc_version_def}" ) - list( APPEND _vlc_version_list "${CMAKE_MATCH_2}" ) - endif() - endforeach() - #message( STATUS "_vlc_version_list: ${_vlc_version_list}" ) - if( DEFINED _vlc_version_list ) - # Compose a doted separated version string - string( REPLACE ";" "." _vlc_version_str "${_vlc_version_list}" ) - else() - message( FATAL_ERROR "VLC_getVersion() failed to extract version information, please contact the maintainer for further support." ) - endif() - set( ${version_var_} "${_vlc_version_str}" PARENT_SCOPE ) -endfunction() - - -#message( STATUS "findVlc.cmake: starting" ) -set( _VLC_FOUND FALSE ) - -if( NOT DEFINED VLC_ROOT_DIR ) - # Standard search for VLC root if the user does not give a hint. - VLC_getRootDir( VLC_ROOT_DIR ) -endif() - -#message( STATUS "FindVLC: VLC_ROOT_DIR: ${VLC_ROOT_DIR}" ) -if( VLC_ROOT_DIR ) - - VLC_getIncludeDir( _vlc_include_dir "${VLC_ROOT_DIR}" ) - if( _vlc_include_dir ) - set( _VLC_FOUND TRUE ) - endif() -endif() - -if( _VLC_FOUND ) - VLC_getVersion( VLC_VERSION "${_vlc_include_dir}/vlc/libvlc_version.h" ) - if( NOT TARGET VLC::vlccore ) - set( VLC_INCLUDE_DIRS "${_vlc_include_dir}/vlc" "${_vlc_include_dir}/vlc/plugins" ) - set( _vlc_interface_compile_definitions "__PLUGIN__;_FILE_OFFSET_BITS=64;_REENTRANT;_THREAD_SAFE" ) - - add_library( VLC::vlccore SHARED IMPORTED ) - set_target_properties( VLC::vlccore PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${VLC_INCLUDE_DIRS}" - INTERFACE_COMPILE_DEFINITIONS "${_vlc_interface_compile_definitions}" ) - - if( MINGW ) - set_target_properties( VLC::vlccore PROPERTIES IMPORTED_LOCATION ${VLC_ROOT_DIR}/libvlccore.dll - IMPORTED_IMPLIB ${VLC_ROOT_DIR}/sdk/lib/libvlccore.lib ) - elseif( APPLE ) - set_target_properties( VLC::vlccore PROPERTIES IMPORTED_LOCATION ${VLC_ROOT_DIR}/lib/libvlccore.dylib ) - elseif( CMAKE_HOST_UNIX ) - if( VLC_ROOT_DIR STREQUAL "/usr" ) - find_library( VLC_LIBVLCCORE libvlccore.so ) - else() - set( VLC_LIBVLCCORE ${VLC_ROOT_DIR}/lib/libvlccore.so ) - endif() - if( VLC_LIBVLCCORE ) - set_target_properties( VLC::vlccore PROPERTIES IMPORTED_LOCATION ${VLC_LIBVLCCORE} ) - endif() - endif() - endif() -else() - # Let find_package know that VLC development files are not available. - unset( VLC_ROOT_DIR ) -endif() - -include( FindPackageHandleStandardArgs ) -find_package_handle_standard_args( VLC REQUIRED_VARS VLC_ROOT_DIR VERSION_VAR VLC_VERSION ) - -# Disposal of temporary stuff. -unset( _VLC_FOUND ) -unset( _vlc_interface_compile_definitions ) -unset( _vlc_include_dir ) - -#message( STATUS "Leaving FindVLC.cmake" ) - diff --git a/cmake/CMakeBuild/cmake/modules/IntelPerfLibCommon.cmake b/cmake/CMakeBuild/cmake/modules/IntelPerfLibCommon.cmake deleted file mode 100644 index 22095da08a43e9fb65ec24384de9f0653159165b..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/IntelPerfLibCommon.cmake +++ /dev/null @@ -1,198 +0,0 @@ -#[[.rst: -IntelPerfLibCommon ------------------- - -Internal utility functions used by Intel Performance Library find modules. - -#]] - - -function( IntelPerfLib_getRedistDir redist_dir_ root_dir_ perflib_id_ ) - - if( NOT EXISTS "${root_dir_}" ) - message( FATAL_ERROR "Directory '${root_dir_}' does not exist." ) - endif() - - # - string( TOLOWER ${perflib_id_} _perflib_id_lc ) - - # On Windows we may run into trouble if a path includes ".." and therefore - # the get_filename_component() logic. - get_filename_component( _root_dir_parent "${root_dir_}" DIRECTORY ) - - if( WIN32 ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( _redist_dir "${_root_dir_parent}/redist/intel64_win/${_perflib_id_lc}" ) - else() - set( _redist_dir "${_root_dir_parent}/redist/ia32_win/${_perflib_id_lc}" ) - endif() - elseif( APPLE ) - set( _redist_dir "${_root_dir_parent}/${_perflib_id_lc}/lib" ) - elseif( UNIX ) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( _redist_dir "${_root_dir_parent}/${_perflib_id_lc}/lib/intel64_lin" ) - else() - set( _redist_dir "${_root_dir_parent}/${_perflib_id_lc}/lib/ia32_lin" ) - endif() - else() - message( FATAL_ERROR "IntelPerfLib_getRedistDir() has not support for the actual platform/configuration." ) - endif() - - if( NOT EXISTS "${_redist_dir}" ) - message( FATAL_ERROR "Directory '${_redist_dir}' does not exist." ) - else() - set( ${redist_dir_} "${_redist_dir}" PARENT_SCOPE ) - endif() -endfunction() - - -function( IntelPerfLib_getVersion version_var_ header_file_ perflib_id_ ) - - if( NOT EXISTS "${header_file_}" ) - message( FATAL_ERROR "header file '${header_file_}' does not exist." ) - endif() - - unset( _version_list ) - string( TOUPPER ${perflib_id_} _perflib_id_uc ) - if( ${_perflib_id_uc} STREQUAL "IPP" ) - set( _regex_version_def "^#define[\t ]+${_perflib_id_uc}_VERSION_(MAJOR|MINOR|UPDATE)[\t ]+([0-9]+)" ) - elseif( ${_perflib_id_uc} MATCHES "^(MKL|DAAL)$" ) - set( _regex_version_def "^#define[\t ]+__INTEL_${_perflib_id_uc}_(_|MINOR__|UPDATE__)[\t ]+([0-9]+)" ) - endif() - - file( STRINGS "${header_file_}" _header_version_lines REGEX "${_regex_version_def}" ) - # message( STATUS "extracted header lines: ${_header_version_lines}" ) - foreach( _line ${_header_version_lines} ) - # message( STATUS "processing header line: ${_line}" ) - if( _line MATCHES "${_regex_version_def}" ) - # message( STATUS "${CMAKE_MATCH_1} -> ${CMAKE_MATCH_2}" ) - list( APPEND _version_list "${CMAKE_MATCH_2}" ) - endif() - endforeach() - #message( STATUS "_version_list: ${_version_list}" ) - if( DEFINED _version_list ) - # Compose a doted separated version string - string( REPLACE ";" "." _version_str "${_version_list}" ) - #message( STATUS "_version_str: ${_version_str}" ) - else() - message( FATAL_ERROR "IntelPerfLib_getVersion() failed to extract version information, please contact the maintainer for further support." ) - endif() - set( ${version_var_} "${_version_str}" PARENT_SCOPE ) -endfunction() - - -# Returns a list of installations paths holding the specified performance library category. -function( IntelPerfLib_getRootDirPaths root_dir_paths_ version_list_ perflib_id_ ) - string( TOLOWER ${perflib_id_} _perflib_id_lc ) - unset( _version_list ) - unset( _root_dir_paths ) - - if( WIN32 ) - set( _perflib_top_dir "C:/Program Files (x86)/IntelSWTools" ) - set( _perflib_platform_dir "windows" ) - elseif( APPLE ) - set( _perflib_top_dir "/opt/intel" ) - set( _perflib_platform_dir "mac" ) - else() - set( _perflib_top_dir "/opt/intel" ) - set( _perflib_platform_dir "linux" ) - endif() - - if( EXISTS "${_perflib_top_dir}" ) - file( GLOB _perflib_inst_dir_list "${_perflib_top_dir}/compilers_and_libraries_*.*.*" ) - - foreach( _pth IN LISTS _perflib_inst_dir_list ) - if( ${_perflib_id_lc} STREQUAL "daal" ) - set( _version_header_file "${_pth}/${_perflib_platform_dir}/${_perflib_id_lc}/include/${_perflib_id_lc}/services/library_version_info.h" ) - elseif( ${_perflib_id_lc} STREQUAL "ipp" ) - set( _version_header_file "${_pth}/${_perflib_platform_dir}/${_perflib_id_lc}/include/${_perflib_id_lc}version.h" ) - elseif( ${_perflib_id_lc} STREQUAL "mkl" ) - set( _version_header_file "${_pth}/${_perflib_platform_dir}/${_perflib_id_lc}/include/${_perflib_id_lc}_version.h" ) - else() - set( _version_header_file "${_pth}/${_perflib_platform_dir}/${_perflib_id_lc}/include/${_perflib_id_lc}_version.h" ) - endif() - if( EXISTS "${_version_header_file}" ) - IntelPerfLib_getVersion( _version_str "${_version_header_file}" ${perflib_id_} ) - #message( STATUS "${_pth}: found ${perflib_id_} ${_version_str}" ) - list( APPEND _version_list ${_version_str} ) - list( APPEND _root_dir_paths "${_pth}/${_perflib_platform_dir}/${_perflib_id_lc}" ) - endif() - endforeach() - endif() - if( ( DEFINED _root_dir_paths ) AND ( DEFINED _version_list ) ) - set( ${version_list_} "${_version_list}" PARENT_SCOPE ) - set( ${root_dir_paths_} "${_root_dir_paths}" PARENT_SCOPE ) - else() - set( ${root_dir_paths_} "${root_dir_paths_}-NOTFOUND" PARENT_SCOPE ) - endif() -endfunction() - - -# Optional arguments: <version> [EXACT] -function( IntelPerfLib_selectRootDir root_dir_ version_ root_dir_paths_ version_list_ ) - set( _find_exact FALSE ) - set( _find_version LATEST ) - - if( ARGC GREATER 4 ) - # One or more optional arguments specified. - if( ARGC EQUAL 5 ) - set( _find_version ${ARGV4} ) - elseif( ARGC EQUAL 6 ) - set( _find_version ${ARGV4} ) - if( ${ARGV5} STREQUAL "EXACT" ) - set( _find_exact TRUE ) - else() - message( FATAL_ERROR "IntelPerfLib_selectRootDir() argument=${ARGV5} not understood." ) - endif() - else() - message( FATAL_ERROR "IntelPerfLib_selectRootDir() received too many arguments." ) - endif() - endif() - - # Build a temporary path map associating available version strings with root paths. - set( _index 0 ) - foreach( _v IN LISTS version_list_ ) - list( GET root_dir_paths_ ${_index} _root_dir ) - #message( STATUS "IntelPerfLib_selectRootDir(): processing ${_root_dir} ${_v}" ) - set( _root_pth_${_v} "${_root_dir}" ) - math( EXPR _index "${_index} + 1" ) - endforeach() - - # Use the standard version sorter to get a list in descending order - bb_version_list_sort( _version_list_sorted ${version_list_} ) - unset( _root_dir ) - if( _find_version STREQUAL "LATEST" ) - list( GET _version_list_sorted 0 _version ) - #message( STATUS "IntelPerfLib_selectRootDir(): ${_version} selected" ) - set( _root_dir "${_root_pth_${_version}}" ) - else() - # Two possibilities: - # - exact version match - # - selected version is greater or equal compared to the requested version - if( _find_exact ) - foreach( _v IN LISTS _version_list_sorted ) - if( _v VERSION_EQUAL ${_find_version} ) - set( _root_dir "${_root_pth_${_v}}" ) - set( _version ${_v} ) - break() - endif() - endforeach() - else() - foreach( _v IN LISTS _version_list_sorted ) - if( _v VERSION_GREATER_EQUAL ${_find_version} ) - set( _root_dir "${_root_pth_${_v}}" ) - set( _version ${_v} ) - break() - endif() - endforeach() - endif() - endif() - if( DEFINED _root_dir ) - set( ${root_dir_} "${_root_dir}" PARENT_SCOPE ) - set( ${version_} "${_version}" PARENT_SCOPE ) - else() - set( ${root_dir_} "${root_dir_}-NOTFOUND" PARENT_SCOPE ) - endif() -endfunction() - - diff --git a/cmake/CMakeBuild/cmake/modules/patched/CPackDeb.cmake b/cmake/CMakeBuild/cmake/modules/patched/CPackDeb.cmake deleted file mode 100644 index bf199050020c4b77e6ac4c025bdeaaf3f5450c7c..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/patched/CPackDeb.cmake +++ /dev/null @@ -1,1119 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackDeb -# -------- -# -# The built in (binary) CPack Deb generator (Unix only) -# -# Variables specific to CPack Debian (DEB) generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackDeb may be used to create Deb package using :module:`CPack`. -# CPackDeb is a :module:`CPack` generator thus it uses the ``CPACK_XXX`` -# variables used by :module:`CPack`. -# -# CPackDeb generator should work on any Linux host but it will produce -# better deb package when Debian specific tools ``dpkg-xxx`` are usable on -# the build system. -# -# CPackDeb has specific features which are controlled by the specifics -# :code:`CPACK_DEBIAN_XXX` variables. -# -# :code:`CPACK_DEBIAN_<COMPONENT>_XXXX` variables may be used in order to have -# **component** specific values. Note however that ``<COMPONENT>`` refers to -# the **grouping name** written in upper case. It may be either a component name -# or a component GROUP name. -# -# Here are some CPackDeb wiki resources that are here for historic reasons and -# are no longer maintained but may still prove useful: -# -# - https://cmake.org/Wiki/CMake:CPackConfiguration -# - https://cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 -# -# List of CPackDEB specific variables: -# -# .. variable:: CPACK_DEB_COMPONENT_INSTALL -# -# Enable component packaging for CPackDEB -# -# * Mandatory : NO -# * Default : OFF -# -# If enabled (ON) multiple packages are generated. By default a single package -# containing files of all components is generated. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_NAME -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_NAME -# -# Set Package control field (variable is automatically transformed to lower -# case). -# -# * Mandatory : YES -# * Default : -# -# - :variable:`CPACK_PACKAGE_NAME` for non-component based -# installations -# - :variable:`CPACK_DEBIAN_PACKAGE_NAME` suffixed with -<COMPONENT> -# for component-based installations. -# -# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source -# -# .. variable:: CPACK_DEBIAN_FILE_NAME -# CPACK_DEBIAN_<COMPONENT>_FILE_NAME -# -# Package file name. -# -# * Mandatory : YES -# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].deb`` -# -# This may be set to ``DEB-DEFAULT`` to allow CPackDeb to generate package file -# name by itself in deb format:: -# -# <PackageName>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb -# -# Alternatively provided package file name must end -# with either ``.deb`` or ``.ipk`` suffix. -# -# .. note:: -# -# Preferred setting of this variable is ``DEB-DEFAULT`` but for backward -# compatibility with CPackDeb in CMake prior to version 3.6 this feature -# is disabled by default. -# -# .. note:: -# -# By using non default filenames duplicate names may occur. Duplicate files -# get overwritten and it is up to the packager to set the variables in a -# manner that will prevent such errors. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_EPOCH -# -# The Debian package epoch -# -# * Mandatory : No -# * Default : - -# -# Optional number that should be incremented when changing versioning schemas -# or fixing mistakes in the version numbers of older packages. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_VERSION -# -# The Debian package version -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_VERSION` -# -# This variable may contain only alphanumerics (A-Za-z0-9) and the characters -# . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If -# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` is not set then hyphens are not -# allowed. -# -# .. note:: -# -# For backward compatibility with CMake 3.9 and lower a failed test of this -# variable's content is not a hard error when both -# :variable:`CPACK_DEBIAN_PACKAGE_RELEASE` and -# :variable:`CPACK_DEBIAN_PACKAGE_EPOCH` variables are not set. An author -# warning is reported instead. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_RELEASE -# -# The Debian package release - Debian revision number. -# -# * Mandatory : No -# * Default : - -# -# This is the numbering of the DEB package itself, i.e. the version of the -# packaging and not the version of the content (see -# :variable:`CPACK_DEBIAN_PACKAGE_VERSION`). One may change the default value -# if the previous packaging was buggy and/or you want to put here a fancy Linux -# distro specific numbering. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_ARCHITECTURE -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ARCHITECTURE -# -# The Debian package architecture -# -# * Mandatory : YES -# * Default : Output of :code:`dpkg --print-architecture` (or :code:`i386` -# if :code:`dpkg` is not found) -# -# .. variable:: CPACK_DEBIAN_PACKAGE_DEPENDS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS -# -# Sets the Debian dependencies of this package. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS` for component-based -# installations. -# -# .. note:: -# -# If :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` or -# more specifically :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS` -# is set for this component, the discovered dependencies will be appended -# to :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` instead of -# :variable:`CPACK_DEBIAN_PACKAGE_DEPENDS`. If -# :variable:`CPACK_DEBIAN_<COMPONENT>_PACKAGE_DEPENDS` is an empty string, -# only the automatically discovered dependencies will be set for this -# component. -# -# Example:: -# -# set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.3.1-6), libc6 (< 2.4)") -# -# .. variable:: CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS -# -# Sets inter component dependencies if listed with -# :variable:`CPACK_COMPONENT_<compName>_DEPENDS` variables. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_DEBIAN_PACKAGE_MAINTAINER -# -# The Debian package maintainer -# -# * Mandatory : YES -# * Default : :code:`CPACK_PACKAGE_CONTACT` -# -# .. variable:: CPACK_DEBIAN_PACKAGE_DESCRIPTION -# CPACK_COMPONENT_<COMPONENT>_DESCRIPTION -# -# The Debian package description -# -# * Mandatory : YES -# * Default : -# -# - :variable:`CPACK_DEBIAN_PACKAGE_DESCRIPTION` if set or -# - :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` -# -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SECTION -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SECTION -# -# Set Section control field e.g. admin, devel, doc, ... -# -# * Mandatory : YES -# * Default : "devel" -# -# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections -# -# .. variable:: CPACK_DEBIAN_ARCHIVE_TYPE -# -# The archive format used for creating the Debian package. -# -# * Mandatory : YES -# * Default : "paxr" -# -# Possible values are: -# -# - paxr -# - gnutar -# -# .. note:: -# -# Default pax archive format is the most portable format and generates -# packages that do not treat sparse files specially. -# GNU tar format on the other hand supports longer filenames. -# -# .. variable:: CPACK_DEBIAN_COMPRESSION_TYPE -# -# The compression used for creating the Debian package. -# -# * Mandatory : YES -# * Default : "gzip" -# -# Possible values are: -# -# - lzma -# - xz -# - bzip2 -# - gzip -# -# .. variable:: CPACK_DEBIAN_PACKAGE_PRIORITY -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PRIORITY -# -# Set Priority control field e.g. required, important, standard, optional, -# extra -# -# * Mandatory : YES -# * Default : "optional" -# -# See https://www.debian.org/doc/debian-policy/ch-archive.html#s-priorities -# -# .. variable:: CPACK_DEBIAN_PACKAGE_HOMEPAGE -# -# The URL of the web site for this package, preferably (when applicable) the -# site from which the original source can be obtained and any additional -# upstream documentation or information may be found. -# -# * Mandatory : NO -# * Default : - -# -# .. note:: -# -# The content of this field is a simple URL without any surrounding -# characters such as <>. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SHLIBDEPS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SHLIBDEPS -# -# May be set to ON in order to use :code:`dpkg-shlibdeps` to generate -# better package dependency list. -# -# * Mandatory : NO -# * Default : -# -# - :variable:`CPACK_DEBIAN_PACKAGE_SHLIBDEPS` if set or -# - OFF -# -# .. note:: -# -# You may need set :variable:`CMAKE_INSTALL_RPATH` to an appropriate value -# if you use this feature, because if you don't :code:`dpkg-shlibdeps` -# may fail to find your own shared libs. -# See https://cmake.org/Wiki/CMake_RPATH_handling. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_DEBUG -# -# May be set when invoking cpack in order to trace debug information -# during CPackDeb run. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_DEBIAN_PACKAGE_PREDEPENDS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PREDEPENDS -# -# Sets the `Pre-Depends` field of the Debian package. -# Like :variable:`Depends <CPACK_DEBIAN_PACKAGE_DEPENDS>`, except that it -# also forces :code:`dpkg` to complete installation of the packages named -# before even starting the installation of the package which declares the -# pre-dependency. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_PREDEPENDS` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_ENHANCES -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_ENHANCES -# -# Sets the `Enhances` field of the Debian package. -# Similar to :variable:`Suggests <CPACK_DEBIAN_PACKAGE_SUGGESTS>` but works -# in the opposite direction: declares that a package can enhance the -# functionality of another package. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_ENHANCES` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_BREAKS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_BREAKS -# -# Sets the `Breaks` field of the Debian package. -# When a binary package (P) declares that it breaks other packages (B), -# :code:`dpkg` will not allow the package (P) which declares `Breaks` be -# **unpacked** unless the packages that will be broken (B) are deconfigured -# first. -# As long as the package (P) is configured, the previously deconfigured -# packages (B) cannot be reconfigured again. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_BREAKS` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-breaks -# -# .. variable:: CPACK_DEBIAN_PACKAGE_CONFLICTS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONFLICTS -# -# Sets the `Conflicts` field of the Debian package. -# When one binary package declares a conflict with another using a `Conflicts` -# field, :code:`dpkg` will not allow them to be unpacked on the system at -# the same time. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_CONFLICTS` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-conflicts -# -# .. note:: -# -# This is a stronger restriction than -# :variable:`Breaks <CPACK_DEBIAN_PACKAGE_BREAKS>`, which prevents the -# broken package from being configured while the breaking package is in -# the "Unpacked" state but allows both packages to be unpacked at the same -# time. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_PROVIDES -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_PROVIDES -# -# Sets the `Provides` field of the Debian package. -# A virtual package is one which appears in the `Provides` control field of -# another package. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_PROVIDES` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-relationships.html#s-virtual -# -# .. variable:: CPACK_DEBIAN_PACKAGE_REPLACES -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_REPLACES -# -# Sets the `Replaces` field of the Debian package. -# Packages can declare in their control file that they should overwrite -# files in certain other packages, or completely replace other packages. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_REPLACES` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_RECOMMENDS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_RECOMMENDS -# -# Sets the `Recommends` field of the Debian package. -# Allows packages to declare a strong, but not absolute, dependency on other -# packages. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_RECOMMENDS` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SUGGESTS -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SUGGESTS -# -# Sets the `Suggests` field of the Debian package. -# Allows packages to declare a suggested package install grouping. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_SUGGESTS` for component-based -# installations. -# -# See http://www.debian.org/doc/debian-policy/ch-relationships.html#s-binarydeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS -# -# * Mandatory : NO -# * Default : OFF -# -# Allows to generate shlibs control file automatically. Compatibility is defined by -# :variable:`CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY` variable value. -# -# .. note:: -# -# Libraries are only considered if they have both library name and version -# set. This can be done by setting SOVERSION property with -# :command:`set_target_properties` command. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY -# -# Compatibility policy for auto-generated shlibs control file. -# -# * Mandatory : NO -# * Default : "=" -# -# Defines compatibility policy for auto-generated shlibs control file. -# Possible values: "=", ">=" -# -# See https://www.debian.org/doc/debian-policy/ch-sharedlibs.html#s-sharedlibs-shlibdeps -# -# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_EXTRA -# -# This variable allow advanced user to add custom script to the -# control.tar.gz. -# Typical usage is for conffiles, postinst, postrm, prerm. -# -# * Mandatory : NO -# * Default : - -# -# Usage:: -# -# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA -# "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") -# -# .. note:: -# -# The original permissions of the files will be used in the final -# package unless the variable -# :variable:`CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION` is set. -# In particular, the scripts should have the proper executable -# flag prior to the generation of the package. -# -# .. variable:: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_CONTROL_STRICT_PERMISSION -# -# This variable indicates if the Debian policy on control files should be -# strictly followed. -# -# * Mandatory : NO -# * Default : FALSE -# -# Usage:: -# -# set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) -# -# .. note:: -# -# This overrides the permissions on the original files, following the rules -# set by Debian policy -# https://www.debian.org/doc/debian-policy/ch-files.html#s-permissions-owners -# -# .. variable:: CPACK_DEBIAN_PACKAGE_SOURCE -# CPACK_DEBIAN_<COMPONENT>_PACKAGE_SOURCE -# -# Sets the ``Source`` field of the binary Debian package. -# When the binary package name is not the same as the source package name -# (in particular when several components/binaries are generated from one -# source) the source from which the binary has been generated should be -# indicated with the field ``Source``. -# -# * Mandatory : NO -# * Default : -# -# - An empty string for non-component based installations -# - :variable:`CPACK_DEBIAN_PACKAGE_SOURCE` for component-based -# installations. -# -# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Source -# -# .. note:: -# -# This value is not interpreted. It is possible to pass an optional -# revision number of the referenced source package as well. -# -# Building Debian packages on Windows -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# To communicate UNIX file permissions from the install stage -# to the CPack DEB generator the "cmake_mode_t" NTFS -# alternate data stream (ADT) is used. -# -# When a filesystem without ADT support is used only owner read/write -# permissions can be preserved. - -# CPack script for creating Debian package -# Author: Mathieu Malaterre -# -# http://wiki.debian.org/HowToPackageForDebian - -if(CMAKE_BINARY_DIR) - message(FATAL_ERROR "CPackDeb.cmake may only be used by CPack internally.") -endif() - -function(cpack_deb_variable_fallback OUTPUT_VAR_NAME) - set(FALLBACK_VAR_NAMES ${ARGN}) - - foreach(variable_name IN LISTS FALLBACK_VAR_NAMES) - if(${variable_name}) - set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE) - break() - endif() - endforeach() -endfunction() - -function(get_component_package_name var component) - string(TOUPPER "${component}" component_upcase) - if(CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME) - string(TOLOWER "${CPACK_DEBIAN_${component_upcase}_PACKAGE_NAME}" package_name) - else() - string(TOLOWER "${CPACK_DEBIAN_PACKAGE_NAME}-${component}" package_name) - endif() - - set("${var}" "${package_name}" PARENT_SCOPE) -endfunction() - -#extract library name and version for given shared object -function(extract_so_info shared_object libname version) - if(READELF_EXECUTABLE) - execute_process(COMMAND "${READELF_EXECUTABLE}" -d "${shared_object}" - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - RESULT_VARIABLE result - OUTPUT_VARIABLE output - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(result EQUAL 0) - string(REGEX MATCH "\\(SONAME\\)[^\n]*\\[([^\n]+)\\.so\\.([^\n]*)\\]" soname "${output}") - set(${libname} "${CMAKE_MATCH_1}" PARENT_SCOPE) - set(${version} "${CMAKE_MATCH_2}" PARENT_SCOPE) - else() - message(WARNING "Error running readelf for \"${shared_object}\"") - endif() - else() - message(FATAL_ERROR "Readelf utility is not available.") - endif() -endfunction() - -function(cpack_deb_prepare_package_vars) - # CPACK_DEBIAN_PACKAGE_SHLIBDEPS - # If specify OFF, only user depends are used - if(NOT DEFINED CPACK_DEBIAN_PACKAGE_SHLIBDEPS) - set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) - endif() - - set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_DEB_PACKAGE_COMPONENT_PART_PATH}") - - # per component automatic discover: some of the component might not have - # binaries. - if(CPACK_DEB_PACKAGE_COMPONENT) - string(TOUPPER "${CPACK_DEB_PACKAGE_COMPONENT}" _local_component_name) - set(_component_shlibdeps_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_SHLIBDEPS") - - # if set, overrides the global configuration - if(DEFINED ${_component_shlibdeps_var}) - set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS "${${_component_shlibdeps_var}}") - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${CPACK_DEB_PACKAGE_COMPONENT}' dpkg-shlibdeps set to ${CPACK_DEBIAN_PACKAGE_SHLIBDEPS}") - endif() - endif() - endif() - - if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OR CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS) - # Generating binary list - Get type of all install files - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE FILE_PATHS_ LIST_DIRECTORIES false RELATIVE "${WDIR}" "${WDIR}/*") - cmake_policy(POP) - - find_program(FILE_EXECUTABLE file) - if(NOT FILE_EXECUTABLE) - message(FATAL_ERROR "CPackDeb: file utility is not available. CPACK_DEBIAN_PACKAGE_SHLIBDEPS and CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS options are not available.") - endif() - - # get file info so that we can determine if file is executable or not - unset(CPACK_DEB_INSTALL_FILES) - foreach(FILE_ IN LISTS FILE_PATHS_) - execute_process(COMMAND env LC_ALL=C ${FILE_EXECUTABLE} "./${FILE_}" - WORKING_DIRECTORY "${WDIR}" - RESULT_VARIABLE FILE_RESULT_ - OUTPUT_VARIABLE INSTALL_FILE_) - if(NOT FILE_RESULT_ EQUAL 0) - message (FATAL_ERROR "CPackDeb: execution of command: '${FILE_EXECUTABLE} ./${FILE_}' failed with exit code: ${FILE_RESULT_}") - endif() - list(APPEND CPACK_DEB_INSTALL_FILES "${INSTALL_FILE_}") - endforeach() - - # Only dynamically linked ELF files are included - # Extract only file name infront of ":" - foreach(_FILE IN LISTS CPACK_DEB_INSTALL_FILES) - if(_FILE MATCHES "ELF.*dynamically linked") - string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") - list(APPEND CPACK_DEB_BINARY_FILES "${CMAKE_MATCH_1}") - set(CONTAINS_EXECUTABLE_FILES_ TRUE) - endif() - if(_FILE MATCHES "ELF.*shared object") - string(REGEX MATCH "(^.*):" _FILE_NAME "${_FILE}") - list(APPEND CPACK_DEB_SHARED_OBJECT_FILES "${CMAKE_MATCH_1}") - endif() - endforeach() - endif() - - if(CPACK_DEBIAN_PACKAGE_SHLIBDEPS) - # dpkg-shlibdeps is a Debian utility for generating dependency list - find_program(SHLIBDEPS_EXECUTABLE dpkg-shlibdeps) - - if(SHLIBDEPS_EXECUTABLE) - # Check version of the dpkg-shlibdeps tool using CPackDEB method - execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --version - OUTPUT_VARIABLE _TMP_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(_TMP_VERSION MATCHES "dpkg-shlibdeps version ([0-9]+\\.[0-9]+\\.[0-9]+)") - set(SHLIBDEPS_EXECUTABLE_VERSION "${CMAKE_MATCH_1}") - else() - set(SHLIBDEPS_EXECUTABLE_VERSION "") - endif() - - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: dpkg-shlibdeps --version output is '${_TMP_VERSION}'") - message("CPackDeb Debug: dpkg-shlibdeps version is <${SHLIBDEPS_EXECUTABLE_VERSION}>") - endif() - - if(CONTAINS_EXECUTABLE_FILES_) - message("CPackDeb: - Generating dependency list") - - # Create blank control file for running dpkg-shlibdeps - # There might be some other way to invoke dpkg-shlibdeps without creating this file - # but standard debian package should not have anything that can collide with this file or directory - file(MAKE_DIRECTORY ${CPACK_TEMPORARY_DIRECTORY}/debian) - file(WRITE ${CPACK_TEMPORARY_DIRECTORY}/debian/control "") - - # Create a DEBIAN directory so that dpkg-shlibdeps can find the package dir when resolving $ORIGIN. - file(MAKE_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}/DEBIAN") - - # Add --ignore-missing-info if the tool supports it - execute_process(COMMAND env LC_ALL=C ${SHLIBDEPS_EXECUTABLE} --help - OUTPUT_VARIABLE _TMP_HELP - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(_TMP_HELP MATCHES "--ignore-missing-info") - set(IGNORE_MISSING_INFO_FLAG "--ignore-missing-info") - endif() - - # Execute dpkg-shlibdeps - # --ignore-missing-info : allow dpkg-shlibdeps to run even if some libs do not belong to a package - # -O : print to STDOUT - execute_process(COMMAND ${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES} - WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" - OUTPUT_VARIABLE SHLIBDEPS_OUTPUT - RESULT_VARIABLE SHLIBDEPS_RESULT - ERROR_VARIABLE SHLIBDEPS_ERROR - OUTPUT_STRIP_TRAILING_WHITESPACE ) - if(CPACK_DEBIAN_PACKAGE_DEBUG) - # dpkg-shlibdeps will throw some warnings if some input files are not binary - message( "CPackDeb Debug: dpkg-shlibdeps warnings \n${SHLIBDEPS_ERROR}") - endif() - if(NOT SHLIBDEPS_RESULT EQUAL 0) - message (FATAL_ERROR "CPackDeb: dpkg-shlibdeps: '${SHLIBDEPS_ERROR}';\n" - "executed command: '${SHLIBDEPS_EXECUTABLE} ${IGNORE_MISSING_INFO_FLAG} -O ${CPACK_DEB_BINARY_FILES}';\n" - "found files: '${INSTALL_FILE_}';\n" - "files info: '${CPACK_DEB_INSTALL_FILES}';\n" - "binary files: '${CPACK_DEB_BINARY_FILES}'") - endif() - - #Get rid of prefix generated by dpkg-shlibdeps - string(REGEX REPLACE "^.*Depends=" "" CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS "${SHLIBDEPS_OUTPUT}") - - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: Found dependency: ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS} from output ${SHLIBDEPS_OUTPUT}") - endif() - - # Remove blank control file - # Might not be safe if package actual contain file or directory named debian - file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/debian") - - # remove temporary directory that was created only for dpkg-shlibdeps execution - file(REMOVE_RECURSE "${CPACK_TEMPORARY_DIRECTORY}/DEBIAN") - else() - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message(AUTHOR_WARNING "CPackDeb Debug: Using only user-provided depends because package does not contain executable files that link to shared libraries.") - endif() - endif() - else() - message("CPackDeb: Using only user-provided dependencies because dpkg-shlibdeps is not found.") - endif() - - else() - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: Using only user-provided dependencies") - endif() - endif() - - # Let's define the control file found in debian package: - - # Binary package: - # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-binarycontrolfiles - - # DEBIAN/control - # debian policy enforce lower case for package name - # Package: (mandatory) - if(NOT CPACK_DEBIAN_PACKAGE_NAME) - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_DEBIAN_PACKAGE_NAME) - endif() - - # Version: (mandatory) - if(NOT CPACK_DEBIAN_PACKAGE_VERSION) - if(NOT CPACK_PACKAGE_VERSION) - message(FATAL_ERROR "CPackDeb: Debian package requires a package version") - endif() - set(CPACK_DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) - endif() - - if(DEFINED CPACK_DEBIAN_PACKAGE_RELEASE OR DEFINED CPACK_DEBIAN_PACKAGE_EPOCH) - # only test the version format if CPACK_DEBIAN_PACKAGE_RELEASE or - # CPACK_DEBIAN_PACKAGE_EPOCH is set - if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^[0-9][A-Za-z0-9.+~-]*$") - message(FATAL_ERROR - "CPackDeb: Debian package version must confirm to \"^[0-9][A-Za-z0-9.+~-]*$\" regex!") - endif() - else() - # before CMake 3.10 version format was not tested so only warn to preserve - # backward compatibility - if(NOT CPACK_DEBIAN_PACKAGE_VERSION MATCHES "^([0-9]+:)?[0-9][A-Za-z0-9.+~-]*$") - message(AUTHOR_WARNING - "CPackDeb: Debian package versioning ([<epoch>:]<version>[-<release>])" - " should confirm to \"^([0-9]+:)?[0-9][A-Za-z0-9.+~-]*$\" regex in" - " order to satisfy Debian packaging rules.") - endif() - endif() - - if(CPACK_DEBIAN_PACKAGE_RELEASE) - if(NOT CPACK_DEBIAN_PACKAGE_RELEASE MATCHES "^[A-Za-z0-9.+~]+$") - message(FATAL_ERROR - "CPackDeb: Debian package release must confirm to \"^[A-Za-z0-9.+~]+$\" regex!") - endif() - string(APPEND CPACK_DEBIAN_PACKAGE_VERSION - "-${CPACK_DEBIAN_PACKAGE_RELEASE}") - elseif(DEFINED CPACK_DEBIAN_PACKAGE_EPOCH) - # only test the version format if CPACK_DEBIAN_PACKAGE_RELEASE or - # CPACK_DEBIAN_PACKAGE_EPOCH is set - versions CPack/Deb generator before - # CMake 3.10 did not check for version format so we have to preserve - # backward compatibility - if(CPACK_DEBIAN_PACKAGE_VERSION MATCHES ".*-.*") - message(FATAL_ERROR - "CPackDeb: Debian package version must not contain hyphens when CPACK_DEBIAN_PACKAGE_RELEASE is not provided!") - endif() - endif() - - if(CPACK_DEBIAN_PACKAGE_EPOCH) - if(NOT CPACK_DEBIAN_PACKAGE_EPOCH MATCHES "^[0-9]+$") - message(FATAL_ERROR - "CPackDeb: Debian package epoch must confirm to \"^[0-9]+$\" regex!") - endif() - set(CPACK_DEBIAN_PACKAGE_VERSION - "${CPACK_DEBIAN_PACKAGE_EPOCH}:${CPACK_DEBIAN_PACKAGE_VERSION}") - endif() - - # Architecture: (mandatory) - if(CPACK_DEB_PACKAGE_COMPONENT AND CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE) - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_${_local_component_name}_PACKAGE_ARCHITECTURE}") - elseif(NOT CPACK_DEBIAN_PACKAGE_ARCHITECTURE) - # There is no such thing as i686 architecture on debian, you should use i386 instead - # $ dpkg --print-architecture - find_program(DPKG_CMD dpkg) - if(NOT DPKG_CMD) - message(STATUS "CPackDeb: Can not find dpkg in your path, default to i386.") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386) - endif() - execute_process(COMMAND "${DPKG_CMD}" --print-architecture - OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - endif() - - # Source: (optional) - # in case several packages are constructed from a unique source - # (multipackaging), the source may be indicated as well. - # The source might contain a version if the generated package - # version is different from the source version - if(NOT CPACK_DEBIAN_PACKAGE_SOURCE) - set(CPACK_DEBIAN_PACKAGE_SOURCE "") - endif() - - # have a look at get_property(result GLOBAL PROPERTY ENABLED_FEATURES), - # this returns the successful find_package() calls, maybe this can help - # Depends: - # You should set: DEBIAN_PACKAGE_DEPENDS - # TODO: automate 'objdump -p | grep NEEDED' - - # if per-component variable, overrides the global CPACK_DEBIAN_PACKAGE_${variable_type_} - # automatic dependency discovery will be performed afterwards. - if(CPACK_DEB_PACKAGE_COMPONENT) - foreach(value_type_ DEPENDS RECOMMENDS SUGGESTS PREDEPENDS ENHANCES BREAKS CONFLICTS PROVIDES REPLACES SOURCE SECTION PRIORITY NAME VERSION) - set(_component_var "CPACK_DEBIAN_${_local_component_name}_PACKAGE_${value_type_}") - - # if set, overrides the global variable - if(DEFINED ${_component_var}) - set(CPACK_DEBIAN_PACKAGE_${value_type_} "${${_component_var}}") - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb Debug: component '${_local_component_name}' ${value_type_} " - "value set to '${CPACK_DEBIAN_PACKAGE_${value_type_}}'") - endif() - endif() - endforeach() - - if(CPACK_DEBIAN_ENABLE_COMPONENT_DEPENDS) - set(COMPONENT_DEPENDS "") - foreach (_PACK ${CPACK_COMPONENT_${_local_component_name}_DEPENDS}) - get_component_package_name(_PACK_NAME "${_PACK}") - if(COMPONENT_DEPENDS) - set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION}), ${COMPONENT_DEPENDS}") - else() - set(COMPONENT_DEPENDS "${_PACK_NAME} (= ${CPACK_DEBIAN_PACKAGE_VERSION})") - endif() - endforeach() - if(COMPONENT_DEPENDS) - if(CPACK_DEBIAN_PACKAGE_DEPENDS) - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_DEPENDS}") - else() - set(CPACK_DEBIAN_PACKAGE_DEPENDS "${COMPONENT_DEPENDS}") - endif() - endif() - endif() - endif() - - # at this point, the CPACK_DEBIAN_PACKAGE_DEPENDS is properly set - # to the minimal dependency of the package - # Append automatically discovered dependencies . - if(NOT "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}" STREQUAL "") - if (CPACK_DEBIAN_PACKAGE_DEPENDS) - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}, ${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - else () - set (CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_AUTO_DEPENDS}") - endif () - endif() - - if(NOT CPACK_DEBIAN_PACKAGE_DEPENDS) - message(STATUS "CPACK_DEBIAN_PACKAGE_DEPENDS not set, the package will have no dependencies.") - endif() - - # Maintainer: (mandatory) - if(NOT CPACK_DEBIAN_PACKAGE_MAINTAINER) - if(NOT CPACK_PACKAGE_CONTACT) - message(FATAL_ERROR "CPackDeb: Debian package requires a maintainer for a package, set CPACK_PACKAGE_CONTACT or CPACK_DEBIAN_PACKAGE_MAINTAINER") - endif() - set(CPACK_DEBIAN_PACKAGE_MAINTAINER ${CPACK_PACKAGE_CONTACT}) - endif() - - # Description: (mandatory) - if(NOT CPACK_DEB_PACKAGE_COMPONENT) - if(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION") - endif() - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) - endif() - else() - set(component_description_var CPACK_COMPONENT_${_local_component_name}_DESCRIPTION) - - # component description overrides package description - if(${component_description_var}) - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${${component_description_var}}) - elseif(NOT CPACK_DEBIAN_PACKAGE_DESCRIPTION) - if(NOT CPACK_PACKAGE_DESCRIPTION_SUMMARY) - message(FATAL_ERROR "CPackDeb: Debian package requires a summary for a package, set CPACK_PACKAGE_DESCRIPTION_SUMMARY or CPACK_DEBIAN_PACKAGE_DESCRIPTION or ${component_description_var}") - endif() - set(CPACK_DEBIAN_PACKAGE_DESCRIPTION ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) - endif() - endif() - - # Section: (recommended) - if(NOT CPACK_DEBIAN_PACKAGE_SECTION) - set(CPACK_DEBIAN_PACKAGE_SECTION "devel") - endif() - - # Priority: (recommended) - if(NOT CPACK_DEBIAN_PACKAGE_PRIORITY) - set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") - endif() - - if(CPACK_DEBIAN_ARCHIVE_TYPE) - set(archive_types_ "paxr;gnutar") - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - if(NOT CPACK_DEBIAN_ARCHIVE_TYPE IN_LIST archive_types_) - message(FATAL_ERROR "CPACK_DEBIAN_ARCHIVE_TYPE set to unsupported" - "type ${CPACK_DEBIAN_ARCHIVE_TYPE}") - endif() - cmake_policy(POP) - else() - set(CPACK_DEBIAN_ARCHIVE_TYPE "paxr") - endif() - - # Compression: (recommended) - if(NOT CPACK_DEBIAN_COMPRESSION_TYPE) - set(CPACK_DEBIAN_COMPRESSION_TYPE "gzip") - endif() - - # Recommends: - # You should set: CPACK_DEBIAN_PACKAGE_RECOMMENDS - - # Suggests: - # You should set: CPACK_DEBIAN_PACKAGE_SUGGESTS - - # CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - # This variable allow advanced user to add custom script to the control.tar.gz (inside the .deb archive) - # Typical examples are: - # - conffiles - # - postinst - # - postrm - # - prerm - # Usage: - # set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA - # "${CMAKE_CURRENT_SOURCE_DIR/prerm;${CMAKE_CURRENT_SOURCE_DIR}/postrm") - - # Are we packaging components ? - if(CPACK_DEB_PACKAGE_COMPONENT) - # override values with per component version if set - foreach(VAR_NAME_ "PACKAGE_CONTROL_EXTRA" "PACKAGE_CONTROL_STRICT_PERMISSION") - if(CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}) - set(CPACK_DEBIAN_${VAR_NAME_} "${CPACK_DEBIAN_${_local_component_name}_${VAR_NAME_}}") - endif() - endforeach() - get_component_package_name(CPACK_DEBIAN_PACKAGE_NAME ${_local_component_name}) - endif() - - set(CPACK_DEBIAN_PACKAGE_SHLIBS_LIST "") - - if (NOT CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY) - set(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY "=") - endif() - - find_program(READELF_EXECUTABLE NAMES readelf) - - if(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS) - if(READELF_EXECUTABLE) - foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES) - extract_so_info("${_FILE}" libname soversion) - if(libname AND soversion) - list(APPEND CPACK_DEBIAN_PACKAGE_SHLIBS_LIST - "${libname} ${soversion} ${CPACK_DEBIAN_PACKAGE_NAME} (${CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS_POLICY} ${CPACK_DEBIAN_PACKAGE_VERSION})") - else() - message(AUTHOR_WARNING "Shared library '${_FILE}' is missing soname or soversion. Library will not be added to DEBIAN/shlibs control file.") - endif() - endforeach() - if (CPACK_DEBIAN_PACKAGE_SHLIBS_LIST) - string(REPLACE ";" "\n" CPACK_DEBIAN_PACKAGE_SHLIBS_LIST "${CPACK_DEBIAN_PACKAGE_SHLIBS_LIST}") - endif() - else() - message(FATAL_ERROR "Readelf utility is not available. CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS option is not available.") - endif() - endif() - - # add ldconfig call in default postrm and postint - set(CPACK_ADD_LDCONFIG_CALL 0) - foreach(_FILE ${CPACK_DEB_SHARED_OBJECT_FILES}) - get_filename_component(_DIR ${_FILE} DIRECTORY) - # all files in CPACK_DEB_SHARED_OBJECT_FILES have dot at the beginning - if(_DIR STREQUAL "./lib" OR _DIR STREQUAL "./usr/lib") - set(CPACK_ADD_LDCONFIG_CALL 1) - endif() - endforeach() - - if(CPACK_ADD_LDCONFIG_CALL) - set(CPACK_DEBIAN_GENERATE_POSTINST 1) - set(CPACK_DEBIAN_GENERATE_POSTRM 1) - foreach(f ${PACKAGE_CONTROL_EXTRA}) - get_filename_component(n "${f}" NAME) - if("${n}" STREQUAL "postinst") - set(CPACK_DEBIAN_GENERATE_POSTINST 0) - endif() - if("${n}" STREQUAL "postrm") - set(CPACK_DEBIAN_GENERATE_POSTRM 0) - endif() - endforeach() - else() - set(CPACK_DEBIAN_GENERATE_POSTINST 0) - set(CPACK_DEBIAN_GENERATE_POSTRM 0) - endif() - - cpack_deb_variable_fallback("CPACK_DEBIAN_FILE_NAME" - "CPACK_DEBIAN_${_local_component_name}_FILE_NAME" - "CPACK_DEBIAN_FILE_NAME") - if(CPACK_DEBIAN_FILE_NAME) - if(CPACK_DEBIAN_FILE_NAME STREQUAL "DEB-DEFAULT") - # Patch package file name to be in corrent debian format: - # <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb - set(CPACK_OUTPUT_FILE_NAME - "${CPACK_DEBIAN_PACKAGE_NAME}_${CPACK_DEBIAN_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}.deb") - else() - cmake_policy(PUSH) - cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_DEBIAN_FILE_NAME MATCHES ".*\\.(deb|ipk)") - cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_DEBIAN_FILE_NAME}' is not a valid DEB package file name as it must end with '.deb' or '.ipk'!") - endif() - cmake_policy(POP) - - set(CPACK_OUTPUT_FILE_NAME "${CPACK_DEBIAN_FILE_NAME}") - endif() - - set(CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_OUTPUT_FILE_NAME}") - get_filename_component(BINARY_DIR "${CPACK_OUTPUT_FILE_PATH}" DIRECTORY) - set(CPACK_OUTPUT_FILE_PATH "${BINARY_DIR}/${CPACK_OUTPUT_FILE_NAME}") - endif() # else() back compatibility - don't change the name - - # Print out some debug information if we were asked for that - if(CPACK_DEBIAN_PACKAGE_DEBUG) - message("CPackDeb:Debug: CPACK_TOPLEVEL_DIRECTORY = '${CPACK_TOPLEVEL_DIRECTORY}'") - message("CPackDeb:Debug: CPACK_TOPLEVEL_TAG = '${CPACK_TOPLEVEL_TAG}'") - message("CPackDeb:Debug: CPACK_TEMPORARY_DIRECTORY = '${CPACK_TEMPORARY_DIRECTORY}'") - message("CPackDeb:Debug: CPACK_OUTPUT_FILE_NAME = '${CPACK_OUTPUT_FILE_NAME}'") - message("CPackDeb:Debug: CPACK_OUTPUT_FILE_PATH = '${CPACK_OUTPUT_FILE_PATH}'") - message("CPackDeb:Debug: CPACK_PACKAGE_FILE_NAME = '${CPACK_PACKAGE_FILE_NAME}'") - message("CPackDeb:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = '${CPACK_PACKAGE_INSTALL_DIRECTORY}'") - message("CPackDeb:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = '${CPACK_TEMPORARY_PACKAGE_FILE_NAME}'") - message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION = '${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}'") - message("CPackDeb:Debug: CPACK_DEBIAN_PACKAGE_SOURCE = '${CPACK_DEBIAN_PACKAGE_SOURCE}'") - endif() - - # For debian source packages: - # debian/control - # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles - - # .dsc - # http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-debiansourcecontrolfiles - - # Builds-Depends: - #if(NOT CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS) - # set(CPACK_DEBIAN_PACKAGE_BUILDS_DEPENDS - # "debhelper (>> 5.0.0), libncurses5-dev, tcl8.4" - # ) - #endif() - - # move variables to parent scope so that they may be used to create debian package - set(GEN_CPACK_OUTPUT_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}" PARENT_SCOPE) - set(GEN_CPACK_TEMPORARY_PACKAGE_FILE_NAME "${CPACK_TEMPORARY_PACKAGE_FILE_NAME}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_NAME "${CPACK_DEBIAN_PACKAGE_NAME}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_DEBIAN_PACKAGE_VERSION}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_SECTION "${CPACK_DEBIAN_PACKAGE_SECTION}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_PRIORITY "${CPACK_DEBIAN_PACKAGE_PRIORITY}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_DEBIAN_PACKAGE_MAINTAINER}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_DEBIAN_PACKAGE_DESCRIPTION}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_DEPENDS "${CPACK_DEBIAN_PACKAGE_DEPENDS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_ARCHIVE_TYPE "${CPACK_DEBIAN_ARCHIVE_TYPE}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_COMPRESSION_TYPE "${CPACK_DEBIAN_COMPRESSION_TYPE}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_RECOMMENDS "${CPACK_DEBIAN_PACKAGE_RECOMMENDS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_SUGGESTS "${CPACK_DEBIAN_PACKAGE_SUGGESTS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_HOMEPAGE "${CPACK_DEBIAN_PACKAGE_HOMEPAGE}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_PREDEPENDS "${CPACK_DEBIAN_PACKAGE_PREDEPENDS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_ENHANCES "${CPACK_DEBIAN_PACKAGE_ENHANCES}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_BREAKS "${CPACK_DEBIAN_PACKAGE_BREAKS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_CONFLICTS "${CPACK_DEBIAN_PACKAGE_CONFLICTS}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_PROVIDES "${CPACK_DEBIAN_PACKAGE_PROVIDES}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_REPLACES "${CPACK_DEBIAN_PACKAGE_REPLACES}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_SHLIBS "${CPACK_DEBIAN_PACKAGE_SHLIBS_LIST}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION - "${CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_PACKAGE_SOURCE - "${CPACK_DEBIAN_PACKAGE_SOURCE}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_GENERATE_POSTINST "${CPACK_DEBIAN_GENERATE_POSTINST}" PARENT_SCOPE) - set(GEN_CPACK_DEBIAN_GENERATE_POSTRM "${CPACK_DEBIAN_GENERATE_POSTRM}" PARENT_SCOPE) - set(GEN_WDIR "${WDIR}" PARENT_SCOPE) -endfunction() - -cpack_deb_prepare_package_vars() diff --git a/cmake/CMakeBuild/cmake/modules/patched/CPackRPM.cmake b/cmake/CMakeBuild/cmake/modules/patched/CPackRPM.cmake deleted file mode 100644 index 000d278db9f1a0d25cd475c6feeca645955da688..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/patched/CPackRPM.cmake +++ /dev/null @@ -1,2786 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# CPackRPM -# -------- -# -# The built in (binary) CPack RPM generator (Unix only) -# -# Variables specific to CPack RPM generator -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackRPM may be used to create RPM packages using :module:`CPack`. -# CPackRPM is a :module:`CPack` generator thus it uses the ``CPACK_XXX`` -# variables used by :module:`CPack`. -# -# CPackRPM has specific features which are controlled by the specifics -# :code:`CPACK_RPM_XXX` variables. -# -# :code:`CPACK_RPM_<COMPONENT>_XXXX` variables may be used in order to have -# **component** specific values. Note however that ``<COMPONENT>`` refers to the -# **grouping name** written in upper case. It may be either a component name or -# a component GROUP name. Usually those variables correspond to RPM spec file -# entities. One may find information about spec files here -# http://www.rpm.org/wiki/Docs -# -# .. note:: -# -# `<COMPONENT>` part of variables is preferred to be in upper case (for e.g. if -# component is named `foo` then use `CPACK_RPM_FOO_XXXX` variable name format) -# as is with other `CPACK_<COMPONENT>_XXXX` variables. -# For the purposes of back compatibility (CMake/CPack version 3.5 and lower) -# support for same cased component (e.g. `fOo` would be used as -# `CPACK_RPM_fOo_XXXX`) is still supported for variables defined in older -# versions of CMake/CPack but is not guaranteed for variables that -# will be added in the future. For the sake of back compatibility same cased -# component variables also override upper cased versions where both are -# present. -# -# Here are some CPackRPM wiki resources that are here for historic reasons and -# are no longer maintained but may still prove useful: -# -# - https://cmake.org/Wiki/CMake:CPackConfiguration -# - https://cmake.org/Wiki/CMake:CPackPackageGenerators#RPM_.28Unix_Only.29 -# -# List of CPackRPM specific variables: -# -# .. variable:: CPACK_RPM_COMPONENT_INSTALL -# -# Enable component packaging for CPackRPM -# -# * Mandatory : NO -# * Default : OFF -# -# If enabled (ON) multiple packages are generated. By default a single package -# containing files of all components is generated. -# -# .. variable:: CPACK_RPM_PACKAGE_SUMMARY -# CPACK_RPM_<component>_PACKAGE_SUMMARY -# -# The RPM package summary. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_DESCRIPTION_SUMMARY` -# -# .. variable:: CPACK_RPM_PACKAGE_NAME -# CPACK_RPM_<component>_PACKAGE_NAME -# -# The RPM package name. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_NAME` -# -# .. variable:: CPACK_RPM_FILE_NAME -# CPACK_RPM_<component>_FILE_NAME -# -# Package file name. -# -# * Mandatory : YES -# * Default : ``<CPACK_PACKAGE_FILE_NAME>[-<component>].rpm`` with spaces -# replaced by '-' -# -# This may be set to ``RPM-DEFAULT`` to allow rpmbuild tool to generate package -# file name by itself. -# Alternatively provided package file name must end with ``.rpm`` suffix. -# -# .. note:: -# -# By using user provided spec file, rpm macro extensions such as for -# generating debuginfo packages or by simply using multiple components more -# than one rpm file may be generated, either from a single spec file or from -# multiple spec files (each component execution produces it's own spec file). -# In such cases duplicate file names may occur as a result of this variable -# setting or spec file content structure. Duplicate files get overwritten -# and it is up to the packager to set the variables in a manner that will -# prevent such errors. -# -# .. variable:: CPACK_RPM_MAIN_COMPONENT -# -# Main component that is packaged without component suffix. -# -# * Mandatory : NO -# * Default : - -# -# This variable can be set to any component or group name so that component or -# group rpm package is generated without component suffix in filename and -# package name. -# -# .. variable:: CPACK_RPM_PACKAGE_EPOCH -# -# The RPM package epoch -# -# * Mandatory : No -# * Default : - -# -# Optional number that should be incremented when changing versioning schemas -# or fixing mistakes in the version numbers of older packages. -# -# .. variable:: CPACK_RPM_PACKAGE_VERSION -# -# The RPM package version. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_PACKAGE_VERSION` -# -# .. variable:: CPACK_RPM_PACKAGE_ARCHITECTURE -# CPACK_RPM_<component>_PACKAGE_ARCHITECTURE -# -# The RPM package architecture. -# -# * Mandatory : YES -# * Default : Native architecture output by ``uname -m`` -# -# This may be set to ``noarch`` if you know you are building a noarch package. -# -# .. variable:: CPACK_RPM_PACKAGE_RELEASE -# -# The RPM package release. -# -# * Mandatory : YES -# * Default : 1 -# -# This is the numbering of the RPM package itself, i.e. the version of the -# packaging and not the version of the content (see -# :variable:`CPACK_RPM_PACKAGE_VERSION`). One may change the default value if -# the previous packaging was buggy and/or you want to put here a fancy Linux -# distro specific numbering. -# -# .. note:: -# -# This is the string that goes into the RPM ``Release:`` field. Some distros -# (e.g. Fedora, CentOS) require ``1%{?dist}`` format and not just a number. -# ``%{?dist}`` part can be added by setting :variable:`CPACK_RPM_PACKAGE_RELEASE_DIST`. -# -# .. variable:: CPACK_RPM_PACKAGE_RELEASE_DIST -# -# The dist tag that is added RPM ``Release:`` field. -# -# * Mandatory : NO -# * Default : OFF -# -# This is the reported ``%{dist}`` tag from the current distribution or empty -# ``%{dist}`` if RPM macro is not set. If this variable is set then RPM -# ``Release:`` field value is set to ``${CPACK_RPM_PACKAGE_RELEASE}%{?dist}``. -# -# .. variable:: CPACK_RPM_PACKAGE_LICENSE -# -# The RPM package license policy. -# -# * Mandatory : YES -# * Default : "unknown" -# -# .. variable:: CPACK_RPM_PACKAGE_GROUP -# CPACK_RPM_<component>_PACKAGE_GROUP -# -# The RPM package group. -# -# * Mandatory : YES -# * Default : "unknown" -# -# .. variable:: CPACK_RPM_PACKAGE_VENDOR -# -# The RPM package vendor. -# -# * Mandatory : YES -# * Default : CPACK_PACKAGE_VENDOR if set or "unknown" -# -# .. variable:: CPACK_RPM_PACKAGE_URL -# CPACK_RPM_<component>_PACKAGE_URL -# -# The projects URL. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_RPM_PACKAGE_DESCRIPTION -# CPACK_RPM_<component>_PACKAGE_DESCRIPTION -# -# RPM package description. -# -# * Mandatory : YES -# * Default : :variable:`CPACK_COMPONENT_<compName>_DESCRIPTION` (component -# based installers only) if set, :variable:`CPACK_PACKAGE_DESCRIPTION_FILE` -# if set or "no package description available" -# -# .. variable:: CPACK_RPM_COMPRESSION_TYPE -# -# RPM compression type. -# -# * Mandatory : NO -# * Default : - -# -# May be used to override RPM compression type to be used to build the -# RPM. For example some Linux distribution now default to lzma or xz -# compression whereas older cannot use such RPM. Using this one can enforce -# compression type to be used. -# -# Possible values are: -# -# - lzma -# - xz -# - bzip2 -# - gzip -# -# .. variable:: CPACK_RPM_PACKAGE_AUTOREQ -# CPACK_RPM_<component>_PACKAGE_AUTOREQ -# -# RPM spec autoreq field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to enable (1, yes) or disable (0, no) automatic shared libraries -# dependency detection. Dependencies are added to requires list. -# -# .. note:: -# -# By default automatic dependency detection is enabled by rpm generator. -# -# .. variable:: CPACK_RPM_PACKAGE_AUTOPROV -# CPACK_RPM_<component>_PACKAGE_AUTOPROV -# -# RPM spec autoprov field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to enable (1, yes) or disable (0, no) automatic listing of shared -# libraries that are provided by the package. Shared libraries are added to -# provides list. -# -# .. note:: -# -# By default automatic provides detection is enabled by rpm generator. -# -# .. variable:: CPACK_RPM_PACKAGE_AUTOREQPROV -# CPACK_RPM_<component>_PACKAGE_AUTOREQPROV -# -# RPM spec autoreqprov field. -# -# * Mandatory : NO -# * Default : - -# -# Variable enables/disables autoreq and autoprov at the same time. -# See :variable:`CPACK_RPM_PACKAGE_AUTOREQ` and :variable:`CPACK_RPM_PACKAGE_AUTOPROV` -# for more details. -# -# .. note:: -# -# By default automatic detection feature is enabled by rpm. -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES -# CPACK_RPM_<component>_PACKAGE_REQUIRES -# -# RPM spec requires field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM dependencies (requires). Note that you must enclose -# the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES "python >= 2.5.0, cmake >= 2.8") -# -# The required package list of an RPM file could be printed with:: -# -# rpm -qp --requires file.rpm -# -# .. variable:: CPACK_RPM_PACKAGE_CONFLICTS -# CPACK_RPM_<component>_PACKAGE_CONFLICTS -# -# RPM spec conflicts field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set negative RPM dependencies (conflicts). Note that you must -# enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_CONFLICTS "libxml2") -# -# The conflicting package list of an RPM file could be printed with:: -# -# rpm -qp --conflicts file.rpm -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PRE -# CPACK_RPM_<component>_PACKAGE_REQUIRES_PRE -# -# RPM spec requires(pre) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM preinstall dependencies (requires(pre)). Note that -# you must enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_PRE "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POST -# CPACK_RPM_<component>_PACKAGE_REQUIRES_POST -# -# RPM spec requires(post) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM postinstall dependencies (requires(post)). Note that -# you must enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_POST "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_POSTUN -# CPACK_RPM_<component>_PACKAGE_REQUIRES_POSTUN -# -# RPM spec requires(postun) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM postuninstall dependencies (requires(postun)). Note -# that you must enclose the complete requires string between quotes, for -# example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_POSTUN "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_REQUIRES_PREUN -# CPACK_RPM_<component>_PACKAGE_REQUIRES_PREUN -# -# RPM spec requires(preun) field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM preuninstall dependencies (requires(preun)). Note that -# you must enclose the complete requires string between quotes, for example:: -# -# set(CPACK_RPM_PACKAGE_REQUIRES_PREUN "shadow-utils, initscripts") -# -# .. variable:: CPACK_RPM_PACKAGE_SUGGESTS -# CPACK_RPM_<component>_PACKAGE_SUGGESTS -# -# RPM spec suggest field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set weak RPM dependencies (suggests). Note that you must -# enclose the complete requires string between quotes. -# -# .. variable:: CPACK_RPM_PACKAGE_PROVIDES -# CPACK_RPM_<component>_PACKAGE_PROVIDES -# -# RPM spec provides field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM dependencies (provides). The provided package list -# of an RPM file could be printed with:: -# -# rpm -qp --provides file.rpm -# -# .. variable:: CPACK_RPM_PACKAGE_OBSOLETES -# CPACK_RPM_<component>_PACKAGE_OBSOLETES -# -# RPM spec obsoletes field. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set RPM packages that are obsoleted by this one. -# -# .. variable:: CPACK_RPM_PACKAGE_RELOCATABLE -# -# build a relocatable RPM. -# -# * Mandatory : NO -# * Default : CPACK_PACKAGE_RELOCATABLE -# -# If this variable is set to TRUE or ON CPackRPM will try -# to build a relocatable RPM package. A relocatable RPM may -# be installed using:: -# -# rpm --prefix or --relocate -# -# in order to install it at an alternate place see rpm(8). Note that -# currently this may fail if :variable:`CPACK_SET_DESTDIR` is set to ``ON``. If -# :variable:`CPACK_SET_DESTDIR` is set then you will get a warning message but -# if there is file installed with absolute path you'll get unexpected behavior. -# -# .. variable:: CPACK_RPM_SPEC_INSTALL_POST -# -# Deprecated - use :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE` instead. -# -# * Mandatory : NO -# * Default : - -# * Deprecated: YES -# -# This way of specifying post-install script is deprecated, use -# :variable:`CPACK_RPM_POST_INSTALL_SCRIPT_FILE`. -# May be used to set an RPM post-install command inside the spec file. -# For example setting it to ``/bin/true`` may be used to prevent -# rpmbuild to strip binaries. -# -# .. variable:: CPACK_RPM_SPEC_MORE_DEFINE -# -# RPM extended spec definitions lines. -# -# * Mandatory : NO -# * Default : - -# -# May be used to add any ``%define`` lines to the generated spec file. -# -# .. variable:: CPACK_RPM_PACKAGE_DEBUG -# -# Toggle CPackRPM debug output. -# -# * Mandatory : NO -# * Default : - -# -# May be set when invoking cpack in order to trace debug information -# during CPack RPM run. For example you may launch CPack like this:: -# -# cpack -D CPACK_RPM_PACKAGE_DEBUG=1 -G RPM -# -# .. variable:: CPACK_RPM_USER_BINARY_SPECFILE -# CPACK_RPM_<componentName>_USER_BINARY_SPECFILE -# -# A user provided spec file. -# -# * Mandatory : NO -# * Default : - -# -# May be set by the user in order to specify a USER binary spec file -# to be used by CPackRPM instead of generating the file. -# The specified file will be processed by configure_file( @ONLY). -# -# .. variable:: CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE -# -# Spec file template. -# -# * Mandatory : NO -# * Default : - -# -# If set CPack will generate a template for USER specified binary -# spec file and stop with an error. For example launch CPack like this:: -# -# cpack -D CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE=1 -G RPM -# -# The user may then use this file in order to hand-craft is own -# binary spec file which may be used with -# :variable:`CPACK_RPM_USER_BINARY_SPECFILE`. -# -# .. variable:: CPACK_RPM_PRE_INSTALL_SCRIPT_FILE -# CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE -# -# Path to file containing pre (un)install script. -# -# * Mandatory : NO -# * Default : - -# -# May be used to embed a pre (un)installation script in the spec file. -# The referred script file (or both) will be read and directly -# put after the ``%pre`` or ``%preun`` section -# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install -# script for each component can be overridden with -# ``CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE`` and -# ``CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE``. -# One may verify which scriptlet has been included with:: -# -# rpm -qp --scripts package.rpm -# -# .. variable:: CPACK_RPM_POST_INSTALL_SCRIPT_FILE -# CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE -# -# Path to file containing post (un)install script. -# -# * Mandatory : NO -# * Default : - -# -# May be used to embed a post (un)installation script in the spec file. -# The referred script file (or both) will be read and directly -# put after the ``%post`` or ``%postun`` section. -# If :variable:`CPACK_RPM_COMPONENT_INSTALL` is set to ON the (un)install -# script for each component can be overridden with -# ``CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE`` and -# ``CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE``. -# One may verify which scriptlet has been included with:: -# -# rpm -qp --scripts package.rpm -# -# .. variable:: CPACK_RPM_USER_FILELIST -# CPACK_RPM_<COMPONENT>_USER_FILELIST -# -# * Mandatory : NO -# * Default : - -# -# May be used to explicitly specify ``%(<directive>)`` file line -# in the spec file. Like ``%config(noreplace)`` or any other directive -# that be found in the ``%files`` section. You can have multiple directives -# per line, as in ``%attr(600,root,root) %config(noreplace)``. Since -# CPackRPM is generating the list of files (and directories) the user -# specified files of the ``CPACK_RPM_<COMPONENT>_USER_FILELIST`` list will -# be removed from the generated list. If referring to directories do -# not add a trailing slash. -# -# .. variable:: CPACK_RPM_CHANGELOG_FILE -# -# RPM changelog file. -# -# * Mandatory : NO -# * Default : - -# -# May be used to embed a changelog in the spec file. -# The referred file will be read and directly put after the ``%changelog`` -# section. -# -# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST -# -# list of path to be excluded. -# -# * Mandatory : NO -# * Default : /etc /etc/init.d /usr /usr/bin /usr/include /usr/lib -# /usr/libx32 /usr/lib64 /usr/share /usr/share/aclocal -# /usr/share/doc -# -# May be used to exclude path (directories or files) from the auto-generated -# list of paths discovered by CPack RPM. The defaut value contains a -# reasonable set of values if the variable is not defined by the user. If the -# variable is defined by the user then CPackRPM will NOT any of the default -# path. If you want to add some path to the default list then you can use -# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION` variable. -# -# .. variable:: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION -# -# additional list of path to be excluded. -# -# * Mandatory : NO -# * Default : - -# -# May be used to add more exclude path (directories or files) from the initial -# default list of excluded paths. See -# :variable:`CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST`. -# -# .. variable:: CPACK_RPM_RELOCATION_PATHS -# -# Packages relocation paths list. -# -# * Mandatory : NO -# * Default : - -# -# May be used to specify more than one relocation path per relocatable RPM. -# Variable contains a list of relocation paths that if relative are prefixed -# by the value of :variable:`CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX` or by the -# value of :variable:`CPACK_PACKAGING_INSTALL_PREFIX` if the component version -# is not provided. -# Variable is not component based as its content can be used to set a different -# path prefix for e.g. binary dir and documentation dir at the same time. -# Only prefixes that are required by a certain component are added to that -# component - component must contain at least one file/directory/symbolic link -# with :variable:`CPACK_RPM_RELOCATION_PATHS` prefix for a certain relocation -# path to be added. Package will not contain any relocation paths if there are -# no files/directories/symbolic links on any of the provided prefix locations. -# Packages that either do not contain any relocation paths or contain -# files/directories/symbolic links that are outside relocation paths print -# out an ``AUTHOR_WARNING`` that RPM will be partially relocatable. -# -# .. variable:: CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX -# -# Per component relocation path install prefix. -# -# * Mandatory : NO -# * Default : CPACK_PACKAGING_INSTALL_PREFIX -# -# May be used to set per component :variable:`CPACK_PACKAGING_INSTALL_PREFIX` -# for relocatable RPM packages. -# -# .. variable:: CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION -# CPACK_RPM_NO_<COMPONENT>_INSTALL_PREFIX_RELOCATION -# -# Removal of default install prefix from relocation paths list. -# -# * Mandatory : NO -# * Default : CPACK_PACKAGING_INSTALL_PREFIX or CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX -# are treated as one of relocation paths -# -# May be used to remove CPACK_PACKAGING_INSTALL_PREFIX and CPACK_RPM_<COMPONENT>_PACKAGE_PREFIX -# from relocatable RPM prefix paths. -# -# .. variable:: CPACK_RPM_ADDITIONAL_MAN_DIRS -# -# * Mandatory : NO -# * Default : - -# -# May be used to set additional man dirs that could potentially be compressed -# by brp-compress RPM macro. Variable content must be a list of regular -# expressions that point to directories containing man files or to man files -# directly. Note that in order to compress man pages a path must also be -# present in brp-compress RPM script and that brp-compress script must be -# added to RPM configuration by the operating system. -# -# Regular expressions that are added by default were taken from brp-compress -# RPM macro: -# -# - /usr/man/man.* -# - /usr/man/.*/man.* -# - /usr/info.* -# - /usr/share/man/man.* -# - /usr/share/man/.*/man.* -# - /usr/share/info.* -# - /usr/kerberos/man.* -# - /usr/X11R6/man/man.* -# - /usr/lib/perl5/man/man.* -# - /usr/share/doc/.*/man/man.* -# - /usr/lib/.*/man/man.* -# -# .. variable:: CPACK_RPM_DEFAULT_USER -# CPACK_RPM_<compName>_DEFAULT_USER -# -# default user ownership of RPM content -# -# * Mandatory : NO -# * Default : root -# -# Value should be user name and not UID. -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_DEFAULT_GROUP -# CPACK_RPM_<compName>_DEFAULT_GROUP -# -# default group ownership of RPM content -# -# * Mandatory : NO -# * Default : root -# -# Value should be group name and not GID. -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_DEFAULT_FILE_PERMISSIONS -# CPACK_RPM_<compName>_DEFAULT_FILE_PERMISSIONS -# -# default permissions used for packaged files -# -# * Mandatory : NO -# * Default : - (system default) -# -# Accepted values are lists with ``PERMISSIONS``. Valid permissions -# are: -# -# - OWNER_READ -# - OWNER_WRITE -# - OWNER_EXECUTE -# - GROUP_READ -# - GROUP_WRITE -# - GROUP_EXECUTE -# - WORLD_READ -# - WORLD_WRITE -# - WORLD_EXECUTE -# -# Note that <compName> must be in upper-case. -# -# .. variable:: CPACK_RPM_DEFAULT_DIR_PERMISSIONS -# CPACK_RPM_<compName>_DEFAULT_DIR_PERMISSIONS -# -# default permissions used for packaged directories -# -# * Mandatory : NO -# * Default : - (system default) -# -# Accepted values are lists with PERMISSIONS. Valid permissions -# are the same as for :variable:`CPACK_RPM_DEFAULT_FILE_PERMISSIONS`. -# Note that <compName> must be in upper-case. -# -# Packaging of Symbolic Links -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# CPackRPM supports packaging of symbolic links:: -# -# execute_process(COMMAND ${CMAKE_COMMAND} -# -E create_symlink <relative_path_location> <symlink_name>) -# install(FILES ${CMAKE_CURRENT_BINARY_DIR}/<symlink_name> -# DESTINATION <symlink_location> COMPONENT libraries) -# -# Symbolic links will be optimized (paths will be shortened if possible) -# before being added to the package or if multiple relocation paths are -# detected, a post install symlink relocation script will be generated. -# -# Symbolic links may point to locations that are not packaged by the same -# package (either a different component or even not packaged at all) but -# those locations will be treated as if they were a part of the package -# while determining if symlink should be either created or present in a -# post install script - depending on relocation paths. -# -# Symbolic links that point to locations outside packaging path produce a -# warning and are treated as non relocatable permanent symbolic links. -# -# Currently there are a few limitations though: -# -# * For component based packaging component interdependency is not checked -# when processing symbolic links. Symbolic links pointing to content of -# a different component are treated the same way as if pointing to location -# that will not be packaged. -# -# * Symbolic links pointing to a location through one or more intermediate -# symbolic links will not be handled differently - if the intermediate -# symbolic link(s) is also on a relocatable path, relocating it during -# package installation may cause initial symbolic link to point to an -# invalid location. -# -# Packaging of debug information -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# Debuginfo packages contain debug symbols and sources for debugging packaged -# binaries. -# -# Debuginfo RPM packaging has it's own set of variables: -# -# .. variable:: CPACK_RPM_DEBUGINFO_PACKAGE -# CPACK_RPM_<component>_DEBUGINFO_PACKAGE -# -# Enable generation of debuginfo RPM package(s). -# -# * Mandatory : NO -# * Default : OFF -# -# .. note:: -# -# Binaries must contain debug symbols before packaging so use either ``Debug`` -# or ``RelWithDebInfo`` for :variable:`CMAKE_BUILD_TYPE` variable value. -# -# .. note:: -# -# Packages generated from packages without binary files, with binary files but -# without execute permissions or without debug symbols will be empty. -# -# .. variable:: CPACK_BUILD_SOURCE_DIRS -# -# Provides locations of root directories of source files from which binaries -# were built. -# -# * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set -# * Default : - -# -# .. note:: -# -# For CMake project :variable:`CPACK_BUILD_SOURCE_DIRS` is set by default to -# point to :variable:`CMAKE_SOURCE_DIR` and :variable:`CMAKE_BINARY_DIR` paths. -# -# .. note:: -# -# Sources with path prefixes that do not fall under any location provided with -# :variable:`CPACK_BUILD_SOURCE_DIRS` will not be present in debuginfo package. -# -# .. variable:: CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX -# CPACK_RPM_<component>_BUILD_SOURCE_DIRS_PREFIX -# -# Prefix of location where sources will be placed during package installation. -# -# * Mandatory : YES if :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is set -# * Default : "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>" and -# for component packaging "/usr/src/debug/<CPACK_PACKAGE_FILE_NAME>-<component>" -# -# .. note:: -# -# Each source path prefix is additionaly suffixed by ``src_<index>`` where -# index is index of the path used from :variable:`CPACK_BUILD_SOURCE_DIRS` -# variable. This produces ``<CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX>/src_<index>`` -# replacement path. -# Limitation is that replaced path part must be shorter or of equal -# length than the length of its replacement. If that is not the case either -# :variable:`CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX` variable has to be set to -# a shorter path or source directories must be placed on a longer path. -# -# .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS -# -# Directories containing sources that should be excluded from debuginfo packages. -# -# * Mandatory : NO -# * Default : "/usr /usr/src /usr/src/debug" -# -# Listed paths are owned by other RPM packages and should therefore not be -# deleted on debuginfo package uninstallation. -# -# .. variable:: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION -# -# Paths that should be appended to :variable:`CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS` -# for exclusion. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE -# -# Create a single debuginfo package even if components packaging is set. -# -# * Mandatory : NO -# * Default : OFF -# -# When this variable is enabled it produces a single debuginfo package even if -# component packaging is enabled. -# -# When using this feature in combination with components packaging and there is -# more than one component this variable requires :variable:`CPACK_RPM_MAIN_COMPONENT` -# to be set. -# -# .. note:: -# -# If none of the :variable:`CPACK_RPM_<component>_DEBUGINFO_PACKAGE` variables -# is set then :variable:`CPACK_RPM_DEBUGINFO_PACKAGE` is automatically set to -# ``ON`` when :variable:`CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE` is set. -# -# .. variable:: CPACK_RPM_DEBUGINFO_FILE_NAME -# CPACK_RPM_<component>_DEBUGINFO_FILE_NAME -# -# Debuginfo package file name. -# -# * Mandatory : NO -# * Default : rpmbuild tool generated package file name -# -# Alternatively provided debuginfo package file name must end with ``.rpm`` -# suffix and should differ from file names of other generated packages. -# -# Variable may contain ``@cpack_component@`` placeholder which will be -# replaced by component name if component packaging is enabled otherwise it -# deletes the placeholder. -# -# Setting the variable to ``RPM-DEFAULT`` may be used to explicitly set -# filename generation to default. -# -# .. note:: -# -# :variable:`CPACK_RPM_FILE_NAME` also supports rpmbuild tool generated package -# file name - disabled by default but can be enabled by setting the variable to -# ``RPM-DEFAULT``. -# -# Packaging of sources (SRPM) -# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# -# SRPM packaging is enabled by setting :variable:`CPACK_RPM_PACKAGE_SOURCES` -# variable while usually using :variable:`CPACK_INSTALLED_DIRECTORIES` variable -# to provide directory containing CMakeLists.txt and source files. -# -# For CMake projects SRPM package would be product by executing: -# -# ``cpack -G RPM --config ./CPackSourceConfig.cmake`` -# -# .. note:: -# -# Produced SRPM package is expected to be built with :manual:`cmake(1)` executable -# and packaged with :manual:`cpack(1)` executable so CMakeLists.txt has to be -# located in root source directory and must be able to generate binary rpm -# packages by executing ``cpack -G`` command. The two executables as well as -# rpmbuild must also be present when generating binary rpm packages from the -# produced SRPM package. -# -# Once the SRPM package is generated it can be used to generate binary packages -# by creating a directory structure for rpm generation and executing rpmbuild -# tool: -# -# ``mkdir -p build_dir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}`` -# ``rpmbuild --define "_topdir <path_to_build_dir>" --rebuild <SRPM_file_name>`` -# -# Generated packages will be located in build_dir/RPMS directory or its sub -# directories. -# -# .. note:: -# -# SRPM package internally uses CPack/RPM generator to generate binary packages -# so CMakeScripts.txt can decide during the SRPM to binary rpm generation step -# what content the package(s) should have as well as how they should be packaged -# (monolithic or components). CMake can decide this for e.g. by reading environment -# variables set by the package manager before starting the process of generating -# binary rpm packages. This way a single SRPM package can be used to produce -# different binary rpm packages on different platforms depending on the platform's -# packaging rules. -# -# Source RPM packaging has it's own set of variables: -# -# .. variable:: CPACK_RPM_PACKAGE_SOURCES -# -# Should the content be packaged as a source rpm (default is binary rpm). -# -# * Mandatory : NO -# * Default : OFF -# -# .. note:: -# -# For cmake projects :variable:`CPACK_RPM_PACKAGE_SOURCES` variable is set -# to ``OFF`` in CPackConfig.cmake and ``ON`` in CPackSourceConfig.cmake -# generated files. -# -# .. variable:: CPACK_RPM_SOURCE_PKG_BUILD_PARAMS -# -# Additional command-line parameters provided to :manual:`cmake(1)` executable. -# -# * Mandatory : NO -# * Default : - -# -# .. variable:: CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX -# -# Packaging install prefix that would be provided in :variable:`CPACK_PACKAGING_INSTALL_PREFIX` -# variable for producing binary RPM packages. -# -# * Mandatory : YES -# * Default : "/" -# -# .. VARIABLE:: CPACK_RPM_BUILDREQUIRES -# -# List of source rpm build dependencies. -# -# * Mandatory : NO -# * Default : - -# -# May be used to set source RPM build dependencies (BuildRequires). Note that -# you must enclose the complete build requirements string between quotes, for -# example:: -# -# set(CPACK_RPM_BUILDREQUIRES "python >= 2.5.0, cmake >= 2.8") - -# Author: Eric Noulard with the help of Alexander Neundorf. - -function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR) - set(PERMISSIONS ${${PERMISSIONS_VAR}}) - list(LENGTH PERMISSIONS PERM_LEN_PRE) - list(REMOVE_DUPLICATES PERMISSIONS) - list(LENGTH PERMISSIONS PERM_LEN_POST) - - if(NOT ${PERM_LEN_PRE} EQUAL ${PERM_LEN_POST}) - message(FATAL_ERROR "${PERMISSIONS_VAR} contains duplicate values.") - endif() - - foreach(PERMISSION_TYPE "OWNER" "GROUP" "WORLD") - set(${PERMISSION_TYPE}_PERMISSIONS 0) - - foreach(PERMISSION ${PERMISSIONS}) - if("${PERMISSION}" STREQUAL "${PERMISSION_TYPE}_READ") - math(EXPR ${PERMISSION_TYPE}_PERMISSIONS "${${PERMISSION_TYPE}_PERMISSIONS} + 4") - elseif("${PERMISSION}" STREQUAL "${PERMISSION_TYPE}_WRITE") - math(EXPR ${PERMISSION_TYPE}_PERMISSIONS "${${PERMISSION_TYPE}_PERMISSIONS} + 2") - elseif("${PERMISSION}" STREQUAL "${PERMISSION_TYPE}_EXECUTE") - math(EXPR ${PERMISSION_TYPE}_PERMISSIONS "${${PERMISSION_TYPE}_PERMISSIONS} + 1") - elseif(PERMISSION MATCHES "${PERMISSION_TYPE}.*") - message(FATAL_ERROR "${PERMISSIONS_VAR} contains invalid values.") - endif() - endforeach() - endforeach() - - set(${RETURN_VAR} "${OWNER_PERMISSIONS}${GROUP_PERMISSIONS}${WORLD_PERMISSIONS}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_prepare_relocation_paths) - # set appropriate prefix, remove possible trailing slash and convert backslashes to slashes - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX) - file(TO_CMAKE_PATH "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX}" PATH_PREFIX) - elseif(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_PREFIX) - file(TO_CMAKE_PATH "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_PREFIX}" PATH_PREFIX) - else() - file(TO_CMAKE_PATH "${CPACK_PACKAGING_INSTALL_PREFIX}" PATH_PREFIX) - endif() - - set(RPM_RELOCATION_PATHS "${CPACK_RPM_RELOCATION_PATHS}") - list(REMOVE_DUPLICATES RPM_RELOCATION_PATHS) - - # set base path prefix - if(EXISTS "${WDIR}/${PATH_PREFIX}") - if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND - NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION AND - NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_INSTALL_PREFIX_RELOCATION) - string(APPEND TMP_RPM_PREFIXES "Prefix: ${PATH_PREFIX}\n") - list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: removing '${PATH_PREFIX}' from relocation paths") - endif() - endif() - endif() - - # set other path prefixes - foreach(RELOCATION_PATH ${RPM_RELOCATION_PATHS}) - if(IS_ABSOLUTE "${RELOCATION_PATH}") - set(PREPARED_RELOCATION_PATH "${RELOCATION_PATH}") - elseif(PATH_PREFIX STREQUAL "/") - # don't prefix path with a second slash as "//" is treated as network path - # by get_filename_component() so it remains in path even inside rpm - # package where it may cause problems with relocation - set(PREPARED_RELOCATION_PATH "/${RELOCATION_PATH}") - else() - set(PREPARED_RELOCATION_PATH "${PATH_PREFIX}/${RELOCATION_PATH}") - endif() - - # handle cases where path contains extra slashes (e.g. /a//b/ instead of - # /a/b) - get_filename_component(PREPARED_RELOCATION_PATH - "${PREPARED_RELOCATION_PATH}" ABSOLUTE) - - if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}") - string(APPEND TMP_RPM_PREFIXES "Prefix: ${PREPARED_RELOCATION_PATH}\n") - list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}") - endif() - endforeach() - - # warn about all the paths that are not relocatable - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE FILE_PATHS_ "${WDIR}/*") - cmake_policy(POP) - foreach(TMP_PATH ${FILE_PATHS_}) - string(LENGTH "${WDIR}" WDIR_LEN) - string(SUBSTRING "${TMP_PATH}" ${WDIR_LEN} -1 TMP_PATH) - unset(TMP_PATH_FOUND_) - - foreach(RELOCATION_PATH ${RPM_USED_PACKAGE_PREFIXES}) - file(RELATIVE_PATH REL_PATH_ "${RELOCATION_PATH}" "${TMP_PATH}") - string(SUBSTRING "${REL_PATH_}" 0 2 PREFIX_) - - if(NOT "${PREFIX_}" STREQUAL "..") - set(TPM_PATH_FOUND_ TRUE) - break() - endif() - endforeach() - - if(NOT TPM_PATH_FOUND_) - message(AUTHOR_WARNING "CPackRPM:Warning: Path ${TMP_PATH} is not on one of the relocatable paths! Package will be partially relocatable.") - endif() - endforeach() - - set(RPM_USED_PACKAGE_PREFIXES "${RPM_USED_PACKAGE_PREFIXES}" PARENT_SCOPE) - set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_prepare_content_list) - # get files list - cmake_policy(PUSH) - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE CPACK_RPM_INSTALL_FILES LIST_DIRECTORIES true RELATIVE "${WDIR}" "${WDIR}/*") - cmake_policy(POP) - set(CPACK_RPM_INSTALL_FILES "/${CPACK_RPM_INSTALL_FILES}") - string(REPLACE ";" ";/" CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}") - - # if we are creating a relocatable package, omit parent directories of - # CPACK_RPM_PACKAGE_PREFIX. This is achieved by building a "filter list" - # which is passed to the find command that generates the content-list - if(CPACK_RPM_PACKAGE_RELOCATABLE) - # get a list of the elements in CPACK_RPM_PACKAGE_PREFIXES that are - # destinct parent paths of other relocation paths and remove the - # final element (so the install-prefix dir itself is not omitted - # from the RPM's content-list) - list(SORT RPM_USED_PACKAGE_PREFIXES) - set(_DISTINCT_PATH "NOT_SET") - foreach(_RPM_RELOCATION_PREFIX ${RPM_USED_PACKAGE_PREFIXES}) - if(NOT "${_RPM_RELOCATION_PREFIX}" MATCHES "${_DISTINCT_PATH}/.*") - set(_DISTINCT_PATH "${_RPM_RELOCATION_PREFIX}") - - string(REPLACE "/" ";" _CPACK_RPM_PACKAGE_PREFIX_ELEMS " ${_RPM_RELOCATION_PREFIX}") - cmake_policy(PUSH) - cmake_policy(SET CMP0007 NEW) - list(REMOVE_AT _CPACK_RPM_PACKAGE_PREFIX_ELEMS -1) - cmake_policy(POP) - unset(_TMP_LIST) - # Now generate all of the parent dirs of the relocation path - foreach(_PREFIX_PATH_ELEM ${_CPACK_RPM_PACKAGE_PREFIX_ELEMS}) - list(APPEND _TMP_LIST "${_PREFIX_PATH_ELEM}") - string(REPLACE ";" "/" _OMIT_DIR "${_TMP_LIST}") - separate_arguments(_OMIT_DIR) - list(APPEND _RPM_DIRS_TO_OMIT ${_OMIT_DIR}) - endforeach() - endif() - endforeach() - endif() - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Initial list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") - endif() - - if(NOT DEFINED CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - set(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST /etc /etc/init.d /usr /usr/bin - /usr/include /usr/lib /usr/libx32 /usr/lib64 - /usr/share /usr/share/aclocal /usr/share/doc ) - if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Adding ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION} to builtin omit list.") - endif() - list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST "${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION}") - endif() - endif() - - if(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST= ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}") - endif() - list(APPEND _RPM_DIRS_TO_OMIT ${CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST}) - endif() - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Final list of path to OMIT in RPM: ${_RPM_DIRS_TO_OMIT}") - endif() - - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES ${_RPM_DIRS_TO_OMIT}) - - # add man paths that will be compressed - # (copied from /usr/lib/rpm/brp-compress - script that does the actual - # compressing) - list(APPEND MAN_LOCATIONS "/usr/man/man.*" "/usr/man/.*/man.*" "/usr/info.*" - "/usr/share/man/man.*" "/usr/share/man/.*/man.*" "/usr/share/info.*" - "/usr/kerberos/man.*" "/usr/X11R6/man/man.*" "/usr/lib/perl5/man/man.*" - "/usr/share/doc/.*/man/man.*" "/usr/lib/.*/man/man.*") - - if(CPACK_RPM_ADDITIONAL_MAN_DIRS) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_ADDITIONAL_MAN_DIRS= ${CPACK_RPM_ADDITIONAL_MAN_DIRS}") - endif() - list(APPEND MAN_LOCATIONS ${CPACK_RPM_ADDITIONAL_MAN_DIRS}) - endif() - - foreach(PACK_LOCATION IN LISTS CPACK_RPM_INSTALL_FILES) - foreach(MAN_LOCATION IN LISTS MAN_LOCATIONS) - # man pages are files inside a certain location - if(PACK_LOCATION MATCHES "${MAN_LOCATION}/" - AND NOT IS_DIRECTORY "${WDIR}${PACK_LOCATION}" - AND NOT IS_SYMLINK "${WDIR}${PACK_LOCATION}") - list(FIND CPACK_RPM_INSTALL_FILES "${PACK_LOCATION}" INDEX) - # insert file location that covers compressed man pages - # even if using a wildcard causes duplicates as those are - # handled by RPM and we still keep the same file list - # in spec file - wildcard only represents file type (e.g. .gz) - list(INSERT CPACK_RPM_INSTALL_FILES ${INDEX} "${PACK_LOCATION}*") - # remove file location that doesn't cover compressed man pages - math(EXPR INDEX ${INDEX}+1) - list(REMOVE_AT CPACK_RPM_INSTALL_FILES ${INDEX}) - - break() - endif() - endforeach() - endforeach() - - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_symlink_get_relocation_prefixes LOCATION PACKAGE_PREFIXES RETURN_VARIABLE) - foreach(PKG_PREFIX IN LISTS PACKAGE_PREFIXES) - string(REGEX MATCH "^${PKG_PREFIX}/.*" FOUND_ "${LOCATION}") - if(FOUND_) - list(APPEND TMP_PREFIXES "${PKG_PREFIX}") - endif() - endforeach() - - set(${RETURN_VARIABLE} "${TMP_PREFIXES}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) - list(LENGTH PACKAGE_PREFIXES LAST_INDEX) - set(SORTED_PACKAGE_PREFIXES "${PACKAGE_PREFIXES}") - list(SORT SORTED_PACKAGE_PREFIXES) - list(REVERSE SORTED_PACKAGE_PREFIXES) - math(EXPR LAST_INDEX ${LAST_INDEX}-1) - - foreach(SYMLINK_INDEX RANGE ${LAST_INDEX}) - list(GET SORTED_PACKAGE_PREFIXES ${SYMLINK_INDEX} SRC_PATH) - list(FIND PACKAGE_PREFIXES "${SRC_PATH}" SYMLINK_INDEX) # reverse magic - string(LENGTH "${SRC_PATH}" SRC_PATH_LEN) - - set(PARTS_CNT 0) - set(SCRIPT_PART "if [ \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}\" != \"${SRC_PATH}\" ]; then\n") - - # both paths relocated - foreach(POINT_INDEX RANGE ${LAST_INDEX}) - list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) - list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic - string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) - - if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) - if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") - set(INDENT "") - else() - string(APPEND SCRIPT_PART " if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") - set(INDENT " ") - endif() - - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}) - math(EXPR PARTS_CNT ${PARTS_CNT}+1) - - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - string(APPEND SCRIPT_PART " ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - string(APPEND SCRIPT_PART " ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") - string(APPEND SCRIPT_PART " ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - string(APPEND SCRIPT_PART " ${INDENT}fi\n") - endforeach() - - if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") - string(APPEND SCRIPT_PART " fi\n") - endif() - endif() - endforeach() - - # source path relocated - if(_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X) - math(EXPR PARTS_CNT ${PARTS_CNT}+1) - - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - math(EXPR SRC_PATH_END ${SPLIT_INDEX}-${SRC_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${SRC_PATH_LEN} ${SRC_PATH_END} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - string(APPEND SCRIPT_PART " if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - string(APPEND SCRIPT_PART " ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") - string(APPEND SCRIPT_PART " CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - string(APPEND SCRIPT_PART " fi\n") - endforeach() - endif() - - if(PARTS_CNT) - set(SCRIPT "${SCRIPT_PART}") - string(APPEND SCRIPT "fi\n") - endif() - endforeach() - - # point path relocated - foreach(POINT_INDEX RANGE ${LAST_INDEX}) - list(GET SORTED_PACKAGE_PREFIXES ${POINT_INDEX} POINT_PATH) - list(FIND PACKAGE_PREFIXES "${POINT_PATH}" POINT_INDEX) # reverse magic - string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) - - if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) - string(APPEND SCRIPT "if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") - - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - string(APPEND SCRIPT " if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - string(APPEND SCRIPT " ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") - string(APPEND SCRIPT " CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - string(APPEND SCRIPT " fi\n") - endforeach() - - string(APPEND SCRIPT "fi\n") - endif() - endforeach() - - # no path relocated - if(_RPM_RELOCATION_SCRIPT_X_X) - foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_X) - math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) - list(GET _RPM_RELOCATION_SCRIPT_PAIRS ${RELOCATION_INDEX} RELOCATION_SCRIPT_PAIR) - string(FIND "${RELOCATION_SCRIPT_PAIR}" ":" SPLIT_INDEX) - - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} 0 ${SPLIT_INDEX} SYMLINK_) - - math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) - string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - - string(APPEND SCRIPT "if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - string(APPEND SCRIPT " ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") - string(APPEND SCRIPT "fi\n") - endforeach() - endif() - - set(RPM_SYMLINK_POSTINSTALL "${SCRIPT}" PARENT_SCOPE) -endfunction() - -function(cpack_rpm_symlink_add_for_relocation_script PACKAGE_PREFIXES SYMLINK SYMLINK_RELOCATION_PATHS POINT POINT_RELOCATION_PATHS) - list(LENGTH SYMLINK_RELOCATION_PATHS SYMLINK_PATHS_COUTN) - list(LENGTH POINT_RELOCATION_PATHS POINT_PATHS_COUNT) - - list(APPEND _RPM_RELOCATION_SCRIPT_PAIRS "${SYMLINK}:${POINT}") - list(LENGTH _RPM_RELOCATION_SCRIPT_PAIRS PAIR_NO) - - if(SYMLINK_PATHS_COUTN) - foreach(SYMLINK_RELOC_PATH IN LISTS SYMLINK_RELOCATION_PATHS) - list(FIND PACKAGE_PREFIXES "${SYMLINK_RELOC_PATH}" SYMLINK_INDEX) - - # source path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_X") - - foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) - list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) - - # both paths relocated - list(APPEND _RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX} "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_${SYMLINK_INDEX}_${POINT_INDEX}") - - # point path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") - endforeach() - endforeach() - elseif(POINT_PATHS_COUNT) - foreach(POINT_RELOC_PATH IN LISTS POINT_RELOCATION_PATHS) - list(FIND PACKAGE_PREFIXES "${POINT_RELOC_PATH}" POINT_INDEX) - - # point path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX} "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}") - endforeach() - endif() - - # no path relocated - list(APPEND _RPM_RELOCATION_SCRIPT_X_X "${PAIR_NO}") - list(APPEND RELOCATION_VARS "_RPM_RELOCATION_SCRIPT_X_X") - - # place variables into parent scope - foreach(VAR IN LISTS RELOCATION_VARS) - set(${VAR} "${${VAR}}" PARENT_SCOPE) - endforeach() - set(_RPM_RELOCATION_SCRIPT_PAIRS "${_RPM_RELOCATION_SCRIPT_PAIRS}" PARENT_SCOPE) - set(REQUIRES_SYMLINK_RELOCATION_SCRIPT "true" PARENT_SCOPE) - set(DIRECTIVE "%ghost " PARENT_SCOPE) -endfunction() - -function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXES IS_RELOCATABLE) - # Prepend directories in ${CPACK_RPM_INSTALL_FILES} with %dir - # This is necessary to avoid duplicate files since rpmbuild does - # recursion on its own when encountering a pathname which is a directory - # which is not flagged as %dir - string(STRIP "${INSTALL_FILES_LIST}" INSTALL_FILES_LIST) - string(REPLACE "\n" ";" INSTALL_FILES_LIST - "${INSTALL_FILES_LIST}") - string(REPLACE "\"" "" INSTALL_FILES_LIST - "${INSTALL_FILES_LIST}") - string(LENGTH "${WDIR}" WDR_LEN_) - - list(SORT INSTALL_FILES_LIST) # make file order consistent on all platforms - - foreach(F IN LISTS INSTALL_FILES_LIST) - unset(DIRECTIVE) - - if(IS_SYMLINK "${WDIR}/${F}") - if(IS_RELOCATABLE) - # check that symlink has relocatable format - get_filename_component(SYMLINK_LOCATION_ "${WDIR}/${F}" DIRECTORY) - execute_process(COMMAND ls -la "${WDIR}/${F}" - WORKING_DIRECTORY "${WDIR}" - OUTPUT_VARIABLE SYMLINK_POINT_ - OUTPUT_STRIP_TRAILING_WHITESPACE) - - string(FIND "${SYMLINK_POINT_}" "->" SYMLINK_POINT_INDEX_ REVERSE) - math(EXPR SYMLINK_POINT_INDEX_ ${SYMLINK_POINT_INDEX_}+3) - string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) - - # get destination path - string(SUBSTRING "${SYMLINK_POINT_}" ${SYMLINK_POINT_INDEX_} ${SYMLINK_POINT_LENGTH_} SYMLINK_POINT_) - - # check if path is relative or absolute - string(SUBSTRING "${SYMLINK_POINT_}" 0 1 SYMLINK_IS_ABSOLUTE_) - - if(${SYMLINK_IS_ABSOLUTE_} STREQUAL "/") - # prevent absolute paths from having /../ or /./ section inside of them - get_filename_component(SYMLINK_POINT_ "${SYMLINK_POINT_}" ABSOLUTE) - else() - # handle relative path - get_filename_component(SYMLINK_POINT_ "${SYMLINK_LOCATION_}/${SYMLINK_POINT_}" ABSOLUTE) - endif() - - # recalculate path length after conversion to canonical form - string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_) - - if(SYMLINK_POINT_ MATCHES "${WDIR}/.*") - # only symlinks that are pointing inside the packaging structure should be checked for relocation - string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_) - cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS") - cpack_rpm_symlink_get_relocation_prefixes("${SYMLINK_POINT_WD_}" "${PACKAGE_PREFIXES}" "POINT_RELOCATIONS") - - list(LENGTH SYMLINK_RELOCATIONS SYMLINK_RELOCATIONS_COUNT) - list(LENGTH POINT_RELOCATIONS POINT_RELOCATIONS_COUNT) - else() - # location pointed to is ouside WDR so it should be treated as a permanent symlink - set(SYMLINK_POINT_WD_ "${SYMLINK_POINT_}") - - unset(SYMLINK_RELOCATIONS) - unset(POINT_RELOCATIONS) - unset(SYMLINK_RELOCATIONS_COUNT) - unset(POINT_RELOCATIONS_COUNT) - - message(AUTHOR_WARNING "CPackRPM:Warning: Symbolic link '${F}' points to location that is outside packaging path! Link will possibly not be relocatable.") - endif() - - if(SYMLINK_RELOCATIONS_COUNT AND POINT_RELOCATIONS_COUNT) - # find matching - foreach(SYMLINK_RELOCATION_PREFIX IN LISTS SYMLINK_RELOCATIONS) - list(FIND POINT_RELOCATIONS "${SYMLINK_RELOCATION_PREFIX}" FOUND_INDEX) - if(NOT ${FOUND_INDEX} EQUAL -1) - break() - endif() - endforeach() - - if(NOT ${FOUND_INDEX} EQUAL -1) - # symlinks have the same subpath - if(${SYMLINK_RELOCATIONS_COUNT} EQUAL 1 AND ${POINT_RELOCATIONS_COUNT} EQUAL 1) - # permanent symlink - get_filename_component(SYMLINK_LOCATION_ "${F}" DIRECTORY) - file(RELATIVE_PATH FINAL_PATH_ ${SYMLINK_LOCATION_} ${SYMLINK_POINT_WD_}) - execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${FINAL_PATH_}" "${WDIR}/${F}") - else() - # relocation subpaths - cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" - "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") - endif() - else() - # not on the same relocation path - cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" - "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") - endif() - elseif(POINT_RELOCATIONS_COUNT) - # point is relocatable - cpack_rpm_symlink_add_for_relocation_script("${PACKAGE_PREFIXES}" "${F}" "${SYMLINK_RELOCATIONS}" - "${SYMLINK_POINT_WD_}" "${POINT_RELOCATIONS}") - else() - # is not relocatable or points to non relocatable path - permanent symlink - execute_process(COMMAND "${CMAKE_COMMAND}" -E create_symlink "${SYMLINK_POINT_WD_}" "${WDIR}/${F}") - endif() - endif() - elseif(IS_DIRECTORY "${WDIR}/${F}") - set(DIRECTIVE "%dir ") - endif() - - string(APPEND INSTALL_FILES "${DIRECTIVE}\"${F}\"\n") - endforeach() - - if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) - cpack_rpm_symlink_create_relocation_script("${PACKAGE_PREFIXES}") - endif() - - set(RPM_SYMLINK_POSTINSTALL "${RPM_SYMLINK_POSTINSTALL}" PARENT_SCOPE) - set(CPACK_RPM_INSTALL_FILES "${INSTALL_FILES}" PARENT_SCOPE) -endfunction() - -if(CMAKE_BINARY_DIR) - message(FATAL_ERROR "CPackRPM.cmake may only be used by CPack internally.") -endif() - -if(NOT UNIX) - message(FATAL_ERROR "CPackRPM.cmake may only be used under UNIX.") -endif() - -# We need to check if the binaries were compiled with debug symbols -# because without them the package will be useless -function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) - if(NOT CPACK_BUILD_SOURCE_DIRS) - message(FATAL_ERROR "CPackRPM: CPACK_BUILD_SOURCE_DIRS variable is not set!" - " Required for debuginfo packaging. See documentation of" - " CPACK_RPM_DEBUGINFO_PACKAGE variable for details.") - endif() - - # With objdump we should check the debug symbols - find_program(OBJDUMP_EXECUTABLE objdump) - if(NOT OBJDUMP_EXECUTABLE) - message(FATAL_ERROR "CPackRPM: objdump binary could not be found!" - " Required for debuginfo packaging. See documentation of" - " CPACK_RPM_DEBUGINFO_PACKAGE variable for details.") - endif() - - # With debugedit we prepare source files list - find_program(DEBUGEDIT_EXECUTABLE debugedit "/usr/lib/rpm/") - if(NOT DEBUGEDIT_EXECUTABLE) - message(FATAL_ERROR "CPackRPM: debugedit binary could not be found!" - " Required for debuginfo packaging. See documentation of" - " CPACK_RPM_DEBUGINFO_PACKAGE variable for details.") - endif() - - unset(mkdir_list_) - unset(cp_list_) - unset(additional_sources_) - - foreach(F IN LISTS INSTALL_FILES) - if(IS_DIRECTORY "${WORKING_DIR}/${F}" OR IS_SYMLINK "${WORKING_DIR}/${F}") - continue() - endif() - - execute_process(COMMAND "${OBJDUMP_EXECUTABLE}" -h ${WORKING_DIR}/${F} - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}" - RESULT_VARIABLE OBJDUMP_EXEC_RESULT - OUTPUT_VARIABLE OBJDUMP_OUT - ERROR_QUIET) - # Check that if the given file was executable or not - if(NOT OBJDUMP_EXEC_RESULT) - string(FIND "${OBJDUMP_OUT}" "debug" FIND_RESULT) - if(FIND_RESULT GREATER -1) - set(index_ 0) - foreach(source_dir_ IN LISTS CPACK_BUILD_SOURCE_DIRS) - string(LENGTH "${source_dir_}" source_dir_len_) - string(LENGTH "${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}/src_${index_}" debuginfo_dir_len) - if(source_dir_len_ LESS debuginfo_dir_len) - message(FATAL_ERROR "CPackRPM: source dir path '${source_dir_}' is" - " shorter than debuginfo sources dir path '${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}/src_${index_}'!" - " Source dir path must be longer than debuginfo sources dir path." - " Set CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX variable to a shorter value" - " or make source dir path longer." - " Required for debuginfo packaging. See documentation of" - " CPACK_RPM_DEBUGINFO_PACKAGE variable for details.") - endif() - - file(REMOVE "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}/debugsources_add.list") - execute_process(COMMAND "${DEBUGEDIT_EXECUTABLE}" -b "${source_dir_}" -d "${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}/src_${index_}" -i -l "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}/debugsources_add.list" "${WORKING_DIR}/${F}" - RESULT_VARIABLE res_ - OUTPUT_VARIABLE opt_ - ERROR_VARIABLE err_ - ) - - file(STRINGS - "${CPACK_RPM_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}/debugsources_add.list" - sources_) - list(REMOVE_DUPLICATES sources_) - - foreach(source_ IN LISTS sources_) - if(EXISTS "${source_dir_}/${source_}" AND NOT IS_DIRECTORY "${source_dir_}/${source_}") - get_filename_component(path_part_ "${source_}" DIRECTORY) - list(APPEND mkdir_list_ "%{buildroot}${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}/src_${index_}/${path_part_}") - list(APPEND cp_list_ "cp \"${source_dir_}/${source_}\" \"%{buildroot}${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}/src_${index_}/${path_part_}\"") - - list(APPEND additional_sources_ "${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}/src_${index_}/${source_}") - endif() - endforeach() - - math(EXPR index_ "${index_} + 1") - endforeach() - else() - message(WARNING "CPackRPM: File: ${F} does not contain debug symbols. They will possibly be missing from debuginfo package!") - endif() - endif() - endforeach() - - list(LENGTH mkdir_list_ len_) - if(len_) - list(REMOVE_DUPLICATES mkdir_list_) - unset(TMP_RPM_DEBUGINFO_INSTALL) - foreach(part_ IN LISTS mkdir_list_) - string(APPEND TMP_RPM_DEBUGINFO_INSTALL "mkdir -p \"${part_}\"\n") - endforeach() - endif() - - list(LENGTH cp_list_ len_) - if(len_) - list(REMOVE_DUPLICATES cp_list_) - foreach(part_ IN LISTS cp_list_) - string(APPEND TMP_RPM_DEBUGINFO_INSTALL "${part_}\n") - endforeach() - endif() - - if(NOT DEFINED CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS) - set(CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS /usr /usr/src /usr/src/debug) - if(CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Adding ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION} to builtin omit list.") - endif() - list(APPEND CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS "${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS_ADDITION}") - endif() - endif() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS= ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS}") - endif() - - list(LENGTH additional_sources_ len_) - if(len_) - list(REMOVE_DUPLICATES additional_sources_) - unset(additional_sources_all_) - foreach(source_ IN LISTS additional_sources_) - string(REPLACE "/" ";" split_source_ " ${source_}") - list(REMOVE_AT split_source_ 0) - unset(tmp_path_) - # Now generate all segments of the path - foreach(segment_ IN LISTS split_source_) - string(APPEND tmp_path_ "/${segment_}") - list(APPEND additional_sources_all_ "${tmp_path_}") - endforeach() - endforeach() - - list(REMOVE_DUPLICATES additional_sources_all_) - list(REMOVE_ITEM additional_sources_all_ - ${CPACK_RPM_DEBUGINFO_EXCLUDE_DIRS}) - - unset(TMP_DEBUGINFO_ADDITIONAL_SOURCES) - foreach(source_ IN LISTS additional_sources_all_) - string(APPEND TMP_DEBUGINFO_ADDITIONAL_SOURCES "${source_}\n") - endforeach() - endif() - - set(TMP_RPM_DEBUGINFO_INSTALL "${TMP_RPM_DEBUGINFO_INSTALL}" PARENT_SCOPE) - set(TMP_DEBUGINFO_ADDITIONAL_SOURCES "${TMP_DEBUGINFO_ADDITIONAL_SOURCES}" - PARENT_SCOPE) -endfunction() - -function(cpack_rpm_variable_fallback OUTPUT_VAR_NAME) - set(FALLBACK_VAR_NAMES ${ARGN}) - - foreach(variable_name IN LISTS FALLBACK_VAR_NAMES) - if(${variable_name}) - set(${OUTPUT_VAR_NAME} "${${variable_name}}" PARENT_SCOPE) - break() - endif() - endforeach() -endfunction() - -function(cpack_rpm_generate_package) - # rpmbuild is the basic command for building RPM package - # it may be a simple (symbolic) link to rpm command. - find_program(RPMBUILD_EXECUTABLE rpmbuild) - - # Check version of the rpmbuild tool this would be easier to - # track bugs with users and CPackRPM debug mode. - # We may use RPM version in order to check for available version dependent features - if(RPMBUILD_EXECUTABLE) - execute_process(COMMAND ${RPMBUILD_EXECUTABLE} --version - OUTPUT_VARIABLE _TMP_VERSION - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "^.* " "" - RPMBUILD_EXECUTABLE_VERSION - ${_TMP_VERSION}) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: rpmbuild version is <${RPMBUILD_EXECUTABLE_VERSION}>") - endif() - endif() - - if(NOT RPMBUILD_EXECUTABLE) - message(FATAL_ERROR "RPM package requires rpmbuild executable") - endif() - - # Display lsb_release output if DEBUG mode enable - # This will help to diagnose problem with CPackRPM - # because we will know on which kind of Linux we are - if(CPACK_RPM_PACKAGE_DEBUG) - find_program(LSB_RELEASE_EXECUTABLE lsb_release) - if(LSB_RELEASE_EXECUTABLE) - execute_process(COMMAND ${LSB_RELEASE_EXECUTABLE} -a - OUTPUT_VARIABLE _TMP_LSB_RELEASE_OUTPUT - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REGEX REPLACE "\n" ", " - LSB_RELEASE_OUTPUT - ${_TMP_LSB_RELEASE_OUTPUT}) - else () - set(LSB_RELEASE_OUTPUT "lsb_release not installed/found!") - endif() - message("CPackRPM:Debug: LSB_RELEASE = ${LSB_RELEASE_OUTPUT}") - endif() - - # We may use RPM version in the future in order - # to shut down warning about space in buildtree - # some recent RPM version should support space in different places. - # not checked [yet]. - if(CPACK_TOPLEVEL_DIRECTORY MATCHES ".* .*") - message(FATAL_ERROR "${RPMBUILD_EXECUTABLE} can't handle paths with spaces, use a build directory without spaces for building RPMs.") - endif() - - # If rpmbuild is found - # we try to discover alien since we may be on non RPM distro like Debian. - # In this case we may try to to use more advanced features - # like generating RPM directly from DEB using alien. - # FIXME feature not finished (yet) - find_program(ALIEN_EXECUTABLE alien) - if(ALIEN_EXECUTABLE) - message(STATUS "alien found, we may be on a Debian based distro.") - endif() - - # Are we packaging components ? - if(CPACK_RPM_PACKAGE_COMPONENT) - string(TOUPPER ${CPACK_RPM_PACKAGE_COMPONENT} CPACK_RPM_PACKAGE_COMPONENT_UPPER) - endif() - - set(WDIR "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") - - # - # Use user-defined RPM specific variables value - # or generate reasonable default value from - # CPACK_xxx generic values. - # The variables comes from the needed (mandatory or not) - # values found in the RPM specification file aka ".spec" file. - # The variables which may/should be defined are: - # - - # CPACK_RPM_PACKAGE_SUMMARY (mandatory) - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_SUMMARY" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_SUMMARY" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_SUMMARY") - endif() - - if(NOT CPACK_RPM_PACKAGE_SUMMARY) - if(CPACK_PACKAGE_DESCRIPTION_SUMMARY) - set(CPACK_RPM_PACKAGE_SUMMARY ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}) - else() - # if neither var is defined lets use the name as summary - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_SUMMARY) - endif() - endif() - - # CPACK_RPM_PACKAGE_NAME (mandatory) - if(NOT CPACK_RPM_PACKAGE_NAME) - string(TOLOWER "${CPACK_PACKAGE_NAME}" CPACK_RPM_PACKAGE_NAME) - endif() - - if(CPACK_RPM_PACKAGE_COMPONENT) - string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}" - CPACK_RPM_MAIN_COMPONENT_UPPER) - - if(NOT CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER) - string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") - - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME") - endif() - endif() - - # CPACK_RPM_PACKAGE_VERSION (mandatory) - if(NOT CPACK_RPM_PACKAGE_VERSION) - if(NOT CPACK_PACKAGE_VERSION) - message(FATAL_ERROR "RPM package requires a package version") - endif() - set(CPACK_RPM_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION}) - endif() - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_VERSION" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_VERSION" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_VERSION") - endif() - - # Replace '-' in version with '_' - # '-' character is an Illegal RPM version character - # it is illegal because it is used to separate - # RPM "Version" from RPM "Release" - string(REPLACE "-" "_" CPACK_RPM_PACKAGE_VERSION ${CPACK_RPM_PACKAGE_VERSION}) - - # CPACK_RPM_PACKAGE_ARCHITECTURE (mandatory) - if(NOT CPACK_RPM_PACKAGE_ARCHITECTURE) - execute_process(COMMAND uname "-m" - OUTPUT_VARIABLE CPACK_RPM_PACKAGE_ARCHITECTURE - OUTPUT_STRIP_TRAILING_WHITESPACE) - else() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using user-specified build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") - endif() - endif() - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_ARCHITECTURE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_ARCHITECTURE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_ARCHITECTURE") - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using component build arch = ${CPACK_RPM_PACKAGE_ARCHITECTURE}") - endif() - endif() - - if(${CPACK_RPM_PACKAGE_ARCHITECTURE} STREQUAL "noarch") - set(TMP_RPM_BUILDARCH "Buildarch: ${CPACK_RPM_PACKAGE_ARCHITECTURE}") - else() - set(TMP_RPM_BUILDARCH "") - endif() - - # CPACK_RPM_PACKAGE_RELEASE - # The RPM release is the numbering of the RPM package ITSELF - # this is the version of the PACKAGING and NOT the version - # of the CONTENT of the package. - # You may well need to generate a new RPM package release - # without changing the version of the packaged software. - # This is the case when the packaging is buggy (not) the software :=) - # If not set, 1 is a good candidate - if(NOT CPACK_RPM_PACKAGE_RELEASE) - set(CPACK_RPM_PACKAGE_RELEASE "1") - endif() - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_RELEASE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RELEASE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_RELEASE") - endif() - - if(CPACK_RPM_PACKAGE_RELEASE_DIST) - string(APPEND CPACK_RPM_PACKAGE_RELEASE "%{?dist}") - endif() - - # CPACK_RPM_PACKAGE_LICENSE - if(NOT CPACK_RPM_PACKAGE_LICENSE) - set(CPACK_RPM_PACKAGE_LICENSE "unknown") - endif() - - # CPACK_RPM_PACKAGE_GROUP - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_GROUP" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_GROUP" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_GROUP") - endif() - - if(NOT CPACK_RPM_PACKAGE_GROUP) - set(CPACK_RPM_PACKAGE_GROUP "unknown") - endif() - - # CPACK_RPM_PACKAGE_VENDOR - if(NOT CPACK_RPM_PACKAGE_VENDOR) - if(CPACK_PACKAGE_VENDOR) - set(CPACK_RPM_PACKAGE_VENDOR "${CPACK_PACKAGE_VENDOR}") - else() - set(CPACK_RPM_PACKAGE_VENDOR "unknown") - endif() - endif() - - # CPACK_RPM_PACKAGE_SOURCE - # The name of the source tarball in case we generate a source RPM - - # CPACK_RPM_PACKAGE_DESCRIPTION - # The variable content may be either - # - explicitly given by the user or - # - filled with the content of CPACK_PACKAGE_DESCRIPTION_FILE - # if it is defined - # - set to a default value - # - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_DESCRIPTION" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_DESCRIPTION" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_DESCRIPTION" - "CPACK_COMPONENT_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DESCRIPTION") - endif() - - if(NOT CPACK_RPM_PACKAGE_DESCRIPTION) - if(CPACK_PACKAGE_DESCRIPTION_FILE) - file(READ ${CPACK_PACKAGE_DESCRIPTION_FILE} CPACK_RPM_PACKAGE_DESCRIPTION) - else () - set(CPACK_RPM_PACKAGE_DESCRIPTION "no package description available") - endif () - endif () - - # CPACK_RPM_COMPRESSION_TYPE - # - if (CPACK_RPM_COMPRESSION_TYPE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User Specified RPM compression type: ${CPACK_RPM_COMPRESSION_TYPE}") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "lzma") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.lzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "xz") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w7.xzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "bzip2") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.bzdio") - endif() - if(CPACK_RPM_COMPRESSION_TYPE STREQUAL "gzip") - set(CPACK_RPM_COMPRESSION_TYPE_TMP "%define _binary_payload w9.gzdio") - endif() - else() - set(CPACK_RPM_COMPRESSION_TYPE_TMP "") - endif() - - if(NOT CPACK_RPM_PACKAGE_SOURCES) - if(CPACK_PACKAGE_RELOCATABLE OR CPACK_RPM_PACKAGE_RELOCATABLE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Trying to build a relocatable package") - endif() - if(CPACK_SET_DESTDIR AND (NOT CPACK_SET_DESTDIR STREQUAL "I_ON")) - message("CPackRPM:Warning: CPACK_SET_DESTDIR is set (=${CPACK_SET_DESTDIR}) while requesting a relocatable package (CPACK_RPM_PACKAGE_RELOCATABLE is set): this is not supported, the package won't be relocatable.") - set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) - else() - set(CPACK_RPM_PACKAGE_PREFIX ${CPACK_PACKAGING_INSTALL_PREFIX}) # kept for back compatibility (provided external RPM spec files) - cpack_rpm_prepare_relocation_paths() - set(CPACK_RPM_PACKAGE_RELOCATABLE TRUE) - endif() - endif() - else() - if(CPACK_RPM_PACKAGE_COMPONENT) - message(FATAL_ERROR "CPACK_RPM_PACKAGE_SOURCES parameter can not be used" - " in combination with CPACK_RPM_PACKAGE_COMPONENT parameter!") - endif() - - set(CPACK_RPM_PACKAGE_RELOCATABLE FALSE) # disable relocatable option if building source RPM - endif() - - execute_process( - COMMAND "${RPMBUILD_EXECUTABLE}" --querytags - OUTPUT_VARIABLE RPMBUILD_TAG_LIST - OUTPUT_STRIP_TRAILING_WHITESPACE) - string(REPLACE "\n" ";" RPMBUILD_TAG_LIST "${RPMBUILD_TAG_LIST}") - - if(CPACK_RPM_PACKAGE_EPOCH) - set(TMP_RPM_EPOCH "Epoch: ${CPACK_RPM_PACKAGE_EPOCH}") - endif() - - # Check if additional fields for RPM spec header are given - # There may be some COMPONENT specific variables as well - # If component specific var is not provided we use the global one - # for each component - foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: processing ${_RPM_SPEC_HEADER}") - endif() - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${_RPM_SPEC_HEADER}" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}) - cmake_policy(PUSH) - cmake_policy(SET CMP0057 NEW) - # Prefix can be replaced by Prefixes but the old version stil works so we'll ignore it for now - # Requires* is a special case because it gets transformed to Requires(pre/post/preun/postun) - # Auto* is a special case because the tags can not be queried by querytags rpmbuild flag - set(special_case_tags_ PREFIX REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN AUTOPROV AUTOREQ AUTOREQPROV) - if(NOT _RPM_SPEC_HEADER IN_LIST RPMBUILD_TAG_LIST AND NOT _RPM_SPEC_HEADER IN_LIST special_case_tags_) - cmake_policy(POP) - message(AUTHOR_WARNING "CPackRPM:Warning: ${_RPM_SPEC_HEADER} not " - "supported in provided rpmbuild. Tag will not be used.") - continue() - endif() - cmake_policy(POP) - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: using CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}") - endif() - - set(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}}) - endif() - - # Treat the RPM Spec keyword iff it has been properly defined - if(DEFINED CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) - # Transform NAME --> Name e.g. PROVIDES --> Provides - # The Upper-case first letter and lowercase tail is the - # appropriate value required in the final RPM spec file. - string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) - string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) - string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) - string(APPEND _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_TAIL}") - # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. - set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) - list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) - if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) - string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") - string(APPEND _PACKAGE_HEADER_NAME ")") - endif() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - endif() - set(TMP_RPM_${_RPM_SPEC_HEADER} "${_PACKAGE_HEADER_NAME}: ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") - unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) - endif() - endforeach() - - # CPACK_RPM_SPEC_INSTALL_POST - # May be used to define a RPM post intallation script - # for example setting it to "/bin/true" may prevent - # rpmbuild from stripping binaries. - if(CPACK_RPM_SPEC_INSTALL_POST) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined CPACK_RPM_SPEC_INSTALL_POST = ${CPACK_RPM_SPEC_INSTALL_POST}") - endif() - set(TMP_RPM_SPEC_INSTALL_POST "%define __spec_install_post ${CPACK_RPM_SPEC_INSTALL_POST}") - endif() - - # CPACK_RPM_POST_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_INSTALL_SCRIPT_FILE) - # CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_POST_UNINSTALL_SCRIPT_FILE) - # May be used to embed a post (un)installation script in the spec file. - # The refered script file(s) will be read and directly - # put after the %post or %postun section - # ---------------------------------------------------------------- - # CPACK_RPM_PRE_INSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_INSTALL_SCRIPT_FILE) - # CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE (or CPACK_RPM_<COMPONENT>_PRE_UNINSTALL_SCRIPT_FILE) - # May be used to embed a pre (un)installation script in the spec file. - # The refered script file(s) will be read and directly - # put after the %pre or %preun section - foreach(RPM_SCRIPT_FILE_TYPE_ "INSTALL" "UNINSTALL") - foreach(RPM_SCRIPT_FILE_TIME_ "PRE" "POST") - set("CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE" - "${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE}") - - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE") - endif() - - # Handle file if it has been specified - if(CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE) - if(EXISTS ${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE}) - file(READ ${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE} - "CPACK_RPM_SPEC_${RPM_SCRIPT_FILE_TIME_}${RPM_SCRIPT_FILE_TYPE_}") - else() - message("CPackRPM:Warning: CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_SCRIPT_FILE <${CPACK_RPM_${RPM_SCRIPT_FILE_TIME_}_${RPM_SCRIPT_FILE_TYPE_}_READ_FILE}> does not exists - ignoring") - endif() - else() - # reset SPEC var value if no file has been specified - # (either globally or component-wise) - set("CPACK_RPM_SPEC_${RPM_SCRIPT_FILE_TIME_}${RPM_SCRIPT_FILE_TYPE_}" "") - endif() - endforeach() - endforeach() - - # CPACK_RPM_CHANGELOG_FILE - # May be used to embed a changelog in the spec file. - # The refered file will be read and directly put after the %changelog section - if(CPACK_RPM_CHANGELOG_FILE) - if(EXISTS ${CPACK_RPM_CHANGELOG_FILE}) - file(READ ${CPACK_RPM_CHANGELOG_FILE} CPACK_RPM_SPEC_CHANGELOG) - else() - message(SEND_ERROR "CPackRPM:Warning: CPACK_RPM_CHANGELOG_FILE <${CPACK_RPM_CHANGELOG_FILE}> does not exists - ignoring") - endif() - else() - set(CPACK_RPM_SPEC_CHANGELOG "* Sun Jul 4 2010 Eric Noulard <eric.noulard@gmail.com> - ${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}\n Generated by CPack RPM (no Changelog file were provided)") - endif() - - # CPACK_RPM_SPEC_MORE_DEFINE - # This is a generated spec rpm file spaceholder - if(CPACK_RPM_SPEC_MORE_DEFINE) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: User defined more define spec line specified:\n ${CPACK_RPM_SPEC_MORE_DEFINE}") - endif() - endif() - - # Now we may create the RPM build tree structure - set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") - message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") - # Prepare RPM build tree - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/BUILD) - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/RPMS) - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SOURCES) - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SPECS) - file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/SRPMS) - - # it seems rpmbuild can't handle spaces in the path - # neither escaping (as below) nor putting quotes around the path seem to help - #string(REGEX REPLACE " " "\\\\ " CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") - set(CPACK_RPM_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}") - - cpack_rpm_prepare_content_list() - - # In component case, put CPACK_ABSOLUTE_DESTINATION_FILES_<COMPONENT> - # into CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL - # otherwise, put CPACK_ABSOLUTE_DESTINATION_FILES - # This must be done BEFORE the CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL handling - if(CPACK_RPM_PACKAGE_COMPONENT) - if(CPACK_ABSOLUTE_DESTINATION_FILES) - cpack_rpm_variable_fallback("COMPONENT_FILES_TAG" - "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT}" - "CPACK_ABSOLUTE_DESTINATION_FILES_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}") - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${${COMPONENT_FILES_TAG}}") - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: <${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif() - endif() - else() - if(CPACK_ABSOLUTE_DESTINATION_FILES) - set(CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL "${CPACK_ABSOLUTE_DESTINATION_FILES}") - endif() - endif() - - # In component case, set CPACK_RPM_USER_FILELIST_INTERNAL with CPACK_RPM_<COMPONENT>_USER_FILELIST. - set(CPACK_RPM_USER_FILELIST_INTERNAL "") - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_USER_FILELIST_INTERNAL" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_FILELIST" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_USER_FILELIST") - - if(CPACK_RPM_PACKAGE_DEBUG AND CPACK_RPM_USER_FILELIST_INTERNAL) - message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - message("CPackRPM:Debug: in component = ${CPACK_RPM_PACKAGE_COMPONENT}") - endif() - elseif(CPACK_RPM_USER_FILELIST) - set(CPACK_RPM_USER_FILELIST_INTERNAL "${CPACK_RPM_USER_FILELIST}") - endif() - - # Handle user specified file line list in CPACK_RPM_USER_FILELIST_INTERNAL - # Remove those files from CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL - # or CPACK_RPM_INSTALL_FILES, - # hence it must be done before these auto-generated lists are processed. - if(CPACK_RPM_USER_FILELIST_INTERNAL) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling User Filelist: <${CPACK_RPM_USER_FILELIST_INTERNAL}>") - endif() - - # Create CMake list from CPACK_RPM_INSTALL_FILES - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST - "${CPACK_RPM_INSTALL_FILES_LIST}") - - set(CPACK_RPM_USER_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z]+(\\([^()]*\\))? " "" F_PATH ${F}) - string(REGEX MATCH "(%[A-Za-z]+(\\([^()]*\\))? )*" F_PREFIX ${F}) - string(STRIP ${F_PREFIX} F_PREFIX) - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") - endif() - if(F_PREFIX) - string(APPEND F_PREFIX " ") - endif() - # Rebuild the user list file - string(APPEND CPACK_RPM_USER_INSTALL_FILES "${F_PREFIX}\"${F_PATH}\"\n") - - # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) - # ABSOLUTE destination files list may not exists at all - if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) - endif() - endforeach() - - # Rebuild CPACK_RPM_INSTALL_FILES - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n") - endforeach() - else() - set(CPACK_RPM_USER_INSTALL_FILES "") - endif() - - if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: Handling Absolute Destination Files: ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}") - endif() - # Remove trailing space - string(STRIP "${CPACK_RPM_INSTALL_FILES}" CPACK_RPM_INSTALL_FILES_LIST) - # Transform endline separated - string into CMake List - string(REPLACE "\n" ";" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove unecessary quotes - string(REPLACE "\"" "" CPACK_RPM_INSTALL_FILES_LIST "${CPACK_RPM_INSTALL_FILES_LIST}") - # Remove ABSOLUTE install file from INSTALL FILE LIST - list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL}) - # Rebuild INSTALL_FILES - set(CPACK_RPM_INSTALL_FILES "") - foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n") - endforeach() - # Build ABSOLUTE_INSTALL_FILES - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") - foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - string(APPEND CPACK_RPM_ABSOLUTE_INSTALL_FILES "%config \"${F}\"\n") - endforeach() - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") - message("CPackRPM:Debug: CPACK_RPM_INSTALL_FILES=${CPACK_RPM_INSTALL_FILES}") - endif() - else() - # reset vars in order to avoid leakage of value(s) from one component to another - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") - endif() - - cpack_rpm_variable_fallback("CPACK_RPM_DEBUGINFO_PACKAGE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_DEBUGINFO_PACKAGE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEBUGINFO_PACKAGE" - "CPACK_RPM_DEBUGINFO_PACKAGE") - if(CPACK_RPM_DEBUGINFO_PACKAGE OR (CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND NOT GENERATE_SPEC_PARTS)) - cpack_rpm_variable_fallback("CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_BUILD_SOURCE_DIRS_PREFIX" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_BUILD_SOURCE_DIRS_PREFIX" - "CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX") - if(NOT CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX) - set(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX "/usr/src/debug/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}") - endif() - - # handle cases where path contains extra slashes (e.g. /a//b/ instead of - # /a/b) - get_filename_component(CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX - "${CPACK_RPM_BUILD_SOURCE_DIRS_PREFIX}" ABSOLUTE) - - if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS) - file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.files" - "${CPACK_RPM_INSTALL_FILES}") - else() - if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND CPACK_RPM_PACKAGE_COMPONENT) - # this part is only required by components packaging - with monolithic - # packages we can be certain that there are no other components present - # so CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE is a noop - if(CPACK_RPM_DEBUGINFO_PACKAGE) - # only add current package files to debuginfo list if debuginfo - # generation is enabled for current package - string(STRIP "${CPACK_RPM_INSTALL_FILES}" install_files_) - string(REPLACE "\n" ";" install_files_ "${install_files_}") - string(REPLACE "\"" "" install_files_ "${install_files_}") - else() - unset(install_files_) - endif() - - file(GLOB files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.files") - - foreach(f_ IN LISTS files_) - file(READ "${f_}" tmp_) - string(APPEND install_files_ ";${tmp_}") - endforeach() - - # if there were other components/groups so we need to move files from them - # to current component otherwise those files won't be found - file(GLOB components_ LIST_DIRECTORIES true RELATIVE - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}" - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/*") - foreach(component_ IN LISTS components_) - string(TOUPPER "${component_}" component_dir_upper_) - if(component_dir_upper_ STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER) - # skip current component - continue() - endif() - - cmake_policy(PUSH) - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE files_for_move_ LIST_DIRECTORIES false RELATIVE - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}" - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/*") - cmake_policy(POP) - - foreach(f_ IN LISTS files_for_move_) - get_filename_component(dir_path_ "${f_}" DIRECTORY) - set(src_file_ - "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/${component_}/${f_}") - - # check that we are not overriding an existing file that doesn't - # match the file that we want to copy - if(EXISTS "${src_file_}" AND EXISTS "${WDIR}/${f_}") - execute_process( - COMMAND ${CMAKE_COMMAND} -E compare_files "${src_file_}" "${WDIR}/${f_}" - RESULT_VARIABLE res_ - ) - if(res_) - message(FATAL_ERROR "CPackRPM:Error: File on path '${WDIR}/${f_}'" - " already exists but is a different than the one in component" - " '${component_}'! Packages will not be generated.") - endif() - endif() - - file(MAKE_DIRECTORY "${WDIR}/${dir_path_}") - file(RENAME "${src_file_}" - "${WDIR}/${f_}") - endforeach() - endforeach() - - cpack_rpm_debugsymbol_check("${install_files_}" "${WDIR}") - else() - string(STRIP "${CPACK_RPM_INSTALL_FILES}" install_files_) - string(REPLACE "\n" ";" install_files_ "${install_files_}") - string(REPLACE "\"" "" install_files_ "${install_files_}") - - cpack_rpm_debugsymbol_check("${install_files_}" "${WDIR}") - endif() - - if(TMP_DEBUGINFO_ADDITIONAL_SOURCES) - set(TMP_RPM_DEBUGINFO " -# Modified version of %%debug_package macro -# defined in /usr/lib/rpm/macros as that one -# can't handle injection of extra source files. -%ifnarch noarch -%global __debug_package 1 -%package debuginfo -Summary: Debug information for package %{name} -Group: Development/Debug -AutoReqProv: 0 -%description debuginfo -This package provides debug information for package %{name}. -Debug information is useful when developing applications that use this -package or when debugging this package. -%files debuginfo -f debugfiles.list -%defattr(-,root,root) -${TMP_DEBUGINFO_ADDITIONAL_SOURCES} -%endif -") - elseif(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE) - message(AUTHOR_WARNING "CPackRPM:Warning: debuginfo package was requested" - " but will not be generated as no source files were found!") - else() - message(AUTHOR_WARNING "CPackRPM:Warning: debuginfo package was requested" - " but will not be generated as no source files were found! Component: '" - "${CPACK_RPM_PACKAGE_COMPONENT}'.") - endif() - endif() - endif() - - # Prepare install files - cpack_rpm_prepare_install_files( - "${CPACK_RPM_INSTALL_FILES}" - "${WDIR}" - "${RPM_USED_PACKAGE_PREFIXES}" - "${CPACK_RPM_PACKAGE_RELOCATABLE}" - ) - - # set default user and group - foreach(_PERM_TYPE "USER" "GROUP") - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}) - set(TMP_DEFAULT_${_PERM_TYPE} "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}}") - elseif(CPACK_RPM_DEFAULT_${_PERM_TYPE}) - set(TMP_DEFAULT_${_PERM_TYPE} "${CPACK_RPM_DEFAULT_${_PERM_TYPE}}") - else() - set(TMP_DEFAULT_${_PERM_TYPE} "root") - endif() - endforeach() - - # set default file and dir permissions - foreach(_PERM_TYPE "FILE" "DIR") - if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}_PERMISSIONS) - get_unix_permissions_octal_notation("CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}_PERMISSIONS" "TMP_DEFAULT_${_PERM_TYPE}_PERMISSIONS") - set(_PERMISSIONS_VAR "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEFAULT_${_PERM_TYPE}_PERMISSIONS") - elseif(CPACK_RPM_DEFAULT_${_PERM_TYPE}_PERMISSIONS) - get_unix_permissions_octal_notation("CPACK_RPM_DEFAULT_${_PERM_TYPE}_PERMISSIONS" "TMP_DEFAULT_${_PERM_TYPE}_PERMISSIONS") - set(_PERMISSIONS_VAR "CPACK_RPM_DEFAULT_${_PERM_TYPE}_PERMISSIONS") - else() - set(TMP_DEFAULT_${_PERM_TYPE}_PERMISSIONS "-") - endif() - endforeach() - - # The name of the final spec file to be used by rpmbuild - set(CPACK_RPM_BINARY_SPECFILE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_NAME}.spec") - - # Print out some debug information if we were asked for that - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: CPACK_TOPLEVEL_DIRECTORY = ${CPACK_TOPLEVEL_DIRECTORY}") - message("CPackRPM:Debug: CPACK_TOPLEVEL_TAG = ${CPACK_TOPLEVEL_TAG}") - message("CPackRPM:Debug: CPACK_TEMPORARY_DIRECTORY = ${CPACK_TEMPORARY_DIRECTORY}") - message("CPackRPM:Debug: CPACK_OUTPUT_FILE_NAME = ${CPACK_OUTPUT_FILE_NAME}") - message("CPackRPM:Debug: CPACK_OUTPUT_FILE_PATH = ${CPACK_OUTPUT_FILE_PATH}") - message("CPackRPM:Debug: CPACK_PACKAGE_FILE_NAME = ${CPACK_PACKAGE_FILE_NAME}") - message("CPackRPM:Debug: CPACK_RPM_BINARY_SPECFILE = ${CPACK_RPM_BINARY_SPECFILE}") - message("CPackRPM:Debug: CPACK_PACKAGE_INSTALL_DIRECTORY = ${CPACK_PACKAGE_INSTALL_DIRECTORY}") - message("CPackRPM:Debug: CPACK_TEMPORARY_PACKAGE_FILE_NAME = ${CPACK_TEMPORARY_PACKAGE_FILE_NAME}") - endif() - - # - # USER generated/provided spec file handling. - # - - # We can have a component specific spec file. - if(CPACK_RPM_PACKAGE_COMPONENT) - cpack_rpm_variable_fallback("CPACK_RPM_USER_BINARY_SPECFILE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_USER_BINARY_SPECFILE" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_USER_BINARY_SPECFILE") - endif() - - cpack_rpm_variable_fallback("CPACK_RPM_FILE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_FILE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_FILE_NAME" - "CPACK_RPM_FILE_NAME") - if(NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT") - if(CPACK_RPM_FILE_NAME) - cmake_policy(PUSH) - cmake_policy(SET CMP0010 NEW) - if(NOT CPACK_RPM_FILE_NAME MATCHES ".*\\.rpm") - cmake_policy(POP) - message(FATAL_ERROR "'${CPACK_RPM_FILE_NAME}' is not a valid RPM package file name as it must end with '.rpm'!") - endif() - cmake_policy(POP) - else() - # old file name format for back compatibility - string(TOUPPER "${CPACK_RPM_MAIN_COMPONENT}" - CPACK_RPM_MAIN_COMPONENT_UPPER) - - if(CPACK_RPM_MAIN_COMPONENT_UPPER STREQUAL CPACK_RPM_PACKAGE_COMPONENT_UPPER) - # this is the main component so ignore the component filename part - set(CPACK_RPM_FILE_NAME "${CPACK_PACKAGE_FILE_NAME}.rpm") - else() - set(CPACK_RPM_FILE_NAME "${CPACK_OUTPUT_FILE_NAME}") - endif() - endif() - # else example: - #set(CPACK_RPM_FILE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}-${CPACK_RPM_PACKAGE_RELEASE}-${CPACK_RPM_PACKAGE_ARCHITECTURE}.rpm") - - if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE AND GENERATE_SPEC_PARTS) - string(TOLOWER "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm" expected_filename_) - - file(WRITE "${CPACK_RPM_ROOTDIR}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}.rpm_name" - "${expected_filename_};${CPACK_RPM_FILE_NAME}") - elseif(NOT CPACK_RPM_DEBUGINFO_PACKAGE) - set(FILE_NAME_DEFINE "%define _rpmfilename ${CPACK_RPM_FILE_NAME}") - endif() - endif() - - if(CPACK_RPM_PACKAGE_SOURCES) # source rpm - set(archive_name_ "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_VERSION}") - - execute_process( - COMMAND ${CMAKE_COMMAND} -E tar "cfvz" "${CPACK_RPM_DIRECTORY}/SOURCES/${archive_name_}.tar.gz" "${CPACK_PACKAGE_FILE_NAME}" - WORKING_DIRECTORY ${CPACK_RPM_DIRECTORY} - ) - set(TMP_RPM_SOURCE "Source: ${archive_name_}.tar.gz") - - if(CPACK_RPM_BUILDREQUIRES) - set(TMP_RPM_BUILD_REQUIRES "BuildRequires: ${CPACK_RPM_BUILDREQUIRES}") - endif() - - # Disable debuginfo packages - srpm generates invalid packages due to - # releasing controll to cpack to generate binary packages. - # Note however that this doesn't prevent cpack to generate debuginfo - # packages when run from srpm with --rebuild. - set(TMP_RPM_DISABLE_DEBUGINFO "%define debug_package %{nil}") - - if(NOT CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX) - set(CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX "/") - endif() - - set(TMP_RPM_BUILD - " -%build -mkdir cpack_rpm_build_dir -cd cpack_rpm_build_dir -cmake ${CPACK_RPM_SOURCE_PKG_BUILD_PARAMS} -DCPACK_PACKAGING_INSTALL_PREFIX=${CPACK_RPM_SOURCE_PKG_PACKAGING_INSTALL_PREFIX} ../${CPACK_PACKAGE_FILE_NAME} -make %{?_smp_mflags}" # %{?_smp_mflags} -> -j option - ) - set(TMP_RPM_INSTALL - " -cd cpack_rpm_build_dir -cpack -G RPM -mv *.rpm %_rpmdir" - ) - set(TMP_RPM_PREP "%setup -c") - - set(RPMBUILD_FLAGS "-bs") - - file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in - "# Restore old style debuginfo creation for rpm >= 4.14. -%undefine _debugsource_packages -%undefine _debuginfo_subpackages - -# -*- rpm-spec -*- -BuildRoot: %_topdir/\@CPACK_PACKAGE_FILE_NAME\@ -Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ -Name: \@CPACK_RPM_PACKAGE_NAME\@ -Version: \@CPACK_RPM_PACKAGE_VERSION\@ -Release: \@CPACK_RPM_PACKAGE_RELEASE\@ -License: \@CPACK_RPM_PACKAGE_LICENSE\@ -Group: \@CPACK_RPM_PACKAGE_GROUP\@ -Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ - -\@TMP_RPM_SOURCE\@ -\@TMP_RPM_BUILD_REQUIRES\@ -\@TMP_RPM_BUILDARCH\@ -\@TMP_RPM_PREFIXES\@ - -\@TMP_RPM_DISABLE_DEBUGINFO\@ - -%define _rpmdir %_topdir/RPMS -%define _srcrpmdir %_topdir/SRPMS -\@FILE_NAME_DEFINE\@ -%define _unpackaged_files_terminate_build 0 -\@TMP_RPM_SPEC_INSTALL_POST\@ -\@CPACK_RPM_SPEC_MORE_DEFINE\@ -\@CPACK_RPM_COMPRESSION_TYPE_TMP\@ - -%description -\@CPACK_RPM_PACKAGE_DESCRIPTION\@ - -# This is a shortcutted spec file generated by CMake RPM generator -# we skip _install step because CPack does that for us. -# We do only save CPack installed tree in _prepr -# and then restore it in build. -%prep -\@TMP_RPM_PREP\@ - -\@TMP_RPM_BUILD\@ - -#p build - -%install -\@TMP_RPM_INSTALL\@ - -%clean - -%changelog -\@CPACK_RPM_SPEC_CHANGELOG\@ -" - ) - - elseif(GENERATE_SPEC_PARTS) # binary rpm with single debuginfo package - file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in - "# -*- rpm-spec -*- -%package -n \@CPACK_RPM_PACKAGE_NAME\@ -Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ -Version: \@CPACK_RPM_PACKAGE_VERSION\@ -Release: \@CPACK_RPM_PACKAGE_RELEASE\@ -License: \@CPACK_RPM_PACKAGE_LICENSE\@ -Group: \@CPACK_RPM_PACKAGE_GROUP\@ -Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ - -\@TMP_RPM_URL\@ -\@TMP_RPM_REQUIRES\@ -\@TMP_RPM_REQUIRES_PRE\@ -\@TMP_RPM_REQUIRES_POST\@ -\@TMP_RPM_REQUIRES_PREUN\@ -\@TMP_RPM_REQUIRES_POSTUN\@ -\@TMP_RPM_PROVIDES\@ -\@TMP_RPM_OBSOLETES\@ -\@TMP_RPM_CONFLICTS\@ -\@TMP_RPM_SUGGESTS\@ -\@TMP_RPM_AUTOPROV\@ -\@TMP_RPM_AUTOREQ\@ -\@TMP_RPM_AUTOREQPROV\@ -\@TMP_RPM_BUILDARCH\@ -\@TMP_RPM_PREFIXES\@ -\@TMP_RPM_EPOCH\@ - -%description -n \@CPACK_RPM_PACKAGE_NAME\@ -\@CPACK_RPM_PACKAGE_DESCRIPTION\@ - -%files -n \@CPACK_RPM_PACKAGE_NAME\@ -%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) -\@CPACK_RPM_INSTALL_FILES\@ -\@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@ -\@CPACK_RPM_USER_INSTALL_FILES\@ -" - ) - - else() # binary rpm - if(CPACK_RPM_DEBUGINFO_SINGLE_PACKAGE) - # find generated spec file and take its name - file(GLOB spec_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.spec") - - foreach(f_ IN LISTS spec_files_) - file(READ "${f_}" tmp_) - string(APPEND TMP_OTHER_COMPONENTS "\n${tmp_}\n") - endforeach() - endif() - - # We should generate a USER spec file template: - # - either because the user asked for it : CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE - # - or the user did not provide one : NOT CPACK_RPM_USER_BINARY_SPECFILE - set(RPMBUILD_FLAGS "-bb") - if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE OR NOT CPACK_RPM_USER_BINARY_SPECFILE) - - file(WRITE ${CPACK_RPM_BINARY_SPECFILE}.in - "# Restore old style debuginfo creation for rpm >= 4.14. -%undefine _debugsource_packages -%undefine _debuginfo_subpackages - -# -*- rpm-spec -*- -BuildRoot: %_topdir/\@CPACK_PACKAGE_FILE_NAME\@\@CPACK_RPM_PACKAGE_COMPONENT_PART_PATH\@ -Summary: \@CPACK_RPM_PACKAGE_SUMMARY\@ -Name: \@CPACK_RPM_PACKAGE_NAME\@ -Version: \@CPACK_RPM_PACKAGE_VERSION\@ -Release: \@CPACK_RPM_PACKAGE_RELEASE\@ -License: \@CPACK_RPM_PACKAGE_LICENSE\@ -Group: \@CPACK_RPM_PACKAGE_GROUP\@ -Vendor: \@CPACK_RPM_PACKAGE_VENDOR\@ - -\@TMP_RPM_URL\@ -\@TMP_RPM_REQUIRES\@ -\@TMP_RPM_REQUIRES_PRE\@ -\@TMP_RPM_REQUIRES_POST\@ -\@TMP_RPM_REQUIRES_PREUN\@ -\@TMP_RPM_REQUIRES_POSTUN\@ -\@TMP_RPM_PROVIDES\@ -\@TMP_RPM_OBSOLETES\@ -\@TMP_RPM_CONFLICTS\@ -\@TMP_RPM_SUGGESTS\@ -\@TMP_RPM_AUTOPROV\@ -\@TMP_RPM_AUTOREQ\@ -\@TMP_RPM_AUTOREQPROV\@ -\@TMP_RPM_BUILDARCH\@ -\@TMP_RPM_PREFIXES\@ - -\@TMP_RPM_DEBUGINFO\@ - -%define _rpmdir %_topdir/RPMS -%define _srcrpmdir %_topdir/SRPMS -\@FILE_NAME_DEFINE\@ -%define _unpackaged_files_terminate_build 0 -\@TMP_RPM_SPEC_INSTALL_POST\@ -\@CPACK_RPM_SPEC_MORE_DEFINE\@ -\@CPACK_RPM_COMPRESSION_TYPE_TMP\@ - -%description -\@CPACK_RPM_PACKAGE_DESCRIPTION\@ - -# This is a shortcutted spec file generated by CMake RPM generator -# we skip _install step because CPack does that for us. -# We do only save CPack installed tree in _prepr -# and then restore it in build. -%prep -mv $RPM_BUILD_ROOT %_topdir/tmpBBroot - -%install -if [ -e $RPM_BUILD_ROOT ]; -then - rm -rf $RPM_BUILD_ROOT -fi -mv %_topdir/tmpBBroot $RPM_BUILD_ROOT - -\@TMP_RPM_DEBUGINFO_INSTALL\@ - -%clean - -%post -\@RPM_SYMLINK_POSTINSTALL\@ -\@CPACK_RPM_SPEC_POSTINSTALL\@ - -%postun -\@CPACK_RPM_SPEC_POSTUNINSTALL\@ - -%pre -\@CPACK_RPM_SPEC_PREINSTALL\@ - -%preun -\@CPACK_RPM_SPEC_PREUNINSTALL\@ - -%files -%defattr(\@TMP_DEFAULT_FILE_PERMISSIONS\@,\@TMP_DEFAULT_USER\@,\@TMP_DEFAULT_GROUP\@,\@TMP_DEFAULT_DIR_PERMISSIONS\@) -\@CPACK_RPM_INSTALL_FILES\@ -\@CPACK_RPM_ABSOLUTE_INSTALL_FILES\@ -\@CPACK_RPM_USER_INSTALL_FILES\@ - -%changelog -\@CPACK_RPM_SPEC_CHANGELOG\@ - -\@TMP_OTHER_COMPONENTS\@ -" - ) - endif() - - # Stop here if we were asked to only generate a template USER spec file - # The generated file may then be used as a template by user who wants - # to customize their own spec file. - if(CPACK_RPM_GENERATE_USER_BINARY_SPECFILE_TEMPLATE) - message(FATAL_ERROR "CPackRPM: STOP here Generated USER binary spec file template is: ${CPACK_RPM_BINARY_SPECFILE}.in") - endif() - endif() - - # After that we may either use a user provided spec file - # or generate one using appropriate variables value. - if(CPACK_RPM_USER_BINARY_SPECFILE) - # User may have specified SPECFILE just use it - message("CPackRPM: Will use USER specified spec file: ${CPACK_RPM_USER_BINARY_SPECFILE}") - # The user provided file is processed for @var replacement - configure_file(${CPACK_RPM_USER_BINARY_SPECFILE} ${CPACK_RPM_BINARY_SPECFILE} @ONLY) - else() - # No User specified spec file, will use the generated spec file - message("CPackRPM: Will use GENERATED spec file: ${CPACK_RPM_BINARY_SPECFILE}") - # Note the just created file is processed for @var replacement - configure_file(${CPACK_RPM_BINARY_SPECFILE}.in ${CPACK_RPM_BINARY_SPECFILE} @ONLY) - endif() - - if(NOT GENERATE_SPEC_PARTS) # generate package - if(RPMBUILD_EXECUTABLE) - # Now call rpmbuild using the SPECFILE - execute_process( - COMMAND "${RPMBUILD_EXECUTABLE}" ${RPMBUILD_FLAGS} - --define "_topdir ${CPACK_RPM_DIRECTORY}" - --buildroot "%_topdir/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - --target "${CPACK_RPM_PACKAGE_ARCHITECTURE}" - "${CPACK_RPM_BINARY_SPECFILE}" - WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}${CPACK_RPM_PACKAGE_COMPONENT_PART_PATH}" - RESULT_VARIABLE CPACK_RPMBUILD_EXEC_RESULT - ERROR_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err" - OUTPUT_FILE "${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") - if(CPACK_RPM_PACKAGE_DEBUG OR CPACK_RPMBUILD_EXEC_RESULT) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err RPMBUILDERR) - file(READ ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out RPMBUILDOUT) - message("CPackRPM:Debug: You may consult rpmbuild logs in: ") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.err") - message("CPackRPM:Debug: *** ${RPMBUILDERR} ***") - message("CPackRPM:Debug: - ${CPACK_TOPLEVEL_DIRECTORY}/rpmbuild${CPACK_RPM_PACKAGE_NAME}.out") - message("CPackRPM:Debug: *** ${RPMBUILDOUT} ***") - endif() - else() - if(ALIEN_EXECUTABLE) - message(FATAL_ERROR "RPM packaging through alien not done (yet)") - endif() - endif() - - # find generated rpm files and take their names - cmake_policy(PUSH) - # Tell file(GLOB_RECURSE) not to follow directory symlinks - # even if the project does not set this policy to NEW. - cmake_policy(SET CMP0009 NEW) - file(GLOB_RECURSE GENERATED_FILES "${CPACK_RPM_DIRECTORY}/RPMS/*.rpm" - "${CPACK_RPM_DIRECTORY}/SRPMS/*.rpm") - cmake_policy(POP) - - if(NOT GENERATED_FILES) - message(FATAL_ERROR "RPM package was not generated! ${CPACK_RPM_DIRECTORY}") - endif() - - unset(expected_filenames_) - unset(filenames_) - if(CPACK_RPM_DEBUGINFO_PACKAGE AND NOT CPACK_RPM_FILE_NAME STREQUAL "RPM-DEFAULT") - list(APPEND expected_filenames_ - "${CPACK_RPM_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}.*\\.rpm") - list(APPEND filenames_ "${CPACK_RPM_FILE_NAME}") - endif() - - if(CPACK_RPM_DEBUGINFO_PACKAGE) - cpack_rpm_variable_fallback("CPACK_RPM_DEBUGINFO_FILE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_DEBUGINFO_FILE_NAME" - "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_DEBUGINFO_FILE_NAME" - "CPACK_RPM_DEBUGINFO_FILE_NAME") - - if(CPACK_RPM_DEBUGINFO_FILE_NAME AND - NOT CPACK_RPM_DEBUGINFO_FILE_NAME STREQUAL "RPM-DEFAULT") - list(APPEND expected_filenames_ - "${CPACK_RPM_PACKAGE_NAME}-debuginfo-${CPACK_PACKAGE_VERSION}.*\\.rpm") - string(REPLACE "@cpack_component@" "${CPACK_RPM_PACKAGE_COMPONENT}" - CPACK_RPM_DEBUGINFO_FILE_NAME "${CPACK_RPM_DEBUGINFO_FILE_NAME}") - list(APPEND filenames_ "${CPACK_RPM_DEBUGINFO_FILE_NAME}") - endif() - endif() - - # check if other files have to be renamed - file(GLOB rename_files_ "${CPACK_RPM_DIRECTORY}/SPECS/*.rpm_name") - if(rename_files_) - foreach(f_ IN LISTS rename_files_) - file(READ "${f_}" tmp_) - list(GET tmp_ 0 efn_) - list(APPEND expected_filenames_ "${efn_}") - list(GET tmp_ 1 fn_) - list(APPEND filenames_ "${fn_}") - endforeach() - endif() - - if(expected_filenames_) - foreach(F IN LISTS GENERATED_FILES) - unset(matched_) - foreach(expected_ IN LISTS expected_filenames_) - if(F MATCHES ".*/${expected_}") - list(FIND expected_filenames_ "${expected_}" idx_) - list(GET filenames_ ${idx_} filename_) - get_filename_component(FILE_PATH "${F}" DIRECTORY) - file(RENAME "${F}" "${FILE_PATH}/${filename_}") - list(APPEND new_files_list_ "${FILE_PATH}/${filename_}") - set(matched_ "YES") - - break() - endif() - endforeach() - - if(NOT matched_) - list(APPEND new_files_list_ "${F}") - endif() - endforeach() - - set(GENERATED_FILES "${new_files_list_}") - endif() - endif() - - set(GEN_CPACK_OUTPUT_FILES "${GENERATED_FILES}" PARENT_SCOPE) - - if(CPACK_RPM_PACKAGE_DEBUG) - message("CPackRPM:Debug: GEN_CPACK_OUTPUT_FILES = ${GENERATED_FILES}") - endif() -endfunction() - -cpack_rpm_generate_package() diff --git a/cmake/CMakeBuild/cmake/modules/patched/FindBoost.cmake b/cmake/CMakeBuild/cmake/modules/patched/FindBoost.cmake deleted file mode 100644 index 7b7ac8e1f131f2dad5cfd37b798b77d8f9421c43..0000000000000000000000000000000000000000 --- a/cmake/CMakeBuild/cmake/modules/patched/FindBoost.cmake +++ /dev/null @@ -1,1998 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindBoost -# --------- -# -# Find Boost include dirs and libraries -# -# Use this module by invoking find_package with the form:: -# -# find_package(Boost -# [version] [EXACT] # Minimum or EXACT version e.g. 1.36.0 -# [REQUIRED] # Fail with error if Boost is not found -# [COMPONENTS <libs>...] # Boost libraries by their canonical name -# ) # e.g. "date_time" for "libboost_date_time" -# -# This module finds headers and requested component libraries OR a CMake -# package configuration file provided by a "Boost CMake" build. For the -# latter case skip to the "Boost CMake" section below. For the former -# case results are reported in variables:: -# -# Boost_FOUND - True if headers and requested libraries were found -# Boost_INCLUDE_DIRS - Boost include directories -# Boost_LIBRARY_DIRS - Link directories for Boost libraries -# Boost_LIBRARIES - Boost component libraries to be linked -# Boost_<C>_FOUND - True if component <C> was found (<C> is upper-case) -# Boost_<C>_LIBRARY - Libraries to link for component <C> (may include -# target_link_libraries debug/optimized keywords) -# Boost_VERSION - BOOST_VERSION value from boost/version.hpp -# Boost_LIB_VERSION - Version string appended to library filenames -# Boost_MAJOR_VERSION - Boost major version number (X in X.y.z) -# Boost_MINOR_VERSION - Boost minor version number (Y in x.Y.z) -# Boost_SUBMINOR_VERSION - Boost subminor version number (Z in x.y.Z) -# Boost_LIB_DIAGNOSTIC_DEFINITIONS (Windows) -# - Pass to add_definitions() to have diagnostic -# information about Boost's automatic linking -# displayed during compilation -# -# This module reads hints about search locations from variables:: -# -# BOOST_ROOT - Preferred installation prefix -# (or BOOSTROOT) -# BOOST_INCLUDEDIR - Preferred include directory e.g. <prefix>/include -# BOOST_LIBRARYDIR - Preferred library directory e.g. <prefix>/lib -# Boost_NO_SYSTEM_PATHS - Set to ON to disable searching in locations not -# specified by these hint variables. Default is OFF. -# Boost_ADDITIONAL_VERSIONS -# - List of Boost versions not known to this module -# (Boost install locations may contain the version) -# -# and saves search results persistently in CMake cache entries:: -# -# Boost_INCLUDE_DIR - Directory containing Boost headers -# Boost_LIBRARY_DIR_RELEASE - Directory containing release Boost libraries -# Boost_LIBRARY_DIR_DEBUG - Directory containing debug Boost libraries -# Boost_<C>_LIBRARY_DEBUG - Component <C> library debug variant -# Boost_<C>_LIBRARY_RELEASE - Component <C> library release variant -# -# The following :prop_tgt:`IMPORTED` targets are also defined:: -# -# Boost::boost - Target for header-only dependencies -# (Boost include directory) -# Boost::<C> - Target for specific component dependency -# (shared or static library); <C> is lower- -# case -# Boost::diagnostic_definitions - interface target to enable diagnostic -# information about Boost's automatic linking -# during compilation (adds BOOST_LIB_DIAGNOSTIC) -# Boost::disable_autolinking - interface target to disable automatic -# linking with MSVC (adds BOOST_ALL_NO_LIB) -# Boost::dynamic_linking - interface target to enable dynamic linking -# linking with MSVC (adds BOOST_ALL_DYN_LINK) -# -# Implicit dependencies such as Boost::filesystem requiring -# Boost::system will be automatically detected and satisfied, even -# if system is not specified when using find_package and if -# Boost::system is not added to target_link_libraries. If using -# Boost::thread, then Threads::Threads will also be added automatically. -# -# It is important to note that the imported targets behave differently -# than variables created by this module: multiple calls to -# find_package(Boost) in the same directory or sub-directories with -# different options (e.g. static or shared) will not override the -# values of the targets created by the first call. -# -# Users may set these hints or results as cache entries. Projects -# should not read these entries directly but instead use the above -# result variables. Note that some hint names start in upper-case -# "BOOST". One may specify these as environment variables if they are -# not specified as CMake variables or cache entries. -# -# This module first searches for the Boost header files using the above -# hint variables (excluding BOOST_LIBRARYDIR) and saves the result in -# Boost_INCLUDE_DIR. Then it searches for requested component libraries -# using the above hints (excluding BOOST_INCLUDEDIR and -# Boost_ADDITIONAL_VERSIONS), "lib" directories near Boost_INCLUDE_DIR, -# and the library name configuration settings below. It saves the -# library directories in Boost_LIBRARY_DIR_DEBUG and -# Boost_LIBRARY_DIR_RELEASE and individual library -# locations in Boost_<C>_LIBRARY_DEBUG and Boost_<C>_LIBRARY_RELEASE. -# When one changes settings used by previous searches in the same build -# tree (excluding environment variables) this module discards previous -# search results affected by the changes and searches again. -# -# Boost libraries come in many variants encoded in their file name. -# Users or projects may tell this module which variant to find by -# setting variables:: -# -# Boost_USE_DEBUG_LIBS - Set to ON or OFF to specify whether to search -# and use the debug libraries. Default is ON. -# Boost_USE_RELEASE_LIBS - Set to ON or OFF to specify whether to search -# and use the release libraries. Default is ON. -# Boost_USE_MULTITHREADED - Set to OFF to use the non-multithreaded -# libraries ('mt' tag). Default is ON. -# Boost_USE_STATIC_LIBS - Set to ON to force the use of the static -# libraries. Default is OFF. -# Boost_USE_STATIC_RUNTIME - Set to ON or OFF to specify whether to use -# libraries linked statically to the C++ runtime -# ('s' tag). Default is platform dependent. -# Boost_USE_DEBUG_RUNTIME - Set to ON or OFF to specify whether to use -# libraries linked to the MS debug C++ runtime -# ('g' tag). Default is ON. -# Boost_USE_DEBUG_PYTHON - Set to ON to use libraries compiled with a -# debug Python build ('y' tag). Default is OFF. -# Boost_USE_STLPORT - Set to ON to use libraries compiled with -# STLPort ('p' tag). Default is OFF. -# Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS -# - Set to ON to use libraries compiled with -# STLPort deprecated "native iostreams" -# ('n' tag). Default is OFF. -# Boost_COMPILER - Set to the compiler-specific library suffix -# (e.g. "-gcc43"). Default is auto-computed -# for the C++ compiler in use. A list may be -# used if multiple compatible suffixes should -# be tested for, in decreasing order of -# preference. -# Boost_THREADAPI - Suffix for "thread" component library name, -# such as "pthread" or "win32". Names with -# and without this suffix will both be tried. -# Boost_NAMESPACE - Alternate namespace used to build boost with -# e.g. if set to "myboost", will search for -# myboost_thread instead of boost_thread. -# -# Other variables one may set to control this module are:: -# -# Boost_DEBUG - Set to ON to enable debug output from FindBoost. -# Please enable this before filing any bug report. -# Boost_DETAILED_FAILURE_MSG -# - Set to ON to add detailed information to the -# failure message even when the REQUIRED option -# is not given to the find_package call. -# Boost_REALPATH - Set to ON to resolve symlinks for discovered -# libraries to assist with packaging. For example, -# the "system" component library may be resolved to -# "/usr/lib/libboost_system.so.1.42.0" instead of -# "/usr/lib/libboost_system.so". This does not -# affect linking and should not be enabled unless -# the user needs this information. -# Boost_LIBRARY_DIR - Default value for Boost_LIBRARY_DIR_RELEASE and -# Boost_LIBRARY_DIR_DEBUG. -# -# On Visual Studio and Borland compilers Boost headers request automatic -# linking to corresponding libraries. This requires matching libraries -# to be linked explicitly or available in the link library search path. -# In this case setting Boost_USE_STATIC_LIBS to OFF may not achieve -# dynamic linking. Boost automatic linking typically requests static -# libraries with a few exceptions (such as Boost.Python). Use:: -# -# add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) -# -# to ask Boost to report information about automatic linking requests. -# -# Example to find Boost headers only:: -# -# find_package(Boost 1.36.0) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# endif() -# -# Example to find Boost libraries and use imported targets:: -# -# find_package(Boost 1.56 REQUIRED COMPONENTS -# date_time filesystem iostreams) -# add_executable(foo foo.cc) -# target_link_libraries(foo Boost::date_time Boost::filesystem -# Boost::iostreams) -# -# Example to find Boost headers and some *static* (release only) libraries:: -# -# set(Boost_USE_STATIC_LIBS ON) # only find static libs -# set(Boost_USE_DEBUG_LIBS OFF) # ignore debug libs and -# set(Boost_USE_RELEASE_LIBS ON) # only find release libs -# set(Boost_USE_MULTITHREADED ON) -# set(Boost_USE_STATIC_RUNTIME OFF) -# find_package(Boost 1.36.0 COMPONENTS date_time filesystem system ...) -# if(Boost_FOUND) -# include_directories(${Boost_INCLUDE_DIRS}) -# add_executable(foo foo.cc) -# target_link_libraries(foo ${Boost_LIBRARIES}) -# endif() -# -# Boost CMake -# ^^^^^^^^^^^ -# -# If Boost was built using the boost-cmake project it provides a package -# configuration file for use with find_package's Config mode. This -# module looks for the package configuration file called -# BoostConfig.cmake or boost-config.cmake and stores the result in cache -# entry "Boost_DIR". If found, the package configuration file is loaded -# and this module returns with no further action. See documentation of -# the Boost CMake package configuration for details on what it provides. -# -# Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake. - -# Save project's policies -cmake_policy(PUSH) -cmake_policy(SET CMP0057 NEW) # if IN_LIST - -#------------------------------------------------------------------------------- -# Before we go searching, check whether boost-cmake is available, unless the -# user specifically asked NOT to search for boost-cmake. -# -# If Boost_DIR is set, this behaves as any find_package call would. If not, -# it looks at BOOST_ROOT and BOOSTROOT to find Boost. -# -if (NOT Boost_NO_BOOST_CMAKE) - # If Boost_DIR is not set, look for BOOSTROOT and BOOST_ROOT as alternatives, - # since these are more conventional for Boost. - if ("$ENV{Boost_DIR}" STREQUAL "") - if (NOT "$ENV{BOOST_ROOT}" STREQUAL "") - set(ENV{Boost_DIR} $ENV{BOOST_ROOT}) - elseif (NOT "$ENV{BOOSTROOT}" STREQUAL "") - set(ENV{Boost_DIR} $ENV{BOOSTROOT}) - endif() - endif() - - # Do the same find_package call but look specifically for the CMake version. - # Note that args are passed in the Boost_FIND_xxxxx variables, so there is no - # need to delegate them to this find_package call. - find_package(Boost QUIET NO_MODULE) - mark_as_advanced(Boost_DIR) - - # If we found boost-cmake, then we're done. Print out what we found. - # Otherwise let the rest of the module try to find it. - if (Boost_FOUND) - message(STATUS "Boost ${Boost_FIND_VERSION} found.") - if (Boost_FIND_COMPONENTS) - message(STATUS "Found Boost components:\n ${Boost_FIND_COMPONENTS}") - endif() - # Restore project's policies - cmake_policy(POP) - return() - endif() -endif() - - -#------------------------------------------------------------------------------- -# FindBoost functions & macros -# - -############################################ -# -# Check the existence of the libraries. -# -############################################ -# This macro was taken directly from the FindQt4.cmake file that is included -# with the CMake distribution. This is NOT my work. All work was done by the -# original authors of the FindQt4.cmake file. Only minor modifications were -# made to remove references to Qt and make this file more generally applicable -# And ELSE/ENDIF pairs were removed for readability. -######################################################################### - -macro(_Boost_ADJUST_LIB_VARS basename) - if(Boost_INCLUDE_DIR ) - if(Boost_${basename}_LIBRARY_DEBUG AND Boost_${basename}_LIBRARY_RELEASE) - # if the generator supports configuration types then set - # optimized and debug libraries, or if the CMAKE_BUILD_TYPE has a value - if(CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE) - set(Boost_${basename}_LIBRARY optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - else() - # if there are no configuration types and CMAKE_BUILD_TYPE has no value - # then just use the release libraries - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) - endif() - # FIXME: This probably should be set for both cases - set(Boost_${basename}_LIBRARIES optimized ${Boost_${basename}_LIBRARY_RELEASE} debug ${Boost_${basename}_LIBRARY_DEBUG}) - endif() - - # if only the release version was found, set the debug variable also to the release version - if(Boost_${basename}_LIBRARY_RELEASE AND NOT Boost_${basename}_LIBRARY_DEBUG) - set(Boost_${basename}_LIBRARY_DEBUG ${Boost_${basename}_LIBRARY_RELEASE}) - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE}) - set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE}) - endif() - - # if only the debug version was found, set the release variable also to the debug version - if(Boost_${basename}_LIBRARY_DEBUG AND NOT Boost_${basename}_LIBRARY_RELEASE) - set(Boost_${basename}_LIBRARY_RELEASE ${Boost_${basename}_LIBRARY_DEBUG}) - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_DEBUG}) - set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_DEBUG}) - endif() - - # If the debug & release library ends up being the same, omit the keywords - if("${Boost_${basename}_LIBRARY_RELEASE}" STREQUAL "${Boost_${basename}_LIBRARY_DEBUG}") - set(Boost_${basename}_LIBRARY ${Boost_${basename}_LIBRARY_RELEASE} ) - set(Boost_${basename}_LIBRARIES ${Boost_${basename}_LIBRARY_RELEASE} ) - endif() - - if(Boost_${basename}_LIBRARY AND Boost_${basename}_HEADER) - set(Boost_${basename}_FOUND ON) - if("x${basename}" STREQUAL "xTHREAD" AND NOT TARGET Threads::Threads) - string(APPEND Boost_ERROR_REASON_THREAD " (missing dependency: Threads)") - set(Boost_THREAD_FOUND OFF) - endif() - endif() - - endif() - # Make variables changeable to the advanced user - mark_as_advanced( - Boost_${basename}_LIBRARY_RELEASE - Boost_${basename}_LIBRARY_DEBUG - ) -endmacro() - -# Detect changes in used variables. -# Compares the current variable value with the last one. -# In short form: -# v != v_LAST -> CHANGED = 1 -# v is defined, v_LAST not -> CHANGED = 1 -# v is not defined, but v_LAST is -> CHANGED = 1 -# otherwise -> CHANGED = 0 -# CHANGED is returned in variable named ${changed_var} -macro(_Boost_CHANGE_DETECT changed_var) - set(${changed_var} 0) - foreach(v ${ARGN}) - if(DEFINED _Boost_COMPONENTS_SEARCHED) - if(${v}) - if(_${v}_LAST) - string(COMPARE NOTEQUAL "${${v}}" "${_${v}_LAST}" _${v}_CHANGED) - else() - set(_${v}_CHANGED 1) - endif() - elseif(_${v}_LAST) - set(_${v}_CHANGED 1) - endif() - if(_${v}_CHANGED) - set(${changed_var} 1) - endif() - else() - set(_${v}_CHANGED 0) - endif() - endforeach() -endmacro() - -# -# Find the given library (var). -# Use 'build_type' to support different lib paths for RELEASE or DEBUG builds -# -macro(_Boost_FIND_LIBRARY var build_type) - - find_library(${var} ${ARGN}) - - if(${var}) - # If this is the first library found then save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. - if(NOT Boost_LIBRARY_DIR_${build_type}) - get_filename_component(_dir "${${var}}" PATH) - set(Boost_LIBRARY_DIR_${build_type} "${_dir}" CACHE PATH "Boost library directory ${build_type}" FORCE) - endif() - elseif(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) - # Try component-specific hints but do not save Boost_LIBRARY_DIR_[RELEASE,DEBUG]. - find_library(${var} HINTS ${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT} ${ARGN}) - endif() - - # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is known then search only there. - if(Boost_LIBRARY_DIR_${build_type}) - set(_boost_LIBRARY_SEARCH_DIRS_${build_type} ${Boost_LIBRARY_DIR_${build_type}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " Boost_LIBRARY_DIR_${build_type} = ${Boost_LIBRARY_DIR_${build_type}}" - " _boost_LIBRARY_SEARCH_DIRS_${build_type} = ${_boost_LIBRARY_SEARCH_DIRS_${build_type}}") - endif() - endif() -endmacro() - -#------------------------------------------------------------------------------- - -# -# Runs compiler with "-dumpversion" and parses major/minor -# version with a regex. -# -function(_Boost_COMPILER_DUMPVERSION _OUTPUT_VERSION) - - exec_program(${CMAKE_CXX_COMPILER} - ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion - OUTPUT_VARIABLE _boost_COMPILER_VERSION - ) - string(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2" - _boost_COMPILER_VERSION ${_boost_COMPILER_VERSION}) - - set(${_OUTPUT_VERSION} ${_boost_COMPILER_VERSION} PARENT_SCOPE) -endfunction() - -# -# Take a list of libraries with "thread" in it -# and prepend duplicates with "thread_${Boost_THREADAPI}" -# at the front of the list -# -function(_Boost_PREPEND_LIST_WITH_THREADAPI _output) - set(_orig_libnames ${ARGN}) - string(REPLACE "thread" "thread_${Boost_THREADAPI}" _threadapi_libnames "${_orig_libnames}") - set(${_output} ${_threadapi_libnames} ${_orig_libnames} PARENT_SCOPE) -endfunction() - -# -# If a library is found, replace its cache entry with its REALPATH -# -function(_Boost_SWAP_WITH_REALPATH _library _docstring) - if(${_library}) - get_filename_component(_boost_filepathreal ${${_library}} REALPATH) - unset(${_library} CACHE) - set(${_library} ${_boost_filepathreal} CACHE FILEPATH "${_docstring}") - endif() -endfunction() - -function(_Boost_CHECK_SPELLING _var) - if(${_var}) - string(TOUPPER ${_var} _var_UC) - message(FATAL_ERROR "ERROR: ${_var} is not the correct spelling. The proper spelling is ${_var_UC}.") - endif() -endfunction() - -# Guesses Boost's compiler prefix used in built library names -# Returns the guess by setting the variable pointed to by _ret -function(_Boost_GUESS_COMPILER_PREFIX _ret) - if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" - OR CMAKE_CXX_COMPILER MATCHES "icl" - OR CMAKE_CXX_COMPILER MATCHES "icpc") - if(WIN32) - set (_boost_COMPILER "-iw") - else() - set (_boost_COMPILER "-il") - endif() - elseif (GHSMULTI) - set(_boost_COMPILER "-ghs") - elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") - if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) - set(_boost_COMPILER "-vc141;-vc140") - elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) - set(_boost_COMPILER "-vc140") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) - set(_boost_COMPILER "-vc120") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) - set(_boost_COMPILER "-vc110") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) - set(_boost_COMPILER "-vc100") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) - set(_boost_COMPILER "-vc90") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) - set(_boost_COMPILER "-vc80") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13.10) - set(_boost_COMPILER "-vc71") - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 13) # Good luck! - set(_boost_COMPILER "-vc7") # yes, this is correct - else() # VS 6.0 Good luck! - set(_boost_COMPILER "-vc6") # yes, this is correct - endif() - elseif (BORLAND) - set(_boost_COMPILER "-bcb") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro") - set(_boost_COMPILER "-sw") - elseif(CMAKE_CXX_COMPILER_ID STREQUAL "XL") - set(_boost_COMPILER "-xlc") - elseif (MINGW) - if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) - set(_boost_COMPILER "-mgw") # no GCC version encoding prior to 1.34 - else() - _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) - set(_boost_COMPILER "-mgw${_boost_COMPILER_VERSION}") - endif() - elseif (UNIX) - if (CMAKE_COMPILER_IS_GNUCXX) - if(${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION} VERSION_LESS 1.34) - set(_boost_COMPILER "-gcc") # no GCC version encoding prior to 1.34 - else() - _Boost_COMPILER_DUMPVERSION(_boost_COMPILER_VERSION) - # Determine which version of GCC we have. - if(APPLE) - if(Boost_MINOR_VERSION) - if(${Boost_MINOR_VERSION} GREATER 35) - # In Boost 1.36.0 and newer, the mangled compiler name used - # on Mac OS X/Darwin is "xgcc". - set(_boost_COMPILER "-xgcc${_boost_COMPILER_VERSION}") - else() - # In Boost <= 1.35.0, there is no mangled compiler name for - # the Mac OS X/Darwin version of GCC. - set(_boost_COMPILER "") - endif() - else() - # We don't know the Boost version, so assume it's - # pre-1.36.0. - set(_boost_COMPILER "") - endif() - else() - set(_boost_COMPILER "-gcc${_boost_COMPILER_VERSION}") - endif() - endif() - endif () - else() - # TODO at least Boost_DEBUG here? - set(_boost_COMPILER "") - endif() - set(${_ret} ${_boost_COMPILER} PARENT_SCOPE) -endfunction() - -# -# Get component dependencies. Requires the dependencies to have been -# defined for the Boost release version. -# -# component - the component to check -# _ret - list of library dependencies -# -function(_Boost_COMPONENT_DEPENDENCIES component _ret) - # Note: to add a new Boost release, run - # - # % cmake -DBOOST_DIR=/path/to/boost/source -P Utilities/Scripts/BoostScanDeps.cmake - # - # The output may be added in a new block below. If it's the same as - # the previous release, simply update the version range of the block - # for the previous release. Also check if any new components have - # been added, and add any new components to - # _Boost_COMPONENT_HEADERS. - # - # This information was originally generated by running - # BoostScanDeps.cmake against every boost release to date supported - # by FindBoost: - # - # % for version in /path/to/boost/sources/* - # do - # cmake -DBOOST_DIR=$version -P Utilities/Scripts/BoostScanDeps.cmake - # done - # - # The output was then updated by search and replace with these regexes: - # - # - Strip message(STATUS) prefix dashes - # s;^-- ;; - # - Indent - # s;^set(; set(;; - # - Add conditionals - # s;Scanning /path/to/boost/sources/boost_\(.*\)_\(.*\)_\(.*); elseif(NOT Boost_VERSION VERSION_LESS \10\20\3 AND Boost_VERSION VERSION_LESS xxxx); - # - # This results in the logic seen below, but will require the xxxx - # replacing with the following Boost release version (or the next - # minor version to be released, e.g. 1.59 was the latest at the time - # of writing, making 1.60 the next, so 106000 is the needed version - # number). Identical consecutive releases were then merged together - # by updating the end range of the first block and removing the - # following redundant blocks. - # - # Running the script against all historical releases should be - # required only if the BoostScanDeps.cmake script logic is changed. - # The addition of a new release should only require it to be run - # against the new release. - set(_Boost_IMPORTED_TARGETS TRUE) - if(Boost_VERSION VERSION_LESS 103300) - message(WARNING "Imported targets and dependency information not available for Boost version ${Boost_VERSION} (all versions older than 1.33)") - set(_Boost_IMPORTED_TARGETS FALSE) - elseif(NOT Boost_VERSION VERSION_LESS 103300 AND Boost_VERSION VERSION_LESS 103500) - set(_Boost_IOSTREAMS_DEPENDENCIES regex thread) - set(_Boost_REGEX_DEPENDENCIES thread) - set(_Boost_WAVE_DEPENDENCIES filesystem thread) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 103500 AND Boost_VERSION VERSION_LESS 103600) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 103600 AND Boost_VERSION VERSION_LESS 103800) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 103800 AND Boost_VERSION VERSION_LESS 104300) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 104300 AND Boost_VERSION VERSION_LESS 104400) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 104400 AND Boost_VERSION VERSION_LESS 104500) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random serialization) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES serialization filesystem system thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 104500 AND Boost_VERSION VERSION_LESS 104700) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 104700 AND Boost_VERSION VERSION_LESS 104800) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 104800 AND Boost_VERSION VERSION_LESS 105000) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES date_time) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 105000 AND Boost_VERSION VERSION_LESS 105300) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 105300 AND Boost_VERSION VERSION_LESS 105400) - set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 105400 AND Boost_VERSION VERSION_LESS 105500) - set(_Boost_ATOMIC_DEPENDENCIES thread chrono system date_time) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 105500 AND Boost_VERSION VERSION_LESS 105600) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l regex random) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 105600 AND Boost_VERSION VERSION_LESS 105900) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 105900 AND Boost_VERSION VERSION_LESS 106000) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES log_setup date_time system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 106000 AND Boost_VERSION VERSION_LESS 106100) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_TIMER_DEPENDENCIES chrono system) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 106100 AND Boost_VERSION VERSION_LESS 106200) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106300) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - elseif(NOT Boost_VERSION VERSION_LESS 106300 AND Boost_VERSION VERSION_LESS 106500) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_COROUTINE2_DEPENDENCIES context fiber thread chrono system date_time) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - else() - if(NOT Boost_VERSION VERSION_LESS 106500) - set(_Boost_CHRONO_DEPENDENCIES system) - set(_Boost_CONTEXT_DEPENDENCIES thread chrono system date_time) - set(_Boost_COROUTINE_DEPENDENCIES context system) - set(_Boost_FIBER_DEPENDENCIES context thread chrono system date_time) - set(_Boost_FILESYSTEM_DEPENDENCIES system) - set(_Boost_IOSTREAMS_DEPENDENCIES regex) - set(_Boost_LOG_DEPENDENCIES date_time log_setup system filesystem thread regex chrono atomic) - set(_Boost_MATH_DEPENDENCIES math_c99 math_c99f math_c99l math_tr1 math_tr1f math_tr1l atomic) - set(_Boost_MPI_DEPENDENCIES serialization) - set(_Boost_MPI_PYTHON_DEPENDENCIES python mpi serialization) - set(_Boost_NUMPY_DEPENDENCIES python) - set(_Boost_RANDOM_DEPENDENCIES system) - set(_Boost_THREAD_DEPENDENCIES chrono system date_time atomic) - set(_Boost_WAVE_DEPENDENCIES filesystem system serialization thread chrono date_time atomic) - set(_Boost_WSERIALIZATION_DEPENDENCIES serialization) - endif() - if(NOT Boost_VERSION VERSION_LESS 106700) - message(WARNING "New Boost version may have incorrect or missing dependencies and imported targets") - set(_Boost_IMPORTED_TARGETS FALSE) - endif() - endif() - - string(TOUPPER ${component} uppercomponent) - set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) - set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) - - string(REGEX REPLACE ";" " " _boost_DEPS_STRING "${_Boost_${uppercomponent}_DEPENDENCIES}") - if (NOT _boost_DEPS_STRING) - set(_boost_DEPS_STRING "(none)") - endif() - # message(STATUS "Dependencies for Boost::${component}: ${_boost_DEPS_STRING}") -endfunction() - -# -# Get component headers. This is the primary header (or headers) for -# a given component, and is used to check that the headers are present -# as well as the library itself as an extra sanity check of the build -# environment. -# -# component - the component to check -# _hdrs -# -function(_Boost_COMPONENT_HEADERS component _hdrs) - # Note: new boost components will require adding here. The header - # must be present in all versions of Boost providing a library. - set(_Boost_ATOMIC_HEADERS "boost/atomic.hpp") - set(_Boost_CHRONO_HEADERS "boost/chrono.hpp") - set(_Boost_CONTAINER_HEADERS "boost/container/container_fwd.hpp") - set(_Boost_CONTEXT_HEADERS "boost/context/all.hpp") - set(_Boost_COROUTINE_HEADERS "boost/coroutine/all.hpp") - set(_Boost_EXCEPTION_HEADERS "boost/exception/exception.hpp") - set(_Boost_DATE_TIME_HEADERS "boost/date_time/date.hpp") - set(_Boost_FIBER_HEADERS "boost/fiber/all.hpp") - set(_Boost_FILESYSTEM_HEADERS "boost/filesystem/path.hpp") - set(_Boost_GRAPH_HEADERS "boost/graph/adjacency_list.hpp") - set(_Boost_GRAPH_PARALLEL_HEADERS "boost/graph/adjacency_list.hpp") - set(_Boost_IOSTREAMS_HEADERS "boost/iostreams/stream.hpp") - set(_Boost_LOCALE_HEADERS "boost/locale.hpp") - set(_Boost_LOG_HEADERS "boost/log/core.hpp") - set(_Boost_LOG_SETUP_HEADERS "boost/log/detail/setup_config.hpp") - set(_Boost_MATH_HEADERS "boost/math_fwd.hpp") - set(_Boost_MATH_C99_HEADERS "boost/math/tr1.hpp") - set(_Boost_MATH_C99F_HEADERS "boost/math/tr1.hpp") - set(_Boost_MATH_C99L_HEADERS "boost/math/tr1.hpp") - set(_Boost_MATH_TR1_HEADERS "boost/math/tr1.hpp") - set(_Boost_MATH_TR1F_HEADERS "boost/math/tr1.hpp") - set(_Boost_MATH_TR1L_HEADERS "boost/math/tr1.hpp") - set(_Boost_MPI_HEADERS "boost/mpi.hpp") - set(_Boost_MPI_PYTHON_HEADERS "boost/mpi/python/config.hpp") - set(_Boost_NUMPY_HEADERS "boost/python/numpy.hpp") - set(_Boost_PRG_EXEC_MONITOR_HEADERS "boost/test/prg_exec_monitor.hpp") - set(_Boost_PROGRAM_OPTIONS_HEADERS "boost/program_options.hpp") - set(_Boost_PYTHON_HEADERS "boost/python.hpp") - set(_Boost_RANDOM_HEADERS "boost/random.hpp") - set(_Boost_REGEX_HEADERS "boost/regex.hpp") - set(_Boost_SERIALIZATION_HEADERS "boost/serialization/serialization.hpp") - set(_Boost_SIGNALS_HEADERS "boost/signals.hpp") - set(_Boost_SYSTEM_HEADERS "boost/system/config.hpp") - set(_Boost_TEST_EXEC_MONITOR_HEADERS "boost/test/test_exec_monitor.hpp") - set(_Boost_THREAD_HEADERS "boost/thread.hpp") - set(_Boost_TIMER_HEADERS "boost/timer.hpp") - set(_Boost_TYPE_ERASURE_HEADERS "boost/type_erasure/config.hpp") - set(_Boost_UNIT_TEST_FRAMEWORK_HEADERS "boost/test/framework.hpp") - set(_Boost_WAVE_HEADERS "boost/wave.hpp") - set(_Boost_WSERIALIZATION_HEADERS "boost/archive/text_wiarchive.hpp") - if(WIN32) - set(_Boost_BZIP2_HEADERS "boost/iostreams/filter/bzip2.hpp") - set(_Boost_ZLIB_HEADERS "boost/iostreams/filter/zlib.hpp") - endif() - - string(TOUPPER ${component} uppercomponent) - set(${_hdrs} ${_Boost_${uppercomponent}_HEADERS} PARENT_SCOPE) - - string(REGEX REPLACE ";" " " _boost_HDRS_STRING "${_Boost_${uppercomponent}_HEADERS}") - if (NOT _boost_HDRS_STRING) - set(_boost_HDRS_STRING "(none)") - endif() - # message(STATUS "Headers for Boost::${component}: ${_boost_HDRS_STRING}") -endfunction() - -# -# Determine if any missing dependencies require adding to the component list. -# -# Sets _Boost_${COMPONENT}_DEPENDENCIES for each required component, -# plus _Boost_IMPORTED_TARGETS (TRUE if imported targets should be -# defined; FALSE if dependency information is unavailable). -# -# componentvar - the component list variable name -# extravar - the indirect dependency list variable name -# -# -function(_Boost_MISSING_DEPENDENCIES componentvar extravar) - # _boost_unprocessed_components - list of components requiring processing - # _boost_processed_components - components already processed (or currently being processed) - # _boost_new_components - new components discovered for future processing - # - list(APPEND _boost_unprocessed_components ${${componentvar}}) - - while(_boost_unprocessed_components) - list(APPEND _boost_processed_components ${_boost_unprocessed_components}) - foreach(component ${_boost_unprocessed_components}) - string(TOUPPER ${component} uppercomponent) - set(${_ret} ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) - _Boost_COMPONENT_DEPENDENCIES("${component}" _Boost_${uppercomponent}_DEPENDENCIES) - set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE) - set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE) - foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES}) - if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components)) - list(APPEND _boost_new_components ${componentdep}) - endif() - endforeach() - endforeach() - set(_boost_unprocessed_components ${_boost_new_components}) - unset(_boost_new_components) - endwhile() - set(_boost_extra_components ${_boost_processed_components}) - if(_boost_extra_components AND ${componentvar}) - list(REMOVE_ITEM _boost_extra_components ${${componentvar}}) - endif() - set(${componentvar} ${_boost_processed_components} PARENT_SCOPE) - set(${extravar} ${_boost_extra_components} PARENT_SCOPE) -endfunction() - -# -# Some boost libraries may require particular set of compler features. -# The very first one was `boost::fiber` introduced in Boost 1.62. -# One can check required compiler features of it in -# `${Boost_ROOT}/libs/fiber/build/Jamfile.v2`. -# -function(_Boost_COMPILER_FEATURES component _ret) - # Boost >= 1.62 and < 1.65 - if(NOT Boost_VERSION VERSION_LESS 106200 AND Boost_VERSION VERSION_LESS 106500) - set(_Boost_FIBER_COMPILER_FEATURES - cxx_alias_templates - cxx_auto_type - cxx_constexpr - cxx_defaulted_functions - cxx_final - cxx_lambdas - cxx_noexcept - cxx_nullptr - cxx_rvalue_references - cxx_thread_local - cxx_variadic_templates - ) - endif() - string(TOUPPER ${component} uppercomponent) - set(${_ret} ${_Boost_${uppercomponent}_COMPILER_FEATURES} PARENT_SCOPE) -endfunction() - -# -# Update library search directory hint variable with paths used by prebuilt boost binaries. -# -# Prebuilt windows binaries (https://sourceforge.net/projects/boost/files/boost-binaries/) -# have library directories named using MSVC compiler version and architecture. -# This function would append corresponding directories if MSVC is a current compiler, -# so having `BOOST_ROOT` would be enough to specify to find everything. -# -function(_Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS componentlibvar basedir) - if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - set(_arch_suffix 64) - else() - set(_arch_suffix 32) - endif() - if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.1) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-14.0) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-12.0) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 17) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-11.0) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-10.0) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 15) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-9.0) - elseif(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 14) - list(APPEND ${componentlibvar} ${basedir}/lib${_arch_suffix}-msvc-8.0) - endif() - set(${componentlibvar} ${${componentlibvar}} PARENT_SCOPE) - endif() -endfunction() - -# -# End functions/macros -# -#------------------------------------------------------------------------------- - -#------------------------------------------------------------------------------- -# main. -#------------------------------------------------------------------------------- - - -# If the user sets Boost_LIBRARY_DIR, use it as the default for both -# configurations. -if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR) - set(Boost_LIBRARY_DIR_RELEASE "${Boost_LIBRARY_DIR}") -endif() -if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR) - set(Boost_LIBRARY_DIR_DEBUG "${Boost_LIBRARY_DIR}") -endif() - -if(NOT DEFINED Boost_USE_DEBUG_LIBS) - set(Boost_USE_DEBUG_LIBS TRUE) -endif() -if(NOT DEFINED Boost_USE_RELEASE_LIBS) - set(Boost_USE_RELEASE_LIBS TRUE) -endif() -if(NOT DEFINED Boost_USE_MULTITHREADED) - set(Boost_USE_MULTITHREADED TRUE) -endif() -if(NOT DEFINED Boost_USE_DEBUG_RUNTIME) - set(Boost_USE_DEBUG_RUNTIME TRUE) -endif() - -# Check the version of Boost against the requested version. -if(Boost_FIND_VERSION AND NOT Boost_FIND_VERSION_MINOR) - message(SEND_ERROR "When requesting a specific version of Boost, you must provide at least the major and minor version numbers, e.g., 1.34") -endif() - -if(Boost_FIND_VERSION_EXACT) - # The version may appear in a directory with or without the patch - # level, even when the patch level is non-zero. - set(_boost_TEST_VERSIONS - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}.${Boost_FIND_VERSION_PATCH}" - "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") -else() - # The user has not requested an exact version. Among known - # versions, find those that are acceptable to the user request. - # - # Note: When adding a new Boost release, also update the dependency - # information in _Boost_COMPONENT_DEPENDENCIES and - # _Boost_COMPONENT_HEADERS. See the instructions at the top of - # _Boost_COMPONENT_DEPENDENCIES. - set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.66.0" "1.66" - "1.65.1" "1.65.0" "1.65" - "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" - "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" - "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" - "1.50.0" "1.50" "1.49.0" "1.49" "1.48.0" "1.48" "1.47.0" "1.47" "1.46.1" - "1.46.0" "1.46" "1.45.0" "1.45" "1.44.0" "1.44" "1.43.0" "1.43" "1.42.0" "1.42" - "1.41.0" "1.41" "1.40.0" "1.40" "1.39.0" "1.39" "1.38.0" "1.38" "1.37.0" "1.37" - "1.36.1" "1.36.0" "1.36" "1.35.1" "1.35.0" "1.35" "1.34.1" "1.34.0" - "1.34" "1.33.1" "1.33.0" "1.33") - - set(_boost_TEST_VERSIONS) - if(Boost_FIND_VERSION) - set(_Boost_FIND_VERSION_SHORT "${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - # Select acceptable versions. - foreach(version ${_Boost_KNOWN_VERSIONS}) - if(NOT "${version}" VERSION_LESS "${Boost_FIND_VERSION}") - # This version is high enough. - list(APPEND _boost_TEST_VERSIONS "${version}") - elseif("${version}.99" VERSION_EQUAL "${_Boost_FIND_VERSION_SHORT}.99") - # This version is a short-form for the requested version with - # the patch level dropped. - list(APPEND _boost_TEST_VERSIONS "${version}") - endif() - endforeach() - else() - # Any version is acceptable. - set(_boost_TEST_VERSIONS "${_Boost_KNOWN_VERSIONS}") - endif() -endif() - -# The reason that we failed to find Boost. This will be set to a -# user-friendly message when we fail to find some necessary piece of -# Boost. -set(Boost_ERROR_REASON) - -if(Boost_DEBUG) - # Output some of their choices - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_MULTITHREADED = ${Boost_USE_MULTITHREADED}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_LIBS = ${Boost_USE_STATIC_LIBS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_USE_STATIC_RUNTIME = ${Boost_USE_STATIC_RUNTIME}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_ADDITIONAL_VERSIONS = ${Boost_ADDITIONAL_VERSIONS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Boost_NO_SYSTEM_PATHS = ${Boost_NO_SYSTEM_PATHS}") -endif() - -# Supply Boost_LIB_DIAGNOSTIC_DEFINITIONS as a convenience target. It -# will only contain any interface definitions on WIN32, but is created -# on all platforms to keep end user code free from platform dependent -# code. Also provide convenience targets to disable autolinking and -# enable dynamic linking. -if(NOT TARGET Boost::diagnostic_definitions) - add_library(Boost::diagnostic_definitions INTERFACE IMPORTED) - add_library(Boost::disable_autolinking INTERFACE IMPORTED) - add_library(Boost::dynamic_linking INTERFACE IMPORTED) -endif() -if(WIN32) - # In windows, automatic linking is performed, so you do not have - # to specify the libraries. If you are linking to a dynamic - # runtime, then you can choose to link to either a static or a - # dynamic Boost library, the default is to do a static link. You - # can alter this for a specific library "whatever" by defining - # BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to be - # linked dynamically. Alternatively you can force all Boost - # libraries to dynamic link by defining BOOST_ALL_DYN_LINK. - - # This feature can be disabled for Boost library "whatever" by - # defining BOOST_WHATEVER_NO_LIB, or for all of Boost by defining - # BOOST_ALL_NO_LIB. - - # If you want to observe which libraries are being linked against - # then defining BOOST_LIB_DIAGNOSTIC will cause the auto-linking - # code to emit a #pragma message each time a library is selected - # for linking. - set(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC") - set_target_properties(Boost::diagnostic_definitions PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "BOOST_LIB_DIAGNOSTIC") - set_target_properties(Boost::disable_autolinking PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_NO_LIB") - set_target_properties(Boost::dynamic_linking PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "BOOST_ALL_DYN_LINK") -endif() - -_Boost_CHECK_SPELLING(Boost_ROOT) -_Boost_CHECK_SPELLING(Boost_LIBRARYDIR) -_Boost_CHECK_SPELLING(Boost_INCLUDEDIR) - -# Collect environment variable inputs as hints. Do not consider changes. -foreach(v BOOSTROOT BOOST_ROOT BOOST_INCLUDEDIR BOOST_LIBRARYDIR) - set(_env $ENV{${v}}) - if(_env) - file(TO_CMAKE_PATH "${_env}" _ENV_${v}) - else() - set(_ENV_${v} "") - endif() -endforeach() -if(NOT _ENV_BOOST_ROOT AND _ENV_BOOSTROOT) - set(_ENV_BOOST_ROOT "${_ENV_BOOSTROOT}") -endif() - -# Collect inputs and cached results. Detect changes since the last run. -if(NOT BOOST_ROOT AND BOOSTROOT) - set(BOOST_ROOT "${BOOSTROOT}") -endif() -set(_Boost_VARS_DIR - BOOST_ROOT - Boost_NO_SYSTEM_PATHS - ) - -if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Declared as CMake or Environmental Variables:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_ROOT = ${BOOST_ROOT}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_INCLUDEDIR = ${BOOST_INCLUDEDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " BOOST_LIBRARYDIR = ${BOOST_LIBRARYDIR}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_TEST_VERSIONS = ${_boost_TEST_VERSIONS}") -endif() - -# ------------------------------------------------------------------------ -# Search for Boost include DIR -# ------------------------------------------------------------------------ - -set(_Boost_VARS_INC BOOST_INCLUDEDIR Boost_INCLUDE_DIR Boost_ADDITIONAL_VERSIONS) -_Boost_CHANGE_DETECT(_Boost_CHANGE_INCDIR ${_Boost_VARS_DIR} ${_Boost_VARS_INC}) -# Clear Boost_INCLUDE_DIR if it did not change but other input affecting the -# location did. We will find a new one based on the new inputs. -if(_Boost_CHANGE_INCDIR AND NOT _Boost_INCLUDE_DIR_CHANGED) - unset(Boost_INCLUDE_DIR CACHE) -endif() - -if(NOT Boost_INCLUDE_DIR) - set(_boost_INCLUDE_SEARCH_DIRS "") - if(BOOST_INCLUDEDIR) - list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_INCLUDEDIR}) - elseif(_ENV_BOOST_INCLUDEDIR) - list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_INCLUDEDIR}) - endif() - - if( BOOST_ROOT ) - list(APPEND _boost_INCLUDE_SEARCH_DIRS ${BOOST_ROOT}/include ${BOOST_ROOT}) - elseif( _ENV_BOOST_ROOT ) - list(APPEND _boost_INCLUDE_SEARCH_DIRS ${_ENV_BOOST_ROOT}/include ${_ENV_BOOST_ROOT}) - endif() - - if( Boost_NO_SYSTEM_PATHS) - list(APPEND _boost_INCLUDE_SEARCH_DIRS NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) - else() - if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") - foreach(ver ${_Boost_KNOWN_VERSIONS}) - string(REPLACE "." "_" ver "${ver}") - list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS "C:/local/boost_${ver}") - endforeach() - endif() - list(APPEND _boost_INCLUDE_SEARCH_DIRS PATHS - C:/boost/include - C:/boost - /sw/local/include - ) - endif() - - # Try to find Boost by stepping backwards through the Boost versions - # we know about. - # Build a list of path suffixes for each version. - set(_boost_PATH_SUFFIXES) - foreach(_boost_VER ${_boost_TEST_VERSIONS}) - # Add in a path suffix, based on the required version, ideally - # we could read this from version.hpp, but for that to work we'd - # need to know the include dir already - set(_boost_BOOSTIFIED_VERSION) - - # Transform 1.35 => 1_35 and 1.36.0 => 1_36_0 - if(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)\\.([0-9]+)") - set(_boost_BOOSTIFIED_VERSION - "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}") - elseif(_boost_VER MATCHES "([0-9]+)\\.([0-9]+)") - set(_boost_BOOSTIFIED_VERSION - "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}") - endif() - - list(APPEND _boost_PATH_SUFFIXES - "boost-${_boost_BOOSTIFIED_VERSION}" - "boost_${_boost_BOOSTIFIED_VERSION}" - "boost/boost-${_boost_BOOSTIFIED_VERSION}" - "boost/boost_${_boost_BOOSTIFIED_VERSION}" - ) - - endforeach() - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Include debugging info:") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_INCLUDE_SEARCH_DIRS = ${_boost_INCLUDE_SEARCH_DIRS}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - " _boost_PATH_SUFFIXES = ${_boost_PATH_SUFFIXES}") - endif() - - # Look for a standard boost header file. - find_path(Boost_INCLUDE_DIR - NAMES boost/config.hpp - HINTS ${_boost_INCLUDE_SEARCH_DIRS} - PATH_SUFFIXES ${_boost_PATH_SUFFIXES} - ) -endif() - -# ------------------------------------------------------------------------ -# Extract version information from version.hpp -# ------------------------------------------------------------------------ - -# Set Boost_FOUND based only on header location and version. -# It will be updated below for component libraries. -if(Boost_INCLUDE_DIR) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "location of version.hpp: ${Boost_INCLUDE_DIR}/boost/version.hpp") - endif() - - # Extract Boost_VERSION and Boost_LIB_VERSION from version.hpp - set(Boost_VERSION 0) - set(Boost_LIB_VERSION "") - file(STRINGS "${Boost_INCLUDE_DIR}/boost/version.hpp" _boost_VERSION_HPP_CONTENTS REGEX "#define BOOST_(LIB_)?VERSION ") - set(_Boost_VERSION_REGEX "([0-9]+)") - set(_Boost_LIB_VERSION_REGEX "\"([0-9_]+)\"") - foreach(v VERSION LIB_VERSION) - if("${_boost_VERSION_HPP_CONTENTS}" MATCHES "#define BOOST_${v} ${_Boost_${v}_REGEX}") - set(Boost_${v} "${CMAKE_MATCH_1}") - endif() - endforeach() - unset(_boost_VERSION_HPP_CONTENTS) - - math(EXPR Boost_MAJOR_VERSION "${Boost_VERSION} / 100000") - math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") - math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - - string(APPEND Boost_ERROR_REASON - "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "version.hpp reveals boost " - "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - endif() - - if(Boost_FIND_VERSION) - # Set Boost_FOUND based on requested version. - set(_Boost_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - if("${_Boost_VERSION}" VERSION_LESS "${Boost_FIND_VERSION}") - set(Boost_FOUND 0) - set(_Boost_VERSION_AGE "old") - elseif(Boost_FIND_VERSION_EXACT AND - NOT "${_Boost_VERSION}" VERSION_EQUAL "${Boost_FIND_VERSION}") - set(Boost_FOUND 0) - set(_Boost_VERSION_AGE "new") - else() - set(Boost_FOUND 1) - endif() - if(NOT Boost_FOUND) - # State that we found a version of Boost that is too new or too old. - string(APPEND Boost_ERROR_REASON - "\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") - if (Boost_FIND_VERSION_PATCH) - string(APPEND Boost_ERROR_REASON - ".${Boost_FIND_VERSION_PATCH}") - endif () - if (NOT Boost_FIND_VERSION_EXACT) - string(APPEND Boost_ERROR_REASON " (or newer)") - endif () - string(APPEND Boost_ERROR_REASON ".") - endif () - else() - # Caller will accept any Boost version. - set(Boost_FOUND 1) - endif() -else() - set(Boost_FOUND 0) - string(APPEND Boost_ERROR_REASON - "Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") -endif() - -# ------------------------------------------------------------------------ -# Prefix initialization -# ------------------------------------------------------------------------ - -set(Boost_LIB_PREFIX "") -if ( (GHSMULTI AND Boost_USE_STATIC_LIBS) OR - (WIN32 AND Boost_USE_STATIC_LIBS AND NOT CYGWIN) ) - set(Boost_LIB_PREFIX "lib") -endif() - -if ( NOT Boost_NAMESPACE ) - set(Boost_NAMESPACE "boost") -endif() - -# ------------------------------------------------------------------------ -# Suffix initialization and compiler suffix detection. -# ------------------------------------------------------------------------ - -set(_Boost_VARS_NAME - Boost_NAMESPACE - Boost_COMPILER - Boost_THREADAPI - Boost_USE_DEBUG_PYTHON - Boost_USE_MULTITHREADED - Boost_USE_STATIC_LIBS - Boost_USE_STATIC_RUNTIME - Boost_USE_STLPORT - Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS - ) -_Boost_CHANGE_DETECT(_Boost_CHANGE_LIBNAME ${_Boost_VARS_NAME}) - -# Setting some more suffixes for the library -if (Boost_COMPILER) - set(_boost_COMPILER ${Boost_COMPILER}) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "using user-specified Boost_COMPILER = ${_boost_COMPILER}") - endif() -else() - # Attempt to guess the compiler suffix - # NOTE: this is not perfect yet, if you experience any issues - # please report them and use the Boost_COMPILER variable - # to work around the problems. - _Boost_GUESS_COMPILER_PREFIX(_boost_COMPILER) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "guessed _boost_COMPILER = ${_boost_COMPILER}") - endif() -endif() - -set (_boost_MULTITHREADED "-mt") -if( NOT Boost_USE_MULTITHREADED ) - set (_boost_MULTITHREADED "") -endif() -if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_MULTITHREADED = ${_boost_MULTITHREADED}") -endif() - -#====================== -# Systematically build up the Boost ABI tag -# http://boost.org/doc/libs/1_41_0/more/getting_started/windows.html#library-naming -set( _boost_RELEASE_ABI_TAG "-") -set( _boost_DEBUG_ABI_TAG "-") -# Key Use this library when: -# s linking statically to the C++ standard library and -# compiler runtime support libraries. -if(Boost_USE_STATIC_RUNTIME) - set( _boost_RELEASE_ABI_TAG "${_boost_RELEASE_ABI_TAG}s") - set( _boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}s") -endif() -# g using debug versions of the standard and runtime -# support libraries -if(WIN32 AND Boost_USE_DEBUG_RUNTIME) - if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" - OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") - string(APPEND _boost_DEBUG_ABI_TAG "g") - endif() -endif() -# y using special debug build of python -if(Boost_USE_DEBUG_PYTHON) - string(APPEND _boost_DEBUG_ABI_TAG "y") -endif() -# d using a debug version of your code -string(APPEND _boost_DEBUG_ABI_TAG "d") -# p using the STLport standard library rather than the -# default one supplied with your compiler -if(Boost_USE_STLPORT) - string(APPEND _boost_RELEASE_ABI_TAG "p") - string(APPEND _boost_DEBUG_ABI_TAG "p") -endif() -# n using the STLport deprecated "native iostreams" feature -if(Boost_USE_STLPORT_DEPRECATED_NATIVE_IOSTREAMS) - string(APPEND _boost_RELEASE_ABI_TAG "n") - string(APPEND _boost_DEBUG_ABI_TAG "n") -endif() - -if(Boost_VERSION VERSION_GREATER_EQUAL 106600) - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - set( _boost_ABI_TAG_PLATFORM "x64") - else() - set( _boost_ABI_TAG_PLATFORM "x32") - endif() - foreach( _boost_abi_tag _boost_RELEASE_ABI_TAG _boost_DEBUG_ABI_TAG ) - if( ${${_boost_abi_tag}} STREQUAL "-" ) - string( APPEND ${_boost_abi_tag} ${_boost_ABI_TAG_PLATFORM} ) - else() - string( APPEND ${_boost_abi_tag} "-${_boost_ABI_TAG_PLATFORM}" ) - endif() - endforeach() -endif() - -if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_RELEASE_ABI_TAG = ${_boost_RELEASE_ABI_TAG}") - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_DEBUG_ABI_TAG = ${_boost_DEBUG_ABI_TAG}") -endif() - -# ------------------------------------------------------------------------ -# Begin finding boost libraries -# ------------------------------------------------------------------------ - -set(_Boost_VARS_LIB "") -foreach(c DEBUG RELEASE) - set(_Boost_VARS_LIB_${c} BOOST_LIBRARYDIR Boost_LIBRARY_DIR_${c}) - list(APPEND _Boost_VARS_LIB ${_Boost_VARS_LIB_${c}}) - _Boost_CHANGE_DETECT(_Boost_CHANGE_LIBDIR_${c} ${_Boost_VARS_DIR} ${_Boost_VARS_LIB_${c}} Boost_INCLUDE_DIR) - # Clear Boost_LIBRARY_DIR_${c} if it did not change but other input affecting the - # location did. We will find a new one based on the new inputs. - if(_Boost_CHANGE_LIBDIR_${c} AND NOT _Boost_LIBRARY_DIR_${c}_CHANGED) - unset(Boost_LIBRARY_DIR_${c} CACHE) - endif() - - # If Boost_LIBRARY_DIR_[RELEASE,DEBUG] is set, prefer its value. - if(Boost_LIBRARY_DIR_${c}) - set(_boost_LIBRARY_SEARCH_DIRS_${c} ${Boost_LIBRARY_DIR_${c}} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH) - else() - set(_boost_LIBRARY_SEARCH_DIRS_${c} "") - if(BOOST_LIBRARYDIR) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_LIBRARYDIR}) - elseif(_ENV_BOOST_LIBRARYDIR) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_LIBRARYDIR}) - endif() - - if(BOOST_ROOT) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${BOOST_ROOT}/lib ${BOOST_ROOT}/stage/lib) - _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${BOOST_ROOT}") - elseif(_ENV_BOOST_ROOT) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} ${_ENV_BOOST_ROOT}/lib ${_ENV_BOOST_ROOT}/stage/lib) - _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${_ENV_BOOST_ROOT}") - endif() - - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} - ${Boost_INCLUDE_DIR}/lib - ${Boost_INCLUDE_DIR}/../lib - ${Boost_INCLUDE_DIR}/stage/lib - ) - _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "${Boost_INCLUDE_DIR}/..") - if( Boost_NO_SYSTEM_PATHS ) - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} NO_CMAKE_SYSTEM_PATH NO_SYSTEM_ENVIRONMENT_PATH) - else() - foreach(ver ${_Boost_KNOWN_VERSIONS}) - string(REPLACE "." "_" ver "${ver}") - _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/local/boost_${ver}") - endforeach() - _Boost_UPDATE_WINDOWS_LIBRARY_SEARCH_DIRS_WITH_PREBUILT_PATHS(_boost_LIBRARY_SEARCH_DIRS_${c} "C:/boost") - list(APPEND _boost_LIBRARY_SEARCH_DIRS_${c} PATHS - C:/boost/lib - C:/boost - /sw/local/lib - ) - endif() - endif() -endforeach() - -if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "_boost_LIBRARY_SEARCH_DIRS_RELEASE = ${_boost_LIBRARY_SEARCH_DIRS_RELEASE}" - "_boost_LIBRARY_SEARCH_DIRS_DEBUG = ${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") -endif() - -# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES -if( Boost_USE_STATIC_LIBS ) - set( _boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) - if(WIN32) - list(INSERT CMAKE_FIND_LIBRARY_SUFFIXES 0 .lib .a) - else() - set(CMAKE_FIND_LIBRARY_SUFFIXES .a) - endif() -endif() - -# We want to use the tag inline below without risking double dashes -if(_boost_RELEASE_ABI_TAG) - if(${_boost_RELEASE_ABI_TAG} STREQUAL "-") - set(_boost_RELEASE_ABI_TAG "") - endif() -endif() -if(_boost_DEBUG_ABI_TAG) - if(${_boost_DEBUG_ABI_TAG} STREQUAL "-") - set(_boost_DEBUG_ABI_TAG "") - endif() -endif() - -# The previous behavior of FindBoost when Boost_USE_STATIC_LIBS was enabled -# on WIN32 was to: -# 1. Search for static libs compiled against a SHARED C++ standard runtime library (use if found) -# 2. Search for static libs compiled against a STATIC C++ standard runtime library (use if found) -# We maintain this behavior since changing it could break people's builds. -# To disable the ambiguous behavior, the user need only -# set Boost_USE_STATIC_RUNTIME either ON or OFF. -set(_boost_STATIC_RUNTIME_WORKAROUND false) -if(WIN32 AND Boost_USE_STATIC_LIBS) - if(NOT DEFINED Boost_USE_STATIC_RUNTIME) - set(_boost_STATIC_RUNTIME_WORKAROUND TRUE) - endif() -endif() - -# On versions < 1.35, remove the System library from the considered list -# since it wasn't added until 1.35. -if(Boost_VERSION AND Boost_FIND_COMPONENTS) - if(Boost_VERSION LESS 103500) - list(REMOVE_ITEM Boost_FIND_COMPONENTS system) - endif() -endif() - -# Additional components may be required via component dependencies. -# Add any missing components to the list. -_Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS) - -# If thread is required, get the thread libs as a dependency -if("thread" IN_LIST Boost_FIND_COMPONENTS) - if(Boost_FIND_QUIETLY) - set(_Boost_find_quiet QUIET) - else() - set(_Boost_find_quiet "") - endif() - find_package(Threads ${_Boost_find_quiet}) - unset(_Boost_find_quiet) -endif() - -# If the user changed any of our control inputs flush previous results. -if(_Boost_CHANGE_LIBDIR_DEBUG OR _Boost_CHANGE_LIBDIR_RELEASE OR _Boost_CHANGE_LIBNAME) - foreach(COMPONENT ${_Boost_COMPONENTS_SEARCHED}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - foreach(c DEBUG RELEASE) - set(_var Boost_${UPPERCOMPONENT}_LIBRARY_${c}) - unset(${_var} CACHE) - set(${_var} "${_var}-NOTFOUND") - endforeach() - endforeach() - set(_Boost_COMPONENTS_SEARCHED "") -endif() - -foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - - set( _boost_docstring_release "Boost ${COMPONENT} library (release)") - set( _boost_docstring_debug "Boost ${COMPONENT} library (debug)") - - # Compute component-specific hints. - set(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT "") - if(${COMPONENT} STREQUAL "mpi" OR ${COMPONENT} STREQUAL "mpi_python" OR - ${COMPONENT} STREQUAL "graph_parallel") - foreach(lib ${MPI_CXX_LIBRARIES} ${MPI_C_LIBRARIES}) - if(IS_ABSOLUTE "${lib}") - get_filename_component(libdir "${lib}" PATH) - string(REPLACE "\\" "/" libdir "${libdir}") - list(APPEND _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT ${libdir}) - endif() - endforeach() - endif() - - # Consolidate and report component-specific hints. - if(_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) - list(REMOVE_DUPLICATES _Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT) - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Component-specific library search paths for ${COMPONENT}: " - "${_Boost_FIND_LIBRARY_HINTS_FOR_COMPONENT}") - endif() - endif() - - # - # Find headers - # - _Boost_COMPONENT_HEADERS("${COMPONENT}" Boost_${UPPERCOMPONENT}_HEADER_NAME) - # Look for a standard boost header file. - if(Boost_${UPPERCOMPONENT}_HEADER_NAME) - if(EXISTS "${Boost_INCLUDE_DIR}/${Boost_${UPPERCOMPONENT}_HEADER_NAME}") - set(Boost_${UPPERCOMPONENT}_HEADER ON) - else() - set(Boost_${UPPERCOMPONENT}_HEADER OFF) - endif() - else() - set(Boost_${UPPERCOMPONENT}_HEADER ON) - message(WARNING "No header defined for ${COMPONENT}; skipping header check") - endif() - - # - # Find RELEASE libraries - # - unset(_boost_RELEASE_NAMES) - foreach(compiler IN LISTS _boost_COMPILER) - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} ) - endforeach() - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_ABI_TAG} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_RELEASE_STATIC_ABI_TAG "-s${_boost_RELEASE_ABI_TAG}") - foreach(compiler IN LISTS _boost_COMPILER) - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) - endforeach() - list(APPEND _boost_RELEASE_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_RELEASE_STATIC_ABI_TAG} ) - endif() - if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_RELEASE_NAMES ${_boost_RELEASE_NAMES}) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Searching for ${UPPERCOMPONENT}_LIBRARY_RELEASE: ${_boost_RELEASE_NAMES}") - endif() - - # if Boost_LIBRARY_DIR_RELEASE is not defined, - # but Boost_LIBRARY_DIR_DEBUG is, look there first for RELEASE libs - if(NOT Boost_LIBRARY_DIR_RELEASE AND Boost_LIBRARY_DIR_DEBUG) - list(INSERT _boost_LIBRARY_SEARCH_DIRS_RELEASE 0 ${Boost_LIBRARY_DIR_DEBUG}) - endif() - - # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_RELEASE}") - - if(Boost_USE_RELEASE_LIBS) - _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE RELEASE - NAMES ${_boost_RELEASE_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} - NAMES_PER_DIR - DOC "${_boost_docstring_release}" - ) - endif() - - # - # Find DEBUG libraries - # - unset(_boost_DEBUG_NAMES) - foreach(compiler IN LISTS _boost_COMPILER) - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} ) - endforeach() - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_ABI_TAG} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT} ) - if(_boost_STATIC_RUNTIME_WORKAROUND) - set(_boost_DEBUG_STATIC_ABI_TAG "-s${_boost_DEBUG_ABI_TAG}") - foreach(compiler IN LISTS _boost_COMPILER) - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${compiler}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) - endforeach() - list(APPEND _boost_DEBUG_NAMES - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG}-${Boost_LIB_VERSION} - ${Boost_LIB_PREFIX}${Boost_NAMESPACE}_${COMPONENT}${_boost_MULTITHREADED}${_boost_DEBUG_STATIC_ABI_TAG} ) - endif() - if(Boost_THREADAPI AND ${COMPONENT} STREQUAL "thread") - _Boost_PREPEND_LIST_WITH_THREADAPI(_boost_DEBUG_NAMES ${_boost_DEBUG_NAMES}) - endif() - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " - "Searching for ${UPPERCOMPONENT}_LIBRARY_DEBUG: ${_boost_DEBUG_NAMES}") - endif() - - # if Boost_LIBRARY_DIR_DEBUG is not defined, - # but Boost_LIBRARY_DIR_RELEASE is, look there first for DEBUG libs - if(NOT Boost_LIBRARY_DIR_DEBUG AND Boost_LIBRARY_DIR_RELEASE) - list(INSERT _boost_LIBRARY_SEARCH_DIRS_DEBUG 0 ${Boost_LIBRARY_DIR_RELEASE}) - endif() - - # Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing. - string(REPLACE "\\" "/" _boost_LIBRARY_SEARCH_DIRS_tmp "${_boost_LIBRARY_SEARCH_DIRS_DEBUG}") - - if(Boost_USE_DEBUG_LIBS) - _Boost_FIND_LIBRARY(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG DEBUG - NAMES ${_boost_DEBUG_NAMES} - HINTS ${_boost_LIBRARY_SEARCH_DIRS_tmp} - NAMES_PER_DIR - DOC "${_boost_docstring_debug}" - ) - endif () - - if(Boost_REALPATH) - _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE "${_boost_docstring_release}") - _Boost_SWAP_WITH_REALPATH(Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG "${_boost_docstring_debug}" ) - endif() - - _Boost_ADJUST_LIB_VARS(${UPPERCOMPONENT}) - - # Check if component requires some compiler features - _Boost_COMPILER_FEATURES(${COMPONENT} _Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) - -endforeach() - -# Restore the original find library ordering -if( Boost_USE_STATIC_LIBS ) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${_boost_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) -endif() - -# ------------------------------------------------------------------------ -# End finding boost libraries -# ------------------------------------------------------------------------ - -set(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR}) -set(Boost_LIBRARY_DIRS) -if(Boost_LIBRARY_DIR_RELEASE) - list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_RELEASE}) -endif() -if(Boost_LIBRARY_DIR_DEBUG) - list(APPEND Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR_DEBUG}) -endif() -if(Boost_LIBRARY_DIRS) - list(REMOVE_DUPLICATES Boost_LIBRARY_DIRS) -endif() - -# The above setting of Boost_FOUND was based only on the header files. -# Update it for the requested component libraries. -if(Boost_FOUND) - # The headers were found. Check for requested component libs. - set(_boost_CHECKED_COMPONENT FALSE) - set(_Boost_MISSING_COMPONENTS "") - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} COMPONENT) - set(_boost_CHECKED_COMPONENT TRUE) - if(NOT Boost_${COMPONENT}_FOUND) - string(TOLOWER ${COMPONENT} COMPONENT) - list(APPEND _Boost_MISSING_COMPONENTS ${COMPONENT}) - endif() - endforeach() - if(_Boost_MISSING_COMPONENTS AND _Boost_EXTRA_FIND_COMPONENTS) - # Optional indirect dependencies are not counted as missing. - list(REMOVE_ITEM _Boost_MISSING_COMPONENTS ${_Boost_EXTRA_FIND_COMPONENTS}) - endif() - - if(Boost_DEBUG) - message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] Boost_FOUND = ${Boost_FOUND}") - endif() - - if (_Boost_MISSING_COMPONENTS) - set(Boost_FOUND 0) - # We were unable to find some libraries, so generate a sensible - # error message that lists the libraries we were unable to find. - string(APPEND Boost_ERROR_REASON - "\nCould not find the following") - if(Boost_USE_STATIC_LIBS) - string(APPEND Boost_ERROR_REASON " static") - endif() - string(APPEND Boost_ERROR_REASON - " Boost libraries:\n") - foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - string(APPEND Boost_ERROR_REASON - " ${Boost_NAMESPACE}_${COMPONENT}${Boost_ERROR_REASON_${UPPERCOMPONENT}}\n") - endforeach() - - list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) - list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) - if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - string(APPEND Boost_ERROR_REASON - "No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - else () - string(APPEND Boost_ERROR_REASON - "Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") - endif () - endif () - - if( NOT Boost_LIBRARY_DIRS AND NOT _boost_CHECKED_COMPONENT ) - # Compatibility Code for backwards compatibility with CMake - # 2.4's FindBoost module. - - # Look for the boost library path. - # Note that the user may not have installed any libraries - # so it is quite possible the Boost_LIBRARY_DIRS may not exist. - set(_boost_LIB_DIR ${Boost_INCLUDE_DIR}) - - if("${_boost_LIB_DIR}" MATCHES "boost-[0-9]+") - get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - endif() - - if("${_boost_LIB_DIR}" MATCHES "/include$") - # Strip off the trailing "/include" in the path. - get_filename_component(_boost_LIB_DIR ${_boost_LIB_DIR} PATH) - endif() - - if(EXISTS "${_boost_LIB_DIR}/lib") - string(APPEND _boost_LIB_DIR /lib) - elseif(EXISTS "${_boost_LIB_DIR}/stage/lib") - string(APPEND _boost_LIB_DIR "/stage/lib") - else() - set(_boost_LIB_DIR "") - endif() - - if(_boost_LIB_DIR AND EXISTS "${_boost_LIB_DIR}") - set(Boost_LIBRARY_DIRS ${_boost_LIB_DIR}) - endif() - - endif() -else() - # Boost headers were not found so no components were found. - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - set(Boost_${UPPERCOMPONENT}_FOUND 0) - endforeach() -endif() - -# ------------------------------------------------------------------------ -# Add imported targets -# ------------------------------------------------------------------------ - -if(Boost_FOUND) - # For header-only libraries - if(NOT TARGET Boost::boost) - add_library(Boost::boost INTERFACE IMPORTED) - if(Boost_INCLUDE_DIRS) - set_target_properties(Boost::boost PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") - endif() - endif() - - foreach(COMPONENT ${Boost_FIND_COMPONENTS}) - if(_Boost_IMPORTED_TARGETS AND NOT TARGET Boost::${COMPONENT}) - string(TOUPPER ${COMPONENT} UPPERCOMPONENT) - if(Boost_${UPPERCOMPONENT}_FOUND) - if(Boost_USE_STATIC_LIBS) - add_library(Boost::${COMPONENT} STATIC IMPORTED) - else() - # Even if Boost_USE_STATIC_LIBS is OFF, we might have static - # libraries as a result. - add_library(Boost::${COMPONENT} UNKNOWN IMPORTED) - endif() - if(Boost_INCLUDE_DIRS) - set_target_properties(Boost::${COMPONENT} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${Boost_INCLUDE_DIRS}") - endif() - if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY}") - set_target_properties(Boost::${COMPONENT} PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" - IMPORTED_LOCATION "${Boost_${UPPERCOMPONENT}_LIBRARY}") - endif() - if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") - set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY - IMPORTED_CONFIGURATIONS RELEASE) - set_target_properties(Boost::${COMPONENT} PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX" - IMPORTED_LOCATION_RELEASE "${Boost_${UPPERCOMPONENT}_LIBRARY_RELEASE}") - endif() - if(EXISTS "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") - set_property(TARGET Boost::${COMPONENT} APPEND PROPERTY - IMPORTED_CONFIGURATIONS DEBUG) - set_target_properties(Boost::${COMPONENT} PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX" - IMPORTED_LOCATION_DEBUG "${Boost_${UPPERCOMPONENT}_LIBRARY_DEBUG}") - endif() - if(_Boost_${UPPERCOMPONENT}_DEPENDENCIES) - unset(_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES) - foreach(dep ${_Boost_${UPPERCOMPONENT}_DEPENDENCIES}) - list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Boost::${dep}) - endforeach() - if(COMPONENT STREQUAL "thread") - list(APPEND _Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES Threads::Threads) - endif() - set_target_properties(Boost::${COMPONENT} PROPERTIES - INTERFACE_LINK_LIBRARIES "${_Boost_${UPPERCOMPONENT}_TARGET_DEPENDENCIES}") - endif() - if(_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES) - set_target_properties(Boost::${COMPONENT} PROPERTIES - INTERFACE_COMPILE_FEATURES "${_Boost_${UPPERCOMPONENT}_COMPILER_FEATURES}") - endif() - endif() - endif() - endforeach() -endif() - -# ------------------------------------------------------------------------ -# Notification to end user about what was found -# ------------------------------------------------------------------------ - -set(Boost_LIBRARIES "") -if(Boost_FOUND) - if(NOT Boost_FIND_QUIETLY) - message(STATUS "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - if(Boost_FIND_COMPONENTS) - message(STATUS "Found the following Boost libraries:") - endif() - endif() - foreach( COMPONENT ${Boost_FIND_COMPONENTS} ) - string( TOUPPER ${COMPONENT} UPPERCOMPONENT ) - if( Boost_${UPPERCOMPONENT}_FOUND ) - if(NOT Boost_FIND_QUIETLY) - message (STATUS " ${COMPONENT}") - endif() - list(APPEND Boost_LIBRARIES ${Boost_${UPPERCOMPONENT}_LIBRARY}) - endif() - endforeach() -else() - if(Boost_FIND_REQUIRED) - message(SEND_ERROR "Unable to find the requested Boost libraries.\n${Boost_ERROR_REASON}") - else() - if(NOT Boost_FIND_QUIETLY) - # we opt not to automatically output Boost_ERROR_REASON here as - # it could be quite lengthy and somewhat imposing in its requests - # Since Boost is not always a required dependency we'll leave this - # up to the end-user. - if(Boost_DEBUG OR Boost_DETAILED_FAILURE_MSG) - message(STATUS "Could NOT find Boost\n${Boost_ERROR_REASON}") - else() - message(STATUS "Could NOT find Boost") - endif() - endif() - endif() -endif() - -# Configure display of cache entries in GUI. -foreach(v BOOSTROOT BOOST_ROOT ${_Boost_VARS_INC} ${_Boost_VARS_LIB}) - get_property(_type CACHE ${v} PROPERTY TYPE) - if(_type) - set_property(CACHE ${v} PROPERTY ADVANCED 1) - if("x${_type}" STREQUAL "xUNINITIALIZED") - if("x${v}" STREQUAL "xBoost_ADDITIONAL_VERSIONS") - set_property(CACHE ${v} PROPERTY TYPE STRING) - else() - set_property(CACHE ${v} PROPERTY TYPE PATH) - endif() - endif() - endif() -endforeach() - -# Record last used values of input variables so we can -# detect on the next run if the user changed them. -foreach(v - ${_Boost_VARS_INC} ${_Boost_VARS_LIB} - ${_Boost_VARS_DIR} ${_Boost_VARS_NAME} - ) - if(DEFINED ${v}) - set(_${v}_LAST "${${v}}" CACHE INTERNAL "Last used ${v} value.") - else() - unset(_${v}_LAST CACHE) - endif() -endforeach() - -# Maintain a persistent list of components requested anywhere since -# the last flush. -set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}") -list(APPEND _Boost_COMPONENTS_SEARCHED ${Boost_FIND_COMPONENTS}) -list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED) -list(SORT _Boost_COMPONENTS_SEARCHED) -set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}" - CACHE INTERNAL "Components requested for this build tree.") - -# Restore project's policies -cmake_policy(POP) diff --git a/cmake/CMakeBuild/cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu1804.cmake b/cmake/CMakeBuild/cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu1804.cmake new file mode 100644 index 0000000000000000000000000000000000000000..9c0ec5c3f62bc2d64d4a18b4adfc2abe63a818d3 --- /dev/null +++ b/cmake/CMakeBuild/cmake/toolchains/aarch64-linux-gnu-gcc-ubuntu1804.cmake @@ -0,0 +1,46 @@ +# name of the target operating system +set( CMAKE_SYSTEM_NAME Linux ) +set( CMAKE_SYSTEM_PROCESSOR aarch64 ) + +set( GNU_MACHINE "aarch64-linux-gnu" ) + +# which compilers to use for C and C++ +set( CMAKE_C_COMPILER ${GNU_MACHINE}-gcc ) +set( CMAKE_CXX_COMPILER ${GNU_MACHINE}-g++ ) + +# here is the target environment located +if( NOT DEFINED ARM_LINUX_SYSROOT AND DEFINED GNU_MACHINE ) + set( ARM_LINUX_SYSROOT /usr/${GNU_MACHINE}${FLOAT_ABI_SUFFIX} ) +endif() + +list( APPEND CMAKE_FIND_ROOT_PATH ${ARM_LINUX_SYSROOT} ) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) +set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) + +set( USE_OPENCV_TOOLCHAIN_FLAGS ON ) +if( USE_OPENCV_TOOLCHAIN_FLAGS ) + # --- + # Snatched from OpenCV 3.4.2-1 + # --- + + #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi") + #set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fdata-sections -Wa,--noexecstack -fsigned-char -Wno-psabi") + set( CMAKE_CXX_FLAGS_INIT "-fdata-sections -Wa,--noexecstack -fsigned-char" ) + set( CMAKE_C_FLAGS_INIT "-fdata-sections -Wa,--noexecstack -fsigned-char" ) + + set(ARM_LINKER_FLAGS "-Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now") + + #set(CMAKE_SHARED_LINKER_FLAGS "${ARM_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS}") + #set(CMAKE_MODULE_LINKER_FLAGS "${ARM_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}") + #set(CMAKE_EXE_LINKER_FLAGS "${ARM_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}") + + set( CMAKE_SHARED_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" ) + set( CMAKE_MODULE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" ) + set( CMAKE_EXE_LINKER_FLAGS_INIT "${ARM_LINKER_FLAGS}" ) + +endif() diff --git a/cmake/CMakeBuild/cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu1804.cmake b/cmake/CMakeBuild/cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu1804.cmake new file mode 100644 index 0000000000000000000000000000000000000000..2b5fb9816e7827651527607ee9094b90d2bc2a4d --- /dev/null +++ b/cmake/CMakeBuild/cmake/toolchains/x86_64-w64-mingw32-gcc-posix-ubuntu1804.cmake @@ -0,0 +1,31 @@ +# name of the target operating system +set( CMAKE_SYSTEM_NAME Windows ) +set( CMAKE_SYSTEM_PROCESSOR x86_64 ) # or AMD64? + +# which compilers to use for C and C++ +set( CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix ) +set( CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix ) +set( CMAKE_RC_COMPILER x86_64-w64-mingw32-windres ) + +# here is the target environment located +#SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc /home/alex/mingw-install ) +# +# /usr/share/mingw-w64/include +# /usr/x86_64-w64-mingw32/lib +# /usr/x86_64-w64-mingw32/include +# /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include +# /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/libstdc++.a +set( CMAKE_FIND_ROOT_PATH /usr/share/mingw-w64 /usr/x86_64-w64-mingw32 /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix ) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) +set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) +set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) + +set( bb_MINGW_RUNTIME_FILES + /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libstdc++-6.dll + /usr/lib/gcc/x86_64-w64-mingw32/7.3-posix/libgcc_s_seh-1.dll + /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll ) + diff --git a/cmake/CMakeBuild/lldb/CMakeBuildLldbExt.py b/cmake/CMakeBuild/lldb/CMakeBuildLldbExt.py old mode 100644 new mode 100755 diff --git a/cmake/CMakeBuild/lldb/CMakeLists.txt b/cmake/CMakeBuild/lldb/CMakeLists.txt index c98ec7ac6017d561593afd5a211beb6c516001fa..a947e4cd3051c8ecbb7ce2d0e79dacfcaca3143c 100644 --- a/cmake/CMakeBuild/lldb/CMakeLists.txt +++ b/cmake/CMakeBuild/lldb/CMakeLists.txt @@ -1,4 +1,4 @@ -# CMakeBuild/lldb/CMakeLists.txt +# CMakeBuild/CMakeBuild/lldb/CMakeLists.txt if( NOT DEFINED LLDB_INSTALL_ROOT ) set( LLDB_INSTALL_ROOT "$ENV{HOME}/.lldb.d" ) @@ -15,11 +15,6 @@ if( NOT DEFINED ENABLE_LLDBINIT_UPDATE ) message( STATUS "${CMAKE_CURRENT_LIST_FILE}: ENABLE_LLDBINIT_UPDATE not set, using default ${ENABLE_LLDBINIT_UPDATE}." ) endif() -#foreach( _vars_required LLDB_INSTALL_ROOT LLDBINIT_FILE ENABLE_LLDBINIT_UPDATE ) -# if( NOT DEFINED ${_vars_required} ) -# message( FATAL_ERROR "Required variable ${_vars_required} is not defined, please check your top-level CMakeLists.txt." ) -# endif() -#endforeach() set( LLDB_INSTALL_DIR ${LLDB_INSTALL_ROOT}/${PROJECT_NAME} ) diff --git a/cmake/modules/GetSVN.cmake b/cmake/modules/GetSVN.cmake deleted file mode 100644 index c9609a0f3e1fd0fa72b8ba62a68df2801f188bbf..0000000000000000000000000000000000000000 --- a/cmake/modules/GetSVN.cmake +++ /dev/null @@ -1,73 +0,0 @@ -if( GENERATE_DUMMY ) - file( WRITE svnrevision.h.in "\n" ) -else() - include( FindSubversion ) - - if( SUBVERSION_FOUND ) - # Copied from FindSubversion: need to change to fix the SEND_ERROR problem - - # the subversion commands should be executed with the C locale, otherwise - # the message (which are parsed) may be translated, Alex - set( _Subversion_SAVED_LC_ALL "$ENV{LC_ALL}" ) - set( ENV{LC_ALL} C ) - - execute_process( COMMAND ${Subversion_SVN_EXECUTABLE} info ${SOURCE_DIR} - OUTPUT_VARIABLE NEXT_WC_INFO - ERROR_VARIABLE Subversion_svn_info_error - RESULT_VARIABLE Subversion_svn_info_result - OUTPUT_STRIP_TRAILING_WHITESPACE ) - - if( NOT ${Subversion_svn_info_result} EQUAL 0 ) - message( "${SOURCE_DIR} is not a subversion directory" ) - file( WRITE svnrevision.h.in "\n" ) - else() - string( REGEX REPLACE "^(.*\n)?URL: ([^\n]+).*" - "\\2" NEXT_WC_URL "${NEXT_WC_INFO}" ) - string( REGEX REPLACE "^(.*\n)?Repository Root: ([^\n]+).*" - "\\2" NEXT_WC_ROOT "${NEXT_WC_INFO}" ) - string( REGEX REPLACE "^(.*\n)?Revision: ([^\n]+).*" - "\\2" NEXT_WC_REVISION "${NEXT_WC_INFO}" ) - string( REGEX REPLACE "^(.*\n)?Last Changed Author: ([^\n]+).*" - "\\2" NEXT_WC_LAST_CHANGED_AUTHOR "${NEXT_WC_INFO}" ) - string( REGEX REPLACE "^(.*\n)?Last Changed Rev: ([^\n]+).*" - "\\2" NEXT_WC_LAST_CHANGED_REV "${NEXT_WC_INFO}" ) - string( REGEX REPLACE "^(.*\n)?Last Changed Date: ([^\n]+).*" - "\\2" NEXT_WC_LAST_CHANGED_DATE "${NEXT_WC_INFO}" ) - - string( REGEX REPLACE "^(.*)?:(.*)" - "\\2" NEXT_WC_URL_PATH "${NEXT_WC_URL}" ) - string( REGEX REPLACE "^(.*)?:(.*)" - "\\2" NEXT_WC_ROOT_PATH "${NEXT_WC_ROOT}" ) - - file( RELATIVE_PATH NEXT_WC_RELATIVE_URL "${NEXT_WC_ROOT_PATH}" "${NEXT_WC_URL_PATH}" ) - - execute_process( COMMAND ${Subversion_SVN_EXECUTABLE} status ${SOURCE_DIR} - OUTPUT_VARIABLE NEXT_WC_STATUS - ERROR_VARIABLE Subversion_svn_status_error - RESULT_VARIABLE Subversion_svn_status_result - OUTPUT_STRIP_TRAILING_WHITESPACE ) - - if( ${Subversion_svn_status_result} EQUAL 0 ) - if( NEXT_WC_STATUS ) - set( NEXT_WC_STATUS "M" ) - else() - set( NEXT_WC_STATUS "" ) - endif() - endif() - - # write a file with the SVNVERSION define - file( WRITE svnrevision.h.in "#define SVNREVISION \"${NEXT_WC_LAST_CHANGED_REV}${NEXT_WC_STATUS}\"\n" ) - file( APPEND svnrevision.h.in "#define SVNRELATIVEURL \"${NEXT_WC_RELATIVE_URL}\"\n" ) - endif() - - # restore the previous LC_ALL - set( ENV{LC_ALL} ${_Subversion_SAVED_LC_ALL} ) - else() - message( "Subversion executable not found!" ) - file( WRITE svnrevision.h.in "\n" ) - endif() -endif() - -# copy the file to the final header only if the version changes -# reduces needless rebuilds -execute_process( COMMAND ${CMAKE_COMMAND} -E copy_if_different svnrevision.h.in svnrevision.h ) diff --git a/source/Lib/CommonAnalyserLib/CMakeLists.txt b/source/Lib/CommonAnalyserLib/CMakeLists.txt index e8b16075b0e043e46ac705aba60774cb22366242..0fd16c8367e1c2756ebb970de74309327d285668 100644 --- a/source/Lib/CommonAnalyserLib/CMakeLists.txt +++ b/source/Lib/CommonAnalyserLib/CMakeLists.txt @@ -92,7 +92,7 @@ set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_ if( MSVC ) set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX" ) set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) -elseif( UNIX ) +elseif( UNIX OR MINGW ) set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" ) set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx" ) diff --git a/source/Lib/CommonLib/CMakeLists.txt b/source/Lib/CommonLib/CMakeLists.txt index 54bba996e1a60d13fcbe63b4bba30c4f8100c58e..06cb4088c813a94e400fb9379486eb14fc5050f1 100644 --- a/source/Lib/CommonLib/CMakeLists.txt +++ b/source/Lib/CommonLib/CMakeLists.txt @@ -91,7 +91,7 @@ set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_DEFINITIONS USE_ if( MSVC ) set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX" ) set_property( SOURCE ${AVX2_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "/arch:AVX2" ) -elseif( UNIX ) +elseif( UNIX OR MINGW ) set_property( SOURCE ${SSE41_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.1" ) set_property( SOURCE ${SSE42_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-msse4.2" ) set_property( SOURCE ${AVX_SRC_FILES} APPEND PROPERTY COMPILE_FLAGS "-mavx" )