Пример #1
0
    def test_compiler_args(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 = self._get_conanfile(settings)
        gen = CompilerArgsGenerator(conan_file)
        self.assertEqual(
            '-Dmydefine1 -I\\root\\include -I\\root\\path\\to\\include1'
            ' cxx_flag1 c_flag1 -O2 -Ob2 -DNDEBUG -link'
            ' -LIBPATH:\\root\\lib -LIBPATH:\\root\\path\\to\\lib1 mylib.lib',
            gen.content)

        settings = Settings.loads(get_default_settings_yml())
        settings.os = "Macos"
        settings.compiler = "apple-clang"
        settings.compiler.version = "9.0"
        settings.arch = "x86"
        settings.build_type = "Release"
        conan_file = self._get_conanfile(settings)
        gen = CompilerArgsGenerator(conan_file)
        self.assertEqual(
            '-Dmydefine1 -I/root/include -I/root/path/to/include1'
            ' cxx_flag1 c_flag1 -m32 -O3 -DNDEBUG'
            ' -Wl,-rpath,"/root/lib" -Wl,-rpath,"/root/path/to/lib1"'
            ' -L/root/lib -L/root/path/to/lib1 -lmylib'
            ' -F /root/Frameworks', gen.content)

        settings = Settings.loads(get_default_settings_yml())
        settings.os = "Linux"
        settings.os_build = "Macos"
        settings.compiler = "apple-clang"
        settings.compiler.version = "9.0"
        settings.arch = "x86"
        settings.build_type = "Release"

        conan_file = self._get_conanfile(settings)
        args = CompilerArgsGenerator(conan_file)
        self.assertEqual(
            '-Dmydefine1 -I/root/include -I/root/path/to/include1'
            ' cxx_flag1 c_flag1 -m32 -O3 -DNDEBUG'
            ' -Wl,-rpath,"/root/lib" -Wl,-rpath,"/root/path/to/lib1"'
            ' -L/root/lib -L/root/path/to/lib1 -lmylib'
            ' -F /root/Frameworks', args.content)
Пример #2
0
    def compiler_args_test(self):
        settings = Settings.loads(default_settings_yml)
        settings.os = "Windows"
        settings.compiler = "Visual Studio"
        settings.compiler.version = "15"
        settings.arch = "x86"
        settings.build_type = "Release"

        conan_file = self._get_conanfile(settings)
        gen = CompilerArgsGenerator(conan_file)
        self.assertEquals(
            '-Dmydefine1 -Ipath\\to\\include1 cxx_flag1 c_flag1 -DNDEBUG '
            '-link -LIBPATH:path\\to\\lib1 mylib.lib', gen.content)

        settings = Settings.loads(default_settings_yml)
        settings.os = "Macos"
        settings.compiler = "apple-clang"
        settings.compiler.version = "9.0"
        settings.arch = "x86"
        settings.build_type = "Release"
        conan_file = self._get_conanfile(settings)
        gen = CompilerArgsGenerator(conan_file)
        self.assertEquals(
            '-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -DNDEBUG '
            '-Wl,-rpath,"path/to/lib1" -Lpath/to/lib1 -lmylib', gen.content)

        settings = Settings.loads(default_settings_yml)
        settings.os = "Linux"
        settings.os_build = "Macos"
        settings.compiler = "apple-clang"
        settings.compiler.version = "9.0"
        settings.arch = "x86"
        settings.build_type = "Release"

        conan_file = self._get_conanfile(settings)
        args = CompilerArgsGenerator(conan_file)
        self.assertEquals(
            '-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -DNDEBUG '
            '-Wl,-rpath,"path/to/lib1" '
            '-Lpath/to/lib1 -lmylib', args.content)
Пример #3
0
    def system_libs_test(self):
        settings = Settings.loads(get_default_settings_yml())
        settings.os = "Linux"
        settings.compiler = "gcc"
        settings.compiler.version = "8"
        settings.arch = "x86_64"
        settings.build_type = "Release"

        conan_file = self._get_conanfile(settings, system_libs=True)
        args = CompilerArgsGenerator(conan_file)
        self.assertEqual('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m64 -O3 -s -DNDEBUG '
                         '-Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib -lsystem_lib1',
                         args.content)
Пример #4
0
    def apple_frameworks_test(self):
        settings = Settings.loads(get_default_settings_yml())
        settings.os = "Macos"
        settings.compiler = "apple-clang"
        settings.compiler.version = "9.1"
        settings.arch = "x86_64"
        settings.build_type = "Release"

        conan_file = self._get_conanfile(settings, frameworks=True)
        args = CompilerArgsGenerator(conan_file)
        self.assertEqual('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m64 -O3 -DNDEBUG '
                         '-Wl,-rpath,"path/to/lib1" -Lpath/to/lib1 -lmylib '
                         '-framework AVFoundation -framework VideoToolbox '
                         '-F path/to/Frameworks1 -F path/to/Frameworks2', args.content)
Пример #5
0
    def visual_studio_extensions_test(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("/root")
        cpp_info.libs.append("mylib")
        cpp_info.libs.append("other.lib")
        conan_file.deps_cpp_info.update(cpp_info, "zlib")
        conan_file.env_info = EnvInfo()

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