Ejemplo n.º 1
0
    def diamond_mingw_test(self):
        use_cmake = cmake_targets = False
        self._export("Hello0", "0.1", use_cmake=use_cmake, cmake_targets=cmake_targets)
        self._export("Hello1", "0.1", ["Hello0/0.1@lasote/stable"], use_cmake=use_cmake,
                     cmake_targets=cmake_targets)
        self._export("Hello2", "0.1", ["Hello0/0.1@lasote/stable"], use_cmake=use_cmake,
                     cmake_targets=cmake_targets)
        self._export("Hello3", "0.1", ["Hello1/0.1@lasote/stable", "Hello2/0.1@lasote/stable"],
                     use_cmake=use_cmake, cmake_targets=cmake_targets)

        files3 = cpp_hello_conan_files("Hello4", "0.1", ["Hello3/0.1@lasote/stable"],
                                       language=1, use_cmake=use_cmake,
                                       cmake_targets=cmake_targets)

        self.client.save(files3)

        with tools.remove_from_path("bash.exe"):
            with mingw_in_path():
                not_env = os.system("g++ --version > nul")
                if not_env != 0:
                    raise Exception("This platform does not support G++ command")
                install = "install %s -s compiler=gcc -s compiler.libcxx=libstdc++ " \
                          "-s compiler.version=4.9" % path_dot()

                self.client.run("install %s -s compiler=gcc -s compiler.libcxx=libstdc++ " 
                                "-s compiler.version=4.9 --build=missing" % path_dot())
                self.client.run("build .")
                
                command = os.sep.join([".", "bin", "say_hello"])
                self.client.run_command(command)
                self.assertEqual(['Hola Hello4', 'Hola Hello3', 'Hola Hello1', 'Hola Hello0',
                                'Hola Hello2', 'Hola Hello0'],
                                str(self.client.out).splitlines()[-6:])
Ejemplo n.º 2
0
 def build_mingw_test(self):
     with tools.remove_from_path("bash.exe"):
         with mingw_in_path():
             not_env = os.system("c++ --version > nul")
             if not_env != 0:
                 raise Exception("This platform does not support G++ command")
             install = "install %s -s compiler=gcc -s compiler.libcxx=libstdc++ " \
                       "-s compiler.version=4.9" % path_dot()
             for cmd, lang, static, pure_c in [(install, 0, True, True),
                                               (install + " -o language=1 -o static=False", 1, False, False)]:
                 from conans.test.functional.basic_build_test import build
                 build(self, cmd, static, pure_c, use_cmake=False, lang=lang)
Ejemplo n.º 3
0
    def test_base(self):
        with mingw_in_path():
            client = TestClient(path_with_spaces=False)
            self._export(client, "LIB_C", [])
            self._export(client, "LIB_B", ["LIB_C"])
            self._export(client, "LIB_B2", [])
            self._export(client, "LIB_A", ["LIB_B", "LIB_B2"])

            consumer = textwrap.dedent("""
                from conans import ConanFile, Meson

                class ConanFileToolsTest(ConanFile):
                    generators = "pkg_config"
                    requires = "LIB_A/0.1@conan/stable"
                    settings = "os", "compiler", "build_type"

                    def build(self):
                        meson = Meson(self)
                        meson.configure()
                        meson.build()
                """)
            meson_build = textwrap.dedent("""
                project('conan_hello', 'c')
                liba = dependency('LIB_A', version : '>=0')
                executable('demo', 'main.c', dependencies: [liba])
                """)

            main_c = textwrap.dedent("""
                #include "helloLIB_A.h"
                int main(){
                helloLIB_A();
                }
                """)

            client.save(
                {
                    CONANFILE: consumer,
                    "meson.build": meson_build,
                    "main.c": main_c
                },
                clean_first=True)
            mkdir(os.path.join(client.current_folder, "build"))
            client.current_folder = os.path.join(client.current_folder,
                                                 "build")
            client.run("install .. --build")

            client.run("build .. --source-folder ..")
            command = "demo" if platform.system() == "Windows" else "./demo"
            client.run_command(command)
            self.assertEqual(
                ['Hello LIB_A', 'Hello LIB_B', 'Hello LIB_C', 'Hello LIB_B2'],
                str(client.out).splitlines()[-4:])