aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordimdim11 <dimdim11@yandex-team.com>2024-10-03 17:41:15 +0300
committerdimdim11 <dimdim11@yandex-team.com>2024-10-03 17:51:35 +0300
commitdc3750a31cc61b7bd4d7d5b6195ddfd6f3843c7d (patch)
treeb8f9cb5a7ac719262790cdcf55af3284a1909054
parentd7525e0eec8e7242a5cedd5fbdaf3bdaaeea02c7 (diff)
downloadydb-dc3750a31cc61b7bd4d7d5b6195ddfd6f3843c7d.tar.gz
Remove hardcoded-cmake generator files
Remove hardcoded-cmake generator files commit_hash:133622cd3a729cbb7cbfdee793de79d6de4f20f4
-rw-r--r--.mapping.json6
-rw-r--r--build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py200
-rw-r--r--build/export_generators/hardcoded-cmake/build/scripts/export_script_gen.py132
-rw-r--r--build/export_generators/hardcoded-cmake/build/scripts/gather_swig_java.cmake3
-rw-r--r--build/export_generators/hardcoded-cmake/build/scripts/generate_vcs_info.py319
-rw-r--r--build/export_generators/hardcoded-cmake/build/scripts/re_replace.py47
-rw-r--r--build/export_generators/hardcoded-cmake/build/scripts/split_unittest.py84
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/FindAIO.cmake26
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/FindIDN.cmake26
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/FindJNITarget.cmake33
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/antlr.cmake30
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/antlr4.cmake30
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/archive.cmake13
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/bison.cmake24
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/common.cmake332
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile15
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile15
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile15
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile15
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile28
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile28
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile11
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.x86_64.profile11
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan1_deprecated.cmake962
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/conan_provider.cmake663
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/cuda.cmake190
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/cython.cmake42
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/fat_object.cmake8
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/fbs.cmake29
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.cmake50
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake68
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake41
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake165
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.linker.gnu.cmake29
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/global_flags.linker.msvc.cmake16
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/llvm-tools.cmake111
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/masm.cmake9
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/protobuf.cmake102
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/recursive_library.cmake50
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/shared_libs.cmake9
-rw-r--r--build/export_generators/hardcoded-cmake/cmake/swig.cmake51
-rw-r--r--build/export_generators/hardcoded-cmake/common_cmake_lists.jinja10
-rw-r--r--build/export_generators/hardcoded-cmake/conanfile.py.jinja80
-rw-r--r--build/export_generators/hardcoded-cmake/dir_cmake_lists.jinja40
-rw-r--r--build/export_generators/hardcoded-cmake/disclaimer.jinja13
-rw-r--r--build/export_generators/hardcoded-cmake/generator.toml279
-rw-r--r--build/export_generators/hardcoded-cmake/root_cmake_lists.jinja66
-rw-r--r--build/export_generators/hardcoded-cmake/root_global_vars.jinja17
-rw-r--r--build/export_generators/hardcoded-cmake/target_cmake_lists.jinja77
-rw-r--r--build/scripts/create_recursive_library_for_cmake.py200
-rw-r--r--build/scripts/export_script_gen.py132
-rw-r--r--build/scripts/gather_swig_java.cmake3
-rw-r--r--build/scripts/generate_vcs_info.py319
-rw-r--r--build/scripts/re_replace.py47
-rw-r--r--build/scripts/split_unittest.py84
55 files changed, 0 insertions, 5405 deletions
diff --git a/.mapping.json b/.mapping.json
index dd509fd613..72ea1f601d 100644
--- a/.mapping.json
+++ b/.mapping.json
@@ -1,12 +1,6 @@
{
"build/mapping.conf.json":"devtools/ya/opensource/mapping.conf.json",
"build/scripts":"build/export_generators/hardcoded-cmake/build/scripts",
- "build/scripts/create_recursive_library_for_cmake.py":"build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py",
- "build/scripts/export_script_gen.py":"build/export_generators/hardcoded-cmake/build/scripts/export_script_gen.py",
- "build/scripts/gather_swig_java.cmake":"build/export_generators/hardcoded-cmake/build/scripts/gather_swig_java.cmake",
- "build/scripts/generate_vcs_info.py":"build/export_generators/hardcoded-cmake/build/scripts/generate_vcs_info.py",
- "build/scripts/re_replace.py":"build/export_generators/hardcoded-cmake/build/scripts/re_replace.py",
- "build/scripts/split_unittest.py":"build/export_generators/hardcoded-cmake/build/scripts/split_unittest.py",
"build/ya.conf.json":"devtools/ya/opensource/ya.conf.json",
"ya":"devtools/ya/opensource/ya",
"ya.conf":"devtools/ya/opensource/ya.conf"
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py b/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py
deleted file mode 100644
index 4eb8013a91..0000000000
--- a/build/export_generators/hardcoded-cmake/build/scripts/create_recursive_library_for_cmake.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# Custom script is necessary because CMake does not yet support creating static libraries combined with dependencies
-# https://gitlab.kitware.com/cmake/cmake/-/issues/22975
-#
-# This script is intended to be used set as a CXX_LINKER_LAUNCHER property for recursive library targets.
-# It parses the linking command and transforms it to archiving commands combining static libraries from dependencies.
-
-import argparse
-import os
-import re
-import shlex
-import subprocess
-import sys
-import tempfile
-
-
-class Opts(object):
- def __init__(self, args):
- argparser = argparse.ArgumentParser(allow_abbrev=False)
- argparser.add_argument('--project-binary-dir', required=True)
- argparser.add_argument('--cmake-ar', required=True)
- argparser.add_argument('--cmake-ranlib', required=True)
- argparser.add_argument('--cmake-host-system-name', required=True)
- argparser.add_argument('--cmake-cxx-standard-libraries')
- argparser.add_argument('--global-part-suffix', required=True)
- self.parsed_args, other_args = argparser.parse_known_args(args=args)
-
- if len(other_args) < 2:
- # must contain at least '--linking-cmdline' and orginal linking tool name
- raise Exception('not enough arguments')
- if other_args[0] != '--linking-cmdline':
- raise Exception("expected '--linking-cmdline' arg, got {}".format(other_args[0]))
-
- self.is_msvc_compatible_linker = other_args[1].endswith('\\link.exe') or other_args[1].endswith('\\lld-link.exe')
-
- is_host_system_windows = self.parsed_args.cmake_host_system_name == 'Windows'
- std_libraries_to_exclude_from_input = (
- set(self.parsed_args.cmake_cxx_standard_libraries.split())
- if self.parsed_args.cmake_cxx_standard_libraries is not None
- else set()
- )
- msvc_preserved_option_prefixes = [
- 'machine:',
- 'nodefaultlib',
- 'nologo',
- ]
-
- self.preserved_options = []
-
- # these variables can contain paths absolute or relative to project_binary_dir
- self.global_libs_and_objects_input = []
- self.non_global_libs_input = []
- self.output = None
-
- def is_external_library(path):
- """
- Check whether this library has been built in this CMake project or came from Conan-provided dependencies
- (these use absolute paths).
- If it is a library that is added from some other path (like CUDA) return True
- """
- return not (os.path.exists(path) or os.path.exists(os.path.join(self.parsed_args.project_binary_dir, path)))
-
- def process_input(args):
- i = 0
- is_in_whole_archive = False
-
- while i < len(args):
- arg = args[i]
- if is_host_system_windows and ((arg[0] == '/') or (arg[0] == '-')):
- arg_wo_specifier_lower = arg[1:].lower()
- if arg_wo_specifier_lower.startswith('out:'):
- self.output = arg[len('/out:') :]
- elif arg_wo_specifier_lower.startswith('wholearchive:'):
- lib_path = arg[len('/wholearchive:') :]
- if not is_external_library(lib_path):
- self.global_libs_and_objects_input.append(lib_path)
- else:
- for preserved_option_prefix in msvc_preserved_option_prefixes:
- if arg_wo_specifier_lower.startswith(preserved_option_prefix):
- self.preserved_options.append(arg)
- break
- # other flags are non-linking related and just ignored
- elif arg[0] == '-':
- if arg == '-o':
- if (i + 1) >= len(args):
- raise Exception('-o flag without an argument')
- self.output = args[i + 1]
- i += 1
- elif arg == '-Wl,--whole-archive':
- is_in_whole_archive = True
- elif arg == '-Wl,--no-whole-archive':
- is_in_whole_archive = False
- elif arg.startswith('-Wl,-force_load,'):
- lib_path = arg[len('-Wl,-force_load,') :]
- if not is_external_library(lib_path):
- self.global_libs_and_objects_input.append(lib_path)
- elif arg == '-isysroot':
- i += 1
- # other flags are non-linking related and just ignored
- elif arg[0] == '@':
- # response file with args
- with open(arg[1:]) as response_file:
- parsed_args = shlex.shlex(response_file, posix=False, punctuation_chars=False)
- parsed_args.whitespace_split = True
- args_in_response_file = list(arg.strip('"') for arg in parsed_args)
- process_input(args_in_response_file)
- elif not is_external_library(arg):
- if is_in_whole_archive or arg.endswith('.o') or arg.endswith('.obj'):
- self.global_libs_and_objects_input.append(arg)
- elif arg not in std_libraries_to_exclude_from_input:
- self.non_global_libs_input.append(arg)
- i += 1
-
- process_input(other_args[2:])
-
- if self.output is None:
- raise Exception("No output specified")
-
- if (len(self.global_libs_and_objects_input) == 0) and (len(self.non_global_libs_input) == 0):
- raise Exception("List of input objects and libraries is empty")
-
-
-class FilesCombiner(object):
- def __init__(self, opts):
- self.opts = opts
-
- archiver_tool_path = opts.parsed_args.cmake_ar
- if sys.platform.startswith('darwin'):
- # force LIBTOOL even if CMAKE_AR is defined because 'ar' under Darwin does not contain the necessary options
- arch_type = 'LIBTOOL'
- archiver_tool_path = 'libtool'
- elif opts.is_msvc_compatible_linker:
- arch_type = 'LIB'
- elif re.match(r'^(|.*/)llvm\-ar(\-[\d])?', opts.parsed_args.cmake_ar):
- arch_type = 'LLVM_AR'
- elif re.match(r'^(|.*/)(gcc\-)?ar(\-[\d])?', opts.parsed_args.cmake_ar):
- arch_type = 'GNU_AR'
- else:
- raise Exception('Unsupported arch type for CMAKE_AR={}'.format(opts.parsed_args.cmake_ar))
-
- self.archiving_cmd_prefix = [
- sys.executable,
- os.path.join(os.path.dirname(os.path.abspath(__file__)), 'link_lib.py'),
- archiver_tool_path,
- arch_type,
- 'gnu', # llvm_ar_format, used only if arch_type == 'LLVM_AR'
- opts.parsed_args.project_binary_dir,
- 'None', # plugin. Unused for now
- ]
- # the remaining archiving cmd args are [output, .. input .. ]
-
- def do(self, output, input_list):
- input_file_path = None
- try:
- if self.opts.is_msvc_compatible_linker:
- # use response file for input (because of Windows cmdline length limitations)
-
- # can't use NamedTemporaryFile because of permissions issues on Windows
- input_file_fd, input_file_path = tempfile.mkstemp()
- try:
- input_file = os.fdopen(input_file_fd, 'w')
- for input in input_list:
- if ' ' in input:
- input_file.write('"{}" '.format(input))
- else:
- input_file.write('{} '.format(input))
- input_file.flush()
- finally:
- os.close(input_file_fd)
- input_args = ['@' + input_file_path]
- else:
- input_args = input_list
-
- cmd = self.archiving_cmd_prefix + [output] + self.opts.preserved_options + input_args
- subprocess.check_call(cmd)
- finally:
- if input_file_path is not None:
- os.remove(input_file_path)
-
- if not self.opts.is_msvc_compatible_linker:
- subprocess.check_call([self.opts.parsed_args.cmake_ranlib, output])
-
-
-if __name__ == "__main__":
- opts = Opts(sys.argv[1:])
-
- output_prefix, output_ext = os.path.splitext(opts.output)
- globals_output = output_prefix + opts.parsed_args.global_part_suffix + output_ext
-
- if os.path.exists(globals_output):
- os.remove(globals_output)
- if os.path.exists(opts.output):
- os.remove(opts.output)
-
- files_combiner = FilesCombiner(opts)
-
- if len(opts.global_libs_and_objects_input) > 0:
- files_combiner.do(globals_output, opts.global_libs_and_objects_input)
-
- if len(opts.non_global_libs_input) > 0:
- files_combiner.do(opts.output, opts.non_global_libs_input)
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/export_script_gen.py b/build/export_generators/hardcoded-cmake/build/scripts/export_script_gen.py
deleted file mode 100644
index 3df3df8638..0000000000
--- a/build/export_generators/hardcoded-cmake/build/scripts/export_script_gen.py
+++ /dev/null
@@ -1,132 +0,0 @@
-import argparse
-import collections
-import sys
-
-
-def parse_export_file(src):
- for line in src:
- line = line.strip()
-
- if line and '#' not in line:
- words = line.split()
- if len(words) == 2 and words[0] == 'linux_version':
- yield {'linux_version': words[1]}
- elif len(words) == 2:
- yield {'lang': words[0], 'sym': words[1]}
- elif len(words) == 1:
- yield {'lang': 'C', 'sym': words[0]}
- else:
- raise Exception('unsupported exports line: "{}"'.format(line))
-
-
-def to_c(sym):
- symbols = collections.deque(sym.split('::'))
- c_prefixes = [ # demangle prefixes for c++ symbols
- '_ZN', # namespace
- '_ZTIN', # typeinfo for
- '_ZTSN', # typeinfo name for
- '_ZTTN', # VTT for
- '_ZTVN', # vtable for
- '_ZNK', # const methods
- ]
- c_sym = ''
- while symbols:
- s = symbols.popleft()
- if s == '*':
- c_sym += '*'
- break
- if '*' in s and len(s) > 1:
- raise Exception('Unsupported format, cannot guess length of symbol: ' + s)
- c_sym += str(len(s)) + s
- if symbols:
- raise Exception('Unsupported format: ' + sym)
- if c_sym[-1] != '*':
- c_sym += 'E*'
- return ['{prefix}{sym}'.format(prefix=prefix, sym=c_sym) for prefix in c_prefixes]
-
-
-def to_gnu(src, dest):
- d = collections.defaultdict(list)
- version = None
- for item in parse_export_file(src):
- if item.get('linux_version'):
- if not version:
- version = item.get('linux_version')
- else:
- raise Exception('More than one linux_version defined')
- elif item['lang'] == 'C++':
- d['C'].extend(to_c(item['sym']))
- else:
- d[item['lang']].append(item['sym'])
-
- if version:
- dest.write('{} {{\nglobal:\n'.format(version))
- else:
- dest.write('{\nglobal:\n')
-
- for k, v in d.items():
- dest.write(' extern "' + k + '" {\n')
-
- for x in v:
- dest.write(' ' + x + ';\n')
-
- dest.write(' };\n')
-
- dest.write('local: *;\n};\n')
-
-
-def to_msvc(src, dest):
- dest.write('EXPORTS\n')
- for item in parse_export_file(src):
- if item.get('linux_version'):
- continue
- if item.get('lang') == 'C':
- dest.write(' {}\n'.format(item.get('sym')))
-
-
-def to_darwin(src, dest):
- pre = ''
- for item in parse_export_file(src):
- if item.get('linux_version'):
- continue
-
- if item['lang'] == 'C':
- dest.write(pre + '-Wl,-exported_symbol,_' + item['sym'])
- elif item['lang'] == 'C++':
- for sym in to_c(item['sym']):
- dest.write(pre + '-Wl,-exported_symbol,_' + sym)
- else:
- raise Exception('unsupported lang: ' + item['lang'])
- if pre == '':
- pre = ' '
-
-
-def main():
- parser = argparse.ArgumentParser(
- description='Convert self-invented platform independent export file format to the format required by specific linker'
- )
- parser.add_argument(
- 'src', type=argparse.FileType('r', encoding='UTF-8'), help='platform independent export file path'
- )
- parser.add_argument(
- 'dest', type=argparse.FileType('w', encoding='UTF-8'), help='destination export file for required linker'
- )
- parser.add_argument('--format', help='destination file type format: gnu, msvc or darwin')
-
- args = parser.parse_args()
- if args.format == 'gnu':
- to_gnu(args.src, args.dest)
- elif args.format == 'msvc':
- to_msvc(args.src, args.dest)
- elif args.format == 'darwin':
- to_darwin(args.src, args.dest)
- else:
- print('Unknown destination file format: {}'.format(args.format), file=sys.stderr)
- sys.exit(1)
-
- args.src.close()
- args.dest.close()
-
-
-if __name__ == '__main__':
- main()
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/gather_swig_java.cmake b/build/export_generators/hardcoded-cmake/build/scripts/gather_swig_java.cmake
deleted file mode 100644
index fa0acf42c1..0000000000
--- a/build/export_generators/hardcoded-cmake/build/scripts/gather_swig_java.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-file(GLOB JAVA_FILES ${JAVA_SRC_DIR}/*.java)
-list(JOIN JAVA_FILES "\n" JAVA_LST_CONTENT)
-file(WRITE ${JAVA_LST} ${JAVA_LST_CONTENT})
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/generate_vcs_info.py b/build/export_generators/hardcoded-cmake/build/scripts/generate_vcs_info.py
deleted file mode 100644
index 6360e01de2..0000000000
--- a/build/export_generators/hardcoded-cmake/build/scripts/generate_vcs_info.py
+++ /dev/null
@@ -1,319 +0,0 @@
-# coding: utf-8
-import json
-import locale
-import re
-import os
-import subprocess
-import sys
-import time
-
-
-INDENT = " " * 4
-
-
-def _get_vcs_dictionary(vcs_type, *arg):
- if vcs_type == 'git':
- return _GitVersion.parse(*arg)
- else:
- raise Exception("Unknown VCS type {}".format(str(vcs_type)))
-
-
-def _get_user_locale():
- try:
- return [locale.getencoding()]
- except Exception:
- return []
-
-
-class _GitVersion:
- @classmethod
- def parse(cls, commit_hash, author_info, summary_info, body_info, tag_info, branch_info, depth=None):
- r"""Parses output of
- git rev-parse HEAD
- git log -1 --format='format:%an <%ae>'
- git log -1 --format='format:%s'
- git log -1 --grep='^git-svn-id: ' --format='format:%b' or
- git log -1 --grep='^Revision: r?\d*' --format='format:%b
- git describe --exact-match --tags HEAD
- git describe --exact-match --all HEAD
- and depth as computed by _get_git_depth
- '"""
-
- info = {}
- info['hash'] = commit_hash
- info['commit_author'] = _SystemInfo._to_text(author_info)
- info['summary'] = _SystemInfo._to_text(summary_info)
-
- if 'svn_commit_revision' not in info:
- url = re.search("git?-svn?-id: (.*)@(\\d*).*", body_info)
- if url:
- info['svn_url'] = url.group(1)
- info['svn_commit_revision'] = int(url.group(2))
-
- if 'svn_commit_revision' not in info:
- rev = re.search('Revision: r?(\\d*).*', body_info)
- if rev:
- info['svn_commit_revision'] = int(rev.group(1))
-
- info['tag'] = tag_info
- info['branch'] = branch_info
- info['scm_text'] = cls._format_scm_data(info)
- info['vcs'] = 'git'
-
- if depth:
- info['patch_number'] = int(depth)
- return info
-
- @staticmethod
- def _format_scm_data(info):
- scm_data = "Git info:\n"
- scm_data += INDENT + "Commit: " + info['hash'] + "\n"
- scm_data += INDENT + "Branch: " + info['branch'] + "\n"
- scm_data += INDENT + "Author: " + info['commit_author'] + "\n"
- scm_data += INDENT + "Summary: " + info['summary'] + "\n"
- if 'svn_commit_revision' in info or 'svn_url' in info:
- scm_data += INDENT + "git-svn info:\n"
- if 'svn_url' in info:
- scm_data += INDENT + "URL: " + info['svn_url'] + "\n"
- if 'svn_commit_revision' in info:
- scm_data += INDENT + "Last Changed Rev: " + str(info['svn_commit_revision']) + "\n"
- return scm_data
-
- @staticmethod
- def external_data(arc_root):
- env = os.environ.copy()
- env['TZ'] = ''
-
- hash_args = ['rev-parse', 'HEAD']
- author_args = ['log', '-1', '--format=format:%an <%ae>']
- summary_args = ['log', '-1', '--format=format:%s']
- svn_args = ['log', '-1', '--grep=^git-svn-id: ', '--format=format:%b']
- svn_args_alt = ['log', '-1', '--grep=^Revision: r\\?\\d*', '--format=format:%b']
- tag_args = ['describe', '--exact-match', '--tags', 'HEAD']
- branch_args = ['describe', '--exact-match', '--all', 'HEAD']
-
- # using local 'Popen' wrapper
- commit = _SystemInfo._system_command_call(['git'] + hash_args, env=env, cwd=arc_root).rstrip()
- author = _SystemInfo._system_command_call(['git'] + author_args, env=env, cwd=arc_root)
- commit = _SystemInfo._system_command_call(['git'] + hash_args, env=env, cwd=arc_root).rstrip()
- author = _SystemInfo._system_command_call(['git'] + author_args, env=env, cwd=arc_root)
- summary = _SystemInfo._system_command_call(['git'] + summary_args, env=env, cwd=arc_root)
- svn_id = _SystemInfo._system_command_call(['git'] + svn_args, env=env, cwd=arc_root)
- if not svn_id:
- svn_id = _SystemInfo._system_command_call(['git'] + svn_args_alt, env=env, cwd=arc_root)
-
- try:
- tag_info = _SystemInfo._system_command_call(['git'] + tag_args, env=env, cwd=arc_root).splitlines()
- except Exception:
- tag_info = [''.encode('utf-8')]
-
- try:
- branch_info = _SystemInfo._system_command_call(['git'] + branch_args, env=env, cwd=arc_root).splitlines()
- except Exception:
- branch_info = [''.encode('utf-8')]
-
- depth = str(_GitVersion._get_git_depth(env, arc_root)).encode('utf-8')
-
- # logger.debug('Git info commit:{}, author:{}, summary:{}, svn_id:{}'.format(commit, author, summary, svn_id))
- return [commit, author, summary, svn_id, tag_info[0], branch_info[0], depth]
-
- # YT's patch number.
- @staticmethod
- def _get_git_depth(env, arc_root):
- graph = {}
- full_history_args = ["log", "--full-history", "--format=%H %P", "HEAD"]
- history = _SystemInfo._system_command_call(['git'] + full_history_args, env=env, cwd=arc_root).decode('utf-8')
-
- head = None
- for line in history.splitlines():
- values = line.split()
- if values:
- if head is None:
- head = values[0]
- graph[values[0]] = values[1:]
-
- assert head
- cache = {}
- stack = [(head, None, False)]
- while stack:
- commit, child, calculated = stack.pop()
- if commit in cache:
- calculated = True
- if calculated:
- if child is not None:
- cache[child] = max(cache.get(child, 0), cache[commit] + 1)
- else:
- stack.append((commit, child, True))
- parents = graph[commit]
- if not parents:
- cache[commit] = 0
- else:
- for parent in parents:
- stack.append((parent, commit, False))
- return cache[head]
-
-
-class _SystemInfo:
- LOCALE_LIST = _get_user_locale() + [sys.getfilesystemencoding(), 'utf-8']
-
- @classmethod
- def get_locale(cls):
- import codecs
-
- for i in cls.LOCALE_LIST:
- if not i:
- continue
- try:
- codecs.lookup(i)
- return i
- except LookupError:
- continue
-
- @staticmethod
- def _to_text(s):
- if isinstance(s, bytes):
- return s.decode(_SystemInfo.get_locale(), errors='replace')
- return s
-
- @staticmethod
- def get_user():
- sys_user = os.environ.get("USER")
- if not sys_user:
- sys_user = os.environ.get("USERNAME")
- if not sys_user:
- sys_user = os.environ.get("LOGNAME")
- if not sys_user:
- sys_user = "Unknown user"
- return sys_user
-
- @staticmethod
- def get_date(stamp=None):
- # Format compatible with SVN-xml format.
- return time.strftime("%Y-%m-%dT%H:%M:%S.000000Z", time.gmtime(stamp))
-
- @staticmethod
- def get_timestamp():
- # Unix timestamp.
- return int(time.time())
-
- @staticmethod
- def get_other_data(src_dir, data_file='local.ymake'):
- other_data = "Other info:\n"
- other_data += INDENT + "Build by: " + _SystemInfo.get_user() + "\n"
- other_data += INDENT + "Top src dir: {}\n".format(src_dir)
-
- # logger.debug("Other data: %s", other_data)
-
- return other_data
-
- @staticmethod
- def _get_host_info(fake_build_info=False):
- if fake_build_info:
- host_info = '*sys localhost 1.0.0 #dummy information '
- elif not on_win():
- host_info = ' '.join(os.uname())
- else:
- host_info = _SystemInfo._system_command_call("VER") # XXX: check shell from cygwin to call VER this way!
- return INDENT + INDENT + host_info.strip() + "\n" if host_info else ""
-
- @staticmethod
- def _system_command_call(command, **kwargs):
- if isinstance(command, list):
- command = subprocess.list2cmdline(command)
- try:
- process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, **kwargs)
- stdout, stderr = process.communicate()
- if process.returncode != 0:
- # logger.debug('{}\nRunning {} failed with exit code {}\n'.format(stderr, command, process.returncode))
- raise get_svn_exception()(stdout=stdout, stderr=stderr, rc=process.returncode, cmd=[command])
- return stdout
- except OSError as e:
- msg = e.strerror
- errcodes = 'error {}'.format(e.errno)
- if on_win() and isinstance(e, WindowsError):
- errcodes += ', win-error {}'.format(e.winerror)
- try:
- import ctypes
-
- msg = str(ctypes.FormatError(e.winerror), _SystemInfo.get_locale()).encode('utf-8')
- except ImportError:
- pass
- # logger.debug('System command call {} failed [{}]: {}\n'.format(command, errcodes, msg))
- return None
-
-
-def _get_raw_data(vcs_type, vcs_root):
- lines = []
- if vcs_type == 'git':
- lines = _GitVersion.external_data(vcs_root)
-
- return [l.decode('utf-8') for l in lines]
-
-
-def _get_json(vcs_root):
- try:
- vcs_type = "git"
- info = _get_vcs_dictionary(vcs_type, *_get_raw_data(vcs_type, vcs_root))
- return info, vcs_root
- except Exception:
- return None, ""
-
-
-def _dump_json(
- arc_root,
- info,
- other_data=None,
- build_user=None,
- build_date=None,
- build_timestamp=0,
- custom_version='',
-):
- j = {}
- j['PROGRAM_VERSION'] = info['scm_text'] + "\n" + _SystemInfo._to_text(other_data)
- j['CUSTOM_VERSION'] = str(_SystemInfo._to_text(custom_version))
- j['SCM_DATA'] = info['scm_text']
- j['ARCADIA_SOURCE_PATH'] = _SystemInfo._to_text(arc_root)
- j['ARCADIA_SOURCE_URL'] = info.get('url', info.get('svn_url', ''))
- j['ARCADIA_SOURCE_REVISION'] = info.get('revision', -1)
- j['ARCADIA_SOURCE_HG_HASH'] = info.get('hash', '')
- j['ARCADIA_SOURCE_LAST_CHANGE'] = info.get('commit_revision', info.get('svn_commit_revision', -1))
- j['ARCADIA_SOURCE_LAST_AUTHOR'] = info.get('commit_author', '')
- j['ARCADIA_PATCH_NUMBER'] = info.get('patch_number', 0)
- j['BUILD_USER'] = _SystemInfo._to_text(build_user)
- j['VCS'] = info.get('vcs', '')
- j['BRANCH'] = info.get('branch', '')
- j['ARCADIA_TAG'] = info.get('tag', '')
- j['DIRTY'] = info.get('dirty', '')
-
- if 'url' in info or 'svn_url' in info:
- j['SVN_REVISION'] = info.get('svn_commit_revision', info.get('revision', -1))
- j['SVN_ARCROOT'] = info.get('url', info.get('svn_url', ''))
- j['SVN_TIME'] = info.get('commit_date', info.get('svn_commit_date', ''))
-
- j['BUILD_DATE'] = build_date
- j['BUILD_TIMESTAMP'] = build_timestamp
-
- return json.dumps(j, sort_keys=True, indent=4, separators=(',', ': '))
-
-
-def get_version_info(arc_root, custom_version=""):
- info, vcs_root = _get_json(arc_root)
- if info is None:
- return ""
-
- return _dump_json(
- vcs_root,
- info,
- other_data=_SystemInfo.get_other_data(
- src_dir=vcs_root,
- ),
- build_user=_SystemInfo.get_user(),
- build_date=_SystemInfo.get_date(None),
- build_timestamp=_SystemInfo.get_timestamp(),
- custom_version=custom_version,
- )
-
-
-if __name__ == '__main__':
- with open(sys.argv[1], 'wt', encoding="utf-8") as f:
- f.write(get_version_info(sys.argv[2]))
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/re_replace.py b/build/export_generators/hardcoded-cmake/build/scripts/re_replace.py
deleted file mode 100644
index 3a882c41d2..0000000000
--- a/build/export_generators/hardcoded-cmake/build/scripts/re_replace.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import sys
-from typing import List
-import argparse
-import re
-
-# Usage: re_replace.py --from-re <REGEXP> --to-re <REGEXP_REPLACE> FILE [FILE ...]
-
-
-def patch_line(line: str, from_re: re.Pattern, to_re: str) -> str:
- return re.sub(from_re, to_re, line)
-
-
-def main(args: List[str]):
- argparser = argparse.ArgumentParser(allow_abbrev=False)
- argparser.add_argument('--from-re', required=True)
- argparser.add_argument('--to-re', required=True)
- parsed_args, files = argparser.parse_known_args(args=args)
- from_re = re.compile(parsed_args.from_re)
- if not files:
- raise Exception('No input files')
-
- patched_files = []
- skipped_files = []
- for file in files:
- patched = False
- with open(file, 'rt', encoding="utf-8") as f:
- lines = f.readlines()
- for i in range(len(lines)):
- line = lines[i]
- patched_line = patch_line(line, from_re, parsed_args.to_re)
- if patched_line != line:
- patched = True
- lines[i] = patched_line
- if patched:
- with open(file, 'wt', encoding="utf-8") as f:
- f.writelines(lines)
- patched_files.append(file)
- else:
- skipped_files.append(file)
- if patched_files:
- print("Patched by re_replace: " + ", ".join(patched_files))
- if skipped_files:
- print("Skipped by re_replace: " + ", ".join(skipped_files))
-
-
-if __name__ == '__main__':
- main(sys.argv[1:])
diff --git a/build/export_generators/hardcoded-cmake/build/scripts/split_unittest.py b/build/export_generators/hardcoded-cmake/build/scripts/split_unittest.py
deleted file mode 100644
index 7214c70fdc..0000000000
--- a/build/export_generators/hardcoded-cmake/build/scripts/split_unittest.py
+++ /dev/null
@@ -1,84 +0,0 @@
-import argparse
-import os
-import tempfile
-import shlex
-import subprocess
-
-
-def parse_args():
- parser = argparse.ArgumentParser()
- parser.add_argument("--split-factor", type=int, default=0)
- parser.add_argument("--shard", type=int, default=0)
- parser.add_argument("--fork-mode", type=str, default="SEQUENTIAL")
- parser.add_argument("command", nargs=argparse.REMAINDER)
- return parser.parse_args()
-
-
-def get_sequential_chunk(tests, modulo, modulo_index):
- chunk_size = len(tests) // modulo
- not_used = len(tests) % modulo
- shift = chunk_size + (modulo_index < not_used)
- start = chunk_size * modulo_index + min(modulo_index, not_used)
- end = start + shift
- return [] if end > len(tests) else tests[start:end]
-
-
-def get_shuffled_chunk(tests, modulo, modulo_index):
- result_tests = []
- for i, test in enumerate(tests):
- if i % modulo == modulo_index:
- result_tests.append(test)
- return result_tests
-
-
-def list_tests(binary):
- # can't use NamedTemporaryFile or mkstemp because of child process access issues on Windows
- # https://stackoverflow.com/questions/66744497/python-tempfile-namedtemporaryfile-cant-use-generated-tempfile
- with tempfile.TemporaryDirectory() as tmp_dir:
- list_file = os.path.join(tmp_dir, 'list')
- cmd = [binary, "--list-verbose", "--list-path", list_file]
- subprocess.check_call(cmd)
-
- with open(list_file) as afile:
- lines = afile.read().strip().split("\n")
- lines = [x.strip() for x in lines]
- return [x for x in lines if x]
-
-
-def get_shard_tests(args):
- test_names = list_tests(args.command[0])
- test_names = sorted(test_names)
-
- if args.fork_mode == "MODULO":
- return get_shuffled_chunk(test_names, args.split_factor, args.shard)
- elif args.fork_mode == "SEQUENTIAL":
- return get_sequential_chunk(test_names, args.split_factor, args.shard)
- else:
- raise ValueError("detected unknown partition mode: {}".format(args.fork_mode))
-
-
-def get_shard_cmd_args(args):
- return ["+{}".format(x) for x in get_shard_tests(args)]
-
-
-def main():
- args = parse_args()
-
- if args.split_factor:
- shard_cmd = get_shard_cmd_args(args)
- if shard_cmd:
- cmd = args.command + shard_cmd
- else:
- print("No tests for {} shard".format(args.shard))
- return 0
- else:
- cmd = args.command
-
- rc = subprocess.call(cmd)
- if rc:
- print("Some tests failed. To reproduce run: {}".format(shlex.join(cmd)))
- return rc
-
-
-if __name__ == "__main__":
- exit(main())
diff --git a/build/export_generators/hardcoded-cmake/cmake/FindAIO.cmake b/build/export_generators/hardcoded-cmake/cmake/FindAIO.cmake
deleted file mode 100644
index 8b774e3c7c..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/FindAIO.cmake
+++ /dev/null
@@ -1,26 +0,0 @@
-# - Find AIO
-#
-# AIO_INCLUDE - Where to find libaio.h
-# AIO_LIBS - List of libraries when using AIO.
-# AIO_FOUND - True if AIO found.
-
-find_path(AIO_INCLUDE_DIR
- libaio.h
- HINTS $ENV{AIO_ROOT}/include /usr/include REQUIRED)
-
-find_library(AIO_LIBRARIES
- aio
- HINTS $ENV{AIO_ROOT}/lib REQUIRED)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(AIO DEFAULT_MSG AIO_LIBRARIES AIO_INCLUDE_DIR)
-
-mark_as_advanced(AIO_INCLUDE_DIR AIO_LIBRARIES)
-
-if (AIO_FOUND AND NOT TARGET AIO::aio)
- add_library(AIO::aio UNKNOWN IMPORTED)
- set_target_properties(AIO::aio PROPERTIES
- IMPORTED_LOCATION ${AIO_LIBRARIES}
- INTERFACE_INCLUDE_DIRECTORIES ${AIO_INCLUDE_DIR}
- )
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/FindIDN.cmake b/build/export_generators/hardcoded-cmake/cmake/FindIDN.cmake
deleted file mode 100644
index a7f3913aac..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/FindIDN.cmake
+++ /dev/null
@@ -1,26 +0,0 @@
-# - Find IDN
-#
-# IDN_INCLUDE - Where to find LibIDN public headers
-# IDN_LIBS - List of libraries when using LibIDN.
-# IDN_FOUND - True if LibIDN found.
-
-find_path(IDN_INCLUDE_DIR
- idna.h
- HINTS $ENV{IDN_ROOT}/include /usr/include REQUIRED)
-
-find_library(IDN_LIBRARIES
- idn
- HINTS $ENV{IDN_ROOT}/lib REQUIRED)
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(IDN DEFAULT_MSG IDN_LIBRARIES IDN_INCLUDE_DIR)
-
-mark_as_advanced(IDN_INCLUDE_DIR IDN_LIBRARIES)
-
-if (IDN_FOUND AND NOT TARGET IDN::IDN)
- add_library(IDN::IDN UNKNOWN IMPORTED)
- set_target_properties(IDN::IDN PROPERTIES
- IMPORTED_LOCATION ${IDN_LIBRARIES}
- INTERFACE_INCLUDE_DIRECTORIES ${IDN_INCLUDE_DIR}
- )
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/FindJNITarget.cmake b/build/export_generators/hardcoded-cmake/cmake/FindJNITarget.cmake
deleted file mode 100644
index 1c7f7d59a6..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/FindJNITarget.cmake
+++ /dev/null
@@ -1,33 +0,0 @@
-if(JNITarget_FIND_QUIETLY)
- find_package(JNI QUIET)
-elseif(JNITarget_FIND_REQUIRED)
- find_package(JNI REQUIRED)
-else()
- find_package(JNI)
-endif()
-
-set(JNI_TARGET_INCLUDE_DIRS ${JNI_INCLUDE_DIRS})
-set(JNI_TARGET_LIBRARIES ${JNI_LIBRARIES})
-
-if (JNI_FOUND)
- add_library(JNITarget::jni IMPORTED UNKNOWN)
- set_property(TARGET JNITarget::jni PROPERTY
- IMPORTED_LOCATION ${JAVA_JVM_LIBRARY}
- )
- set_property(TARGET JNITarget::jni PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}
- )
-
- add_library(JNITarget::jni_awt IMPORTED UNKNOWN)
- set_property(TARGET JNITarget::jni_awt PROPERTY
- IMPORTED_LOCATION ${JAVA_AWT_LIBRARY}
- )
- set_property(TARGET JNITarget::jni_awt PROPERTY
- INTERFACE_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_PATH}
- )
-endif()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(JNITarget DEFAULT_MSG JNI_TARGET_LIBRARIES JNI_TARGET_INCLUDE_DIRS)
-
-mark_as_advanced(JNI_TARGET_INCLUDE_DIRS JNI_TARGET_LIBRARIES)
diff --git a/build/export_generators/hardcoded-cmake/cmake/antlr.cmake b/build/export_generators/hardcoded-cmake/cmake/antlr.cmake
deleted file mode 100644
index 3bbce44a67..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/antlr.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-function(ensure_antlr)
- if(NOT ANTLR3_EXECUTABLE)
- find_program(ANTLR3_EXECUTABLE NAMES antlr3)
- if (NOT ANTLR3_EXECUTABLE)
- message(FATAL_ERROR "Unable to find antlr3 program. Please install antlr3 and make sure executable file present in the $PATH env.")
- endif()
- endif()
-endfunction()
-
-function(run_antlr)
- ensure_antlr()
- set(options "")
- set(oneValueArgs WORKING_DIRECTORY)
- set(multiValueArgs OUTPUT DEPENDS ANTLER_ARGS)
- cmake_parse_arguments(
- RUN_ANTLR3
- "${options}"
- "${oneValueArgs}"
- "${multiValueArgs}"
- ${ARGN}
- )
-
- add_custom_command(
- OUTPUT ${RUN_ANTLR3_OUTPUT}
- COMMAND ${ANTLR3_EXECUTABLE} ${RUN_ANTLR3_ANTLER_ARGS}
- WORKING_DIRECTORY ${RUN_ANTLR3_WORKING_DIRECTORY}
- DEPENDS ${RUN_ANTLR3_DEPENDS}
- )
-
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/antlr4.cmake b/build/export_generators/hardcoded-cmake/cmake/antlr4.cmake
deleted file mode 100644
index df3465c1b3..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/antlr4.cmake
+++ /dev/null
@@ -1,30 +0,0 @@
-function(ensure_antlr4)
- if(NOT ANTLR4_EXECUTABLE)
- find_program(ANTLR4_EXECUTABLE NAMES antlr4)
- if (NOT ANTLR4_EXECUTABLE)
- message(FATAL_ERROR "Unable to find antlr4 program. Please install antlr4 and make sure executable file present in the $PATH env.")
- endif()
- endif()
-endfunction()
-
-function(run_antlr4)
- ensure_antlr4()
- set(options "")
- set(oneValueArgs WORKING_DIRECTORY)
- set(multiValueArgs OUTPUT DEPENDS ANTLER_ARGS)
- cmake_parse_arguments(
- RUN_ANTLR4
- "${options}"
- "${oneValueArgs}"
- "${multiValueArgs}"
- ${ARGN}
- )
-
- add_custom_command(
- OUTPUT ${RUN_ANTLR4_OUTPUT}
- COMMAND ${ANTLR4_EXECUTABLE} ${RUN_ANTLR4_ANTLER_ARGS}
- WORKING_DIRECTORY ${RUN_ANTLR4_WORKING_DIRECTORY}
- DEPENDS ${RUN_ANTLR4_DEPENDS}
- )
-
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/archive.cmake b/build/export_generators/hardcoded-cmake/cmake/archive.cmake
deleted file mode 100644
index 0f4f0b4d35..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/archive.cmake
+++ /dev/null
@@ -1,13 +0,0 @@
-find_package(Python3 REQUIRED)
-
-function(target_rodata_sources TgtName Scope)
- foreach(rodata ${ARGN})
- get_filename_component(CppVar ${rodata} NAME_WLE)
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/rodata2cpp.py ${CppVar} ${rodata} ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/rodata2cpp.py ${rodata}
- )
- target_sources(${TgtName} ${Scope} ${CMAKE_CURRENT_BINARY_DIR}/${CppVar}.cpp)
- endforeach()
-endfunction() \ No newline at end of file
diff --git a/build/export_generators/hardcoded-cmake/cmake/bison.cmake b/build/export_generators/hardcoded-cmake/cmake/bison.cmake
deleted file mode 100644
index fd7eddda7b..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/bison.cmake
+++ /dev/null
@@ -1,24 +0,0 @@
-function(target_bison_parser Tgt Scope)
- foreach(arg ${ARGN})
- get_filename_component(argPath ${arg} REALPATH)
- if (argPath MATCHES "${PROJECT_SOURCE_DIR}/.*")
- file(RELATIVE_PATH argRel ${CMAKE_CURRENT_SOURCE_DIR} ${argPath})
- string(REPLACE ".." "__" ArgInBindir ${argRel})
- set(ArgInBindir ${CMAKE_CURRENT_BINARY_DIR}/${ArgInBindir})
- else()
- set(ArgInBindir ${argPath})
- endif()
- get_filename_component(OutputBase ${arg} NAME_WLE)
- get_filename_component(OutputDir ${ArgInBindir} DIRECTORY)
- add_custom_command(
- OUTPUT ${OutputDir}/${OutputBase}.cpp ${OutputDir}/${OutputBase}.h
- COMMAND ${CMAKE_COMMAND} -E make_directory ${OutputDir}
- COMMAND ${CMAKE_COMMAND} -E env M4=${PROJECT_BINARY_DIR}/bin/m4/bin/m4 ${PROJECT_BINARY_DIR}/bin/bison/bin/bison ${BISON_FLAGS} -v --defines=${OutputDir}/${OutputBase}.h -o ${OutputDir}/${OutputBase}.cpp ${arg}
- DEPENDS ${arg}
- )
- target_sources(${Tgt} ${Scope} ${OutputDir}/${OutputBase}.cpp ${OutputDir}/${OutputBase}.h)
- endforeach()
-endfunction()
-
-function(target_flex_lexers Tgt)
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/common.cmake b/build/export_generators/hardcoded-cmake/cmake/common.cmake
deleted file mode 100644
index 4eb0fbafce..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/common.cmake
+++ /dev/null
@@ -1,332 +0,0 @@
-# Set of common macros
-
-find_package(Python3 REQUIRED)
-
-add_compile_definitions(ARCADIA_ROOT=${PROJECT_SOURCE_DIR})
-add_compile_definitions(ARCADIA_BUILD_ROOT=${PROJECT_BINARY_DIR})
-add_compile_definitions(CATBOOST_OPENSOURCE=yes)
-
-# assumes ToolName is always both the binary and the target name
-function(get_built_tool_path OutBinPath OutDependency SrcPath ToolName)
- if (CMAKE_GENERATOR MATCHES "Visual.Studio.*")
- set(BinPath "${TOOLS_ROOT}/${SrcPath}/\$(Configuration)/${ToolName}${CMAKE_EXECUTABLE_SUFFIX}")
- else()
- set(BinPath "${TOOLS_ROOT}/${SrcPath}/${ToolName}${CMAKE_EXECUTABLE_SUFFIX}")
- endif()
- set(${OutBinPath} ${BinPath} PARENT_SCOPE)
- if (CMAKE_CROSSCOMPILING)
- set(${OutDependency} ${BinPath} PARENT_SCOPE)
- else()
- set(${OutDependency} ${ToolName} PARENT_SCOPE)
- endif()
-endfunction()
-
-
-function(target_ragel_lexers TgtName Key Src)
- SET(RAGEL_BIN ${PROJECT_BINARY_DIR}/bin/ragel${CMAKE_EXECUTABLE_SUFFIX})
- get_filename_component(OutPath ${Src} NAME_WLE)
- get_filename_component(SrcDirPath ${Src} DIRECTORY)
- get_filename_component(OutputExt ${OutPath} EXT)
- if (OutputExt STREQUAL "")
- string(APPEND OutPath .rl6.cpp)
- endif()
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OutPath}
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/run_tool.py -- ${RAGEL_BIN} ${RAGEL_FLAGS} ${ARGN} -o ${CMAKE_CURRENT_BINARY_DIR}/${OutPath} ${Src}
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/run_tool.py ${Src}
- WORKING_DIRECTORY ${SrcDirPath}
- )
- target_sources(${TgtName} ${Key} ${CMAKE_CURRENT_BINARY_DIR}/${OutPath})
-endfunction()
-
-function(target_yasm_source TgtName Key Src)
- SET(YASM_BIN ${PROJECT_BINARY_DIR}/bin/yasm${CMAKE_EXECUTABLE_SUFFIX})
- get_filename_component(OutPath ${Src} NAME_WLE)
- string(APPEND OutPath .o)
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${OutPath}
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/run_tool.py -- ${YASM_BIN} ${YASM_FLAGS} ${ARGN} -o ${CMAKE_CURRENT_BINARY_DIR}/${OutPath} ${Src}
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/run_tool.py ${Src}
- )
- target_sources(${TgtName} ${Key} ${CMAKE_CURRENT_BINARY_DIR}/${OutPath})
-endfunction()
-
-function(target_joined_source TgtName Out)
- foreach(InSrc ${ARGN})
- file(RELATIVE_PATH IncludePath ${PROJECT_SOURCE_DIR} ${InSrc})
- list(APPEND IncludesList ${IncludePath})
- endforeach()
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${Out}
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/gen_join_srcs.py ${CMAKE_CURRENT_BINARY_DIR}/${Out} ${IncludesList}
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/gen_join_srcs.py ${ARGN}
- )
- target_sources(${TgtName} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${Out})
-endfunction()
-
-function(target_sources_custom TgtName CompileOutSuffix)
- set(opts "")
- set(oneval_args "")
- set(multival_args SRCS CUSTOM_FLAGS)
- cmake_parse_arguments(TARGET_SOURCES_CUSTOM
- "${opts}"
- "${oneval_args}"
- "${multival_args}"
- ${ARGN}
- )
-
- foreach(Src ${TARGET_SOURCES_CUSTOM_SRCS})
- file(RELATIVE_PATH SrcRealPath ${PROJECT_SOURCE_DIR} ${Src})
- get_filename_component(SrcDir ${SrcRealPath} DIRECTORY)
- get_filename_component(SrcName ${SrcRealPath} NAME_WLE)
- get_filename_component(SrcExt ${SrcRealPath} LAST_EXT)
- set(SrcCopy "${PROJECT_BINARY_DIR}/${SrcDir}/${SrcName}${CompileOutSuffix}${SrcExt}")
- add_custom_command(
- OUTPUT ${SrcCopy}
- COMMAND ${CMAKE_COMMAND} -E copy ${Src} ${SrcCopy}
- DEPENDS ${Src}
- )
- list(APPEND PreparedSrc ${SrcCopy})
- set_property(
- SOURCE
- ${SrcCopy}
- APPEND PROPERTY COMPILE_OPTIONS
- ${TARGET_SOURCES_CUSTOM_CUSTOM_FLAGS}
- -I${PROJECT_SOURCE_DIR}/${SrcDir}
- )
- endforeach()
-
- target_sources(
- ${TgtName}
- PRIVATE
- ${PreparedSrc}
- )
-endfunction()
-
-function(generate_enum_serilization Tgt Input)
- set(opts "")
- set(oneval_args INCLUDE_HEADERS GEN_HEADER)
- set(multival_args "")
- cmake_parse_arguments(ENUM_SERIALIZATION_ARGS
- "${opts}"
- "${oneval_args}"
- "${multival_args}"
- ${ARGN}
- )
-
- get_built_tool_path(enum_parser_bin enum_parser_dependency tools/enum_parser/enum_parser enum_parser)
-
- get_filename_component(BaseName ${Input} NAME)
- if (ENUM_SERIALIZATION_ARGS_GEN_HEADER)
- set_property(SOURCE ${ENUM_SERIALIZATION_ARGS_GEN_HEADER} PROPERTY GENERATED On)
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BaseName}_serialized.cpp ${ENUM_SERIALIZATION_ARGS_GEN_HEADER}
- COMMAND
- ${enum_parser_bin}
- ${Input}
- --include-path ${ENUM_SERIALIZATION_ARGS_INCLUDE_HEADERS}
- --output ${CMAKE_CURRENT_BINARY_DIR}/${BaseName}_serialized.cpp
- --header ${ENUM_SERIALIZATION_ARGS_GEN_HEADER}
- DEPENDS ${Input} ${enum_parser_dependency}
- )
- else()
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${BaseName}_serialized.cpp
- COMMAND
- ${enum_parser_bin}
- ${Input}
- --include-path ${ENUM_SERIALIZATION_ARGS_INCLUDE_HEADERS}
- --output ${CMAKE_CURRENT_BINARY_DIR}/${BaseName}_serialized.cpp
- DEPENDS ${Input} ${enum_parser_dependency}
- )
- endif()
- target_sources(${Tgt} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${BaseName}_serialized.cpp)
-endfunction()
-
-
-if (MSVC AND (${CMAKE_VERSION} VERSION_LESS "3.21.0"))
- message(FATAL_ERROR "Build with MSVC-compatible toolchain requires at least cmake 3.21.0 because of used TARGET_OBJECTS feature")
-endif()
-
-function(add_global_library_for TgtName MainName)
- if (MSVC)
- add_library(${TgtName} OBJECT ${ARGN})
- add_dependencies(${TgtName} ${MainName}) # needed because object library can use some extra generated files in MainName
- target_link_libraries(${MainName} INTERFACE ${TgtName} "$<TARGET_OBJECTS:${TgtName}>")
- else()
- add_library(${TgtName} STATIC ${ARGN})
- add_library(${TgtName}.wholearchive INTERFACE)
- add_dependencies(${TgtName}.wholearchive ${TgtName})
- add_dependencies(${TgtName} ${MainName})
- if(APPLE)
- target_link_options(${TgtName}.wholearchive INTERFACE "SHELL:-Wl,-force_load,$<TARGET_FILE:${TgtName}>")
- else()
- target_link_options(${TgtName}.wholearchive INTERFACE "SHELL:-Wl,--whole-archive $<TARGET_FILE:${TgtName}> -Wl,--no-whole-archive")
- endif()
- target_link_libraries(${MainName} INTERFACE ${TgtName}.wholearchive)
- endif()
-endfunction()
-
-function(copy_file From To)
- add_custom_command(
- OUTPUT ${To}
- COMMAND ${CMAKE_COMMAND} -E copy ${From} ${To}
- DEPENDS ${From}
- )
-endfunction()
-
-function(vcs_info Tgt)
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/vcs_info.json
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/generate_vcs_info.py ${CMAKE_CURRENT_BINARY_DIR}/vcs_info.json ${PROJECT_SOURCE_DIR}
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/generate_vcs_info.py
- )
-
- add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/vcs_info.py ${CMAKE_CURRENT_BINARY_DIR}/vcs_info.json ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c ${PROJECT_SOURCE_DIR}/build/scripts/c_templates/svn_interface.c
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/vcs_info.py ${PROJECT_SOURCE_DIR}/build/scripts/c_templates/svn_interface.c ${CMAKE_CURRENT_BINARY_DIR}/vcs_info.json
- )
- target_sources(${Tgt} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/__vcs_version__.c)
-endfunction()
-
-function(resources Tgt Output)
- set(opts "")
- set(oneval_args "")
- set(multival_args INPUTS KEYS)
- cmake_parse_arguments(RESOURCE_ARGS
- "${opts}"
- "${oneval_args}"
- "${multival_args}"
- ${ARGN}
- )
- list(LENGTH RESOURCE_ARGS_INPUTS InputsCount)
- list(LENGTH RESOURCE_ARGS_KEYS KeysCount)
- if (NOT ${InputsCount} EQUAL ${KeysCount})
- message(FATAL_ERROR "Resources inputs count isn't equal to keys count in " ${Tgt})
- endif()
- math(EXPR ListsMaxIdx "${InputsCount} - 1")
- foreach(Idx RANGE ${ListsMaxIdx})
- list(GET RESOURCE_ARGS_INPUTS ${Idx} Input)
- list(GET RESOURCE_ARGS_KEYS ${Idx} Key)
- list(APPEND ResourcesList ${Input})
- list(APPEND ResourcesList ${Key})
- endforeach()
-
- get_built_tool_path(rescompiler_bin rescompiler_dependency tools/rescompiler/bin rescompiler)
-
- add_custom_command(
- OUTPUT ${Output}
- COMMAND ${rescompiler_bin} ${Output} ${ResourcesList}
- DEPENDS ${RESOURCE_ARGS_INPUTS} ${rescompiler_dependency}
- )
-endfunction()
-
-function(use_export_script Target ExportFile)
- get_filename_component(OutName ${ExportFile} NAME)
- set(OutPath ${CMAKE_CURRENT_BINARY_DIR}/gen_${OutName})
-
- if (MSVC)
- target_link_options(${Target} PRIVATE /DEF:${OutPath})
- set(EXPORT_SCRIPT_FLAVOR msvc)
- elseif(APPLE)
- execute_process(
- COMMAND ${Python3_EXECUTABLE} ${PROJECT_SOURCE_DIR}/build/scripts/export_script_gen.py ${ExportFile} - --format darwin
- RESULT_VARIABLE _SCRIPT_RES
- OUTPUT_VARIABLE _SCRIPT_FLAGS
- ERROR_VARIABLE _SCRIPT_STDERR
- )
- if (NOT ${_SCRIPT_RES} EQUAL 0)
- message(FATAL_ERROR "Failed to parse export symbols from ${ExportFile}:\n${_SCRIPT_STDERR}")
- return()
- endif()
- separate_arguments(ParsedScriptFlags NATIVE_COMMAND ${_SCRIPT_FLAGS})
- target_link_options(${Target} PRIVATE ${ParsedScriptFlags})
- return()
- else()
- set(EXPORT_SCRIPT_FLAVOR gnu)
- target_link_options(${Target} PRIVATE -Wl,--gc-sections -rdynamic -Wl,--version-script=${OutPath})
- endif()
-
- add_custom_command(
- OUTPUT ${OutPath}
- COMMAND
- Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/export_script_gen.py ${ExportFile} ${OutPath} --format ${EXPORT_SCRIPT_FLAVOR}
- DEPENDS ${ExportFile} ${PROJECT_SOURCE_DIR}/build/scripts/export_script_gen.py
- )
- target_sources(${Target} PRIVATE ${OutPath})
- set_property(SOURCE ${OutPath} PROPERTY
- HEADER_FILE_ONLY On
- )
- set_property(TARGET ${Target} APPEND PROPERTY
- LINK_DEPENDS ${OutPath}
- )
-endfunction()
-
-function(add_yunittest)
- set(opts "")
- set(oneval_args NAME TEST_TARGET)
- set(multival_args TEST_ARG)
- cmake_parse_arguments(YUNITTEST_ARGS
- "${opts}"
- "${oneval_args}"
- "${multival_args}"
- ${ARGN}
- )
-
- get_property(SPLIT_FACTOR TARGET ${YUNITTEST_ARGS_TEST_TARGET} PROPERTY SPLIT_FACTOR)
- get_property(SPLIT_TYPE TARGET ${YUNITTEST_ARGS_TEST_TARGET} PROPERTY SPLIT_TYPE)
-
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/run_testpack")
- add_test(NAME ${YUNITTEST_ARGS_NAME} COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/run_testpack" ${YUNITTEST_ARGS_TEST_ARG})
- set_property(TEST ${YUNITTEST_ARGS_NAME} PROPERTY ENVIRONMENT "source_root=${PROJECT_SOURCE_DIR};build_root=${PROJECT_BINARY_DIR};test_split_factor=${SPLIT_FACTOR};test_split_type=${SPLIT_TYPE}")
- return()
- endif()
-
- if (${SPLIT_FACTOR} EQUAL 1)
- add_test(NAME ${YUNITTEST_ARGS_NAME} COMMAND ${YUNITTEST_ARGS_TEST_TARGET} ${YUNITTEST_ARGS_TEST_ARG})
- return()
- endif()
-
- if ("${SPLIT_TYPE}")
- set(FORK_MODE_ARG --fork-mode ${SPLIT_TYPE})
- endif()
- math(EXPR LastIdx "${SPLIT_FACTOR} - 1")
- foreach(Idx RANGE ${LastIdx})
- add_test(NAME ${YUNITTEST_ARGS_NAME}_${Idx}
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/split_unittest.py --split-factor ${SPLIT_FACTOR} ${FORK_MODE_ARG} --shard ${Idx}
- $<TARGET_FILE:${YUNITTEST_ARGS_TEST_TARGET}> ${YUNITTEST_ARGS_TEST_ARG})
- endforeach()
-endfunction()
-
-function(set_yunittest_property)
- set(opts "")
- set(oneval_args TEST PROPERTY)
- set(multival_args )
- cmake_parse_arguments(YUNITTEST_ARGS
- "${opts}"
- "${oneval_args}"
- "${multival_args}"
- ${ARGN}
- )
- get_property(SPLIT_FACTOR TARGET ${YUNITTEST_ARGS_TEST} PROPERTY SPLIT_FACTOR)
-
- if ((${SPLIT_FACTOR} EQUAL 1) OR (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/run_testpack"))
- set_property(TEST ${YUNITTEST_ARGS_TEST} PROPERTY ${YUNITTEST_ARGS_PROPERTY} "${YUNITTEST_ARGS_UNPARSED_ARGUMENTS}")
- return()
- endif()
-
- math(EXPR LastIdx "${SPLIT_FACTOR} - 1")
- foreach(Idx RANGE ${LastIdx})
- set_property(TEST ${YUNITTEST_ARGS_TEST}_${Idx} PROPERTY ${YUNITTEST_ARGS_PROPERTY} "${YUNITTEST_ARGS_UNPARSED_ARGUMENTS}")
- endforeach()
-endfunction()
-
-option(CUSTOM_ALLOCATORS "Enables use of per executable specified allocators. Can be turned off in order to use code instrumentation tooling relying on system allocator (sanitizers, heaptrack, ...)" On)
-function(target_allocator Tgt)
- if (CUSTOM_ALLOCATORS)
- target_link_libraries(${Tgt} PRIVATE ${ARGN})
- else()
- target_link_libraries(${Tgt} PRIVATE system_allocator)
- endif()
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile
deleted file mode 100644
index 6147d99225..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.arm64.profile
+++ /dev/null
@@ -1,15 +0,0 @@
-include(default)
-[settings]
-arch=armv8
-build_type=Release
-compiler=clang
-compiler.libcxx=libc++
-compiler.version=14
-compiler.cppstd=20
-os=Android
-os.api_level=21
-[tool_requires]
-android-ndk/r25
-[options]
-[env]
-
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile
deleted file mode 100644
index 57d8f55785..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.armv7.profile
+++ /dev/null
@@ -1,15 +0,0 @@
-include(default)
-[settings]
-arch=armv7
-build_type=Release
-compiler=clang
-compiler.libcxx=libc++
-compiler.version=14
-compiler.cppstd=20
-os=Android
-os.api_level=21
-[tool_requires]
-android-ndk/r25
-[options]
-[env]
-
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile
deleted file mode 100644
index d8b73b992c..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86.profile
+++ /dev/null
@@ -1,15 +0,0 @@
-include(default)
-[settings]
-arch=x86
-build_type=Release
-compiler=clang
-compiler.libcxx=libc++
-compiler.version=14
-compiler.cppstd=20
-os=Android
-os.api_level=21
-[tool_requires]
-android-ndk/r25
-[options]
-[env]
-
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile
deleted file mode 100644
index 50ad337afa..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/android.x86_64.profile
+++ /dev/null
@@ -1,15 +0,0 @@
-include(default)
-[settings]
-arch=x86_64
-build_type=Release
-compiler=clang
-compiler.libcxx=libc++
-compiler.version=14
-compiler.cppstd=20
-os=Android
-os.api_level=21
-[tool_requires]
-android-ndk/r25
-[options]
-[env]
-
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile
deleted file mode 100644
index 6945b1d777..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.aarch64.profile
+++ /dev/null
@@ -1,28 +0,0 @@
-include(default)
-
-target_host=aarch64-linux-gnu
-
-[settings]
-arch=armv8
-build_type=Release
-compiler=gcc
-compiler.libcxx=libstdc++11
-compiler.version=12
-compiler.cppstd=20
-os=Linux
-[options]
-
-[env]
-CONAN_CMAKE_FIND_ROOT_PATH=/usr/$target_host
-CONAN_CMAKE_SYSROOT=/usr/$target_host
-SYSROOT=/usr/$target_host
-CC=$target_host-gcc
-CXX=$target_host-g++
-CXXFLAGS="-I/usr/$target_host/include/"
-CFLAGS="-I/usr/$target_host/include/"
-CHOST=$target_host
-AR=$target_host-ar
-AS=$target_host-as
-RANLIB=$target_host-ranlib
-LD=$target_host-ld
-STRIP=$target_host-strip
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile
deleted file mode 100644
index 5ecd24d6ce..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/linux.ppc64le.profile
+++ /dev/null
@@ -1,28 +0,0 @@
-include(default)
-
-target_host=powerpc64le-linux-gnu
-
-[settings]
-arch=ppc64le
-build_type=Release
-compiler=gcc
-compiler.libcxx=libstdc++11
-compiler.version=12
-compiler.cppstd=20
-os=Linux
-[options]
-
-[env]
-CONAN_CMAKE_FIND_ROOT_PATH=/usr/$target_host
-CONAN_CMAKE_SYSROOT=/usr/$target_host
-SYSROOT=/usr/$target_host
-CC=$target_host-gcc
-CXX=$target_host-g++
-CXXFLAGS="-I/usr/$target_host/include/"
-CFLAGS="-I/usr/$target_host/include/"
-CHOST=$target_host
-AR=$target_host-ar
-AS=$target_host-as
-RANLIB=$target_host-ranlib
-LD=$target_host-ld
-STRIP=$target_host-strip
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile
deleted file mode 100644
index 52ba46ab97..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.arm64.profile
+++ /dev/null
@@ -1,11 +0,0 @@
-include(default)
-[settings]
-arch=armv8
-build_type=Release
-compiler=clang
-compiler.libcxx=libc++
-compiler.version=14
-compiler.cppstd=20
-os=Macos
-[options]
-[env]
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.x86_64.profile b/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.x86_64.profile
deleted file mode 100644
index 3370b88548..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan-profiles/macos.x86_64.profile
+++ /dev/null
@@ -1,11 +0,0 @@
-include(default)
-[settings]
-arch=x86_64
-build_type=Release
-compiler=clang
-compiler.libcxx=libc++
-compiler.version=14
-compiler.cppstd=20
-os=Macos
-[options]
-[env]
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan1_deprecated.cmake b/build/export_generators/hardcoded-cmake/cmake/conan1_deprecated.cmake
deleted file mode 100644
index 5e42e26c9d..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan1_deprecated.cmake
+++ /dev/null
@@ -1,962 +0,0 @@
-# The MIT License (MIT)
-
-# Copyright (c) 2018 JFrog
-
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-
-
-# This file comes from: https://github.com/conan-io/cmake-conan. Please refer
-# to this repository for issues and documentation.
-
-# Its purpose is to wrap and launch Conan C/C++ Package Manager when cmake is called.
-# It will take CMake current settings (os, compiler, compiler version, architecture)
-# and translate them to conan settings for installing and retrieving dependencies.
-
-# It is intended to facilitate developers building projects that have conan dependencies,
-# but it is only necessary on the end-user side. It is not necessary to create conan
-# packages, in fact it shouldn't be use for that. Check the project documentation.
-
-# version: 0.17.0
-
-include(CMakeParseArguments)
-
-function(_get_msvc_ide_version result)
- set(${result} "" PARENT_SCOPE)
-
- # VisualStudioVersion is set by vcvars*.bat
- if(DEFINED ENV{VisualStudioVersion})
- string(REGEX MATCH "([0-9]+)\.0" _ $ENV{VisualStudioVersion})
- if(CMAKE_MATCH_COUNT EQUAL 1)
- set(${result} ${CMAKE_MATCH_1} PARENT_SCOPE)
- return()
- else()
- message(FATAL_ERROR "Conan: Unexpected env variable VisualStudioVersion format [$ENV{VisualStudioVersion}]")
- endif()
- endif()
-
- # fallback to MSVC_VERSION which is set only based on _MSC_VER and can differ from the really installed
- # Visual Studio version if non-standard toolset is used
- if(NOT MSVC_VERSION VERSION_LESS 1400 AND MSVC_VERSION VERSION_LESS 1500)
- set(${result} 8 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1500 AND MSVC_VERSION VERSION_LESS 1600)
- set(${result} 9 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1600 AND MSVC_VERSION VERSION_LESS 1700)
- set(${result} 10 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1700 AND MSVC_VERSION VERSION_LESS 1800)
- set(${result} 11 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1800 AND MSVC_VERSION VERSION_LESS 1900)
- set(${result} 12 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1900 AND MSVC_VERSION VERSION_LESS 1910)
- set(${result} 14 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1910 AND MSVC_VERSION VERSION_LESS 1920)
- set(${result} 15 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1920 AND MSVC_VERSION VERSION_LESS 1930)
- set(${result} 16 PARENT_SCOPE)
- elseif(NOT MSVC_VERSION VERSION_LESS 1930 AND MSVC_VERSION VERSION_LESS 1940)
- set(${result} 17 PARENT_SCOPE)
- else()
- message(FATAL_ERROR "Conan: Unknown MSVC compiler version [${MSVC_VERSION}]")
- endif()
-endfunction()
-
-macro(_conan_detect_build_type)
- conan_parse_arguments(${ARGV})
-
- if(ARGUMENTS_BUILD_TYPE)
- set(_CONAN_SETTING_BUILD_TYPE ${ARGUMENTS_BUILD_TYPE})
- elseif(CMAKE_BUILD_TYPE)
- set(_CONAN_SETTING_BUILD_TYPE ${CMAKE_BUILD_TYPE})
- else()
- message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
- endif()
-
- string(TOUPPER ${_CONAN_SETTING_BUILD_TYPE} _CONAN_SETTING_BUILD_TYPE_UPPER)
- if (_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "DEBUG")
- set(_CONAN_SETTING_BUILD_TYPE "Debug")
- elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELEASE")
- set(_CONAN_SETTING_BUILD_TYPE "Release")
- elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "RELWITHDEBINFO")
- set(_CONAN_SETTING_BUILD_TYPE "RelWithDebInfo")
- elseif(_CONAN_SETTING_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL")
- set(_CONAN_SETTING_BUILD_TYPE "MinSizeRel")
- endif()
-endmacro()
-
-macro(_conan_check_system_name)
- #handle -s os setting
- if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
- #use default conan os setting if CMAKE_SYSTEM_NAME is not defined
- set(CONAN_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
- if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
- set(CONAN_SYSTEM_NAME Macos)
- message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}")
- set(_CONAN_SETTING_OS_VERSION ${CMAKE_OSX_DEPLOYMENT_TARGET})
- endif()
- if(${CMAKE_SYSTEM_NAME} STREQUAL "QNX")
- set(CONAN_SYSTEM_NAME Neutrino)
- endif()
- set(CONAN_SUPPORTED_PLATFORMS Windows Linux Macos Android iOS FreeBSD WindowsStore WindowsCE watchOS tvOS FreeBSD SunOS AIX Arduino Emscripten Neutrino)
- list (FIND CONAN_SUPPORTED_PLATFORMS "${CONAN_SYSTEM_NAME}" _index)
- if (${_index} GREATER -1)
- #check if the cmake system is a conan supported one
- set(_CONAN_SETTING_OS ${CONAN_SYSTEM_NAME})
- else()
- message(FATAL_ERROR "cmake system ${CONAN_SYSTEM_NAME} is not supported by conan. Use one of ${CONAN_SUPPORTED_PLATFORMS}")
- endif()
- endif()
-endmacro()
-
-macro(_conan_check_language)
- get_property(_languages GLOBAL PROPERTY ENABLED_LANGUAGES)
- if (";${_languages};" MATCHES ";CXX;")
- set(LANGUAGE CXX)
- set(USING_CXX 1)
- elseif (";${_languages};" MATCHES ";C;")
- set(LANGUAGE C)
- set(USING_CXX 0)
- else ()
- message(FATAL_ERROR "Conan: Neither C or C++ was detected as a language for the project. Unabled to detect compiler version.")
- endif()
-endmacro()
-
-macro(_conan_detect_compiler)
-
- conan_parse_arguments(${ARGV})
-
- if(ARGUMENTS_ARCH)
- set(_CONAN_SETTING_ARCH ${ARGUMENTS_ARCH})
- endif()
-
- if(USING_CXX)
- set(_CONAN_SETTING_COMPILER_CPPSTD ${CMAKE_CXX_STANDARD})
- endif()
-
- if (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL GNU)
- # using GCC
- # TODO: Handle other params
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(COMPILER_VERSION ${MAJOR}.${MINOR})
- if(${MAJOR} GREATER 4)
- set(COMPILER_VERSION ${MAJOR})
- endif()
- set(_CONAN_SETTING_COMPILER gcc)
- set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Intel)
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(COMPILER_VERSION ${MAJOR}.${MINOR})
- set(_CONAN_SETTING_COMPILER intel)
- set(_CONAN_SETTING_COMPILER_VERSION ${COMPILER_VERSION})
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL AppleClang)
- # using AppleClang
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(_CONAN_SETTING_COMPILER apple-clang)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang
- AND NOT "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC"
- AND NOT "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC")
-
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_${LANGUAGE}_COMPILER_VERSION})
- list(GET VERSION_LIST 0 MAJOR)
- list(GET VERSION_LIST 1 MINOR)
- set(_CONAN_SETTING_COMPILER clang)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR}.${MINOR})
- if(APPLE)
- cmake_policy(GET CMP0025 APPLE_CLANG_POLICY)
- if(NOT APPLE_CLANG_POLICY STREQUAL NEW)
- message(STATUS "Conan: APPLE and Clang detected. Assuming apple-clang compiler. Set CMP0025 to avoid it")
- set(_CONAN_SETTING_COMPILER apple-clang)
- endif()
- endif()
- if(${_CONAN_SETTING_COMPILER} STREQUAL clang AND ${MAJOR} GREATER 7)
- set(_CONAN_SETTING_COMPILER_VERSION ${MAJOR})
- endif()
- if (USING_CXX)
- conan_cmake_detect_unix_libcxx(_LIBCXX)
- set(_CONAN_SETTING_COMPILER_LIBCXX ${_LIBCXX})
- endif ()
- elseif(${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL MSVC
- OR (${CMAKE_${LANGUAGE}_COMPILER_ID} STREQUAL Clang
- AND "${CMAKE_${LANGUAGE}_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC"
- AND "${CMAKE_${LANGUAGE}_SIMULATE_ID}" STREQUAL "MSVC"))
-
- set(_VISUAL "Visual Studio")
- _get_msvc_ide_version(_VISUAL_VERSION)
- if("${_VISUAL_VERSION}" STREQUAL "")
- message(FATAL_ERROR "Conan: Visual Studio not recognized")
- else()
- set(_CONAN_SETTING_COMPILER ${_VISUAL})
- set(_CONAN_SETTING_COMPILER_VERSION ${_VISUAL_VERSION})
- endif()
-
- if(NOT _CONAN_SETTING_ARCH)
- if (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "64")
- set(_CONAN_SETTING_ARCH x86_64)
- elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "^ARM")
- message(STATUS "Conan: Using default ARM architecture from MSVC")
- set(_CONAN_SETTING_ARCH armv6)
- elseif (MSVC_${LANGUAGE}_ARCHITECTURE_ID MATCHES "86")
- set(_CONAN_SETTING_ARCH x86)
- else ()
- message(FATAL_ERROR "Conan: Unknown MSVC architecture [${MSVC_${LANGUAGE}_ARCHITECTURE_ID}]")
- endif()
- endif()
-
- conan_cmake_detect_vs_runtime(_vs_runtime ${ARGV})
- message(STATUS "Conan: Detected VS runtime: ${_vs_runtime}")
- set(_CONAN_SETTING_COMPILER_RUNTIME ${_vs_runtime})
-
- if (CMAKE_GENERATOR_TOOLSET)
- set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
- elseif(CMAKE_VS_PLATFORM_TOOLSET AND (CMAKE_GENERATOR STREQUAL "Ninja"))
- set(_CONAN_SETTING_COMPILER_TOOLSET ${CMAKE_VS_PLATFORM_TOOLSET})
- endif()
- else()
- message(FATAL_ERROR "Conan: compiler setup not recognized")
- endif()
-
-endmacro()
-
-function(conan_cmake_settings result)
- #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER})
- #message(STATUS "COMPILER " ${CMAKE_CXX_COMPILER_ID})
- #message(STATUS "VERSION " ${CMAKE_CXX_COMPILER_VERSION})
- #message(STATUS "FLAGS " ${CMAKE_LANG_FLAGS})
- #message(STATUS "LIB ARCH " ${CMAKE_CXX_LIBRARY_ARCHITECTURE})
- #message(STATUS "BUILD TYPE " ${CMAKE_BUILD_TYPE})
- #message(STATUS "GENERATOR " ${CMAKE_GENERATOR})
- #message(STATUS "GENERATOR WIN64 " ${CMAKE_CL_64})
-
- message(STATUS "Conan: Automatic detection of conan settings from cmake")
-
- conan_parse_arguments(${ARGV})
-
- _conan_detect_build_type(${ARGV})
-
- _conan_check_system_name()
-
- _conan_check_language()
-
- _conan_detect_compiler(${ARGV})
-
- # If profile is defined it is used
- if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND ARGUMENTS_DEBUG_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_DEBUG_PROFILE})
- elseif(CMAKE_BUILD_TYPE STREQUAL "Release" AND ARGUMENTS_RELEASE_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_RELEASE_PROFILE})
- elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo" AND ARGUMENTS_RELWITHDEBINFO_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_RELWITHDEBINFO_PROFILE})
- elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel" AND ARGUMENTS_MINSIZEREL_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_MINSIZEREL_PROFILE})
- elseif(ARGUMENTS_PROFILE)
- set(_APPLIED_PROFILES ${ARGUMENTS_PROFILE})
- endif()
-
- foreach(ARG ${_APPLIED_PROFILES})
- set(_SETTINGS ${_SETTINGS} -pr=${ARG})
- endforeach()
- foreach(ARG ${ARGUMENTS_PROFILE_BUILD})
- conan_check(VERSION 1.24.0 REQUIRED DETECT_QUIET)
- set(_SETTINGS ${_SETTINGS} -pr:b=${ARG})
- endforeach()
-
- if(NOT _SETTINGS OR ARGUMENTS_PROFILE_AUTO STREQUAL "ALL")
- set(ARGUMENTS_PROFILE_AUTO arch os.version build_type compiler compiler.version
- compiler.runtime compiler.libcxx compiler.toolset)
- endif()
-
- # remove any manually specified settings from the autodetected settings
- foreach(ARG ${ARGUMENTS_SETTINGS})
- string(REGEX MATCH "[^=]*" MANUAL_SETTING "${ARG}")
- message(STATUS "Conan: ${MANUAL_SETTING} was added as an argument. Not using the autodetected one.")
- list(REMOVE_ITEM ARGUMENTS_PROFILE_AUTO "${MANUAL_SETTING}")
- endforeach()
-
- # Automatic from CMake
- foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
- string(TOUPPER ${ARG} _arg_name)
- string(REPLACE "." "_" _arg_name ${_arg_name})
- if(_CONAN_SETTING_${_arg_name})
- set(_SETTINGS ${_SETTINGS} -s ${ARG}=${_CONAN_SETTING_${_arg_name}})
- endif()
- endforeach()
-
- foreach(ARG ${ARGUMENTS_SETTINGS})
- set(_SETTINGS ${_SETTINGS} -s ${ARG})
- endforeach()
-
- message(STATUS "Conan: Settings= ${_SETTINGS}")
-
- set(${result} ${_SETTINGS} PARENT_SCOPE)
-endfunction()
-
-
-function(conan_cmake_detect_unix_libcxx result)
- # Take into account any -stdlib in compile options
- get_directory_property(compile_options DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_OPTIONS)
- string(GENEX_STRIP "${compile_options}" compile_options)
-
- # Take into account any _GLIBCXX_USE_CXX11_ABI in compile definitions
- get_directory_property(defines DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
- string(GENEX_STRIP "${defines}" defines)
-
- foreach(define ${defines})
- if(define MATCHES "_GLIBCXX_USE_CXX11_ABI")
- if(define MATCHES "^-D")
- set(compile_options ${compile_options} "${define}")
- else()
- set(compile_options ${compile_options} "-D${define}")
- endif()
- endif()
- endforeach()
-
- # add additional compiler options ala cmRulePlaceholderExpander::ExpandRuleVariable
- set(EXPAND_CXX_COMPILER ${CMAKE_CXX_COMPILER})
- if(CMAKE_CXX_COMPILER_ARG1)
- # CMake splits CXX="foo bar baz" into CMAKE_CXX_COMPILER="foo", CMAKE_CXX_COMPILER_ARG1="bar baz"
- # without this, ccache, winegcc, or other wrappers might lose all their arguments
- separate_arguments(SPLIT_CXX_COMPILER_ARG1 NATIVE_COMMAND ${CMAKE_CXX_COMPILER_ARG1})
- list(APPEND EXPAND_CXX_COMPILER ${SPLIT_CXX_COMPILER_ARG1})
- endif()
-
- if(CMAKE_CXX_COMPILE_OPTIONS_TARGET AND CMAKE_CXX_COMPILER_TARGET)
- # without --target= we may be calling the wrong underlying GCC
- list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_TARGET}${CMAKE_CXX_COMPILER_TARGET}")
- endif()
-
- if(CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN AND CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
- list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_EXTERNAL_TOOLCHAIN}${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
- endif()
-
- if(CMAKE_CXX_COMPILE_OPTIONS_SYSROOT)
- # without --sysroot= we may find the wrong #include <string>
- if(CMAKE_SYSROOT_COMPILE)
- list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT_COMPILE}")
- elseif(CMAKE_SYSROOT)
- list(APPEND EXPAND_CXX_COMPILER "${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}")
- endif()
- endif()
-
- separate_arguments(SPLIT_CXX_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS})
-
- if(CMAKE_OSX_SYSROOT)
- set(xcode_sysroot_option "--sysroot=${CMAKE_OSX_SYSROOT}")
- endif()
-
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E echo "#include <string>"
- COMMAND ${EXPAND_CXX_COMPILER} ${SPLIT_CXX_FLAGS} -x c++ ${xcode_sysroot_option} ${compile_options} -E -dM -
- OUTPUT_VARIABLE string_defines
- )
-
- if(string_defines MATCHES "#define __GLIBCXX__")
- # Allow -D_GLIBCXX_USE_CXX11_ABI=ON/OFF as argument to cmake
- if(DEFINED _GLIBCXX_USE_CXX11_ABI)
- if(_GLIBCXX_USE_CXX11_ABI)
- set(${result} libstdc++11 PARENT_SCOPE)
- return()
- else()
- set(${result} libstdc++ PARENT_SCOPE)
- return()
- endif()
- endif()
-
- if(string_defines MATCHES "#define _GLIBCXX_USE_CXX11_ABI 1\n")
- set(${result} libstdc++11 PARENT_SCOPE)
- else()
- # Either the compiler is missing the define because it is old, and so
- # it can't use the new abi, or the compiler was configured to use the
- # old abi by the user or distro (e.g. devtoolset on RHEL/CentOS)
- set(${result} libstdc++ PARENT_SCOPE)
- endif()
- else()
- set(${result} libc++ PARENT_SCOPE)
- endif()
-endfunction()
-
-function(conan_cmake_detect_vs_runtime result)
-
- conan_parse_arguments(${ARGV})
- if(ARGUMENTS_BUILD_TYPE)
- set(build_type "${ARGUMENTS_BUILD_TYPE}")
- elseif(CMAKE_BUILD_TYPE)
- set(build_type "${CMAKE_BUILD_TYPE}")
- else()
- message(FATAL_ERROR "Please specify in command line CMAKE_BUILD_TYPE (-DCMAKE_BUILD_TYPE=Release)")
- endif()
-
- if(build_type)
- string(TOUPPER "${build_type}" build_type)
- endif()
-
- if (DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
- if(${CMAKE_MSVC_RUNTIME_LIBRARY} STREQUAL MultiThreaded)
- set(${result} "MT" PARENT_SCOPE)
- elseif(${CMAKE_MSVC_RUNTIME_LIBRARY} STREQUAL MultiThreadedDebug)
- set(${result} "MTd" PARENT_SCOPE)
- elseif(${CMAKE_MSVC_RUNTIME_LIBRARY} STREQUAL MultiThreadedDLL)
- set(${result} "MD" PARENT_SCOPE)
- elseif(${CMAKE_MSVC_RUNTIME_LIBRARY} STREQUAL MultiThreadedDebugDLL)
- set(${result} "MDd" PARENT_SCOPE)
- elseif(${CMAKE_MSVC_RUNTIME_LIBRARY} STREQUAL "MultiThreaded$<$<CONFIG:Debug>:Debug>")
- if(${build_type} STREQUAL DEBUG)
- set(${result} "MTd" PARENT_SCOPE)
- else()
- set(${result} "MT" PARENT_SCOPE)
- endif()
- elseif(${CMAKE_MSVC_RUNTIME_LIBRARY} STREQUAL "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL")
- if(${build_type} STREQUAL DEBUG)
- set(${result} "MDd" PARENT_SCOPE)
- else()
- set(${result} "MD" PARENT_SCOPE)
- endif()
- else()
- message(FATAL_ERROR "Incorrect CMAKE_MSVC_RUNTIME_LIBRARY value ${CMAKE_MSVC_RUNTIME_LIBRARY}")
- endif()
- return()
- endif()
-
- set(variables CMAKE_CXX_FLAGS_${build_type} CMAKE_C_FLAGS_${build_type} CMAKE_CXX_FLAGS CMAKE_C_FLAGS)
- foreach(variable ${variables})
- if(NOT "${${variable}}" STREQUAL "")
- string(REPLACE " " ";" flags "${${variable}}")
- foreach (flag ${flags})
- if("${flag}" STREQUAL "/MD" OR "${flag}" STREQUAL "/MDd" OR "${flag}" STREQUAL "/MT" OR "${flag}" STREQUAL "/MTd")
- string(SUBSTRING "${flag}" 1 -1 runtime)
- set(${result} "${runtime}" PARENT_SCOPE)
- return()
- endif()
- endforeach()
- endif()
- endforeach()
- if("${build_type}" STREQUAL "DEBUG")
- set(${result} "MDd" PARENT_SCOPE)
- else()
- set(${result} "MD" PARENT_SCOPE)
- endif()
-endfunction()
-
-function(_collect_settings result)
- set(ARGUMENTS_PROFILE_AUTO arch os.version build_type compiler compiler.version
- compiler.runtime compiler.libcxx compiler.toolset
- compiler.cppstd)
- foreach(ARG ${ARGUMENTS_PROFILE_AUTO})
- string(TOUPPER ${ARG} _arg_name)
- string(REPLACE "." "_" _arg_name ${_arg_name})
- if(_CONAN_SETTING_${_arg_name})
- set(detected_setings ${detected_setings} ${ARG}=${_CONAN_SETTING_${_arg_name}})
- endif()
- endforeach()
- set(${result} ${detected_setings} PARENT_SCOPE)
-endfunction()
-
-function(conan_cmake_autodetect detected_settings)
- _conan_detect_build_type(${ARGV})
- _conan_check_system_name()
- _conan_check_language()
- _conan_detect_compiler(${ARGV})
- _collect_settings(collected_settings)
- set(${detected_settings} ${collected_settings} PARENT_SCOPE)
-endfunction()
-
-macro(conan_parse_arguments)
- set(options BASIC_SETUP CMAKE_TARGETS UPDATE KEEP_RPATHS NO_LOAD NO_OUTPUT_DIRS OUTPUT_QUIET NO_IMPORTS SKIP_STD)
- set(oneValueArgs CONANFILE ARCH BUILD_TYPE INSTALL_FOLDER CONAN_COMMAND)
- set(multiValueArgs DEBUG_PROFILE RELEASE_PROFILE RELWITHDEBINFO_PROFILE MINSIZEREL_PROFILE
- PROFILE REQUIRES OPTIONS IMPORTS SETTINGS BUILD ENV GENERATORS PROFILE_AUTO
- INSTALL_ARGS CONFIGURATION_TYPES PROFILE_BUILD BUILD_REQUIRES)
- cmake_parse_arguments(ARGUMENTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-endmacro()
-
-function(old_conan_cmake_install)
- # Calls "conan install"
- # Argument BUILD is equivalant to --build={missing, PkgName,...} or
- # --build when argument is 'BUILD all' (which builds all packages from source)
- # Argument CONAN_COMMAND, to specify the conan path, e.g. in case of running from source
- # cmake does not identify conan as command, even if it is +x and it is in the path
- conan_parse_arguments(${ARGV})
-
- if(CONAN_CMAKE_MULTI)
- set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake_multi)
- else()
- set(ARGUMENTS_GENERATORS ${ARGUMENTS_GENERATORS} cmake)
- endif()
-
- set(CONAN_BUILD_POLICY "")
- foreach(ARG ${ARGUMENTS_BUILD})
- if(${ARG} STREQUAL "all")
- set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build)
- break()
- else()
- set(CONAN_BUILD_POLICY ${CONAN_BUILD_POLICY} --build=${ARG})
- endif()
- endforeach()
- if(ARGUMENTS_CONAN_COMMAND)
- set(CONAN_CMD ${ARGUMENTS_CONAN_COMMAND})
- else()
- conan_check(REQUIRED)
- endif()
- set(CONAN_OPTIONS "")
- if(ARGUMENTS_CONANFILE)
- if(IS_ABSOLUTE ${ARGUMENTS_CONANFILE})
- set(CONANFILE ${ARGUMENTS_CONANFILE})
- else()
- set(CONANFILE ${CMAKE_CURRENT_SOURCE_DIR}/${ARGUMENTS_CONANFILE})
- endif()
- else()
- set(CONANFILE ".")
- endif()
- foreach(ARG ${ARGUMENTS_OPTIONS})
- set(CONAN_OPTIONS ${CONAN_OPTIONS} -o=${ARG})
- endforeach()
- if(ARGUMENTS_UPDATE)
- set(CONAN_INSTALL_UPDATE --update)
- endif()
- if(ARGUMENTS_NO_IMPORTS)
- set(CONAN_INSTALL_NO_IMPORTS --no-imports)
- endif()
- set(CONAN_INSTALL_FOLDER "")
- if(ARGUMENTS_INSTALL_FOLDER)
- set(CONAN_INSTALL_FOLDER -if=${ARGUMENTS_INSTALL_FOLDER})
- endif()
- foreach(ARG ${ARGUMENTS_GENERATORS})
- set(CONAN_GENERATORS ${CONAN_GENERATORS} -g=${ARG})
- endforeach()
- foreach(ARG ${ARGUMENTS_ENV})
- set(CONAN_ENV_VARS ${CONAN_ENV_VARS} -e=${ARG})
- endforeach()
- set(conan_args install ${CONANFILE} ${settings} ${CONAN_ENV_VARS} ${CONAN_GENERATORS} ${CONAN_BUILD_POLICY} ${CONAN_INSTALL_UPDATE} ${CONAN_INSTALL_NO_IMPORTS} ${CONAN_OPTIONS} ${CONAN_INSTALL_FOLDER} ${ARGUMENTS_INSTALL_ARGS})
-
- string (REPLACE ";" " " _conan_args "${conan_args}")
- message(STATUS "Conan executing: ${CONAN_CMD} ${_conan_args}")
-
- if(ARGUMENTS_OUTPUT_QUIET)
- execute_process(COMMAND ${CONAN_CMD} ${conan_args}
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE conan_output
- ERROR_VARIABLE conan_output
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- else()
- execute_process(COMMAND ${CONAN_CMD} ${conan_args}
- RESULT_VARIABLE return_code
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- endif()
-
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan install failed='${return_code}'")
- endif()
-
-endfunction()
-
-function(conan_cmake_install)
- if(DEFINED CONAN_COMMAND)
- set(CONAN_CMD ${CONAN_COMMAND})
- else()
- conan_check(REQUIRED)
- endif()
-
- set(installOptions UPDATE NO_IMPORTS OUTPUT_QUIET ERROR_QUIET)
- set(installOneValueArgs PATH_OR_REFERENCE REFERENCE REMOTE LOCKFILE LOCKFILE_OUT LOCKFILE_NODE_ID INSTALL_FOLDER)
- set(installMultiValueArgs GENERATOR BUILD ENV ENV_HOST ENV_BUILD OPTIONS_HOST OPTIONS OPTIONS_BUILD PROFILE
- PROFILE_HOST PROFILE_BUILD SETTINGS SETTINGS_HOST SETTINGS_BUILD CONF)
- cmake_parse_arguments(ARGS "${installOptions}" "${installOneValueArgs}" "${installMultiValueArgs}" ${ARGN})
- foreach(arg ${installOptions})
- if(ARGS_${arg})
- set(${arg} ${${arg}} ${ARGS_${arg}})
- endif()
- endforeach()
- foreach(arg ${installOneValueArgs})
- if(DEFINED ARGS_${arg})
- if("${arg}" STREQUAL "REMOTE")
- set(flag "--remote")
- elseif("${arg}" STREQUAL "LOCKFILE")
- set(flag "--lockfile")
- elseif("${arg}" STREQUAL "LOCKFILE_OUT")
- set(flag "--lockfile-out")
- elseif("${arg}" STREQUAL "LOCKFILE_NODE_ID")
- set(flag "--lockfile-node-id")
- elseif("${arg}" STREQUAL "INSTALL_FOLDER")
- set(flag "--install-folder")
- endif()
- set(${arg} ${${arg}} ${flag} ${ARGS_${arg}})
- endif()
- endforeach()
- foreach(arg ${installMultiValueArgs})
- if(DEFINED ARGS_${arg})
- if("${arg}" STREQUAL "GENERATOR")
- set(flag "--generator")
- elseif("${arg}" STREQUAL "BUILD")
- set(flag "--build")
- elseif("${arg}" STREQUAL "ENV")
- set(flag "--env")
- elseif("${arg}" STREQUAL "ENV_HOST")
- set(flag "--env:host")
- elseif("${arg}" STREQUAL "ENV_BUILD")
- set(flag "--env:build")
- elseif("${arg}" STREQUAL "OPTIONS")
- set(flag "--options")
- elseif("${arg}" STREQUAL "OPTIONS_HOST")
- set(flag "--options:host")
- elseif("${arg}" STREQUAL "OPTIONS_BUILD")
- set(flag "--options:build")
- elseif("${arg}" STREQUAL "PROFILE")
- set(flag "--profile")
- elseif("${arg}" STREQUAL "PROFILE_HOST")
- set(flag "--profile:host")
- elseif("${arg}" STREQUAL "PROFILE_BUILD")
- set(flag "--profile:build")
- elseif("${arg}" STREQUAL "SETTINGS")
- set(flag "--settings")
- elseif("${arg}" STREQUAL "SETTINGS_HOST")
- set(flag "--settings:host")
- elseif("${arg}" STREQUAL "SETTINGS_BUILD")
- set(flag "--settings:build")
- elseif("${arg}" STREQUAL "CONF")
- set(flag "--conf")
- endif()
- list(LENGTH ARGS_${arg} numargs)
- foreach(item ${ARGS_${arg}})
- if(${item} STREQUAL "all" AND ${arg} STREQUAL "BUILD")
- set(${arg} "--build")
- break()
- endif()
- set(${arg} ${${arg}} ${flag} ${item})
- endforeach()
- endif()
- endforeach()
- if(DEFINED UPDATE)
- set(UPDATE --update)
- endif()
- if(DEFINED NO_IMPORTS)
- set(NO_IMPORTS --no-imports)
- endif()
- set(install_args install ${PATH_OR_REFERENCE} ${REFERENCE} ${UPDATE} ${NO_IMPORTS} ${REMOTE} ${LOCKFILE} ${LOCKFILE_OUT} ${LOCKFILE_NODE_ID} ${INSTALL_FOLDER}
- ${GENERATOR} ${BUILD} ${ENV} ${ENV_HOST} ${ENV_BUILD} ${OPTIONS} ${OPTIONS_HOST} ${OPTIONS_BUILD}
- ${PROFILE} ${PROFILE_HOST} ${PROFILE_BUILD} ${SETTINGS} ${SETTINGS_HOST} ${SETTINGS_BUILD} ${CONF})
-
- string(REPLACE ";" " " _install_args "${install_args}")
- message(STATUS "Conan executing: ${CONAN_CMD} ${_install_args}")
-
- if(ARGS_OUTPUT_QUIET)
- set(OUTPUT_OPT OUTPUT_QUIET)
- endif()
- if(ARGS_ERROR_QUIET)
- set(ERROR_OPT ERROR_QUIET)
- endif()
-
- execute_process(COMMAND ${CONAN_CMD} ${install_args}
- RESULT_VARIABLE return_code
- ${OUTPUT_OPT}
- ${ERROR_OPT}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
- if(NOT "${return_code}" STREQUAL "0")
- if (ARGS_ERROR_QUIET)
- message(WARNING "Conan install failed='${return_code}'")
- else()
- message(FATAL_ERROR "Conan install failed='${return_code}'")
- endif()
- endif()
-
-endfunction()
-
-function(conan_cmake_setup_conanfile)
- conan_parse_arguments(${ARGV})
- if(ARGUMENTS_CONANFILE)
- get_filename_component(_CONANFILE_NAME ${ARGUMENTS_CONANFILE} NAME)
- # configure_file will make sure cmake re-runs when conanfile is updated
- configure_file(${ARGUMENTS_CONANFILE} ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk COPYONLY)
- file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${_CONANFILE_NAME}.junk)
- else()
- conan_cmake_generate_conanfile(ON ${ARGV})
- endif()
-endfunction()
-
-function(conan_cmake_configure)
- conan_cmake_generate_conanfile(OFF ${ARGV})
-endfunction()
-
-# Generate, writing in disk a conanfile.txt with the requires, options, and imports
-# specified as arguments
-# This will be considered as temporary file, generated in CMAKE_CURRENT_BINARY_DIR)
-function(conan_cmake_generate_conanfile DEFAULT_GENERATOR)
-
- conan_parse_arguments(${ARGV})
-
- set(_FN "${CMAKE_CURRENT_BINARY_DIR}/conanfile.txt")
- file(WRITE ${_FN} "")
-
- if(DEFINED ARGUMENTS_REQUIRES)
- file(APPEND ${_FN} "[requires]\n")
- foreach(REQUIRE ${ARGUMENTS_REQUIRES})
- file(APPEND ${_FN} ${REQUIRE} "\n")
- endforeach()
- endif()
-
- if (DEFAULT_GENERATOR OR DEFINED ARGUMENTS_GENERATORS)
- file(APPEND ${_FN} "[generators]\n")
- if (DEFAULT_GENERATOR)
- file(APPEND ${_FN} "cmake\n")
- endif()
- if (DEFINED ARGUMENTS_GENERATORS)
- foreach(GENERATOR ${ARGUMENTS_GENERATORS})
- file(APPEND ${_FN} ${GENERATOR} "\n")
- endforeach()
- endif()
- endif()
-
- if(DEFINED ARGUMENTS_BUILD_REQUIRES)
- file(APPEND ${_FN} "[build_requires]\n")
- foreach(BUILD_REQUIRE ${ARGUMENTS_BUILD_REQUIRES})
- file(APPEND ${_FN} ${BUILD_REQUIRE} "\n")
- endforeach()
- endif()
-
- if(DEFINED ARGUMENTS_IMPORTS)
- file(APPEND ${_FN} "[imports]\n")
- foreach(IMPORTS ${ARGUMENTS_IMPORTS})
- file(APPEND ${_FN} ${IMPORTS} "\n")
- endforeach()
- endif()
-
- if(DEFINED ARGUMENTS_OPTIONS)
- file(APPEND ${_FN} "[options]\n")
- foreach(OPTION ${ARGUMENTS_OPTIONS})
- file(APPEND ${_FN} ${OPTION} "\n")
- endforeach()
- endif()
-
-endfunction()
-
-
-macro(conan_load_buildinfo)
- if(CONAN_CMAKE_MULTI)
- set(_CONANBUILDINFO conanbuildinfo_multi.cmake)
- else()
- set(_CONANBUILDINFO conanbuildinfo.cmake)
- endif()
- if(ARGUMENTS_INSTALL_FOLDER)
- set(_CONANBUILDINFOFOLDER ${ARGUMENTS_INSTALL_FOLDER})
- else()
- set(_CONANBUILDINFOFOLDER ${CMAKE_CURRENT_BINARY_DIR})
- endif()
- # Checks for the existence of conanbuildinfo.cmake, and loads it
- # important that it is macro, so variables defined at parent scope
- if(EXISTS "${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO}")
- message(STATUS "Conan: Loading ${_CONANBUILDINFO}")
- include(${_CONANBUILDINFOFOLDER}/${_CONANBUILDINFO})
- else()
- message(FATAL_ERROR "${_CONANBUILDINFO} doesn't exist in ${CMAKE_CURRENT_BINARY_DIR}")
- endif()
-endmacro()
-
-
-macro(conan_cmake_run)
- conan_parse_arguments(${ARGV})
-
- if(ARGUMENTS_CONFIGURATION_TYPES AND NOT CMAKE_CONFIGURATION_TYPES)
- message(WARNING "CONFIGURATION_TYPES should only be specified for multi-configuration generators")
- elseif(ARGUMENTS_CONFIGURATION_TYPES AND ARGUMENTS_BUILD_TYPE)
- message(WARNING "CONFIGURATION_TYPES and BUILD_TYPE arguments should not be defined at the same time.")
- endif()
-
- if(CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE AND NOT CONAN_EXPORTED
- AND NOT ARGUMENTS_BUILD_TYPE)
- set(CONAN_CMAKE_MULTI ON)
- if (NOT ARGUMENTS_CONFIGURATION_TYPES)
- set(ARGUMENTS_CONFIGURATION_TYPES "Release;Debug")
- endif()
- message(STATUS "Conan: Using cmake-multi generator")
- else()
- set(CONAN_CMAKE_MULTI OFF)
- endif()
-
- if(NOT CONAN_EXPORTED)
- conan_cmake_setup_conanfile(${ARGV})
- if(CONAN_CMAKE_MULTI)
- foreach(CMAKE_BUILD_TYPE ${ARGUMENTS_CONFIGURATION_TYPES})
- set(ENV{CONAN_IMPORT_PATH} ${CMAKE_BUILD_TYPE})
- conan_cmake_settings(settings ${ARGV})
- old_conan_cmake_install(SETTINGS ${settings} ${ARGV})
- endforeach()
- set(CMAKE_BUILD_TYPE)
- else()
- conan_cmake_settings(settings ${ARGV})
- old_conan_cmake_install(SETTINGS ${settings} ${ARGV})
- endif()
- endif()
-
- if (NOT ARGUMENTS_NO_LOAD)
- conan_load_buildinfo()
- endif()
-
- if(ARGUMENTS_BASIC_SETUP)
- foreach(_option CMAKE_TARGETS KEEP_RPATHS NO_OUTPUT_DIRS SKIP_STD)
- if(ARGUMENTS_${_option})
- if(${_option} STREQUAL "CMAKE_TARGETS")
- list(APPEND _setup_options "TARGETS")
- else()
- list(APPEND _setup_options ${_option})
- endif()
- endif()
- endforeach()
- conan_basic_setup(${_setup_options})
- endif()
-endmacro()
-
-macro(conan_check)
- # Checks conan availability in PATH
- # Arguments REQUIRED, DETECT_QUIET and VERSION are optional
- # Example usage:
- # conan_check(VERSION 1.0.0 REQUIRED)
- set(options REQUIRED DETECT_QUIET)
- set(oneValueArgs VERSION)
- cmake_parse_arguments(CONAN "${options}" "${oneValueArgs}" "" ${ARGN})
- if(NOT CONAN_DETECT_QUIET)
- message(STATUS "Conan: checking conan executable")
- endif()
-
- find_program(CONAN_CMD conan)
- if(NOT CONAN_CMD AND CONAN_REQUIRED)
- message(FATAL_ERROR "Conan executable not found! Please install conan.")
- endif()
- if(NOT CONAN_DETECT_QUIET)
- message(STATUS "Conan: Found program ${CONAN_CMD}")
- endif()
- execute_process(COMMAND ${CONAN_CMD} --version
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE CONAN_VERSION_OUTPUT
- ERROR_VARIABLE CONAN_VERSION_OUTPUT)
-
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan --version failed='${return_code}'")
- endif()
-
- if(NOT CONAN_DETECT_QUIET)
- string(STRIP "${CONAN_VERSION_OUTPUT}" _CONAN_VERSION_OUTPUT)
- message(STATUS "Conan: Version found ${_CONAN_VERSION_OUTPUT}")
- endif()
-
- if(DEFINED CONAN_VERSION)
- string(REGEX MATCH ".*Conan version ([0-9]+\\.[0-9]+\\.[0-9]+)" FOO
- "${CONAN_VERSION_OUTPUT}")
- if(${CMAKE_MATCH_1} VERSION_LESS ${CONAN_VERSION})
- message(FATAL_ERROR "Conan outdated. Installed: ${CMAKE_MATCH_1}, \
- required: ${CONAN_VERSION}. Consider updating via 'pip \
- install conan==${CONAN_VERSION}'.")
- endif()
- endif()
-endmacro()
-
-function(conan_add_remote)
- # Adds a remote
- # Arguments URL and NAME are required, INDEX, COMMAND and VERIFY_SSL are optional
- # Example usage:
- # conan_add_remote(NAME bincrafters INDEX 1
- # URL https://api.bintray.com/conan/bincrafters/public-conan
- # VERIFY_SSL True)
- set(oneValueArgs URL NAME INDEX COMMAND VERIFY_SSL)
- cmake_parse_arguments(CONAN "" "${oneValueArgs}" "" ${ARGN})
-
- if(DEFINED CONAN_INDEX)
- set(CONAN_INDEX_ARG "-i ${CONAN_INDEX}")
- endif()
- if(DEFINED CONAN_COMMAND)
- set(CONAN_CMD ${CONAN_COMMAND})
- else()
- conan_check(REQUIRED DETECT_QUIET)
- endif()
- set(CONAN_VERIFY_SSL_ARG "True")
- if(DEFINED CONAN_VERIFY_SSL)
- set(CONAN_VERIFY_SSL_ARG ${CONAN_VERIFY_SSL})
- endif()
- message(STATUS "Conan: Adding ${CONAN_NAME} remote repository (${CONAN_URL}) verify ssl (${CONAN_VERIFY_SSL_ARG})")
- execute_process(COMMAND ${CONAN_CMD} remote add ${CONAN_NAME} ${CONAN_INDEX_ARG} -f ${CONAN_URL} ${CONAN_VERIFY_SSL_ARG}
- RESULT_VARIABLE return_code)
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan remote failed='${return_code}'")
- endif()
-endfunction()
-
-macro(conan_config_install)
- # install a full configuration from a local or remote zip file
- # Argument ITEM is required, arguments TYPE, SOURCE, TARGET and VERIFY_SSL are optional
- # Example usage:
- # conan_config_install(ITEM https://github.com/conan-io/cmake-conan.git
- # TYPE git SOURCE source-folder TARGET target-folder VERIFY_SSL false)
- set(oneValueArgs ITEM TYPE SOURCE TARGET VERIFY_SSL)
- set(multiValueArgs ARGS)
- cmake_parse_arguments(CONAN "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- find_program(CONAN_CMD conan)
- if(NOT CONAN_CMD AND CONAN_REQUIRED)
- message(FATAL_ERROR "Conan executable not found!")
- endif()
-
- if(DEFINED CONAN_VERIFY_SSL)
- set(CONAN_VERIFY_SSL_ARG "--verify-ssl=${CONAN_VERIFY_SSL}")
- endif()
-
- if(DEFINED CONAN_TYPE)
- set(CONAN_TYPE_ARG "--type=${CONAN_TYPE}")
- endif()
-
- if(DEFINED CONAN_ARGS)
- set(CONAN_ARGS_ARGS "--args=\"${CONAN_ARGS}\"")
- endif()
-
- if(DEFINED CONAN_SOURCE)
- set(CONAN_SOURCE_ARGS "--source-folder=${CONAN_SOURCE}")
- endif()
-
- if(DEFINED CONAN_TARGET)
- set(CONAN_TARGET_ARGS "--target-folder=${CONAN_TARGET}")
- endif()
-
- set (CONAN_CONFIG_INSTALL_ARGS ${CONAN_VERIFY_SSL_ARG}
- ${CONAN_TYPE_ARG}
- ${CONAN_ARGS_ARGS}
- ${CONAN_SOURCE_ARGS}
- ${CONAN_TARGET_ARGS})
-
- message(STATUS "Conan: Installing config from ${CONAN_ITEM}")
- execute_process(COMMAND ${CONAN_CMD} config install ${CONAN_ITEM} ${CONAN_CONFIG_INSTALL_ARGS}
- RESULT_VARIABLE return_code)
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan config failed='${return_code}'")
- endif()
-endmacro()
diff --git a/build/export_generators/hardcoded-cmake/cmake/conan_provider.cmake b/build/export_generators/hardcoded-cmake/cmake/conan_provider.cmake
deleted file mode 100644
index edb51e2a43..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/conan_provider.cmake
+++ /dev/null
@@ -1,663 +0,0 @@
-# The MIT License (MIT)
-#
-# Copyright (c) 2024 JFrog
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to deal
-# in the Software without restriction, including without limitation the rights
-# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-# copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in all
-# copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-# SOFTWARE.
-
-set(CONAN_MINIMUM_VERSION 2.0.5)
-
-# Create a new policy scope and set the minimum required cmake version so the
-# features behind a policy setting like if(... IN_LIST ...) behaves as expected
-# even if the parent project does not specify a minimum cmake version or a minimum
-# version less than this module requires (e.g. 3.0) before the first project() call.
-# (see: https://cmake.org/cmake/help/latest/variable/CMAKE_PROJECT_TOP_LEVEL_INCLUDES.html)
-#
-# The policy-affecting calls like cmake_policy(SET...) or `cmake_minimum_required` only
-# affects the current policy scope, i.e. between the PUSH and POP in this case.
-#
-# https://cmake.org/cmake/help/book/mastering-cmake/chapter/Policies.html#the-policy-stack
-cmake_policy(PUSH)
-cmake_minimum_required(VERSION 3.24)
-
-function(detect_os OS OS_API_LEVEL OS_SDK OS_SUBSYSTEM OS_VERSION)
- # it could be cross compilation
- message(STATUS "CMake-Conan: cmake_system_name=${CMAKE_SYSTEM_NAME}")
- if(CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Generic")
- if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
- set(${OS} Macos PARENT_SCOPE)
- elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX")
- set(${OS} Neutrino PARENT_SCOPE)
- elseif(CMAKE_SYSTEM_NAME STREQUAL "CYGWIN")
- set(${OS} Windows PARENT_SCOPE)
- set(${OS_SUBSYSTEM} cygwin PARENT_SCOPE)
- elseif(CMAKE_SYSTEM_NAME MATCHES "^MSYS")
- set(${OS} Windows PARENT_SCOPE)
- set(${OS_SUBSYSTEM} msys2 PARENT_SCOPE)
- else()
- set(${OS} ${CMAKE_SYSTEM_NAME} PARENT_SCOPE)
- endif()
- if(CMAKE_SYSTEM_NAME STREQUAL "Android")
- if(DEFINED ANDROID_PLATFORM)
- string(REGEX MATCH "[0-9]+" _OS_API_LEVEL ${ANDROID_PLATFORM})
- elseif(DEFINED CMAKE_SYSTEM_VERSION)
- set(_OS_API_LEVEL ${CMAKE_SYSTEM_VERSION})
- endif()
- message(STATUS "CMake-Conan: android api level=${_OS_API_LEVEL}")
- set(${OS_API_LEVEL} ${_OS_API_LEVEL} PARENT_SCOPE)
- endif()
- if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS")
- # CMAKE_OSX_SYSROOT contains the full path to the SDK for MakeFile/Ninja
- # generators, but just has the original input string for Xcode.
- if(NOT IS_DIRECTORY ${CMAKE_OSX_SYSROOT})
- set(_OS_SDK ${CMAKE_OSX_SYSROOT})
- else()
- if(CMAKE_OSX_SYSROOT MATCHES Simulator)
- set(apple_platform_suffix simulator)
- else()
- set(apple_platform_suffix os)
- endif()
- if(CMAKE_OSX_SYSROOT MATCHES AppleTV)
- set(_OS_SDK "appletv${apple_platform_suffix}")
- elseif(CMAKE_OSX_SYSROOT MATCHES iPhone)
- set(_OS_SDK "iphone${apple_platform_suffix}")
- elseif(CMAKE_OSX_SYSROOT MATCHES Watch)
- set(_OS_SDK "watch${apple_platform_suffix}")
- endif()
- endif()
- if(DEFINED _OS_SDK)
- message(STATUS "CMake-Conan: cmake_osx_sysroot=${CMAKE_OSX_SYSROOT}")
- set(${OS_SDK} ${_OS_SDK} PARENT_SCOPE)
- endif()
- if(DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
- message(STATUS "CMake-Conan: cmake_osx_deployment_target=${CMAKE_OSX_DEPLOYMENT_TARGET}")
- set(${OS_VERSION} ${CMAKE_OSX_DEPLOYMENT_TARGET} PARENT_SCOPE)
- endif()
- endif()
- endif()
-endfunction()
-
-
-function(detect_arch ARCH)
- # CMAKE_OSX_ARCHITECTURES can contain multiple architectures, but Conan only supports one.
- # Therefore this code only finds one. If the recipes support multiple architectures, the
- # build will work. Otherwise, there will be a linker error for the missing architecture(s).
- if(DEFINED CMAKE_OSX_ARCHITECTURES)
- string(REPLACE " " ";" apple_arch_list "${CMAKE_OSX_ARCHITECTURES}")
- list(LENGTH apple_arch_list apple_arch_count)
- if(apple_arch_count GREATER 1)
- message(WARNING "CMake-Conan: Multiple architectures detected, this will only work if Conan recipe(s) produce fat binaries.")
- endif()
- endif()
- if(CMAKE_SYSTEM_NAME MATCHES "Darwin|iOS|tvOS|watchOS" AND NOT CMAKE_OSX_ARCHITECTURES STREQUAL "")
- set(host_arch ${CMAKE_OSX_ARCHITECTURES})
- elseif(MSVC)
- set(host_arch ${CMAKE_CXX_COMPILER_ARCHITECTURE_ID})
- else()
- set(host_arch ${CMAKE_SYSTEM_PROCESSOR})
- endif()
- if(host_arch MATCHES "aarch64|arm64|ARM64")
- set(_ARCH armv8)
- elseif(host_arch MATCHES "armv7|armv7-a|armv7l|ARMV7")
- set(_ARCH armv7)
- elseif(host_arch MATCHES armv7s)
- set(_ARCH armv7s)
- elseif(host_arch MATCHES "i686|i386|X86")
- set(_ARCH x86)
- elseif(host_arch MATCHES "AMD64|amd64|x86_64|x64")
- set(_ARCH x86_64)
- endif()
- message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}")
- set(${ARCH} ${_ARCH} PARENT_SCOPE)
-endfunction()
-
-
-function(detect_cxx_standard CXX_STANDARD)
- set(${CXX_STANDARD} ${CMAKE_CXX_STANDARD} PARENT_SCOPE)
- if(CMAKE_CXX_EXTENSIONS)
- set(${CXX_STANDARD} "gnu${CMAKE_CXX_STANDARD}" PARENT_SCOPE)
- endif()
-endfunction()
-
-
-macro(detect_gnu_libstdcxx)
- # _CONAN_IS_GNU_LIBSTDCXX true if GNU libstdc++
- check_cxx_source_compiles("
- #include <cstddef>
- #if !defined(__GLIBCXX__) && !defined(__GLIBCPP__)
- static_assert(false);
- #endif
- int main(){}" _CONAN_IS_GNU_LIBSTDCXX)
-
- # _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI true if C++11 ABI
- check_cxx_source_compiles("
- #include <string>
- static_assert(sizeof(std::string) != sizeof(void*), \"using libstdc++\");
- int main () {}" _CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
-
- set(_CONAN_GNU_LIBSTDCXX_SUFFIX "")
- if(_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
- set(_CONAN_GNU_LIBSTDCXX_SUFFIX "11")
- endif()
- unset (_CONAN_GNU_LIBSTDCXX_IS_CXX11_ABI)
-endmacro()
-
-
-macro(detect_libcxx)
- # _CONAN_IS_LIBCXX true if LLVM libc++
- check_cxx_source_compiles("
- #include <cstddef>
- #if !defined(_LIBCPP_VERSION)
- static_assert(false);
- #endif
- int main(){}" _CONAN_IS_LIBCXX)
-endmacro()
-
-
-function(detect_lib_cxx LIB_CXX)
- if(CMAKE_SYSTEM_NAME STREQUAL "Android")
- message(STATUS "CMake-Conan: android_stl=${CMAKE_ANDROID_STL_TYPE}")
- set(${LIB_CXX} ${CMAKE_ANDROID_STL_TYPE} PARENT_SCOPE)
- return()
- endif()
-
- include(CheckCXXSourceCompiles)
-
- if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
- detect_gnu_libstdcxx()
- set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE)
- elseif(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang")
- set(${LIB_CXX} "libc++" PARENT_SCOPE)
- elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
- # Check for libc++
- detect_libcxx()
- if(_CONAN_IS_LIBCXX)
- set(${LIB_CXX} "libc++" PARENT_SCOPE)
- return()
- endif()
-
- # Check for libstdc++
- detect_gnu_libstdcxx()
- if(_CONAN_IS_GNU_LIBSTDCXX)
- set(${LIB_CXX} "libstdc++${_CONAN_GNU_LIBSTDCXX_SUFFIX}" PARENT_SCOPE)
- return()
- endif()
-
- # TODO: it would be an error if we reach this point
- elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
- # Do nothing - compiler.runtime and compiler.runtime_type
- # should be handled separately: https://github.com/conan-io/cmake-conan/pull/516
- return()
- else()
- # TODO: unable to determine, ask user to provide a full profile file instead
- endif()
-endfunction()
-
-
-function(detect_compiler COMPILER COMPILER_VERSION COMPILER_RUNTIME COMPILER_RUNTIME_TYPE)
- if(DEFINED CMAKE_CXX_COMPILER_ID)
- set(_COMPILER ${CMAKE_CXX_COMPILER_ID})
- set(_COMPILER_VERSION ${CMAKE_CXX_COMPILER_VERSION})
- else()
- if(NOT DEFINED CMAKE_C_COMPILER_ID)
- message(FATAL_ERROR "C or C++ compiler not defined")
- endif()
- set(_COMPILER ${CMAKE_C_COMPILER_ID})
- set(_COMPILER_VERSION ${CMAKE_C_COMPILER_VERSION})
- endif()
-
- message(STATUS "CMake-Conan: CMake compiler=${_COMPILER}")
- message(STATUS "CMake-Conan: CMake compiler version=${_COMPILER_VERSION}")
-
- if(_COMPILER MATCHES MSVC)
- set(_COMPILER "msvc")
- string(SUBSTRING ${MSVC_VERSION} 0 3 _COMPILER_VERSION)
- # Configure compiler.runtime and compiler.runtime_type settings for MSVC
- if(CMAKE_MSVC_RUNTIME_LIBRARY)
- set(_msvc_runtime_library ${CMAKE_MSVC_RUNTIME_LIBRARY})
- else()
- set(_msvc_runtime_library MultiThreaded$<$<CONFIG:Debug>:Debug>DLL) # default value documented by CMake
- endif()
-
- set(_KNOWN_MSVC_RUNTIME_VALUES "")
- list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded MultiThreadedDLL)
- list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreadedDebug MultiThreadedDebugDLL)
- list(APPEND _KNOWN_MSVC_RUNTIME_VALUES MultiThreaded$<$<CONFIG:Debug>:Debug> MultiThreaded$<$<CONFIG:Debug>:Debug>DLL)
-
- # only accept the 6 possible values, otherwise we don't don't know to map this
- if(NOT _msvc_runtime_library IN_LIST _KNOWN_MSVC_RUNTIME_VALUES)
- message(FATAL_ERROR "CMake-Conan: unable to map MSVC runtime: ${_msvc_runtime_library} to Conan settings")
- endif()
-
- # Runtime is "dynamic" in all cases if it ends in DLL
- if(_msvc_runtime_library MATCHES ".*DLL$")
- set(_COMPILER_RUNTIME "dynamic")
- else()
- set(_COMPILER_RUNTIME "static")
- endif()
- message(STATUS "CMake-Conan: CMake compiler.runtime=${_COMPILER_RUNTIME}")
-
- # Only define compiler.runtime_type when explicitly requested
- # If a generator expression is used, let Conan handle it conditional on build_type
- if(NOT _msvc_runtime_library MATCHES "<CONFIG:Debug>:Debug>")
- if(_msvc_runtime_library MATCHES "Debug")
- set(_COMPILER_RUNTIME_TYPE "Debug")
- else()
- set(_COMPILER_RUNTIME_TYPE "Release")
- endif()
- message(STATUS "CMake-Conan: CMake compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}")
- endif()
-
- unset(_KNOWN_MSVC_RUNTIME_VALUES)
-
- elseif(_COMPILER MATCHES AppleClang)
- set(_COMPILER "apple-clang")
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
- list(GET VERSION_LIST 0 _COMPILER_VERSION)
- elseif(_COMPILER MATCHES Clang)
- set(_COMPILER "clang")
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
- list(GET VERSION_LIST 0 _COMPILER_VERSION)
- elseif(_COMPILER MATCHES GNU)
- set(_COMPILER "gcc")
- string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
- list(GET VERSION_LIST 0 _COMPILER_VERSION)
- endif()
-
- message(STATUS "CMake-Conan: [settings] compiler=${_COMPILER}")
- message(STATUS "CMake-Conan: [settings] compiler.version=${_COMPILER_VERSION}")
- if (_COMPILER_RUNTIME)
- message(STATUS "CMake-Conan: [settings] compiler.runtime=${_COMPILER_RUNTIME}")
- endif()
- if (_COMPILER_RUNTIME_TYPE)
- message(STATUS "CMake-Conan: [settings] compiler.runtime_type=${_COMPILER_RUNTIME_TYPE}")
- endif()
-
- set(${COMPILER} ${_COMPILER} PARENT_SCOPE)
- set(${COMPILER_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE)
- set(${COMPILER_RUNTIME} ${_COMPILER_RUNTIME} PARENT_SCOPE)
- set(${COMPILER_RUNTIME_TYPE} ${_COMPILER_RUNTIME_TYPE} PARENT_SCOPE)
-endfunction()
-
-
-function(detect_build_type BUILD_TYPE)
- get_property(_MULTICONFIG_GENERATOR GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- if(NOT _MULTICONFIG_GENERATOR)
- # Only set when we know we are in a single-configuration generator
- # Note: we may want to fail early if `CMAKE_BUILD_TYPE` is not defined
- set(${BUILD_TYPE} ${CMAKE_BUILD_TYPE} PARENT_SCOPE)
- endif()
-endfunction()
-
-macro(set_conan_compiler_if_appleclang lang command output_variable)
- if(CMAKE_${lang}_COMPILER_ID STREQUAL "AppleClang")
- execute_process(COMMAND xcrun --find ${command}
- OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE)
- cmake_path(GET _xcrun_out PARENT_PATH _xcrun_toolchain_path)
- cmake_path(GET CMAKE_${lang}_COMPILER PARENT_PATH _compiler_parent_path)
- if ("${_xcrun_toolchain_path}" STREQUAL "${_compiler_parent_path}")
- set(${output_variable} "")
- endif()
- unset(_xcrun_out)
- unset(_xcrun_toolchain_path)
- unset(_compiler_parent_path)
- endif()
-endmacro()
-
-
-macro(append_compiler_executables_configuration)
- set(_conan_c_compiler "")
- set(_conan_cpp_compiler "")
- if(CMAKE_C_COMPILER)
- set(_conan_c_compiler "\"c\":\"${CMAKE_C_COMPILER}\",")
- set_conan_compiler_if_appleclang(C cc _conan_c_compiler)
- else()
- message(WARNING "CMake-Conan: The C compiler is not defined. "
- "Please define CMAKE_C_COMPILER or enable the C language.")
- endif()
- if(CMAKE_CXX_COMPILER)
- set(_conan_cpp_compiler "\"cpp\":\"${CMAKE_CXX_COMPILER}\"")
- set_conan_compiler_if_appleclang(CXX c++ _conan_cpp_compiler)
- else()
- message(WARNING "CMake-Conan: The C++ compiler is not defined. "
- "Please define CMAKE_CXX_COMPILER or enable the C++ language.")
- endif()
-
- if(NOT "x${_conan_c_compiler}${_conan_cpp_compiler}" STREQUAL "x")
- string(APPEND PROFILE "tools.build:compiler_executables={${_conan_c_compiler}${_conan_cpp_compiler}}\n")
- endif()
- unset(_conan_c_compiler)
- unset(_conan_cpp_compiler)
-endmacro()
-
-
-function(detect_host_profile output_file)
- detect_os(MYOS MYOS_API_LEVEL MYOS_SDK MYOS_SUBSYSTEM MYOS_VERSION)
- detect_arch(MYARCH)
- detect_compiler(MYCOMPILER MYCOMPILER_VERSION MYCOMPILER_RUNTIME MYCOMPILER_RUNTIME_TYPE)
- detect_cxx_standard(MYCXX_STANDARD)
- detect_lib_cxx(MYLIB_CXX)
- detect_build_type(MYBUILD_TYPE)
-
- set(PROFILE "")
- string(APPEND PROFILE "[settings]\n")
- if(MYARCH)
- string(APPEND PROFILE arch=${MYARCH} "\n")
- endif()
- if(MYOS)
- string(APPEND PROFILE os=${MYOS} "\n")
- endif()
- if(MYOS_API_LEVEL)
- string(APPEND PROFILE os.api_level=${MYOS_API_LEVEL} "\n")
- endif()
- if(MYOS_VERSION)
- string(APPEND PROFILE os.version=${MYOS_VERSION} "\n")
- endif()
- if(MYOS_SDK)
- string(APPEND PROFILE os.sdk=${MYOS_SDK} "\n")
- endif()
- if(MYOS_SUBSYSTEM)
- string(APPEND PROFILE os.subsystem=${MYOS_SUBSYSTEM} "\n")
- endif()
- if(MYCOMPILER)
- string(APPEND PROFILE compiler=${MYCOMPILER} "\n")
- endif()
- if(MYCOMPILER_VERSION)
- string(APPEND PROFILE compiler.version=${MYCOMPILER_VERSION} "\n")
- endif()
- if(MYCOMPILER_RUNTIME)
- string(APPEND PROFILE compiler.runtime=${MYCOMPILER_RUNTIME} "\n")
- endif()
- if(MYCOMPILER_RUNTIME_TYPE)
- string(APPEND PROFILE compiler.runtime_type=${MYCOMPILER_RUNTIME_TYPE} "\n")
- endif()
- if(MYCXX_STANDARD)
- string(APPEND PROFILE compiler.cppstd=${MYCXX_STANDARD} "\n")
- endif()
- if(MYLIB_CXX)
- string(APPEND PROFILE compiler.libcxx=${MYLIB_CXX} "\n")
- endif()
- if(MYBUILD_TYPE)
- string(APPEND PROFILE "build_type=${MYBUILD_TYPE}\n")
- endif()
-
- if(NOT DEFINED output_file)
- set(_FN "${CMAKE_BINARY_DIR}/profile")
- else()
- set(_FN ${output_file})
- endif()
-
- string(APPEND PROFILE "[conf]\n")
- string(APPEND PROFILE "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}\n")
-
- # propagate compilers via profile
- append_compiler_executables_configuration()
-
- if(MYOS STREQUAL "Android")
- string(APPEND PROFILE "tools.android:ndk_path=${CMAKE_ANDROID_NDK}\n")
- endif()
-
- message(STATUS "CMake-Conan: Creating profile ${_FN}")
- file(WRITE ${_FN} ${PROFILE})
- message(STATUS "CMake-Conan: Profile: \n${PROFILE}")
-endfunction()
-
-
-function(conan_profile_detect_default)
- message(STATUS "CMake-Conan: Checking if a default profile exists")
- execute_process(COMMAND ${CONAN_COMMAND} profile path default
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE conan_stdout
- ERROR_VARIABLE conan_stderr
- ECHO_ERROR_VARIABLE # show the text output regardless
- ECHO_OUTPUT_VARIABLE
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- if(NOT ${return_code} EQUAL "0")
- message(STATUS "CMake-Conan: The default profile doesn't exist, detecting it.")
- execute_process(COMMAND ${CONAN_COMMAND} profile detect
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE conan_stdout
- ERROR_VARIABLE conan_stderr
- ECHO_ERROR_VARIABLE # show the text output regardless
- ECHO_OUTPUT_VARIABLE
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
- endif()
-endfunction()
-
-
-function(conan_install)
- cmake_parse_arguments(ARGS CONAN_ARGS ${ARGN})
- set(CONAN_OUTPUT_FOLDER ${CMAKE_BINARY_DIR}/conan)
- # Invoke "conan install" with the provided arguments
- set(CONAN_ARGS ${CONAN_ARGS} -of=${CONAN_OUTPUT_FOLDER})
- message(STATUS "CMake-Conan: conan install ${CMAKE_SOURCE_DIR} ${CONAN_ARGS} ${ARGN}")
-
-
- # In case there was not a valid cmake executable in the PATH, we inject the
- # same we used to invoke the provider to the PATH
- if(DEFINED PATH_TO_CMAKE_BIN)
- set(_OLD_PATH $ENV{PATH})
- set(ENV{PATH} "$ENV{PATH}:${PATH_TO_CMAKE_BIN}")
- endif()
-
- execute_process(COMMAND ${CONAN_COMMAND} install ${CMAKE_SOURCE_DIR} ${CONAN_ARGS} ${ARGN} --format=json
- RESULT_VARIABLE return_code
- OUTPUT_VARIABLE conan_stdout
- ERROR_VARIABLE conan_stderr
- ECHO_ERROR_VARIABLE # show the text output regardless
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
-
- if(DEFINED PATH_TO_CMAKE_BIN)
- set(ENV{PATH} "${_OLD_PATH}")
- endif()
-
- if(NOT "${return_code}" STREQUAL "0")
- message(FATAL_ERROR "Conan install failed='${return_code}'")
- endif()
-
- # the files are generated in a folder that depends on the layout used, if
- # one is specified, but we don't know a priori where this is.
- # TODO: this can be made more robust if Conan can provide this in the json output
- string(JSON CONAN_GENERATORS_FOLDER GET ${conan_stdout} graph nodes 0 generators_folder)
- cmake_path(CONVERT ${CONAN_GENERATORS_FOLDER} TO_CMAKE_PATH_LIST CONAN_GENERATORS_FOLDER)
- # message("conan stdout: ${conan_stdout}")
- message(STATUS "CMake-Conan: CONAN_GENERATORS_FOLDER=${CONAN_GENERATORS_FOLDER}")
- set_property(GLOBAL PROPERTY CONAN_GENERATORS_FOLDER "${CONAN_GENERATORS_FOLDER}")
- # reconfigure on conanfile changes
- string(JSON CONANFILE GET ${conan_stdout} graph nodes 0 label)
- message(STATUS "CMake-Conan: CONANFILE=${CMAKE_SOURCE_DIR}/${CONANFILE}")
- set_property(DIRECTORY ${CMAKE_SOURCE_DIR} APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/${CONANFILE}")
- # success
- set_property(GLOBAL PROPERTY CONAN_INSTALL_SUCCESS TRUE)
-
-endfunction()
-
-
-function(conan_get_version conan_command conan_current_version)
- execute_process(
- COMMAND ${conan_command} --version
- OUTPUT_VARIABLE conan_output
- RESULT_VARIABLE conan_result
- OUTPUT_STRIP_TRAILING_WHITESPACE
- )
- if(conan_result)
- message(FATAL_ERROR "CMake-Conan: Error when trying to run Conan")
- endif()
-
- string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" conan_version ${conan_output})
- set(${conan_current_version} ${conan_version} PARENT_SCOPE)
-endfunction()
-
-
-function(conan_version_check)
- set(options )
- set(oneValueArgs MINIMUM CURRENT)
- set(multiValueArgs )
- cmake_parse_arguments(CONAN_VERSION_CHECK
- "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
-
- if(NOT CONAN_VERSION_CHECK_MINIMUM)
- message(FATAL_ERROR "CMake-Conan: Required parameter MINIMUM not set!")
- endif()
- if(NOT CONAN_VERSION_CHECK_CURRENT)
- message(FATAL_ERROR "CMake-Conan: Required parameter CURRENT not set!")
- endif()
-
- if(CONAN_VERSION_CHECK_CURRENT VERSION_LESS CONAN_VERSION_CHECK_MINIMUM)
- message(FATAL_ERROR "CMake-Conan: Conan version must be ${CONAN_VERSION_CHECK_MINIMUM} or later")
- endif()
-endfunction()
-
-
-macro(construct_profile_argument argument_variable profile_list)
- set(${argument_variable} "")
- if("${profile_list}" STREQUAL "CONAN_HOST_PROFILE")
- set(_arg_flag "--profile:host=")
- elseif("${profile_list}" STREQUAL "CONAN_BUILD_PROFILE")
- set(_arg_flag "--profile:build=")
- endif()
-
- set(_profile_list "${${profile_list}}")
- list(TRANSFORM _profile_list REPLACE "auto-cmake" "${CMAKE_BINARY_DIR}/conan_host_profile")
- list(TRANSFORM _profile_list PREPEND ${_arg_flag})
- set(${argument_variable} ${_profile_list})
-
- unset(_arg_flag)
- unset(_profile_list)
-endmacro()
-
-
-macro(conan_provide_dependency method package_name)
- set_property(GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED TRUE)
- get_property(_conan_install_success GLOBAL PROPERTY CONAN_INSTALL_SUCCESS)
- if(NOT _conan_install_success)
- find_program(CONAN_COMMAND "conan" REQUIRED)
- conan_get_version(${CONAN_COMMAND} CONAN_CURRENT_VERSION)
- conan_version_check(MINIMUM ${CONAN_MINIMUM_VERSION} CURRENT ${CONAN_CURRENT_VERSION})
- message(STATUS "CMake-Conan: first find_package() found. Installing dependencies with Conan")
- if("default" IN_LIST CONAN_HOST_PROFILE OR "default" IN_LIST CONAN_BUILD_PROFILE)
- conan_profile_detect_default()
- endif()
- if("auto-cmake" IN_LIST CONAN_HOST_PROFILE)
- detect_host_profile(${CMAKE_BINARY_DIR}/conan_host_profile)
- endif()
- construct_profile_argument(_host_profile_flags CONAN_HOST_PROFILE)
- construct_profile_argument(_build_profile_flags CONAN_BUILD_PROFILE)
- if(EXISTS "${CMAKE_SOURCE_DIR}/conanfile.py")
- file(READ "${CMAKE_SOURCE_DIR}/conanfile.py" outfile)
- if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
- message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile")
- endif()
- set(generator "")
- elseif (EXISTS "${CMAKE_SOURCE_DIR}/conanfile.txt")
- file(READ "${CMAKE_SOURCE_DIR}/conanfile.txt" outfile)
- if(NOT "${outfile}" MATCHES ".*CMakeDeps.*")
- message(WARNING "Cmake-conan: CMakeDeps generator was not defined in the conanfile. "
- "Please define the generator as it will be mandatory in the future")
- endif()
- set(generator "-g;CMakeDeps")
- endif()
- get_property(_multiconfig_generator GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
- if(NOT _multiconfig_generator)
- message(STATUS "CMake-Conan: Installing single configuration ${CMAKE_BUILD_TYPE}")
- conan_install(${_host_profile_flags} ${_build_profile_flags} ${CONAN_INSTALL_ARGS} ${generator})
- else()
- message(STATUS "CMake-Conan: Installing both Debug and Release")
- conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Release ${CONAN_INSTALL_ARGS} ${generator})
- conan_install(${_host_profile_flags} ${_build_profile_flags} -s build_type=Debug ${CONAN_INSTALL_ARGS} ${generator})
- endif()
- unset(_host_profile_flags)
- unset(_build_profile_flags)
- unset(_multiconfig_generator)
- unset(_conan_install_success)
- else()
- message(STATUS "CMake-Conan: find_package(${ARGV1}) found, 'conan install' already ran")
- unset(_conan_install_success)
- endif()
-
- get_property(_conan_generators_folder GLOBAL PROPERTY CONAN_GENERATORS_FOLDER)
-
- # Ensure that we consider Conan-provided packages ahead of any other,
- # irrespective of other settings that modify the search order or search paths
- # This follows the guidelines from the find_package documentation
- # (https://cmake.org/cmake/help/latest/command/find_package.html):
- # find_package (<PackageName> PATHS paths... NO_DEFAULT_PATH)
- # find_package (<PackageName>)
-
- # Filter out `REQUIRED` from the argument list, as the first call may fail
- set(_find_args_${package_name} "${ARGN}")
- list(REMOVE_ITEM _find_args_${package_name} "REQUIRED")
- if(NOT "MODULE" IN_LIST _find_args_${package_name})
- find_package(${package_name} ${_find_args_${package_name}} BYPASS_PROVIDER PATHS "${_conan_generators_folder}" NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
- unset(_find_args_${package_name})
- endif()
-
- # Invoke find_package a second time - if the first call succeeded,
- # this will simply reuse the result. If not, fall back to CMake default search
- # behaviour, also allowing modules to be searched.
- if(NOT ${package_name}_FOUND)
- list(FIND CMAKE_MODULE_PATH "${_conan_generators_folder}" _index)
- if(_index EQUAL -1)
- list(PREPEND CMAKE_MODULE_PATH "${_conan_generators_folder}")
- endif()
- unset(_index)
- find_package(${package_name} ${ARGN} BYPASS_PROVIDER)
- list(REMOVE_ITEM CMAKE_MODULE_PATH "${_conan_generators_folder}")
- endif()
-endmacro()
-
-
-cmake_language(
- SET_DEPENDENCY_PROVIDER conan_provide_dependency
- SUPPORTED_METHODS FIND_PACKAGE
-)
-
-
-macro(conan_provide_dependency_check)
- set(_CONAN_PROVIDE_DEPENDENCY_INVOKED FALSE)
- get_property(_CONAN_PROVIDE_DEPENDENCY_INVOKED GLOBAL PROPERTY CONAN_PROVIDE_DEPENDENCY_INVOKED)
- if(NOT _CONAN_PROVIDE_DEPENDENCY_INVOKED)
- message(WARNING "Conan is correctly configured as dependency provider, "
- "but Conan has not been invoked. Please add at least one "
- "call to `find_package()`.")
- if(DEFINED CONAN_COMMAND)
- # supress warning in case `CONAN_COMMAND` was specified but unused.
- set(_CONAN_COMMAND ${CONAN_COMMAND})
- unset(_CONAN_COMMAND)
- endif()
- endif()
- unset(_CONAN_PROVIDE_DEPENDENCY_INVOKED)
-endmacro()
-
-
-# Add a deferred call at the end of processing the top-level directory
-# to check if the dependency provider was invoked at all.
-cmake_language(DEFER DIRECTORY "${CMAKE_SOURCE_DIR}" CALL conan_provide_dependency_check)
-
-# Configurable variables for Conan profiles
-set(CONAN_HOST_PROFILE "default;auto-cmake" CACHE STRING "Conan host profile")
-set(CONAN_BUILD_PROFILE "default" CACHE STRING "Conan build profile")
-set(CONAN_INSTALL_ARGS "--build=missing" CACHE STRING "Command line arguments for conan install")
-
-find_program(_cmake_program NAMES cmake NO_PACKAGE_ROOT_PATH NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH NO_CMAKE_FIND_ROOT_PATH)
-if(NOT _cmake_program)
- get_filename_component(PATH_TO_CMAKE_BIN "${CMAKE_COMMAND}" DIRECTORY)
- set(PATH_TO_CMAKE_BIN "${PATH_TO_CMAKE_BIN}" CACHE INTERNAL "Path where the CMake executable is")
-endif()
-
-cmake_policy(POP)
diff --git a/build/export_generators/hardcoded-cmake/cmake/cuda.cmake b/build/export_generators/hardcoded-cmake/cmake/cuda.cmake
deleted file mode 100644
index 296da7f2e2..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/cuda.cmake
+++ /dev/null
@@ -1,190 +0,0 @@
-if (HAVE_CUDA)
- if(${CMAKE_VERSION} VERSION_LESS "3.17.0")
- message(FATAL_ERROR "Build with CUDA requires at least cmake 3.17.0")
- endif()
-
- enable_language(CUDA)
-
- include(global_flags)
- include(common)
-
- function(quote_if_contains_spaces OutVar Var)
- if (Var MATCHES ".*[ ].*")
- set(${OutVar} "\"${Var}\"" PARENT_SCOPE)
- else()
- set(${OutVar} ${Var} PARENT_SCOPE)
- endif()
- endfunction()
-
- function(get_cuda_flags_from_cxx_flags OutCudaFlags CxxFlags)
- # OutCudaFlags is an output string
- # CxxFlags is a string
-
- set(skipList
- -gline-tables-only
- # clang coverage
- -fprofile-instr-generate
- -fcoverage-mapping
- /Zc:inline # disable unreferenced functions (kernel registrators) remove
- -Wno-c++17-extensions
- -flto
- -faligned-allocation
- -fsized-deallocation
- # While it might be reasonable to compile host part of .cu sources with these optimizations enabled,
- # nvcc passes these options down towards cicc which lacks x86_64 extensions support.
- -msse2
- -msse3
- -mssse3
- -msse4.1
- -msse4.2
- )
-
- set(skipPrefixRegexp
- "(-fsanitize=|-fsanitize-coverage=|-fsanitize-blacklist=|--system-header-prefix|(/|-)std(:|=)c\\+\\+).*"
- )
-
- string(FIND "${CMAKE_CUDA_HOST_COMPILER}" clang hostCompilerIsClangPos)
- string(COMPARE NOTEQUAL ${hostCompilerIsClangPos} -1 isHostCompilerClang)
-
-
- function(separate_arguments_with_special_symbols Output Src)
- string(REPLACE ";" "$<SEMICOLON>" LocalOutput "${Src}")
- separate_arguments(LocalOutput NATIVE_COMMAND ${LocalOutput})
- set(${Output} ${LocalOutput} PARENT_SCOPE)
- endfunction()
-
- separate_arguments_with_special_symbols(Separated_CxxFlags "${CxxFlags}")
-
- if (MSVC)
- set(flagPrefixSymbol "/")
- else()
- set(flagPrefixSymbol "-")
- endif()
-
- set(localCudaCommonFlags "") # non host compiler options
- set(localCudaCompilerOptions "")
-
- while (Separated_CxxFlags)
- list(POP_FRONT Separated_CxxFlags cxxFlag)
- if ((cxxFlag IN_LIST skipList) OR (cxxFlag MATCHES ${skipPrefixRegexp}))
- continue()
- endif()
- if ((cxxFlag STREQUAL -fopenmp=libomp) AND (NOT isHostCompilerClang))
- list(APPEND localCudaCompilerOptions -fopenmp)
- continue()
- endif()
- if ((NOT isHostCompilerClang) AND (cxxFlag MATCHES "^\-\-target=.*"))
- continue()
- endif()
- if (cxxFlag MATCHES "^${flagPrefixSymbol}(D[^ ]+)=(.+)")
- set(key ${CMAKE_MATCH_1})
- quote_if_contains_spaces(safeValue "${CMAKE_MATCH_2}")
- list(APPEND localCudaCommonFlags "-${key}=${safeValue}")
- continue()
- endif()
- if (cxxFlag MATCHES "^${flagPrefixSymbol}([DI])(.*)")
- set(key ${CMAKE_MATCH_1})
- if (CMAKE_MATCH_2)
- set(value ${CMAKE_MATCH_2})
- set(sep "")
- else()
- list(POP_FRONT Separated_CxxFlags value)
- set(sep " ")
- endif()
- quote_if_contains_spaces(safeValue "${value}")
- list(APPEND localCudaCommonFlags "-${key}${sep}${safeValue}")
- continue()
- endif()
- list(APPEND localCudaCompilerOptions ${cxxFlag})
- endwhile()
-
- if (isHostCompilerClang)
- # nvcc concatenates the sources for clang, and clang reports unused
- # things from .h files as if they they were defined in a .cpp file.
- list(APPEND localCudaCommonFlags -Wno-unused-function -Wno-unused-parameter)
- if (CMAKE_CXX_COMPILER_TARGET)
- list(APPEND localCudaCompilerOptions "--target=${CMAKE_CXX_COMPILER_TARGET}")
- endif()
- endif()
-
- if (CMAKE_SYSROOT)
- list(APPEND localCudaCompilerOptions "--sysroot=${CMAKE_SYSROOT}")
- endif()
-
- list(JOIN localCudaCommonFlags " " joinedLocalCudaCommonFlags)
- string(REPLACE "$<SEMICOLON>" ";" joinedLocalCudaCommonFlags "${joinedLocalCudaCommonFlags}")
- list(JOIN localCudaCompilerOptions , joinedLocalCudaCompilerOptions)
- set(${OutCudaFlags} "${joinedLocalCudaCommonFlags} --compiler-options ${joinedLocalCudaCompilerOptions}" PARENT_SCOPE)
- endfunction()
-
- get_cuda_flags_from_cxx_flags(CMAKE_CUDA_FLAGS "${CMAKE_CXX_FLAGS}")
-
- string(APPEND CMAKE_CUDA_FLAGS
- # Allow __host__, __device__ annotations in lambda declaration.
- " --expt-extended-lambda"
- # Allow host code to invoke __device__ constexpr functions and vice versa
- " --expt-relaxed-constexpr"
- # Allow to use newer compilers than CUDA Toolkit officially supports
- " --allow-unsupported-compiler"
- )
-
- set(NVCC_STD_VER 17)
- if(MSVC)
- set(NVCC_STD "/std:c++${NVCC_STD_VER}")
- else()
- set(NVCC_STD "-std=c++${NVCC_STD_VER}")
- endif()
- string(APPEND CMAKE_CUDA_FLAGS " --compiler-options ${NVCC_STD}")
-
- string(APPEND CMAKE_CUDA_FLAGS " -DTHRUST_IGNORE_CUB_VERSION_CHECK")
-
- if(MSVC)
- # default CMake flags differ from our configuration
- set(CMAKE_CUDA_FLAGS_DEBUG "-D_DEBUG --compiler-options /Z7,/Ob0,/Od")
- set(CMAKE_CUDA_FLAGS_MINSIZEREL "-DNDEBUG --compiler-options /O1,/Ob1")
- set(CMAKE_CUDA_FLAGS_RELEASE "-DNDEBUG --compiler-options /Ox,/Ob2,/Oi")
- set(CMAKE_CUDA_FLAGS_RELWITHDEBINFO "-DNDEBUG --compiler-options /Z7,/Ox,/Ob1")
- endif()
-
- # use versions from contrib, standard libraries from CUDA distibution are incompatible with MSVC and libcxx
- set(CUDA_EXTRA_INCLUDE_DIRECTORIES
- ${PROJECT_SOURCE_DIR}/contrib/libs/nvidia/thrust
- ${PROJECT_SOURCE_DIR}/contrib/libs/nvidia/cub
- )
-
- find_package(CUDAToolkit REQUIRED)
-
- if(${CMAKE_CUDA_COMPILER_VERSION} VERSION_GREATER_EQUAL "11.2")
- string(APPEND CMAKE_CUDA_FLAGS " --threads 0")
- endif()
-
- message(VERBOSE "CMAKE_CUDA_FLAGS = \"${CMAKE_CUDA_FLAGS}\"")
-
- enable_language(CUDA)
-
- function(target_cuda_flags Tgt)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- CUDA_FLAGS ${ARGN}
- )
- endfunction()
-
- function(target_cuda_cflags Tgt)
- if (NOT ("${ARGN}" STREQUAL ""))
- string(JOIN "," OPTIONS ${ARGN})
- set_property(TARGET ${Tgt} APPEND PROPERTY
- CUDA_FLAGS --compiler-options ${OPTIONS}
- )
- endif()
- endfunction()
-
- function(target_cuda_sources Tgt Scope)
- # add include directories on per-CMakeLists file level because some non-CUDA source files may want to include calls to CUDA libs
- include_directories(${CUDA_EXTRA_INCLUDE_DIRECTORIES})
-
- set_source_files_properties(${ARGN} PROPERTIES
- COMPILE_OPTIONS "$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},CUDA_FLAGS>>,;>"
- )
- target_sources(${Tgt} ${Scope} ${ARGN})
- endfunction()
-
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/cython.cmake b/build/export_generators/hardcoded-cmake/cmake/cython.cmake
deleted file mode 100644
index 055c742055..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/cython.cmake
+++ /dev/null
@@ -1,42 +0,0 @@
-function(target_cython_include_directories Tgt)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- CYTHON_INCLUDE_DIRS ${ARGN}
- )
-endfunction()
-
-function(target_cython_options Tgt)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- CYTHON_OPTIONS ${ARGN}
- )
-endfunction()
-
-macro(set_python_type_for_cython Tgt Type)
- if (${Type} STREQUAL PY3)
- find_package(Python3 REQUIRED COMPONENTS Interpreter)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- CYTHON_PYTHON_INTERPRETER ${Python3_EXECUTABLE}
- )
- else()
- find_package(Python2 REQUIRED COMPONENTS Interpreter)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- CYTHON_PYTHON_INTERPRETER ${Python2_EXECUTABLE}
- )
- endif()
-endmacro()
-
-function(target_cython_sources Tgt Scope)
- foreach(Input ${ARGN})
- get_filename_component(OutputBase ${Input} NAME)
- set(CppCythonOutput ${CMAKE_CURRENT_BINARY_DIR}/${OutputBase}.cpp)
- add_custom_command(
- OUTPUT ${CppCythonOutput}
- COMMAND $<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},CYTHON_PYTHON_INTERPRETER>> ${PROJECT_SOURCE_DIR}/contrib/tools/cython/cython.py ${Input} -o ${CppCythonOutput}
- "$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},CYTHON_OPTIONS>>,$<SEMICOLON>>"
- "-I$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},CYTHON_INCLUDE_DIRS>>,$<SEMICOLON>-I>"
- COMMAND_EXPAND_LISTS
- DEPENDS ${OUTPUT_INCLUDES}
- MAIN_DEPENDENCY ${Input}
- )
- target_sources(${Tgt} ${Scope} ${CppCythonOutput})
- endforeach()
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/fat_object.cmake b/build/export_generators/hardcoded-cmake/cmake/fat_object.cmake
deleted file mode 100644
index ae81534e81..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/fat_object.cmake
+++ /dev/null
@@ -1,8 +0,0 @@
-function(add_fat_object Target)
- add_executable(${Target} EXCLUDE_FROM_ALL)
- set_property(TARGET ${Target} PROPERTY EchoString "Partial linking ${FAT_OBJECT_PREFIX}${Target}${FAT_OBJECT_SUFFIX}")
- set_property(TARGET ${Target} PROPERTY SUFFIX ${FAT_OBJECT_SUFFIX})
- set_property(TARGET ${Target} PROPERTY PREFIX ${FAT_OBJECT_PREFIX})
- set_property(TARGET ${Target} PROPERTY POSITION_INDEPENDENT_CODE Off)
- target_link_options(${Target} PRIVATE -Wl,-r -nodefaultlibs -nostartfiles)
-endfunction() \ No newline at end of file
diff --git a/build/export_generators/hardcoded-cmake/cmake/fbs.cmake b/build/export_generators/hardcoded-cmake/cmake/fbs.cmake
deleted file mode 100644
index 22e8f0d413..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/fbs.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-include(common)
-
-function(target_fbs_source Tgt Key Src)
- get_built_tool_path(flatc_bin flatc_dependency contrib/libs/flatbuffers/flatc flatc)
-
- file(RELATIVE_PATH fbsRel ${PROJECT_SOURCE_DIR} ${Src})
- get_filename_component(OutputBase ${fbsRel} NAME_WLE)
- get_filename_component(OutputDir ${PROJECT_BINARY_DIR}/${fbsRel} DIRECTORY)
- add_custom_command(
- OUTPUT
- ${PROJECT_BINARY_DIR}/${fbsRel}.h
- ${PROJECT_BINARY_DIR}/${fbsRel}.cpp
- ${OutputDir}/${OutputBase}.iter.fbs.h
- ${OutputDir}/${OutputBase}.bfbs
- COMMAND Python3::Interpreter
- ${PROJECT_SOURCE_DIR}/build/scripts/cpp_flatc_wrapper.py
- ${flatc_bin}
- ${FBS_CPP_FLAGS} ${ARGN}
- -o ${PROJECT_BINARY_DIR}/${fbsRel}.h
- ${Src}
- DEPENDS ${PROJECT_SOURCE_DIR}/build/scripts/cpp_flatc_wrapper.py ${Src} ${flatc_dependency}
- WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
- )
- target_sources(${Tgt} ${Key}
- ${PROJECT_BINARY_DIR}/${fbsRel}.cpp
- ${PROJECT_BINARY_DIR}/${fbsRel}.h
- ${OutputDir}/${OutputBase}.iter.fbs.h
- )
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.cmake
deleted file mode 100644
index a4c03c4dd6..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.cmake
+++ /dev/null
@@ -1,50 +0,0 @@
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_INIT}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_INIT}")
-
-# workaround when old NDK toolchain that does not set CMAKE_ANDROID_NDK_VERSION is used
-# See for details: https://gitlab.kitware.com/cmake/cmake/-/issues/24386
-if(ANDROID_NDK_REVISION AND NOT CMAKE_ANDROID_NDK_VERSION)
- set(CMAKE_ANDROID_NDK_VERSION "${ANDROID_NDK_REVISION}")
-endif()
-
-if (MSVC)
- set(flagPrefixSymbol "/")
- include(global_flags.compiler.msvc)
- include(global_flags.linker.msvc)
-else()
- set(flagPrefixSymbol "-")
- include(global_flags.compiler.gnu)
- include(global_flags.linker.gnu)
-endif()
-
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$")
- set(_ALL_X86_EXTENSIONS_DEFINES "\
- ${flagPrefixSymbol}DSSE_ENABLED=1 \
- ${flagPrefixSymbol}DSSE3_ENABLED=1 \
- ${flagPrefixSymbol}DSSSE3_ENABLED=1 \
- ")
- if ((CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") OR (NOT ANDROID))
- string(APPEND _ALL_X86_EXTENSIONS_DEFINES "\
- ${flagPrefixSymbol}DSSE41_ENABLED=1 \
- ${flagPrefixSymbol}DSSE42_ENABLED=1 \
- ${flagPrefixSymbol}DPOPCNT_ENABLED=1 \
- ")
- if (NOT ANDROID)
- # older clang versions did not support this feature on Android:
- # https://reviews.llvm.org/rGc32d307a49f5255602e7543e64e6c38a7f536abc
- string(APPEND _ALL_X86_EXTENSIONS_DEFINES " ${flagPrefixSymbol}DCX16_ENABLED=1")
- endif()
- endif()
-
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_ALL_X86_EXTENSIONS_DEFINES}")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_ALL_X86_EXTENSIONS_DEFINES}")
-endif()
-
-message(VERBOSE "CMAKE_C_FLAGS = \"${CMAKE_C_FLAGS}\"")
-message(VERBOSE "CMAKE_CXX_FLAGS = \"${CMAKE_CXX_FLAGS}\"")
-
-if (NOT CMAKE_CROSSCOMPILING)
- set(TOOLS_ROOT ${PROJECT_BINARY_DIR})
-elseif(NOT TOOLS_ROOT)
- message(FATAL_ERROR "TOOLS_ROOT is required for crosscompilation")
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake
deleted file mode 100644
index c5d0013b20..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.cmake
+++ /dev/null
@@ -1,68 +0,0 @@
-set(_GNU_COMMON_C_CXX_FLAGS "\
- -fexceptions \
- -fno-common \
- -fcolor-diagnostics \
- -faligned-allocation \
- -fdebug-default-version=4 \
- -ffunction-sections \
- -fdata-sections \
- -Wall \
- -Wextra \
- -Wno-parentheses \
- -Wno-implicit-const-int-float-conversion \
- -Wno-unknown-warning-option \
- -pipe \
- -D_THREAD_SAFE \
- -D_PTHREADS \
- -D_REENTRANT \
- -D_LARGEFILE_SOURCE \
- -D__STDC_CONSTANT_MACROS \
- -D__STDC_FORMAT_MACROS \
- -D__LONG_LONG_SUPPORTED \
-")
-
-if (CMAKE_SYSTEM_NAME MATCHES "^(Android|Linux)$")
- string(APPEND _GNU_COMMON_C_CXX_FLAGS " -D_GNU_SOURCE")
-endif()
-
-if (CMAKE_SYSTEM_NAME MATCHES "^(Darwin|Linux)$")
- string(APPEND _GNU_COMMON_C_CXX_FLAGS " -DLIBCXX_BUILDING_LIBCXXRT")
-endif()
-
-if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- # Use .init_array instead of .ctors (default for old clang versions)
- # See: https://maskray.me/blog/2021-11-07-init-ctors-init-array
- string(APPEND _GNU_COMMON_C_CXX_FLAGS " -fuse-init-array")
-endif()
-
-if (ANDROID)
- include_directories(SYSTEM ${CMAKE_ANDROID_NDK}/sources/cxx-stl/llvm-libc++abi/include)
-
- # There is no usable _FILE_OFFSET_BITS=64 support in Androids until API 21. And it's incomplete until at least API 24.
- # https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
-else()
- string(APPEND _GNU_COMMON_C_CXX_FLAGS " -D_FILE_OFFSET_BITS=64")
-endif()
-
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|aarch64|ppc64le)")
- string(APPEND _GNU_COMMON_C_CXX_FLAGS " -fsigned-char")
-endif()
-
-include(global_flags.compiler.gnu.march)
-string(APPEND _GNU_COMMON_C_CXX_FLAGS " ${_GNU_MARCH_C_CXX_FLAGS}")
-
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_GNU_COMMON_C_CXX_FLAGS}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_GNU_COMMON_C_CXX_FLAGS} \
- -Woverloaded-virtual \
- -Wimport-preprocessor-directive-pedantic \
- -Wno-undefined-var-template \
- -Wno-return-std-move \
- -Wno-defaulted-function-deleted \
- -Wno-pessimizing-move \
- -Wno-deprecated-anon-enum-enum-conversion \
- -Wno-deprecated-enum-enum-conversion \
- -Wno-deprecated-enum-float-conversion \
- -Wno-ambiguous-reversed-operator \
- -Wno-deprecated-volatile \
-")
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake
deleted file mode 100644
index a9c619efc6..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.gnu.march.cmake
+++ /dev/null
@@ -1,41 +0,0 @@
-
-set(_GNU_MARCH_C_CXX_FLAGS "")
-
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(i686|x86_64|AMD64)$")
- if (CMAKE_SYSTEM_PROCESSOR STREQUAL "i686")
- string(APPEND _GNU_MARCH_C_CXX_FLAGS " -m32")
- elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$")
- string(APPEND _GNU_MARCH_C_CXX_FLAGS " -m64")
- endif()
- string(APPEND _GNU_MARCH_C_CXX_FLAGS "\
- -msse2 \
- -msse3 \
- -mssse3 \
- ")
-
- if ((CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$") OR (NOT ANDROID))
- string(APPEND _GNU_MARCH_C_CXX_FLAGS "\
- -msse4.1 \
- -msse4.2 \
- -mpopcnt \
- ")
- if (NOT ANDROID)
- # older clang versions did not support this feature on Android:
- # https://reviews.llvm.org/rGc32d307a49f5255602e7543e64e6c38a7f536abc
- string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mcx16")
- endif()
- endif()
-
- if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
- string(APPEND _GNU_MARCH_C_CXX_FLAGS " -D_YNDX_LIBUNWIND_ENABLE_EXCEPTION_BACKTRACE")
- endif()
-elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
- if (CMAKE_SYSTEM_NAME MATCHES "^(Darwin|Linux)$")
- # Clang 13+ generates outline atomics by default if '-rtlib=compiler_rt' is specified or system's
- # libgcc version is >= 9.3.1 : https://github.com/llvm/llvm-project/commit/c5e7e649d537067dec7111f3de1430d0fc8a4d11
- # Disable this behaviour because our build links with contrib/libs/cxxsupp/builtins that does not contain outline atomics yet
- string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mno-outline-atomics")
- endif()
-elseif (ANDROID AND (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a"))
- string(APPEND _GNU_MARCH_C_CXX_FLAGS " -mfloat-abi=softfp")
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake
deleted file mode 100644
index 07aaa8ce5f..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.compiler.msvc.cmake
+++ /dev/null
@@ -1,165 +0,0 @@
-if(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang
- AND "${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC"
- AND "${CMAKE_CXX_SIMULATE_ID}" STREQUAL "MSVC")
-
- set(_IS_CLANG_CL_COMPILER true)
-else()
- set(_IS_CLANG_CL_COMPILER false)
-endif()
-
-set(_WARNS_ENABLED
- 4018 # 'expression' : signed/unsigned mismatch
- 4265 # 'class' : class has virtual functions, but destructor is not virtual
- 4296 # 'operator' : expression is always false
- 4431 # missing type specifier - int assumed
-)
-
-set(_WARNS_AS_ERROR
- 4013 # 'function' undefined; assuming extern returning int
-)
-
-set(_WARNS_DISABLED
- # While this warning corresponds to enabled-by-default -Wmacro-redefinition,
- # it floods clog with abundant amount of log lines,
- # as yvals_core.h from Windows SDK redefines certain
- # which macros logically belong to libcxx
- 4005 # '__cpp_lib_*': macro redefinition.
-
- # Ne need to recheck this, but it looks like _CRT_USE_BUILTIN_OFFSETOF still makes sense
- 4117 # macro name '_CRT_USE_BUILTIN_OFFSETOF' is reserved, '#define' ignored
-
- 4127 # conditional expression is constant
- 4200 # nonstandard extension used : zero-sized array in struct/union
- 4201 # nonstandard extension used : nameless struct/union
- 4351 # elements of array will be default initialized
- 4355 # 'this' : used in base member initializer list
- 4503 # decorated name length exceeded, name was truncated
- 4510 # default constructor could not be generated
- 4511 # copy constructor could not be generated
- 4512 # assignment operator could not be generated
- 4554 # check operator precedence for possible error; use parentheses to clarify precedence
- 4610 # 'object' can never be instantiated - user defined constructor required
- 4706 # assignment within conditional expression
- 4800 # forcing value to bool 'true' or 'false' (performance warning)
- 4996 # The POSIX name for this item is deprecated
- 4714 # function marked as __forceinline not inlined
- 4197 # 'TAtomic' : top-level volatile in cast is ignored
- 4245 # 'initializing' : conversion from 'int' to 'ui32', signed/unsigned mismatch
- 4324 # 'ystd::function<void (uint8_t *)>': structure was padded due to alignment specifier
- 5033 # 'register' is no longer a supported storage class
-)
-
-set (_MSVC_COMMON_C_CXX_FLAGS " \
- /DWIN32 \
- /D_WIN32 \
- /D_WINDOWS \
- /D_CRT_SECURE_NO_WARNINGS \
- /D_CRT_NONSTDC_NO_WARNINGS \
- /D_USE_MATH_DEFINES \
- /D__STDC_CONSTANT_MACROS \
- /D__STDC_FORMAT_MACROS \
- /D_USING_V110_SDK71_ \
- /DWIN32_LEAN_AND_MEAN \
- /DNOMINMAX \
- /nologo \
- /Zm500 \
- /GR \
- /bigobj \
- /FC \
- /EHs \
- /errorReport:prompt \
- /Zc:inline \
- /utf-8 \
- /permissive- \
- /D_WIN32_WINNT=0x0601 \
- /D_MBCS \
-")
-
-if (NOT _IS_CLANG_CL_COMPILER)
- # unused by clang-cl
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /MP")
-endif()
-
-if (CMAKE_GENERATOR MATCHES "Visual.Studio.*")
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS "\
- /DY_UCRT_INCLUDE=\"$(UniversalCRT_IncludePath.Split(';')[0].Replace('\\','/'))\" \
- /DY_MSVC_INCLUDE=\"$(VC_VC_IncludePath.Split(';')[0].Replace('\\','/'))\" \
- ")
-else()
- set(UCRT_INCLUDE_FOUND false)
- foreach(INCLUDE_PATH $ENV{INCLUDE})
- if (INCLUDE_PATH MATCHES ".*\\\\Windows Kits\\\\[0-9]+\\\\include\\\\[0-9\\.]+\\\\ucrt$")
- message(VERBOSE "Found Y_UCRT_INCLUDE path \"${INCLUDE_PATH}\"")
- string(REPLACE "\\" "/" SAFE_INCLUDE_PATH "${INCLUDE_PATH}")
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /DY_UCRT_INCLUDE=\"${SAFE_INCLUDE_PATH}\"")
- set(UCRT_INCLUDE_FOUND true)
- break()
- endif()
- endforeach()
- if (NOT UCRT_INCLUDE_FOUND)
- message(FATAL_ERROR "UniversalCRT include path not found, please add it to the standard INCLUDE environment variable (most likely by calling vcvars64.bat)")
- endif()
-
- set(MSVC_INCLUDE_FOUND false)
- foreach(INCLUDE_PATH $ENV{INCLUDE})
- if (INCLUDE_PATH MATCHES ".*VC\\\\Tools\\\\MSVC\\\\[0-9\\.]+\\\\include$")
- message(VERBOSE "Found Y_MSVC_INCLUDE path \"${INCLUDE_PATH}\"")
- string(REPLACE "\\" "/" SAFE_INCLUDE_PATH "${INCLUDE_PATH}")
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /DY_MSVC_INCLUDE=\"${SAFE_INCLUDE_PATH}\"")
- set(MSVC_INCLUDE_FOUND true)
- break()
- endif()
- endforeach()
- if (NOT MSVC_INCLUDE_FOUND)
- message(FATAL_ERROR "MSVC include path not found, please add it to the standard INCLUDE environment variable (most likely by calling vcvars64.bat)")
- endif()
-endif()
-
-foreach(WARN ${_WARNS_AS_ERROR})
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /we${WARN}")
-endforeach()
-
-foreach(WARN ${_WARNS_ENABLED})
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /w1${WARN}")
-endforeach()
-
-foreach(WARN ${_WARNS_DISABLED})
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " /wd${WARN}")
-endforeach()
-
-if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|AMD64)$")
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " \
- /D_WIN64 \
- /DWIN64 \
- /D__SSE2__ \
- /D__SSE3__ \
- /D__SSSE3__ \
- /D__SSE4_1__ \
- /D__SSE4_2__ \
- /D__POPCNT__ \
- ")
-endif()
-
-if (_IS_CLANG_CL_COMPILER)
- # clang-cl works slighly differently than MSVC compiler when specifying arch options, so we have to set them differently
- # https://github.com/llvm/llvm-project/issues/56722
-
- include(global_flags.compiler.gnu.march)
- string(APPEND _MSVC_COMMON_C_CXX_FLAGS " ${_GNU_MARCH_C_CXX_FLAGS}")
-endif()
-
-
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_MSVC_COMMON_C_CXX_FLAGS} \
-")
-
-# TODO - '/D_CRT_USE_BUILTIN_OFFSETOF'
-# TODO - -DUSE_STL_SYSTEM
-
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${_MSVC_COMMON_C_CXX_FLAGS} \
- /Zc:__cplusplus \
-")
-
-set(CMAKE_CXX_FLAGS_DEBUG "/Z7 /Ob0 /Od /D_DEBUG")
-set(CMAKE_CXX_FLAGS_MINSIZEREL "/O1 /Ob1 /DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELEASE "/Ox /Ob2 /Oi /DNDEBUG")
-set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/Z7 /Ox /Ob1 /DNDEBUG")
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.linker.gnu.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.linker.gnu.cmake
deleted file mode 100644
index 37e40ce45b..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.linker.gnu.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-if (ANDROID)
- # NDK r23 onwards has stopped using libgcc:
- # - https://github.com/android/ndk/wiki/Changelog-r23#changes
- # - https://github.com/android/ndk/issues/1230
- # LLVM's libunwind is now used instead of libgcc for all architectures rather than just 32-bit Arm.
- # - https://github.com/android/ndk/issues/1231
- # LLVM's libclang_rt.builtins is now used instead of libgcc.
- if (CMAKE_ANDROID_NDK_VERSION GREATER_EQUAL 23)
- # Use toolchain defaults to link with libunwind/clang_rt.builtins
- add_link_options("-nostdlib++")
- else ()
- # Preserve old behaviour: specify runtime libs manually
- add_link_options(-nodefaultlibs)
- link_libraries(gcc)
- if (CMAKE_ANDROID_ARCH_ABI STREQUAL "armeabi-v7a")
- link_libraries(unwind)
- endif()
- endif()
-elseif (CMAKE_SYSTEM_NAME MATCHES "^(Darwin|Linux)$")
- add_link_options("-nodefaultlibs")
-endif()
-
-if (APPLE)
- set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
-endif()
-
-if (CMAKE_SYSTEM_NAME MATCHES "^(Android|Linux)$")
- add_link_options(-rdynamic)
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/global_flags.linker.msvc.cmake b/build/export_generators/hardcoded-cmake/cmake/global_flags.linker.msvc.cmake
deleted file mode 100644
index d70ff2c3f1..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/global_flags.linker.msvc.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-cmake_policy(SET CMP0091 NEW)
-set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
-
-add_link_options(
- /NOLOGO
- /ERRORREPORT:PROMPT
- /SUBSYSTEM:CONSOLE
- /TLBID:1
- /NXCOMPAT
- /IGNORE:4221
- /INCREMENTAL
-)
-
-if ((CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") OR (CMAKE_SYSTEM_PROCESSOR STREQUAL "AMD64"))
- add_link_options(/MACHINE:X64)
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/llvm-tools.cmake b/build/export_generators/hardcoded-cmake/cmake/llvm-tools.cmake
deleted file mode 100644
index a97653da6e..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/llvm-tools.cmake
+++ /dev/null
@@ -1,111 +0,0 @@
-if (REQUIRED_LLVM_TOOLING_VERSION)
- if (CMAKE_VERSION VERSION_LESS 3.18)
- message(FATAL_ERROR "Forcing LLVM tooling versions requires at least cmake 3.18")
- endif()
- find_program(CLANGPLUSPLUS clang++-${REQUIRED_LLVM_TOOLING_VERSION} REQUIRED)
- find_program(CLANGC clang-${REQUIRED_LLVM_TOOLING_VERSION} REQUIRED)
- find_program(LLVMLINK llvm-link-${REQUIRED_LLVM_TOOLING_VERSION} REQUIRED)
- find_program(LLVMOPT opt-${REQUIRED_LLVM_TOOLING_VERSION} REQUIRED)
- find_program(LLVMLLC llc-${REQUIRED_LLVM_TOOLING_VERSION} REQUIRED)
- find_program(LLVMAS llvm-as-${REQUIRED_LLVM_TOOLING_VERSION} REQUIRED)
-else()
- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
- set(CLANGPLUSPLUS ${CMAKE_CXX_COMPILER})
- message(STATUS "Using ${CLANGPLUSPLUS} for c++ to LLVM IR translation")
- else()
- find_program(CLANGPLUSPLUS NAMES clang++-12 clang++-14 clang++)
- if (CLANGPLUSPLUS MATCHES "CLANGPLUSPLUS-NOTFOUND")
- message(SEND_ERROR "clang++ not found")
- else()
- message(STATUS "Using ${CLANGPLUSPLUS} for c++ to LLVM IR translation")
- endif()
- endif()
-
- if (CMAKE_C_COMPILER_ID MATCHES "Clang")
- set(CLANGC ${CMAKE_C_COMPILER})
- message(STATUS "Using ${CLANGC} for c++ to LLVM IR translation")
- else()
- find_program(CLANGC NAMES clang-12 clang-14 clang)
- if (CLANGC MATCHES "CLANGC-NOTFOUND")
- message(SEND_ERROR "clang not found")
- else()
- message(STATUS "Using ${CLANGC} for c to LLVM IR translation")
- endif()
- endif()
-
- find_program(LLVMLINK NAMES llvm-link-12 llvm-link-14 llvm-link)
- if (LLVMLINK MATCHES "LLVMLINK-NOTFOUND")
- message(SEND_ERROR "llvm-link not found")
- else()
- message(STATUS "Using ${LLVMLINK} for LLVM IR linking")
- endif()
- find_program(LLVMOPT NAMES opt-12 opt-14 opt)
- if (LLVMOPT MATCHES "LLVMOPT-NOTFOUND")
- message(SEND_ERROR "llvm opt tool not found")
- else()
- message(STATUS "Using ${LLVMOPT} for LLVM IR optimization")
- endif()
-
- find_program(LLVMLLC NAMES llc-12 llc-14 llc)
- if (LLVMLLC MATCHES "LLVMLLC-NOTFOUND")
- message(SEND_ERROR "llvm llc tool not found")
- else()
- message(STATUS "Using ${LLVMLLC} for LLVM IR to binary code compilation")
- endif()
- find_program(LLVMAS NAMES llvm-as-12 llvm-as-14 llvm-as)
- if (LLVMAS MATCHES "LLVMAS-NOTFOUND")
- message(SEND_ERROR "llvm-as not found")
- else()
- message(STATUS "Using ${LLVMAS} for LLVM IR -> BC assembling")
- endif()
-endif()
-
-function(llvm_compile_cxx Tgt Inpt Out Tool UseC)
- list(APPEND TARGET_INCLUDES "-I$<JOIN:$<TARGET_PROPERTY:${Tgt},INCLUDE_DIRECTORIES>,$<SEMICOLON>-I>")
- list(APPEND TARGET_COMPILE_OPTIONS "'$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},COMPILE_OPTIONS>>,'$<SEMICOLON>'>'")
- list(APPEND TARGET_COMPILE_DEFINITIONS "'-D$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},COMPILE_DEFINITIONS>>,'$<SEMICOLON>'-D>'")
- if (${UseC})
- set(STD_FLAG "")
- separate_arguments(LANG_FLAGS NATIVE_COMMAND ${CMAKE_C_FLAGS})
- separate_arguments(FLAGSLIST_DEBUG NATIVE_COMMAND ${CMAKE_C_FLAGS_DEBUG})
- separate_arguments(FLAGSLIST_RELEASE NATIVE_COMMAND ${CMAKE_C_FLAGS_RELEASE})
- separate_arguments(FLAGSLIST_MINSIZEREL NATIVE_COMMAND ${CMAKE_C_FLAGS_MINSIZEREL})
- separate_arguments(FLAGSLIST_RELWITHDEBINFO NATIVE_COMMAND ${CMAKE_C_FLAGS_RELWITHDEBINFO})
- else()
- get_target_property(TARGET_STANDARD ${Tgt} CXX_STANDARD)
- set(STD_FLAG "-std=c++${TARGET_STANDARD}")
- separate_arguments(LANG_FLAGS NATIVE_COMMAND ${CMAKE_CXX_FLAGS})
- separate_arguments(FLAGSLIST_DEBUG NATIVE_COMMAND ${CMAKE_CXX_FLAGS_DEBUG})
- separate_arguments(FLAGSLIST_RELEASE NATIVE_COMMAND ${CMAKE_CXX_FLAGS_RELEASE})
- separate_arguments(FLAGSLIST_MINSIZEREL NATIVE_COMMAND ${CMAKE_CXX_FLAGS_MINSIZEREL})
- separate_arguments(FLAGSLIST_RELWITHDEBINFO NATIVE_COMMAND ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})
- endif()
-
- add_custom_command(
- OUTPUT ${Out}
- COMMAND
- ${Tool}
- ${TARGET_INCLUDES}
- ${LANG_FLAGS}
- "$<$<CONFIG:DEBUG>:${FLAGSLIST_DEBUG}>"
- "$<$<CONFIG:RELEASE>:${FLAGSLIST_RELEASE}>"
- "$<$<CONFIG:MINSIZEREL>:${FLAGSLIST_MINSIZEREL}>"
- "$<$<CONFIG:RELWITHDEBINFO>:${FLAGSLIST_RELWITHDEBINFO}>"
- ${TARGET_COMPILE_DEFINITIONS}
- ${STD_FLAG}
- ${TARGET_COMPILE_OPTIONS}
- -Wno-unknown-warning-option
- -fno-lto
- -emit-llvm
- -c
- ${Inpt}
- -o
- ${Out}
- COMMAND_EXPAND_LISTS
- DEPENDS ${Inpt} ${Tool}
- )
-endfunction()
-
-function(llvm_compile_c Tgt Inpt Out Tool)
- llvm_compile_cxx(${Tgt} ${Inpt} ${Out} ${Tool} TRUE)
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/masm.cmake b/build/export_generators/hardcoded-cmake/cmake/masm.cmake
deleted file mode 100644
index 1b64c71542..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/masm.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-if (MSVC)
-
-enable_language(ASM_MASM)
-
-macro(curdir_masm_flags)
- set(CMAKE_ASMMASM_FLAGS ${ARGN})
-endmacro()
-
-endif()
diff --git a/build/export_generators/hardcoded-cmake/cmake/protobuf.cmake b/build/export_generators/hardcoded-cmake/cmake/protobuf.cmake
deleted file mode 100644
index 3660b58758..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/protobuf.cmake
+++ /dev/null
@@ -1,102 +0,0 @@
-include(common)
-
-function(target_proto_plugin Tgt Name PluginTarget)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- PROTOC_OPTS --${Name}_out=${PROJECT_BINARY_DIR}/$<TARGET_PROPERTY:${Tgt},PROTO_NAMESPACE> --plugin=protoc-gen-${Name}=$<TARGET_FILE:${PluginTarget}>
- )
- set_property(TARGET ${Tgt} APPEND PROPERTY
- PROTOC_DEPS ${PluginTarget}
- )
-endfunction()
-
-function(target_proto_addincls Tgt)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- PROTO_ADDINCL ${ARGN}
- )
-endfunction()
-
-function(target_proto_outs Tgt)
- set_property(TARGET ${Tgt} APPEND PROPERTY
- PROTO_OUTS ${ARGN}
- )
-endfunction()
-
-function(target_messages Tgt Scope UseStyleguide UseEvent2Cpp)
- if (vanilla_protobuf STREQUAL "yes")
- set(protoc_bin ${PROJECT_BINARY_DIR}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX})
- set(protoc_dependency "")
- set(UseStyleguide "no") # cpp_styleguide can't compile with vanilla protobuf
- else()
- get_built_tool_path(protoc_bin protoc_dependency "contrib/tools/protoc/bin" "protoc")
- endif()
-
- if (UseStyleguide STREQUAL "yes")
- get_built_tool_path(cpp_styleguide_bin cpp_styleguide_dependency "contrib/tools/protoc/plugins/cpp_styleguide" "cpp_styleguide")
- set(protoc_styleguide_plugin --plugin=protoc-gen-cpp_styleguide=${cpp_styleguide_bin})
- else()
- set(protoc_styleguide_plugin "")
- set(cpp_styleguide_dependency "")
- endif()
-
- if (UseEvent2Cpp STREQUAL "yes")
- get_built_tool_path(event2cpp_bin event2cpp_dependency "tools/event2cpp/bin" "event2cpp")
- set(protoc_event2cpp_plugin --plugin=protoc-gen-event2cpp=${event2cpp_bin})
- set(ext_h ".ev.pb.h")
- set(ext_c ".ev.pb.cc")
- else()
- set(protoc_event2cpp_plugin "")
- set(event2cpp_dependency "")
- set(ext_h ".pb.h")
- set(ext_c ".pb.cc")
- endif()
-
- get_property(ProtocExtraOutsSuf TARGET ${Tgt} PROPERTY PROTOC_EXTRA_OUTS)
- foreach(proto ${ARGN})
- if(proto MATCHES ${PROJECT_BINARY_DIR})
- file(RELATIVE_PATH protoRel ${PROJECT_BINARY_DIR} ${proto})
- elseif (proto MATCHES ${PROJECT_SOURCE_DIR})
- file(RELATIVE_PATH protoRel ${PROJECT_SOURCE_DIR} ${proto})
- else()
- set(protoRel ${proto})
- endif()
- get_filename_component(OutputBase ${protoRel} NAME_WLE)
- get_filename_component(OutputDir ${PROJECT_BINARY_DIR}/${protoRel} DIRECTORY)
- list(TRANSFORM ProtocExtraOutsSuf PREPEND ${OutputDir}/${OutputBase} OUTPUT_VARIABLE ProtocExtraOuts)
- add_custom_command(
- OUTPUT
- ${OutputDir}/${OutputBase}${ext_c}
- ${OutputDir}/${OutputBase}${ext_h}
- ${ProtocExtraOuts}
- COMMAND ${protoc_bin}
- ${COMMON_PROTOC_FLAGS}
- "-I$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},PROTO_ADDINCL>>,;-I>"
- "$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},PROTO_OUTS>>,;>"
- ${protoc_styleguide_plugin}
- ${protoc_event2cpp_plugin}
- "$<JOIN:$<TARGET_GENEX_EVAL:${Tgt},$<TARGET_PROPERTY:${Tgt},PROTOC_OPTS>>,;>"
- ${protoRel}
- COMMAND Python3::Interpreter ${PROJECT_SOURCE_DIR}/build/scripts/re_replace.py --from-re "\"((?:struct|class)\\s+\\S+\\s+)final\\s*:\"" --to-re "\"\\1:\"" ${OutputDir}/${OutputBase}${ext_c} ${OutputDir}/${OutputBase}${ext_h}
- DEPENDS
- ${proto}
- $<TARGET_PROPERTY:${Tgt},PROTOC_DEPS>
- ${protoc_dependency}
- ${cpp_styleguide_dependency}
- ${event2cpp_dependency}
- ${PROJECT_SOURCE_DIR}/build/scripts/re_replace.py
- WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
- COMMAND_EXPAND_LISTS
- )
- target_sources(${Tgt} ${Scope}
- ${OutputDir}/${OutputBase}${ext_c} ${OutputDir}/${OutputBase}${ext_h}
- ${ProtocExtraOuts}
- )
- endforeach()
-endfunction()
-
-function(target_proto_messages Tgt Scope)
- target_messages(${Tgt} ${Scope} "yes" "no" ${ARGN})
-endfunction()
-
-function(target_ev_messages Tgt Scope)
- target_messages(${Tgt} ${Scope} "yes" "yes" ${ARGN})
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/recursive_library.cmake b/build/export_generators/hardcoded-cmake/cmake/recursive_library.cmake
deleted file mode 100644
index dcbb48a182..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/recursive_library.cmake
+++ /dev/null
@@ -1,50 +0,0 @@
-function(add_recursive_library Target)
- if (${CMAKE_VERSION} VERSION_LESS "3.21.0")
- message(FATAL_ERROR "add_recursive_library requires at least cmake 3.21.0 (because it uses CXX_LINKER_LAUNCHER)")
- endif()
-
- if (CMAKE_GENERATOR MATCHES "Visual.Studio.*")
- message(FATAL_ERROR "add_recursive_library is incompatible with Visual Studio generators")
- endif()
-
- find_package(Python3 REQUIRED)
-
- # this is not really an executable but we will use it to make CMake collect all dependencies to pass to the custom linking command (because there's no proper way to do it otherwise)
- add_executable(${Target})
- if (NOT (DEFINED CMAKE_POSITION_INDEPENDENT_CODE))
- # default should be the same as for usual static libraries - https://cmake.org/cmake/help/latest/prop_tgt/POSITION_INDEPENDENT_CODE.html
- set_property(TARGET ${Target} PROPERTY POSITION_INDEPENDENT_CODE Off)
- endif()
-
- set_property(TARGET ${Target} PROPERTY PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
- set_property(TARGET ${Target} PROPERTY SUFFIX ${CMAKE_STATIC_LIBRARY_SUFFIX})
-
- # the result will consist of two files at most (if there are no input files of particular type the resulting output files won't be created):
- # ${PREFIX}${Target}${SUFFIX} - for objects not requiring global initialization
- # ${PREFIX}${Target}${GLOBAL_PART_SUFFIX}${SUFFIX} - for objects requiring global initialization
- set(GLOBAL_PART_SUFFIX ".global")
-
- if (MSVC)
- # if this is not disabled CMake generates additional call to mt.exe after the linking command, manifests are needed only for real executables and dlls
- target_link_options(${Target} PRIVATE "/MANIFEST:NO")
- endif()
- string(CONCAT CXX_LINKER_LAUNCHER_CMD "${Python3_EXECUTABLE}"
- ";${PROJECT_SOURCE_DIR}/build/scripts/create_recursive_library_for_cmake.py"
- ";--project-binary-dir;${PROJECT_BINARY_DIR}"
- ";--cmake-ar;${CMAKE_AR}"
- ";--cmake-ranlib;${CMAKE_RANLIB}"
- ";--cmake-host-system-name;${CMAKE_HOST_SYSTEM_NAME}"
- ";--global-part-suffix;${GLOBAL_PART_SUFFIX}"
- )
- if (CMAKE_CXX_STANDARD_LIBRARIES)
- # because they have to be excluded from input
- string(APPEND CXX_LINKER_LAUNCHER_CMD ";--cmake-cxx-standard-libraries;${CMAKE_CXX_STANDARD_LIBRARIES}")
- endif()
- string(APPEND CXX_LINKER_LAUNCHER_CMD ";--linking-cmdline") # this must be the last argument
-
- set_property(TARGET ${Target} PROPERTY CXX_LINKER_LAUNCHER ${CXX_LINKER_LAUNCHER_CMD})
- set_property(TARGET ${Target} PROPERTY LINK_DEPENDS
- "${PROJECT_SOURCE_DIR}/build/scripts/create_recursive_library_for_cmake.py"
- ";${PROJECT_SOURCE_DIR}/build/scripts/link_lib.py"
- )
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/shared_libs.cmake b/build/export_generators/hardcoded-cmake/cmake/shared_libs.cmake
deleted file mode 100644
index 2c9de143cc..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/shared_libs.cmake
+++ /dev/null
@@ -1,9 +0,0 @@
-add_custom_target(all-shared-libs)
-
-function(add_shared_library Tgt)
- add_library(${Tgt} SHARED ${ARGN})
- add_dependencies(all-shared-libs ${Tgt})
- if (NOT CMAKE_POSITION_INDEPENDENT_CODE)
- set_property(TARGET ${Tgt} PROPERTY EXCLUDE_FROM_ALL On)
- endif()
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/cmake/swig.cmake b/build/export_generators/hardcoded-cmake/cmake/swig.cmake
deleted file mode 100644
index 9ab29f914e..0000000000
--- a/build/export_generators/hardcoded-cmake/cmake/swig.cmake
+++ /dev/null
@@ -1,51 +0,0 @@
-set(SWIG_EXECUTABLE ${PROJECT_BINARY_DIR}/bin/swig${CMAKE_EXECUTABLE_SUFFIX})
-set(SWIG_SOURCE_FILE_EXTENSIONS .swg)
-
-function(add_swig_jni_library TgtName)
- set(opts "")
- set(oneval_args GEN_JAVA_FILES_LIST)
- set(multival_args SOURCES)
- cmake_parse_arguments(SWIG_JNI_LIB
- "${opts}"
- "${oneval_args}"
- "${multival_args}"
- ${ARGN}
- )
-
- set_property(SOURCE
- ${SWIG_JNI_LIB_SOURCES}
- PROPERTY
- CPLUSPLUS On
- )
-
- file(RELATIVE_PATH PathInProject ${PROJECT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
- string(REPLACE "/" "." JVMPackageName ${PathInProject})
- string(REPLACE "-" "_" JVMPackageName ${JVMPackageName})
- string(PREPEND JVMPackageName "ru.yandex.")
-
- string(REPLACE "." "/" OutDir ${JVMPackageName})
- string(CONCAT OutDirAbs ${CMAKE_CURRENT_BINARY_DIR} "/java/" ${OutDir})
-
- swig_add_library(${TgtName}
- TYPE SHARED
- LANGUAGE java
- OUTPUT_DIR ${OutDirAbs}
- OUTFILE_DIR ${CMAKE_CURRENT_BINARY_DIR}/cpp
- SOURCES
- ${SWIG_JNI_LIB_SOURCES}
- )
-
- if(APPLE)
- # for some legacy reason swig_add_library uses '.jnilib' suffix which has been replaced with '.dylib' since JDK7
- set_target_properties(${TgtName} PROPERTIES SUFFIX ".dylib")
- endif()
-
- set_property(TARGET ${TgtName} PROPERTY SWIG_COMPILE_OPTIONS -package ${JVMPackageName})
-
- add_custom_command(TARGET
- ${TgtName}
- POST_BUILD COMMAND
- ${CMAKE_COMMAND} -DJAVA_SRC_DIR=${OutDirAbs} -DJAVA_LST=${CMAKE_CURRENT_BINARY_DIR}/swig_gen_java.lst -P ${PROJECT_SOURCE_DIR}/build/scripts/gather_swig_java.cmake
- BYPRODUCTS ${SWIG_JNI_LIB_GEN_JAVA_FILES_LIST}
- )
-endfunction()
diff --git a/build/export_generators/hardcoded-cmake/common_cmake_lists.jinja b/build/export_generators/hardcoded-cmake/common_cmake_lists.jinja
deleted file mode 100644
index 2a2a76e4e5..0000000000
--- a/build/export_generators/hardcoded-cmake/common_cmake_lists.jinja
+++ /dev/null
@@ -1,10 +0,0 @@
-
-{% include '[generator]/disclaimer.jinja' -%}
-{% set platforms_count = platform_names|length -%}
-{% if platforms_count > 0 -%}
-{% for i in range(platforms_count) %}
-{% if i != 0 %}else{% endif %}if ({{ platforms[platform_names[i]] }})
- include(CMakeLists.{{ platform_names[i] }}.txt)
-{%- endfor %}
-endif()
-{% endif -%}
diff --git a/build/export_generators/hardcoded-cmake/conanfile.py.jinja b/build/export_generators/hardcoded-cmake/conanfile.py.jinja
deleted file mode 100644
index 95bc30e1a4..0000000000
--- a/build/export_generators/hardcoded-cmake/conanfile.py.jinja
+++ /dev/null
@@ -1,80 +0,0 @@
-from conan import ConanFile
-
-{%- if use_conan2 %}
-
-from conan.tools.files import copy
-from conan.tools.cmake import CMakeToolchain, CMakeDeps, cmake_layout
-
-{%- endif %}
-
-
-class App(ConanFile):
-
- settings = "os", "compiler", "build_type", "arch"
-
- default_options = {
-{%- for conan_option in conan_options -%}
-{%- set option_and_value = rsplit(conan_option, "=", 2) %}"{{ option_and_value[0] }}": "{{ option_and_value[1] }}"
-{%- if not loop.last -%}, {% endif -%}
-{%- endfor -%}
-}
-
-{%- if (conan_tool_packages|length) %}
-
- tool_requires =
-{%- for conan_tool_require in conan_tool_packages %} "{{ conan_tool_require }}"
-{%- if not loop.last -%},{%- endif -%}
-{%- endfor -%}
-{%- endif -%}
-
-{%- if (conan_packages|length) %}
-
- def requirements(self):
- requires = [
-{%- for conan_require in conan_packages %} "{{ conan_require }}"
-{%- if not loop.last -%},{%- endif -%}
-{%- endfor %} ]
- for require in requires:
- if ("linux-headers" in require) and (self.settings.os != "Linux"):
- continue
- self.requires(require)
-
-{%- endif -%}
-
-{%- if use_conan2 %}
-
- def generate(self):
- CMakeDeps(self).generate()
- CMakeToolchain(self).generate()
-
- for dep in self.dependencies.values():
- if dep.cpp_info.bindirs:
-{%- for conan_import in conan_imports -%}
-{%- set search_and_dstdir = rsplit(conan_import|trim, "->", 2) -%}
-{%- set search = search_and_dstdir[0]|trim -%}
-{%- set dstdir = search_and_dstdir[1]|trim -%}
-{%- set srcdir_and_mask = rsplit(search, ",", 2) -%}
-{%- set srcdir = srcdir_and_mask[0]|trim -%}
-{%- set mask = srcdir_and_mask[1]|trim %}
- copy(self, pattern="{{ mask }}", src=dep.cpp_info.bindirs[0], dst=self.build_folder + "../../../../{{ dstdir }}")
-{%- endfor %}
-
- def layout(self):
- cmake_layout(self)
-
-{%- else %}
-
- generators = "cmake_find_package", "cmake_paths"
-
- def imports(self):
-{%- for conan_import in conan_imports -%}
-{%- set search_and_dstdir = rsplit(conan_import|trim, "->", 2) -%}
-{%- set search = search_and_dstdir[0]|trim -%}
-{%- set dstdir = search_and_dstdir[1]|trim -%}
-{%- set srcdir_and_mask = rsplit(search, ",", 2) -%}
-{%- set srcdir = srcdir_and_mask[0]|trim -%}
-{%- set mask = srcdir_and_mask[1]|trim %}
- self.copy(pattern="{{ mask }}", src="{{ srcdir }}", dst="{{ dstdir }}")
-{%- endfor %}
-
-{%- endif %}
diff --git a/build/export_generators/hardcoded-cmake/dir_cmake_lists.jinja b/build/export_generators/hardcoded-cmake/dir_cmake_lists.jinja
deleted file mode 100644
index 93afa70506..0000000000
--- a/build/export_generators/hardcoded-cmake/dir_cmake_lists.jinja
+++ /dev/null
@@ -1,40 +0,0 @@
-{%- include '[generator]/disclaimer.jinja' %}
-{% include 'prologue.cmake' ignore missing -%}
-
-{%- for package in packages -%}
-find_package({{ package[0] }} REQUIRED
-{%- if package[1]|length > 0 %} COMPONENTS
-{%- for component in package[1] %}
- {{ component }}
-{% endfor -%}
-{%- endif -%}
-)
-{% endfor -%}
-
-{%- if includes is defined -%}
-{%- for incl in includes -%}
-include({{ incl }})
-{% endfor -%}
-{%- endif -%}
-
-{%- for subdir in subdirs -%}
-add_subdirectory({{ subdir }})
-{% endfor -%}
-
-{%- for dir_macro in dir_macros %}
-{{ dir_macro[0] }}(
-{%- for value in dir_macro[1] %}
- {{ value }}
-{%- endfor %}
-)
-{% endfor -%}
-
-{%- if target is defined -%}
-{%- include '[generator]/target_cmake_lists.jinja' -%}
-{%- endif -%}
-{%- if extra_targets is defined -%}
-{%- for target in extra_targets -%}
-{%- include '[generator]/target_cmake_lists.jinja' -%}
-{%- endfor -%}
-{%- endif -%}
-{%- include 'epilogue.cmake' ignore missing -%}
diff --git a/build/export_generators/hardcoded-cmake/disclaimer.jinja b/build/export_generators/hardcoded-cmake/disclaimer.jinja
deleted file mode 100644
index 8360b7732d..0000000000
--- a/build/export_generators/hardcoded-cmake/disclaimer.jinja
+++ /dev/null
@@ -1,13 +0,0 @@
-# This file was generated by the YaTool build system (https://github.com/yandex/yatool),
-# from a source YaTool build configuration provided in ya.make files.
-#
-# If the repository supports both CMake and ya build configurations, please modify both of them.
-#
-# If only CMake build configuration is supported then modify only CMake files and note that only
-# simple modifications are allowed like adding source-files to targets or adding simple properties
-# like target_include_directories. These modifications will be ported to original ya.make files
-# by maintainers. Any complex modifications which can't be easily ported back to the ya build
-# system may be rejected.
-#
-# Please refer to the build instructions in the repository for more information about manual
-# changes in this file.
diff --git a/build/export_generators/hardcoded-cmake/generator.toml b/build/export_generators/hardcoded-cmake/generator.toml
deleted file mode 100644
index e8c2a28b5c..0000000000
--- a/build/export_generators/hardcoded-cmake/generator.toml
+++ /dev/null
@@ -1,279 +0,0 @@
-[platforms]
-linux="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"x86_64\" AND NOT HAVE_CUDA"
-linux-x86_64="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"x86_64\" AND NOT HAVE_CUDA"
-linux-x86_64-cuda="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"x86_64\" AND HAVE_CUDA"
-
-linux-aarch64="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"aarch64\" AND NOT HAVE_CUDA"
-linux-arm64="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"aarch64\" AND NOT HAVE_CUDA"
-linux-aarch64-cuda="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"aarch64\" AND HAVE_CUDA"
-linux-arm64-cuda="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"aarch64\" AND HAVE_CUDA"
-
-linux-ppc64le="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"ppc64le\" AND NOT HAVE_CUDA"
-linux-ppc64le-cuda="CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"ppc64le\" AND HAVE_CUDA"
-
-darwin="CMAKE_SYSTEM_NAME STREQUAL \"Darwin\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"x86_64\""
-darwin-x86_64="CMAKE_SYSTEM_NAME STREQUAL \"Darwin\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"x86_64\""
-darwin-arm64="CMAKE_SYSTEM_NAME STREQUAL \"Darwin\" AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"arm64\""
-
-windows="WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"AMD64\" AND NOT HAVE_CUDA"
-windows-x86_64="WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"AMD64\" AND NOT HAVE_CUDA"
-windows-x86_64-cuda="WIN32 AND CMAKE_SYSTEM_PROCESSOR STREQUAL \"AMD64\" AND HAVE_CUDA"
-
-android-arm="ANDROID AND CMAKE_ANDROID_ARCH STREQUAL \"arm\""
-android-arm32="ANDROID AND CMAKE_ANDROID_ARCH STREQUAL \"arm\""
-android-arm64="ANDROID AND CMAKE_ANDROID_ARCH STREQUAL \"arm64\""
-android-x86="ANDROID AND CMAKE_ANDROID_ARCH STREQUAL \"x86\""
-android-x86_64="ANDROID AND CMAKE_ANDROID_ARCH STREQUAL \"x86_64\""
-
-[root]
-templates=[
- { path="conanfile.py.jinja", dest="conanfile.py" },
- { path="root_cmake_lists.jinja", dest="CMakeLists.txt" },
- { path="root_global_vars.jinja", dest="cmake/global_vars.cmake" },
-]
-copy=[
- "cmake/global_flags.compiler.gnu.march.cmake",
- "cmake/global_flags.compiler.gnu.cmake",
- "cmake/global_flags.compiler.msvc.cmake",
- "cmake/global_flags.linker.gnu.cmake",
- "cmake/global_flags.linker.msvc.cmake",
- "cmake/global_flags.cmake",
-]
-
-# DEPRECATED - remove after yexport release
-[common]
-template={ path="common_cmake_lists.jinja", dest="CMakeLists.txt" }
-
-# DEPRECATED - remove after yexport release
-[dir]
-template={ path="dir_cmake_lists.jinja", dest="CMakeLists{PLATFORM}.txt" }
-
-# WORKAROUND - used for all targets in hardcoded-cmake
-[targets.EMPTY]
-template={ path="dir_cmake_lists.jinja", dest="CMakeLists{PLATFORM}.txt" }
-merge_platform_template={ path="common_cmake_lists.jinja", dest="CMakeLists.txt" }
-
-[attrs.root]
-project_name="str"
-project_language_list="list"
-platform_vars="list"
-includes="sorted_set"
-use_conan="bool"
-vanilla_protobuf="flag"
-
-[attrs.dir]
-
-[attrs.target]
-is_interface="bool"
-
-[[rules]]
-attrs=["run_antlr"]
-copy=["cmake/antlr.cmake"]
-add_values=[{attr="includes", values=["cmake/antlr.cmake"]}]
-
-[[rules]]
-attrs=["run_antlr4"]
-copy=["cmake/antlr4.cmake"]
-add_values=[{attr="includes", values=["cmake/antlr4.cmake"]}]
-
-[[rules]]
-attrs=[
- "target_bison_parser",
- "target_flex_lexers"
-]
-copy=["cmake/bison.cmake"]
-add_values=[{attr="includes", values=["cmake/bison.cmake"]}]
-
-[[rules]]
-attrs=[
- "conan_add_remote",
- "conan_check",
- "conan_cmake_autodetect",
- "conan_cmake_configure",
- "conan_cmake_detect_unix_libcxx",
- "conan_cmake_detect_vs_runtime",
- "conan_cmake_generate_conanfile",
- "conan_cmake_install",
- "conan_cmake_run",
- "conan_cmake_settings",
- "conan_cmake_setup_conanfile",
- "conan_config_install",
- "conan_load_buildinfo",
- "conan_parse_arguments",
- "conan_require",
- "conan_require_tool",
- "old_conan_cmake_install",
-]
-copy=["cmake/conan1_deprecated.cmake", "cmake/conan_provider.cmake"]
-add_values=[{attr="includes", values=["cmake/conan1_deprecated.cmake"]}]
-
-[[rules]]
-attrs=[
- "target_ev_messages",
- "target_proto_messages",
- "target_proto_plugin",
- "target_proto_outs",
- "target_proto_addincls",
-]
-copy=[
- "cmake/protobuf.cmake",
- "build/scripts/re_replace.py",
-]
-add_values=[{attr="includes", values=["cmake/protobuf.cmake"]}]
-
-[[rules]]
-attrs=[
- "add_global_library_for",
- "archive",
- "resources_file",
- "generate_enum_serilization",
- "copy",
- "target_joined_source",
- "target_ragel_lexers",
- "target_yasm_source",
- "vcs_info",
- "target_sources_custom",
- "use_export_script",
- "add_yunittest",
- "set_yunittest_property",
-]
-copy=[
- "cmake/common.cmake",
- "build/scripts/export_script_gen.py",
- "build/scripts/split_unittest.py",
- "build/scripts/generate_vcs_info.py"
-]
-add_values=[{attr="includes", values=["cmake/common.cmake"]}]
-
-[[rules]]
-attrs=[
- "llvm_compile_c",
- "llvm_compile_cxx",
-]
-copy=["cmake/llvm-tools.cmake"]
-add_values=[{attr="includes", values=["cmake/llvm-tools.cmake"]}]
-
-[[rules]]
-attrs=["curdir_masm_flags"]
-copy=["cmake/masm.cmake"]
-add_values=[{attr="includes", values=["cmake/masm.cmake"]}]
-
-[[rules]]
-attrs=["target_fbs_source"]
-copy=["cmake/fbs.cmake"]
-add_values=[{attr="includes", values=["cmake/fbs.cmake"]}]
-
-[[rules]]
-attrs=["add_fat_object"]
-copy=["cmake/fat_object.cmake"]
-add_values=[{attr="includes", values=["cmake/fat_objects.cmake"]}]
-
-[[rules]]
-attrs=["add_recursive_library"]
-copy=[
- "cmake/recursive_library.cmake",
- "build/scripts/create_recursive_library_for_cmake.py"
-]
-add_values=[{attr="includes", values=["cmake/recursive_library.cmake"]}]
-
-[[rules]]
-attrs=["add_shared_library"]
-copy=["cmake/shared_libs.cmake"]
-add_values=[{attr="includes", values=["cmake/shared_libs.cmake"]}]
-
-[[rules]]
-attrs=[
- "target_cuda_flags",
- "target_cuda_cflags",
- "target_cuda_sources"
-]
-copy=["cmake/cuda.cmake"]
-add_values=[{attr="includes", values=["cmake/cuda.cmake"]}]
-
-[[rules]]
-attrs=["target_rodata_sources"]
-copy=["cmake/archive.cmake"]
-add_values=[{attr="includes", values=["cmake/archive.cmake"]}]
-
-[[rules]]
-attrs=[
- "target_cython_sources",
- "target_cython_options",
- "target_cython_include_directories",
- "set_python_type_for_cython",
-]
-copy=["cmake/cython.cmake"]
-add_values=[{attr="includes", values=["cmake/cython.cmake"]}]
-
-[[rules]]
-attrs=[
- "swig_add_library",
- "add_jar"
-]
-copy=[
- "cmake/swig.cmake",
- "build/scripts/gather_swig_java.cmake"
-]
-add_values=[{attr="includes", values=["cmake/swig.cmake"]}]
-
-[[rules]]
-attrs=[
- "find_package=IDN",
-]
-copy=[
- "cmake/FindIDN.cmake",
-]
-add_values=[{attr="includes", values=["cmake/FindIDN.cmake"]}]
-
-[[rules]]
-attrs=[
- "find_package=AIO",
-]
-copy=[
- "cmake/FindAIO.cmake",
-]
-add_values=[{attr="includes", values=["cmake/FindAIO.cmake"]}]
-
-# Conan profiles for platforms
-[[rules]]
-platforms=[
- "android-arm",
- "android-arm32"
-]
-copy=["cmake/conan-profiles/android.armv7.profile"]
-
-[[rules]]
-platforms=["android-arm64"]
-copy=["cmake/conan-profiles/android.arm64.profile"]
-
-[[rules]]
-platforms=["android-x86"]
-copy=["cmake/conan-profiles/android.x86.profile"]
-
-[[rules]]
-platforms=["android-x86_64"]
-copy=["cmake/conan-profiles/android.x86_64.profile"]
-
-[[rules]]
-platforms=[
- "linux-aarch64",
- "linux-arm64",
- "linux-aarch64-cuda",
- "linux-arm64-cuda"
-]
-copy=["cmake/conan-profiles/linux.aarch64.profile"]
-
-[[rules]]
-platforms=[
- "linux-ppc64le",
- "linux-ppc64le-cuda"
-]
-copy=["cmake/conan-profiles/linux.ppc64le.profile"]
-
-[[rules]]
-platforms=["darwin-x86_64"]
-copy=["cmake/conan-profiles/macos.x86_64.profile"]
-
-[[rules]]
-platforms=["darwin-arm64"]
-copy=["cmake/conan-profiles/macos.arm64.profile"]
diff --git a/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja b/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja
deleted file mode 100644
index 9e8c8b3752..0000000000
--- a/build/export_generators/hardcoded-cmake/root_cmake_lists.jinja
+++ /dev/null
@@ -1,66 +0,0 @@
-
-{% include '[generator]/disclaimer.jinja' -%}
-
-cmake_minimum_required(VERSION 3.15)
-if (POLICY CMP0132)
- cmake_policy(SET CMP0132 NEW)
-endif()
-
-project({{project_name}} LANGUAGES{% for value in project_language_list %} {{value}}{% endfor %})
-
-set(BUILD_SHARED_LIBS Off)
-set(CMAKE_CXX_STANDARD 20)
-set(CMAKE_CXX_EXTENSIONS Off)
-set({{project_name}}_MAX_LINK_JOBS 5 CACHE STRING "Maximum parallel link jobs for Ninja generator")
-set_property(GLOBAL PROPERTY JOB_POOLS link_jobs=${{ '{' }}{{project_name}}_MAX_LINK_JOBS{{ '}' }})
-set(CMAKE_JOB_POOL_LINK link_jobs)
-
-list(APPEND CMAKE_MODULE_PATH ${{ '{' }}PROJECT_BINARY_DIR{{ '}' }} ${{ '{' }}PROJECT_SOURCE_DIR{{ '}' }}/cmake)
-include_directories(${{ '{' }}PROJECT_SOURCE_DIR{{ '}' }} ${{ '{' }}PROJECT_BINARY_DIR{{ '}' }})
-list(APPEND CMAKE_CTEST_ARGUMENTS "--output-on-failure")
-enable_testing()
-
-# Disable 'empty CUDA_ARCHITECTURES not allowed' warning
-# Can't set it in cuda.cmake because of CMake policy subdirectory stack rules
-cmake_policy(SET CMP0104 OLD)
-
-include(cmake/global_flags.cmake)
-include(cmake/global_vars.cmake)
-{% if includes is defined -%}
-{% for incl in includes -%}
-{% if not(use_conan2) or (incl != "cmake/conan1_deprecated.cmake") -%}
-include({{ incl }})
-{% endif -%}
-{% endfor -%}
-{% endif -%}
-
-{%- if (use_conan) and not(use_conan2) %}
-if (CMAKE_CROSSCOMPILING)
- include(${PROJECT_BINARY_DIR}/conan_paths.cmake)
-else()
- conan_cmake_autodetect(settings)
- conan_cmake_install(
- PATH_OR_REFERENCE ${PROJECT_SOURCE_DIR}
- INSTALL_FOLDER ${PROJECT_BINARY_DIR}
- BUILD missing
- REMOTE conancenter
- SETTINGS ${settings}
- ENV "CONAN_CMAKE_GENERATOR=${CMAKE_GENERATOR}"
- CONF "tools.cmake.cmaketoolchain:generator=${CMAKE_GENERATOR}"
- )
-endif()
-{% endif -%}
-
-{%- if vanilla_protobuf %}
-
-set(vanilla_protobuf "yes")
-{%- endif %}
-
-{% set platforms_count = platform_names|length -%}
-{% if platforms_count > 0 -%}
-{% for i in range(platforms_count) -%}
-{% if i != 0 %}else{% endif %}if ({{ platforms[platform_names[i]] }})
- include(CMakeLists.{{ platform_names[i] }}.txt)
-{% endfor -%}
-endif()
-{% endif %}
diff --git a/build/export_generators/hardcoded-cmake/root_global_vars.jinja b/build/export_generators/hardcoded-cmake/root_global_vars.jinja
deleted file mode 100644
index 3bdd464e57..0000000000
--- a/build/export_generators/hardcoded-cmake/root_global_vars.jinja
+++ /dev/null
@@ -1,17 +0,0 @@
-
-{% include '[generator]/disclaimer.jinja' -%}
-
-{% set platforms_count = platform_names|length -%}
-{% if platforms_count > 0 -%}
-{% for i in range(platforms_count) %}
-{% if i != 0 %}else{% endif %}if ({{ platforms[platform_names[i]] }})
-{%- for var in platform_vars[i] %}
- set({% for arg in var %}{{arg}}{% if not loop.last %} {% endif %}{% endfor %})
-{%- endfor %}
-{%- if "windows" in platform_names[i] %}
- set(ENV{PYTHONIOENCODING} utf-8)
- set(ENV{PYTHONUTF8} 1)
-{%- endif %}
-{%- endfor %}
-endif()
-{% endif %}
diff --git a/build/export_generators/hardcoded-cmake/target_cmake_lists.jinja b/build/export_generators/hardcoded-cmake/target_cmake_lists.jinja
deleted file mode 100644
index 39ff17e076..0000000000
--- a/build/export_generators/hardcoded-cmake/target_cmake_lists.jinja
+++ /dev/null
@@ -1,77 +0,0 @@
-{%- set macro = target.macro -%}
-{%- set name = target.name -%}
-
-{{ macro }}({{ name }}
-{%- if target.is_interface %} INTERFACE{%- endif -%}
-{%- set macro_args = target.macro_args -%}
-{%- if macro_args|length > 0 %}
-{%- for arg in macro_args %}
- {{ arg }}
-{% endfor -%}
-{%- endif -%}
-)
-{% for property in target.properties -%}
-set_property(TARGET {{ name }} PROPERTY {{ property[0] }}
-{%- for value in property[1] %}
- {{ value }}
-{%- endfor %}
-)
-{% endfor -%}
-
-{%- for attribute in target.attributes -%}
-
-{%- if attribute[1].iface is defined %}
-{{ attribute[0] }}({{ name }} INTERFACE
-{%- for val in attribute[1].iface %}
- {{ val }}
-{%- endfor %}
-)
-{% endif -%}
-
-{%- if attribute[1].pub is defined %}
-{{ attribute[0] }}({{ name }} PUBLIC
-{%- for val in attribute[1].pub %}
- {{ val }}
-{%- endfor %}
-)
-{% endif -%}
-
-{%- if attribute[1].priv is defined %}
-{{ attribute[0] }}({{ name }} PRIVATE
-{%- for val in attribute[1].priv %}
- {{ val }}
-{%- endfor %}
-)
-{% endif -%}
-
-{%- endfor -%}
-
-{%- for dir_macro in target.target_dir_macros %}
-{{ dir_macro[0] }}(
-{%- for value in dir_macro[1] %}
- {{ value }}
-{%- endfor %}
-)
-{% endfor -%}
-
-{%- for target_macro in target.target_macros %}
-{{ target_macro[0] }}({{ name }}
-{%- if target_macro[1]|length > 0 -%}
-{%- for value in target_macro[1] %}
- {{ value }}
-{%- endfor %}
-{% endif -%}
-)
-{% endfor -%}
-
-{%- set dependencies = target.dependencies -%}
-{%- if dependencies|length > 0 %}
-
-if(NOT CMAKE_CROSSCOMPILING)
- add_dependencies({{ name }}
-{%- for dep in dependencies %}
- {{ dep }}
-{%- endfor %}
-)
-endif()
-{%- endif %}
diff --git a/build/scripts/create_recursive_library_for_cmake.py b/build/scripts/create_recursive_library_for_cmake.py
deleted file mode 100644
index 4eb8013a91..0000000000
--- a/build/scripts/create_recursive_library_for_cmake.py
+++ /dev/null
@@ -1,200 +0,0 @@
-# Custom script is necessary because CMake does not yet support creating static libraries combined with dependencies
-# https://gitlab.kitware.com/cmake/cmake/-/issues/22975
-#
-# This script is intended to be used set as a CXX_LINKER_LAUNCHER property for recursive library targets.
-# It parses the linking command and transforms it to archiving commands combining static libraries from dependencies.
-
-import argparse
-import os
-import re
-import shlex
-import subprocess
-import sys
-import tempfile
-
-
-class Opts(object):
- def __init__(self, args):
- argparser = argparse.ArgumentParser(allow_abbrev=False)
- argparser.add_argument('--project-binary-dir', required=True)
- argparser.add_argument('--cmake-ar', required=True)
- argparser.add_argument('--cmake-ranlib', required=True)
- argparser.add_argument('--cmake-host-system-name', required=True)
- argparser.add_argument('--cmake-cxx-standard-libraries')
- argparser.add_argument('--global-part-suffix', required=True)
- self.parsed_args, other_args = argparser.parse_known_args(args=args)
-
- if len(other_args) < 2:
- # must contain at least '--linking-cmdline' and orginal linking tool name
- raise Exception('not enough arguments')
- if other_args[0] != '--linking-cmdline':
- raise Exception("expected '--linking-cmdline' arg, got {}".format(other_args[0]))
-
- self.is_msvc_compatible_linker = other_args[1].endswith('\\link.exe') or other_args[1].endswith('\\lld-link.exe')
-
- is_host_system_windows = self.parsed_args.cmake_host_system_name == 'Windows'
- std_libraries_to_exclude_from_input = (
- set(self.parsed_args.cmake_cxx_standard_libraries.split())
- if self.parsed_args.cmake_cxx_standard_libraries is not None
- else set()
- )
- msvc_preserved_option_prefixes = [
- 'machine:',
- 'nodefaultlib',
- 'nologo',
- ]
-
- self.preserved_options = []
-
- # these variables can contain paths absolute or relative to project_binary_dir
- self.global_libs_and_objects_input = []
- self.non_global_libs_input = []
- self.output = None
-
- def is_external_library(path):
- """
- Check whether this library has been built in this CMake project or came from Conan-provided dependencies
- (these use absolute paths).
- If it is a library that is added from some other path (like CUDA) return True
- """
- return not (os.path.exists(path) or os.path.exists(os.path.join(self.parsed_args.project_binary_dir, path)))
-
- def process_input(args):
- i = 0
- is_in_whole_archive = False
-
- while i < len(args):
- arg = args[i]
- if is_host_system_windows and ((arg[0] == '/') or (arg[0] == '-')):
- arg_wo_specifier_lower = arg[1:].lower()
- if arg_wo_specifier_lower.startswith('out:'):
- self.output = arg[len('/out:') :]
- elif arg_wo_specifier_lower.startswith('wholearchive:'):
- lib_path = arg[len('/wholearchive:') :]
- if not is_external_library(lib_path):
- self.global_libs_and_objects_input.append(lib_path)
- else:
- for preserved_option_prefix in msvc_preserved_option_prefixes:
- if arg_wo_specifier_lower.startswith(preserved_option_prefix):
- self.preserved_options.append(arg)
- break
- # other flags are non-linking related and just ignored
- elif arg[0] == '-':
- if arg == '-o':
- if (i + 1) >= len(args):
- raise Exception('-o flag without an argument')
- self.output = args[i + 1]
- i += 1
- elif arg == '-Wl,--whole-archive':
- is_in_whole_archive = True
- elif arg == '-Wl,--no-whole-archive':
- is_in_whole_archive = False
- elif arg.startswith('-Wl,-force_load,'):
- lib_path = arg[len('-Wl,-force_load,') :]
- if not is_external_library(lib_path):
- self.global_libs_and_objects_input.append(lib_path)
- elif arg == '-isysroot':
- i += 1
- # other flags are non-linking related and just ignored
- elif arg[0] == '@':
- # response file with args
- with open(arg[1:]) as response_file:
- parsed_args = shlex.shlex(response_file, posix=False, punctuation_chars=False)
- parsed_args.whitespace_split = True
- args_in_response_file = list(arg.strip('"') for arg in parsed_args)
- process_input(args_in_response_file)
- elif not is_external_library(arg):
- if is_in_whole_archive or arg.endswith('.o') or arg.endswith('.obj'):
- self.global_libs_and_objects_input.append(arg)
- elif arg not in std_libraries_to_exclude_from_input:
- self.non_global_libs_input.append(arg)
- i += 1
-
- process_input(other_args[2:])
-
- if self.output is None:
- raise Exception("No output specified")
-
- if (len(self.global_libs_and_objects_input) == 0) and (len(self.non_global_libs_input) == 0):
- raise Exception("List of input objects and libraries is empty")
-
-
-class FilesCombiner(object):
- def __init__(self, opts):
- self.opts = opts
-
- archiver_tool_path = opts.parsed_args.cmake_ar
- if sys.platform.startswith('darwin'):
- # force LIBTOOL even if CMAKE_AR is defined because 'ar' under Darwin does not contain the necessary options
- arch_type = 'LIBTOOL'
- archiver_tool_path = 'libtool'
- elif opts.is_msvc_compatible_linker:
- arch_type = 'LIB'
- elif re.match(r'^(|.*/)llvm\-ar(\-[\d])?', opts.parsed_args.cmake_ar):
- arch_type = 'LLVM_AR'
- elif re.match(r'^(|.*/)(gcc\-)?ar(\-[\d])?', opts.parsed_args.cmake_ar):
- arch_type = 'GNU_AR'
- else:
- raise Exception('Unsupported arch type for CMAKE_AR={}'.format(opts.parsed_args.cmake_ar))
-
- self.archiving_cmd_prefix = [
- sys.executable,
- os.path.join(os.path.dirname(os.path.abspath(__file__)), 'link_lib.py'),
- archiver_tool_path,
- arch_type,
- 'gnu', # llvm_ar_format, used only if arch_type == 'LLVM_AR'
- opts.parsed_args.project_binary_dir,
- 'None', # plugin. Unused for now
- ]
- # the remaining archiving cmd args are [output, .. input .. ]
-
- def do(self, output, input_list):
- input_file_path = None
- try:
- if self.opts.is_msvc_compatible_linker:
- # use response file for input (because of Windows cmdline length limitations)
-
- # can't use NamedTemporaryFile because of permissions issues on Windows
- input_file_fd, input_file_path = tempfile.mkstemp()
- try:
- input_file = os.fdopen(input_file_fd, 'w')
- for input in input_list:
- if ' ' in input:
- input_file.write('"{}" '.format(input))
- else:
- input_file.write('{} '.format(input))
- input_file.flush()
- finally:
- os.close(input_file_fd)
- input_args = ['@' + input_file_path]
- else:
- input_args = input_list
-
- cmd = self.archiving_cmd_prefix + [output] + self.opts.preserved_options + input_args
- subprocess.check_call(cmd)
- finally:
- if input_file_path is not None:
- os.remove(input_file_path)
-
- if not self.opts.is_msvc_compatible_linker:
- subprocess.check_call([self.opts.parsed_args.cmake_ranlib, output])
-
-
-if __name__ == "__main__":
- opts = Opts(sys.argv[1:])
-
- output_prefix, output_ext = os.path.splitext(opts.output)
- globals_output = output_prefix + opts.parsed_args.global_part_suffix + output_ext
-
- if os.path.exists(globals_output):
- os.remove(globals_output)
- if os.path.exists(opts.output):
- os.remove(opts.output)
-
- files_combiner = FilesCombiner(opts)
-
- if len(opts.global_libs_and_objects_input) > 0:
- files_combiner.do(globals_output, opts.global_libs_and_objects_input)
-
- if len(opts.non_global_libs_input) > 0:
- files_combiner.do(opts.output, opts.non_global_libs_input)
diff --git a/build/scripts/export_script_gen.py b/build/scripts/export_script_gen.py
deleted file mode 100644
index 3df3df8638..0000000000
--- a/build/scripts/export_script_gen.py
+++ /dev/null
@@ -1,132 +0,0 @@
-import argparse
-import collections
-import sys
-
-
-def parse_export_file(src):
- for line in src:
- line = line.strip()
-
- if line and '#' not in line:
- words = line.split()
- if len(words) == 2 and words[0] == 'linux_version':
- yield {'linux_version': words[1]}
- elif len(words) == 2:
- yield {'lang': words[0], 'sym': words[1]}
- elif len(words) == 1:
- yield {'lang': 'C', 'sym': words[0]}
- else:
- raise Exception('unsupported exports line: "{}"'.format(line))
-
-
-def to_c(sym):
- symbols = collections.deque(sym.split('::'))
- c_prefixes = [ # demangle prefixes for c++ symbols
- '_ZN', # namespace
- '_ZTIN', # typeinfo for
- '_ZTSN', # typeinfo name for
- '_ZTTN', # VTT for
- '_ZTVN', # vtable for
- '_ZNK', # const methods
- ]
- c_sym = ''
- while symbols:
- s = symbols.popleft()
- if s == '*':
- c_sym += '*'
- break
- if '*' in s and len(s) > 1:
- raise Exception('Unsupported format, cannot guess length of symbol: ' + s)
- c_sym += str(len(s)) + s
- if symbols:
- raise Exception('Unsupported format: ' + sym)
- if c_sym[-1] != '*':
- c_sym += 'E*'
- return ['{prefix}{sym}'.format(prefix=prefix, sym=c_sym) for prefix in c_prefixes]
-
-
-def to_gnu(src, dest):
- d = collections.defaultdict(list)
- version = None
- for item in parse_export_file(src):
- if item.get('linux_version'):
- if not version:
- version = item.get('linux_version')
- else:
- raise Exception('More than one linux_version defined')
- elif item['lang'] == 'C++':
- d['C'].extend(to_c(item['sym']))
- else:
- d[item['lang']].append(item['sym'])
-
- if version:
- dest.write('{} {{\nglobal:\n'.format(version))
- else:
- dest.write('{\nglobal:\n')
-
- for k, v in d.items():
- dest.write(' extern "' + k + '" {\n')
-
- for x in v:
- dest.write(' ' + x + ';\n')
-
- dest.write(' };\n')
-
- dest.write('local: *;\n};\n')
-
-
-def to_msvc(src, dest):
- dest.write('EXPORTS\n')
- for item in parse_export_file(src):
- if item.get('linux_version'):
- continue
- if item.get('lang') == 'C':
- dest.write(' {}\n'.format(item.get('sym')))
-
-
-def to_darwin(src, dest):
- pre = ''
- for item in parse_export_file(src):
- if item.get('linux_version'):
- continue
-
- if item['lang'] == 'C':
- dest.write(pre + '-Wl,-exported_symbol,_' + item['sym'])
- elif item['lang'] == 'C++':
- for sym in to_c(item['sym']):
- dest.write(pre + '-Wl,-exported_symbol,_' + sym)
- else:
- raise Exception('unsupported lang: ' + item['lang'])
- if pre == '':
- pre = ' '
-
-
-def main():
- parser = argparse.ArgumentParser(
- description='Convert self-invented platform independent export file format to the format required by specific linker'
- )
- parser.add_argument(
- 'src', type=argparse.FileType('r', encoding='UTF-8'), help='platform independent export file path'
- )
- parser.add_argument(
- 'dest', type=argparse.FileType('w', encoding='UTF-8'), help='destination export file for required linker'
- )
- parser.add_argument('--format', help='destination file type format: gnu, msvc or darwin')
-
- args = parser.parse_args()
- if args.format == 'gnu':
- to_gnu(args.src, args.dest)
- elif args.format == 'msvc':
- to_msvc(args.src, args.dest)
- elif args.format == 'darwin':
- to_darwin(args.src, args.dest)
- else:
- print('Unknown destination file format: {}'.format(args.format), file=sys.stderr)
- sys.exit(1)
-
- args.src.close()
- args.dest.close()
-
-
-if __name__ == '__main__':
- main()
diff --git a/build/scripts/gather_swig_java.cmake b/build/scripts/gather_swig_java.cmake
deleted file mode 100644
index fa0acf42c1..0000000000
--- a/build/scripts/gather_swig_java.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-file(GLOB JAVA_FILES ${JAVA_SRC_DIR}/*.java)
-list(JOIN JAVA_FILES "\n" JAVA_LST_CONTENT)
-file(WRITE ${JAVA_LST} ${JAVA_LST_CONTENT})
diff --git a/build/scripts/generate_vcs_info.py b/build/scripts/generate_vcs_info.py
deleted file mode 100644
index 6360e01de2..0000000000
--- a/build/scripts/generate_vcs_info.py
+++ /dev/null
@@ -1,319 +0,0 @@
-# coding: utf-8
-import json
-import locale
-import re
-import os
-import subprocess
-import sys
-import time
-
-
-INDENT = " " * 4
-
-
-def _get_vcs_dictionary(vcs_type, *arg):
- if vcs_type == 'git':
- return _GitVersion.parse(*arg)
- else:
- raise Exception("Unknown VCS type {}".format(str(vcs_type)))
-
-
-def _get_user_locale():
- try:
- return [locale.getencoding()]
- except Exception:
- return []
-
-
-class _GitVersion:
- @classmethod
- def parse(cls, commit_hash, author_info, summary_info, body_info, tag_info, branch_info, depth=None):
- r"""Parses output of
- git rev-parse HEAD
- git log -1 --format='format:%an <%ae>'
- git log -1 --format='format:%s'
- git log -1 --grep='^git-svn-id: ' --format='format:%b' or
- git log -1 --grep='^Revision: r?\d*' --format='format:%b
- git describe --exact-match --tags HEAD
- git describe --exact-match --all HEAD
- and depth as computed by _get_git_depth
- '"""
-
- info = {}
- info['hash'] = commit_hash
- info['commit_author'] = _SystemInfo._to_text(author_info)
- info['summary'] = _SystemInfo._to_text(summary_info)
-
- if 'svn_commit_revision' not in info:
- url = re.search("git?-svn?-id: (.*)@(\\d*).*", body_info)
- if url:
- info['svn_url'] = url.group(1)
- info['svn_commit_revision'] = int(url.group(2))
-
- if 'svn_commit_revision' not in info:
- rev = re.search('Revision: r?(\\d*).*', body_info)
- if rev:
- info['svn_commit_revision'] = int(rev.group(1))
-
- info['tag'] = tag_info
- info['branch'] = branch_info
- info['scm_text'] = cls._format_scm_data(info)
- info['vcs'] = 'git'
-
- if depth:
- info['patch_number'] = int(depth)
- return info
-
- @staticmethod
- def _format_scm_data(info):
- scm_data = "Git info:\n"
- scm_data += INDENT + "Commit: " + info['hash'] + "\n"
- scm_data += INDENT + "Branch: " + info['branch'] + "\n"
- scm_data += INDENT + "Author: " + info['commit_author'] + "\n"
- scm_data += INDENT + "Summary: " + info['summary'] + "\n"
- if 'svn_commit_revision' in info or 'svn_url' in info:
- scm_data += INDENT + "git-svn info:\n"
- if 'svn_url' in info:
- scm_data += INDENT + "URL: " + info['svn_url'] + "\n"
- if 'svn_commit_revision' in info:
- scm_data += INDENT + "Last Changed Rev: " + str(info['svn_commit_revision']) + "\n"
- return scm_data
-
- @staticmethod
- def external_data(arc_root):
- env = os.environ.copy()
- env['TZ'] = ''
-
- hash_args = ['rev-parse', 'HEAD']
- author_args = ['log', '-1', '--format=format:%an <%ae>']
- summary_args = ['log', '-1', '--format=format:%s']
- svn_args = ['log', '-1', '--grep=^git-svn-id: ', '--format=format:%b']
- svn_args_alt = ['log', '-1', '--grep=^Revision: r\\?\\d*', '--format=format:%b']
- tag_args = ['describe', '--exact-match', '--tags', 'HEAD']
- branch_args = ['describe', '--exact-match', '--all', 'HEAD']
-
- # using local 'Popen' wrapper
- commit = _SystemInfo._system_command_call(['git'] + hash_args, env=env, cwd=arc_root).rstrip()
- author = _SystemInfo._system_command_call(['git'] + author_args, env=env, cwd=arc_root)
- commit = _SystemInfo._system_command_call(['git'] + hash_args, env=env, cwd=arc_root).rstrip()
- author = _SystemInfo._system_command_call(['git'] + author_args, env=env, cwd=arc_root)
- summary = _SystemInfo._system_command_call(['git'] + summary_args, env=env, cwd=arc_root)
- svn_id = _SystemInfo._system_command_call(['git'] + svn_args, env=env, cwd=arc_root)
- if not svn_id:
- svn_id = _SystemInfo._system_command_call(['git'] + svn_args_alt, env=env, cwd=arc_root)
-
- try:
- tag_info = _SystemInfo._system_command_call(['git'] + tag_args, env=env, cwd=arc_root).splitlines()
- except Exception:
- tag_info = [''.encode('utf-8')]
-
- try:
- branch_info = _SystemInfo._system_command_call(['git'] + branch_args, env=env, cwd=arc_root).splitlines()
- except Exception:
- branch_info = [''.encode('utf-8')]
-
- depth = str(_GitVersion._get_git_depth(env, arc_root)).encode('utf-8')
-
- # logger.debug('Git info commit:{}, author:{}, summary:{}, svn_id:{}'.format(commit, author, summary, svn_id))
- return [commit, author, summary, svn_id, tag_info[0], branch_info[0], depth]
-
- # YT's patch number.
- @staticmethod
- def _get_git_depth(env, arc_root):
- graph = {}
- full_history_args = ["log", "--full-history", "--format=%H %P", "HEAD"]
- history = _SystemInfo._system_command_call(['git'] + full_history_args, env=env, cwd=arc_root).decode('utf-8')
-
- head = None
- for line in history.splitlines():
- values = line.split()
- if values:
- if head is None:
- head = values[0]
- graph[values[0]] = values[1:]
-
- assert head
- cache = {}
- stack = [(head, None, False)]
- while stack:
- commit, child, calculated = stack.pop()
- if commit in cache:
- calculated = True
- if calculated:
- if child is not None:
- cache[child] = max(cache.get(child, 0), cache[commit] + 1)
- else:
- stack.append((commit, child, True))
- parents = graph[commit]
- if not parents:
- cache[commit] = 0
- else:
- for parent in parents:
- stack.append((parent, commit, False))
- return cache[head]
-
-
-class _SystemInfo:
- LOCALE_LIST = _get_user_locale() + [sys.getfilesystemencoding(), 'utf-8']
-
- @classmethod
- def get_locale(cls):
- import codecs
-
- for i in cls.LOCALE_LIST:
- if not i:
- continue
- try:
- codecs.lookup(i)
- return i
- except LookupError:
- continue
-
- @staticmethod
- def _to_text(s):
- if isinstance(s, bytes):
- return s.decode(_SystemInfo.get_locale(), errors='replace')
- return s
-
- @staticmethod
- def get_user():
- sys_user = os.environ.get("USER")
- if not sys_user:
- sys_user = os.environ.get("USERNAME")
- if not sys_user:
- sys_user = os.environ.get("LOGNAME")
- if not sys_user:
- sys_user = "Unknown user"
- return sys_user
-
- @staticmethod
- def get_date(stamp=None):
- # Format compatible with SVN-xml format.
- return time.strftime("%Y-%m-%dT%H:%M:%S.000000Z", time.gmtime(stamp))
-
- @staticmethod
- def get_timestamp():
- # Unix timestamp.
- return int(time.time())
-
- @staticmethod
- def get_other_data(src_dir, data_file='local.ymake'):
- other_data = "Other info:\n"
- other_data += INDENT + "Build by: " + _SystemInfo.get_user() + "\n"
- other_data += INDENT + "Top src dir: {}\n".format(src_dir)
-
- # logger.debug("Other data: %s", other_data)
-
- return other_data
-
- @staticmethod
- def _get_host_info(fake_build_info=False):
- if fake_build_info:
- host_info = '*sys localhost 1.0.0 #dummy information '
- elif not on_win():
- host_info = ' '.join(os.uname())
- else:
- host_info = _SystemInfo._system_command_call("VER") # XXX: check shell from cygwin to call VER this way!
- return INDENT + INDENT + host_info.strip() + "\n" if host_info else ""
-
- @staticmethod
- def _system_command_call(command, **kwargs):
- if isinstance(command, list):
- command = subprocess.list2cmdline(command)
- try:
- process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, **kwargs)
- stdout, stderr = process.communicate()
- if process.returncode != 0:
- # logger.debug('{}\nRunning {} failed with exit code {}\n'.format(stderr, command, process.returncode))
- raise get_svn_exception()(stdout=stdout, stderr=stderr, rc=process.returncode, cmd=[command])
- return stdout
- except OSError as e:
- msg = e.strerror
- errcodes = 'error {}'.format(e.errno)
- if on_win() and isinstance(e, WindowsError):
- errcodes += ', win-error {}'.format(e.winerror)
- try:
- import ctypes
-
- msg = str(ctypes.FormatError(e.winerror), _SystemInfo.get_locale()).encode('utf-8')
- except ImportError:
- pass
- # logger.debug('System command call {} failed [{}]: {}\n'.format(command, errcodes, msg))
- return None
-
-
-def _get_raw_data(vcs_type, vcs_root):
- lines = []
- if vcs_type == 'git':
- lines = _GitVersion.external_data(vcs_root)
-
- return [l.decode('utf-8') for l in lines]
-
-
-def _get_json(vcs_root):
- try:
- vcs_type = "git"
- info = _get_vcs_dictionary(vcs_type, *_get_raw_data(vcs_type, vcs_root))
- return info, vcs_root
- except Exception:
- return None, ""
-
-
-def _dump_json(
- arc_root,
- info,
- other_data=None,
- build_user=None,
- build_date=None,
- build_timestamp=0,
- custom_version='',
-):
- j = {}
- j['PROGRAM_VERSION'] = info['scm_text'] + "\n" + _SystemInfo._to_text(other_data)
- j['CUSTOM_VERSION'] = str(_SystemInfo._to_text(custom_version))
- j['SCM_DATA'] = info['scm_text']
- j['ARCADIA_SOURCE_PATH'] = _SystemInfo._to_text(arc_root)
- j['ARCADIA_SOURCE_URL'] = info.get('url', info.get('svn_url', ''))
- j['ARCADIA_SOURCE_REVISION'] = info.get('revision', -1)
- j['ARCADIA_SOURCE_HG_HASH'] = info.get('hash', '')
- j['ARCADIA_SOURCE_LAST_CHANGE'] = info.get('commit_revision', info.get('svn_commit_revision', -1))
- j['ARCADIA_SOURCE_LAST_AUTHOR'] = info.get('commit_author', '')
- j['ARCADIA_PATCH_NUMBER'] = info.get('patch_number', 0)
- j['BUILD_USER'] = _SystemInfo._to_text(build_user)
- j['VCS'] = info.get('vcs', '')
- j['BRANCH'] = info.get('branch', '')
- j['ARCADIA_TAG'] = info.get('tag', '')
- j['DIRTY'] = info.get('dirty', '')
-
- if 'url' in info or 'svn_url' in info:
- j['SVN_REVISION'] = info.get('svn_commit_revision', info.get('revision', -1))
- j['SVN_ARCROOT'] = info.get('url', info.get('svn_url', ''))
- j['SVN_TIME'] = info.get('commit_date', info.get('svn_commit_date', ''))
-
- j['BUILD_DATE'] = build_date
- j['BUILD_TIMESTAMP'] = build_timestamp
-
- return json.dumps(j, sort_keys=True, indent=4, separators=(',', ': '))
-
-
-def get_version_info(arc_root, custom_version=""):
- info, vcs_root = _get_json(arc_root)
- if info is None:
- return ""
-
- return _dump_json(
- vcs_root,
- info,
- other_data=_SystemInfo.get_other_data(
- src_dir=vcs_root,
- ),
- build_user=_SystemInfo.get_user(),
- build_date=_SystemInfo.get_date(None),
- build_timestamp=_SystemInfo.get_timestamp(),
- custom_version=custom_version,
- )
-
-
-if __name__ == '__main__':
- with open(sys.argv[1], 'wt', encoding="utf-8") as f:
- f.write(get_version_info(sys.argv[2]))
diff --git a/build/scripts/re_replace.py b/build/scripts/re_replace.py
deleted file mode 100644
index 3a882c41d2..0000000000
--- a/build/scripts/re_replace.py
+++ /dev/null
@@ -1,47 +0,0 @@
-import sys
-from typing import List
-import argparse
-import re
-
-# Usage: re_replace.py --from-re <REGEXP> --to-re <REGEXP_REPLACE> FILE [FILE ...]
-
-
-def patch_line(line: str, from_re: re.Pattern, to_re: str) -> str:
- return re.sub(from_re, to_re, line)
-
-
-def main(args: List[str]):
- argparser = argparse.ArgumentParser(allow_abbrev=False)
- argparser.add_argument('--from-re', required=True)
- argparser.add_argument('--to-re', required=True)
- parsed_args, files = argparser.parse_known_args(args=args)
- from_re = re.compile(parsed_args.from_re)
- if not files:
- raise Exception('No input files')
-
- patched_files = []
- skipped_files = []
- for file in files:
- patched = False
- with open(file, 'rt', encoding="utf-8") as f:
- lines = f.readlines()
- for i in range(len(lines)):
- line = lines[i]
- patched_line = patch_line(line, from_re, parsed_args.to_re)
- if patched_line != line:
- patched = True
- lines[i] = patched_line
- if patched:
- with open(file, 'wt', encoding="utf-8") as f:
- f.writelines(lines)
- patched_files.append(file)
- else:
- skipped_files.append(file)
- if patched_files:
- print("Patched by re_replace: " + ", ".join(patched_files))
- if skipped_files:
- print("Skipped by re_replace: " + ", ".join(skipped_files))
-
-
-if __name__ == '__main__':
- main(sys.argv[1:])
diff --git a/build/scripts/split_unittest.py b/build/scripts/split_unittest.py
deleted file mode 100644
index 7214c70fdc..0000000000
--- a/build/scripts/split_unittest.py
+++ /dev/null
@@ -1,84 +0,0 @@
-import argparse
-import os
-import tempfile
-import shlex
-import subprocess
-
-
-def parse_args():
- parser = argparse.ArgumentParser()
- parser.add_argument("--split-factor", type=int, default=0)
- parser.add_argument("--shard", type=int, default=0)
- parser.add_argument("--fork-mode", type=str, default="SEQUENTIAL")
- parser.add_argument("command", nargs=argparse.REMAINDER)
- return parser.parse_args()
-
-
-def get_sequential_chunk(tests, modulo, modulo_index):
- chunk_size = len(tests) // modulo
- not_used = len(tests) % modulo
- shift = chunk_size + (modulo_index < not_used)
- start = chunk_size * modulo_index + min(modulo_index, not_used)
- end = start + shift
- return [] if end > len(tests) else tests[start:end]
-
-
-def get_shuffled_chunk(tests, modulo, modulo_index):
- result_tests = []
- for i, test in enumerate(tests):
- if i % modulo == modulo_index:
- result_tests.append(test)
- return result_tests
-
-
-def list_tests(binary):
- # can't use NamedTemporaryFile or mkstemp because of child process access issues on Windows
- # https://stackoverflow.com/questions/66744497/python-tempfile-namedtemporaryfile-cant-use-generated-tempfile
- with tempfile.TemporaryDirectory() as tmp_dir:
- list_file = os.path.join(tmp_dir, 'list')
- cmd = [binary, "--list-verbose", "--list-path", list_file]
- subprocess.check_call(cmd)
-
- with open(list_file) as afile:
- lines = afile.read().strip().split("\n")
- lines = [x.strip() for x in lines]
- return [x for x in lines if x]
-
-
-def get_shard_tests(args):
- test_names = list_tests(args.command[0])
- test_names = sorted(test_names)
-
- if args.fork_mode == "MODULO":
- return get_shuffled_chunk(test_names, args.split_factor, args.shard)
- elif args.fork_mode == "SEQUENTIAL":
- return get_sequential_chunk(test_names, args.split_factor, args.shard)
- else:
- raise ValueError("detected unknown partition mode: {}".format(args.fork_mode))
-
-
-def get_shard_cmd_args(args):
- return ["+{}".format(x) for x in get_shard_tests(args)]
-
-
-def main():
- args = parse_args()
-
- if args.split_factor:
- shard_cmd = get_shard_cmd_args(args)
- if shard_cmd:
- cmd = args.command + shard_cmd
- else:
- print("No tests for {} shard".format(args.shard))
- return 0
- else:
- cmd = args.command
-
- rc = subprocess.call(cmd)
- if rc:
- print("Some tests failed. To reproduce run: {}".format(shlex.join(cmd)))
- return rc
-
-
-if __name__ == "__main__":
- exit(main())