def test_deployment_target_flag_name(self): self.assertEqual(tools.apple_deployment_target_flag('Macos', "10.1"), '-mmacosx-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('iOS', "10.1"), '-mios-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('watchOS', "10.1"), '-mwatchos-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('tvOS', "10.1"), '-mappletvos-version-min=10.1') self.assertEqual('', tools.apple_deployment_target_flag('Solaris', "10.1"))
def _get_vars(self): def append(*args): ret = [] for arg in args: if arg: if isinstance(arg, list): ret.extend(arg) else: ret.append(arg) return ret lib_paths = format_library_paths(self.library_paths, self._conanfile.settings, win_bash=self._win_bash, subsystem=self.subsystem) include_paths = format_include_paths(self.include_paths, self._conanfile.settings, win_bash=self._win_bash, subsystem=self.subsystem) ld_flags = append(self.link_flags, lib_paths) cpp_flags = append(include_paths, format_defines(self.defines)) libs = format_libraries(self.libs, self._conanfile.settings) tmp_compilation_flags = copy.copy(self.flags) if self.fpic: tmp_compilation_flags.append(pic_flag(self._conanfile.settings)) if tools.is_apple_os(self._os): concat = " ".join(tmp_compilation_flags) if os.environ.get("CFLAGS", None): concat += " " + os.environ.get("CFLAGS", None) if os.environ.get("CXXFLAGS", None): concat += " " + os.environ.get("CXXFLAGS", None) if (self._os_version and "-version-min" not in concat and "-target" not in concat) or \ self._os_subsystem: tmp_compilation_flags.append( tools.apple_deployment_target_flag(self._os, self._os_version, self._os_sdk, self._os_subsystem, self._arch)) if "-isysroot" not in concat and platform.system() == "Darwin": isysroot = tools.XCRun(self._conanfile.settings).sdk_path if isysroot: tmp_compilation_flags.extend(["-isysroot", isysroot]) if "-arch" not in concat and self._arch: apple_arch = tools.to_apple_arch(self._arch) if apple_arch: tmp_compilation_flags.extend(["-arch", apple_arch]) cxx_flags = append(tmp_compilation_flags, self.cxx_flags, self.cppstd_flag) c_flags = tmp_compilation_flags return ld_flags, cpp_flags, libs, cxx_flags, c_flags
def _get_vars(self): def append(*args): ret = [] for arg in args: if arg: if isinstance(arg, list): ret.extend(arg) else: ret.append(arg) return ret lib_paths = format_library_paths(self.library_paths, self._conanfile.settings, win_bash=self._win_bash, subsystem=self.subsystem) include_paths = format_include_paths(self.include_paths, self._conanfile.settings, win_bash=self._win_bash, subsystem=self.subsystem) ld_flags = append(self.link_flags, lib_paths) cpp_flags = append(include_paths, format_defines(self.defines)) libs = format_libraries(self.libs, self._conanfile.settings) tmp_compilation_flags = copy.copy(self.flags) if self.fpic: tmp_compilation_flags.append(pic_flag(self._conanfile.settings)) if tools.is_apple_os(self._os): concat = " ".join(tmp_compilation_flags) if os.environ.get("CFLAGS", None): concat += " " + os.environ.get("CFLAGS", None) if os.environ.get("CXXFLAGS", None): concat += " " + os.environ.get("CXXFLAGS", None) if self._os_version and "-version-min" not in concat and "-target" not in concat: tmp_compilation_flags.append( tools.apple_deployment_target_flag(self._os, self._os_version)) cxx_flags = append(tmp_compilation_flags, self.cxx_flags, self.cppstd_flag) c_flags = tmp_compilation_flags return ld_flags, cpp_flags, libs, cxx_flags, c_flags
def test_deployment_target_flag_name(self): self.assertEqual(tools.apple_deployment_target_flag('Macos', "10.1"), '-mmacosx-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('Macos', "10.1", 'macosx'), '-mmacosx-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('iOS', "10.1"), '-mios-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('iOS', "10.1", 'iphoneos'), '-mios-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('iOS', "10.1", 'iphonesimulator'), '-mios-simulator-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('watchOS', "10.1"), '-mwatchos-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('watchOS', "10.1", 'watchos'), '-mwatchos-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('watchOS', "10.1", 'watchsimulator'), '-mwatchos-simulator-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('tvOS', "10.1"), '-mtvos-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('tvOS', "10.1", 'appletvos'), '-mtvos-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag('tvOS', "10.1", 'appletvsimulator'), '-mtvos-simulator-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag("Macos", "10.1", None, "catalyst"), '-mios-version-min=10.1') self.assertEqual(tools.apple_deployment_target_flag("Macos", "10.1", "macosx", "catalyst"), '-mios-version-min=10.1') self.assertEqual('', tools.apple_deployment_target_flag('Solaris', "10.1"))