def test_pic_flags(self): flag = pic_flag() self.assertEquals(flag, '') flags = pic_flag(compiler='gcc') self.assertEquals(flags, '-fPIC') flags = pic_flag(compiler='Visual Studio') self.assertEquals(flags, "")
def test_pic_flags(self): flag = pic_flag() self.assertEquals(flag, '') flags = pic_flag(compiler='gcc') self.assertEquals(flags, '-fPIC') flags = pic_flag(compiler='Visual Studio') self.assertEquals(flags, "")
def test_pic_flags(self): flag = pic_flag(MockSettings({})) self.assertEqual(flag, '') flags = pic_flag(MockSettings({"compiler": 'gcc'})) self.assertEqual(flags, '-fPIC') flags = pic_flag(MockSettings({"compiler": 'Visual Studio'})) self.assertEqual(flags, "") flags = pic_flag(MockSettings({"compiler": 'intel', "compiler.base": "gcc"})) self.assertEqual(flags, '-fPIC') flags = pic_flag(MockSettings({"compiler": 'intel', "compiler.base": "Visual Studio"})) self.assertEqual(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, win_bash=self._win_bash, subsystem=self.subsystem, compiler=self._compiler) include_paths = format_include_paths(self.include_paths, win_bash=self._win_bash, subsystem=self.subsystem, compiler=self._compiler) ld_flags = append(self.link_flags, lib_paths) cpp_flags = append(include_paths, format_defines(self.defines)) libs = format_libraries(self.libs, compiler=self._compiler) tmp_compilation_flags = copy.copy(self.flags) if self.fpic: tmp_compilation_flags.append(pic_flag(self._compiler)) 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, win_bash=self._win_bash, subsystem=self.subsystem, compiler=self._compiler) include_paths = format_include_paths(self.include_paths, win_bash=self._win_bash, subsystem=self.subsystem, compiler=self._compiler) ld_flags = append(self.link_flags, lib_paths) cpp_flags = append(include_paths, format_defines(self.defines)) libs = format_libraries(self.libs, compiler=self._compiler) tmp_compilation_flags = copy.copy(self.flags) if self.fpic: tmp_compilation_flags.append(pic_flag(self._compiler)) 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) 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