diff --git a/swift/utils/swift_build_support/swift_build_support/products/cmark.py b/swift/utils/swift_build_support/swift_build_support/products/cmark.py index b11313fab87..fe2e8982300 100644 --- a/swift/utils/swift_build_support/swift_build_support/products/cmark.py +++ b/swift/utils/swift_build_support/swift_build_support/products/cmark.py @@ -12,6 +12,9 @@ from . import cmake_product from . import earlyswiftdriver +from ..host_specific_configuration \ + import HostSpecificConfiguration +import os class CMark(cmake_product.CMakeProduct): @@ -68,6 +70,13 @@ class CMark(cmake_product.CMakeProduct): toolchain_file = self.generate_linux_toolchain_file(platform, arch) self.cmake_options.define('CMAKE_TOOLCHAIN_FILE:PATH', toolchain_file) + host_config = HostSpecificConfiguration(host_target, self.args) + self.cmake_options.extend(host_config.cmake_options) + + if 'ANDROID_DATA' not in os.environ: + self.cmake_options.define('CMAKE_C_FLAGS', '%s --target=%s %s' % (os.environ.get('CFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS'))) + self.cmake_options.define('CMAKE_CXX_FLAGS', '%s --target=%s %s' % (os.environ.get('CXXFLAGS'), os.environ.get('CCTERMUX_HOST_PLATFORM'), os.environ.get('CPPFLAGS'))) + self.build_with_cmake(["all"], self.args.cmark_build_variant, []) def should_test(self, host_target): diff --git a/swift/utils/swift_build_support/swift_build_support/products/llvm.py b/swift/utils/swift_build_support/swift_build_support/products/llvm.py index 744dca10fca..7b5932882f2 100644 --- a/swift/utils/swift_build_support/swift_build_support/products/llvm.py +++ b/swift/utils/swift_build_support/swift_build_support/products/llvm.py @@ -340,6 +340,12 @@ class LLVM(cmake_product.CMakeProduct): llvm_cmake_options.define('CLANG_TABLEGEN', clang_tblgen) llvm = os.path.join(host_build_dir, 'llvm') llvm_cmake_options.define('LLVM_NATIVE_BUILD', llvm) + llvm_cmake_options.define('CMAKE_CXX_FLAGS', '{} --target={} {}'.format(os.environ['CXXFLAGS'], os.environ['CCTERMUX_HOST_PLATFORM'], os.environ['CPPFLAGS'])) + llvm_cmake_options.define('CMAKE_EXE_LINKER_FLAGS', '{} --target={}'.format(os.environ['LDFLAGS'], os.environ['CCTERMUX_HOST_PLATFORM'])) + llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH:PATH', self.args.cross_compile_deps_path) + llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH_MODE_PROGRAM', 'NEVER') + llvm_cmake_options.define('CMAKE_FIND_ROOT_PATH_MODE_LIBRARY', 'ONLY') + host_config = HostSpecificConfiguration(host_target, self.args)