Пример #1
0
    def _get_conanfile(settings, frameworks=False, system_libs=False):
        conan_file = ConanFileMock()
        conan_file.settings = settings
        conan_file.source_folder = "my_cache_source_folder"
        conan_file.build_folder = "my_cache_build_folder"
        conan_file.deps_env_info = DepsEnvInfo()
        conan_file.deps_user_info = DepsUserInfo()
        conan_file.deps_cpp_info = DepsCppInfo()

        cpp_info = CppInfo("zlib", "/root")
        cpp_info.includedirs.append("path/to/include1")
        cpp_info.libdirs.append("path/to/lib1")
        cpp_info.libs.append("mylib")
        cpp_info.bindirs = "path/to/bin1"
        cpp_info.cflags.append("c_flag1")
        cpp_info.cxxflags.append("cxx_flag1")
        cpp_info.defines.append("mydefine1")
        if system_libs:
            cpp_info.system_libs.append("system_lib1")
        if frameworks:
            cpp_info.frameworks = ["AVFoundation", "VideoToolbox"]
            cpp_info.frameworkdirs.extend(
                ['path/to/Frameworks1', 'path/to/Frameworks2'])
        cpp_info.filter_empty = False
        conan_file.deps_cpp_info.add("zlib", cpp_info)

        conan_file.env_info = EnvInfo()
        return conan_file
Пример #2
0
    def test_visual_studio_extensions(self):
        settings = Settings.loads(get_default_settings_yml())
        settings.os = "Windows"
        settings.compiler = "Visual Studio"
        settings.compiler.version = "15"
        settings.arch = "x86"
        settings.build_type = "Release"

        conan_file = ConanFileMock()
        conan_file.settings = settings
        conan_file.deps_env_info = DepsEnvInfo()
        conan_file.deps_user_info = DepsUserInfo()
        conan_file.deps_cpp_info = DepsCppInfo()
        cpp_info = CppInfo("zlib", "/root")
        cpp_info.libs.append("mylib")
        cpp_info.libs.append("other.lib")
        conan_file.deps_cpp_info.add("zlib", cpp_info)
        conan_file.env_info = EnvInfo()

        gen = CompilerArgsGenerator(conan_file)
        self.assertEqual('-O2 -Ob2 -DNDEBUG -link mylib.lib other.lib',
                         gen.content)