Exemple #1
0
    def build_vs(self):
        runtime_library = {
            'MT': 'MultiThreaded',
            'MTd': 'MultiThreadedDebug',
            'MD': 'MultiThreadedDLL',
            'MDd': 'MultiThreadedDebugDLL'
        }.get(str(self.settings.compiler.runtime))
        if self.options.shared:
            build_type = 'DynDebug' if self.settings.build_type == 'Debug' else 'DynRelease'
        else:
            build_type = 'StaticDebug' if self.settings.build_type == 'Debug' else 'StaticRelease'

        cmd = tools.msvc_build_command(self.settings,
                                       "libsodium.sln",
                                       upgrade_project=False,
                                       build_type=build_type)
        msvc = {
            '10': 'vs2010',
            '11': 'vs2012',
            '12': 'vs2013',
            '14': 'vs2015',
            '15': 'vs2017'
        }.get(str(self.settings.compiler.version))
        with tools.chdir(os.path.join('sources', 'builds', 'msvc', msvc)):
            runtime = '<ClCompile><RuntimeLibrary>%s</RuntimeLibrary>' % runtime_library
            tools.replace_in_file(os.path.join('libsodium', 'libsodium.props'),
                                  '<ClCompile>', runtime)
            if self.settings.arch == "x86":
                cmd = cmd.replace("x86", "Win32")
            # skip unit tests
            cmd += " /p:PostBuildEventUseInBuild=false"
            self.run(cmd)
Exemple #2
0
    def build(self):
        sln_path = os.path.join("wpcap", "libpcap", "Win32", "Prj")
        sln_file = os.path.join(sln_path, "wpcap.sln")
        proj_file = os.path.join(sln_path, "wpcap.vcxproj")

        unzip_dir = "{0}".format(self.lib_parent_name)
        sln_path_full = os.path.join(unzip_dir, sln_file)
        proj_path_full = os.path.join(unzip_dir, proj_file)
        npcap_dep = self.deps_cpp_info["npcap-dll"]
        npcap_lib_file = os.path.join(npcap_dep.rootpath, npcap_dep.libdirs[0],
                                      "Packet.lib")
        tools.replace_in_file(
            proj_path_full,
            r'..\..\..\..\packetWin7\Dll\Project\Release No NetMon and AirPcap\Packet.lib',
            npcap_lib_file)
        tools.replace_in_file(
            proj_path_full,
            r'..\..\..\..\packetWin7\Dll\Project\x64\Release No NetMon and AirPcap\Packet.lib',
            npcap_lib_file)
        build_command = tools.msvc_build_command(self.settings,
                                                 sln_path_full,
                                                 targets=["Build"],
                                                 upgrade_project=False)

        if self.settings.arch == "x86":
            self.run(build_command.replace('"x86"', '"Win32"'))
        else:
            self.run(build_command)
Exemple #3
0
    def build_vs(self):
        with tools.chdir(
                os.path.join(self.source_subfolder, 'visual', 'VS2010')):
            target = 'liblz4-dll' if self.options.shared else 'liblz4'

            if self.settings.compiler.runtime == 'MD':
                runtime = 'MultiThreadedDLL'
            elif self.settings.compiler.runtime == 'MDd':
                runtime = 'MultiThreadedDebugDLL'
            elif self.settings.compiler.runtime == 'MT':
                runtime = 'MultiThreaded'
            elif self.settings.compiler.runtime == 'MTd':
                runtime = 'MultiThreadedDebug'

            proj_path = os.path.join(target, '%s.vcxproj' % target)
            tools.replace_in_file(
                proj_path,
                search='</ClCompile>',
                replace='<RuntimeLibrary>%s</RuntimeLibrary></ClCompile>' %
                runtime)

            sln_path = os.path.join(os.getcwd(), 'lz4.sln')
            print("sln_path")
            print(sln_path)
            command = tools.msvc_build_command(self.settings,
                                               sln_path,
                                               targets=[target])
            if self.settings.arch == 'x86':
                command = command.replace('/p:Platform="x86"',
                                          '/p:Platform="Win32"')
            self.run(command)
Exemple #4
0
 def build(self):
     vcvars = tools.vcvars_command(self.settings)
     self.run(vcvars)
     unzip_dir = "{0}-{1}".format(self.lib_parent_name, self.version)
     sln_path_full = os.path.join(unzip_dir, self.sln_path)
     build_command = tools.msvc_build_command(self.settings, sln_path_full,  targets=["Build"])
     final_build_command = build_command.replace("Release", '"{0}"'.format(str(self.options.configuration)))
     self.run(final_build_command)
    def build(self):
        unzip_dir = "{0}-{1}".format(self.lib_parent_name, self.version)
        sln_path_full = os.path.join(unzip_dir, self.sln_path)
        build_command = tools.msvc_build_command(
            self.settings,
            sln_path_full,
            build_type=str('"' + str(self.options.configuration) + '"'))

        if self.settings.arch == "x86":
            self.run(build_command.replace('"x86"', '"Win32"'))
        else:
            self.run(build_command)
Exemple #6
0
    def msvc_build_command_test(self):
        if platform.system() != "Windows":
            return
        settings = Settings.loads(default_settings_yml)
        settings.os = "Windows"
        settings.compiler = "Visual Studio"
        settings.compiler.version = "14"
        # test build_type and arch override, for multi-config packages
        cmd = tools.msvc_build_command(settings,
                                       "project.sln",
                                       build_type="Debug",
                                       arch="x86")
        self.assertIn(
            'msbuild project.sln /p:Configuration=Debug /p:Platform="x86"',
            cmd)
        self.assertIn('vcvarsall.bat', cmd)

        # tests errors if args not defined
        with self.assertRaisesRegexp(ConanException,
                                     "Cannot build_sln_command"):
            tools.msvc_build_command(settings, "project.sln")
        settings.arch = "x86"
        with self.assertRaisesRegexp(ConanException,
                                     "Cannot build_sln_command"):
            tools.msvc_build_command(settings, "project.sln")

        # succesful definition via settings
        settings.build_type = "Debug"
        cmd = tools.msvc_build_command(settings, "project.sln")
        self.assertIn(
            'msbuild project.sln /p:Configuration=Debug /p:Platform="x86"',
            cmd)
        self.assertIn('vcvarsall.bat', cmd)
Exemple #7
0
 def build(self):
     if self.settings.os == "Windows":
         sln = os.path.join(self.archive_name, "visual", "vs2010",
                            "lz4.sln")
         if self.options.shared:
             target = "liblz4-dll"
         else:
             target = "liblz4"
         vcvars_cmd = tools.vcvars_command(self.settings)
         build_cmd = tools.msvc_build_command(self.settings,
                                              sln_path=sln,
                                              targets=[target])
         build_cmd = build_cmd.replace('"x86"', '"Win32"')
         self.run("{0} && {1}".format(vcvars_cmd, build_cmd))
Exemple #8
0
 def build_msvc(self):
     # windows\INSTALL-MSVC.txt
     with tools.chdir(os.path.join(self.root, 'windows')):
         target = 'liblzma_dll' if self.options.shared else 'liblzma'
         if str(self.settings.compiler.runtime).startswith('MT'):
             tools.replace_in_file('%s.vcxproj' % target,
                                   '<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>',
                                   '<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>')
             tools.replace_in_file('%s.vcxproj' % target,
                                   '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>',
                                   '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>')
         command = tools.msvc_build_command(self.settings, 'xz_win.sln', targets=[target], upgrade_project=False)
         if self.settings.arch == 'x86':
             command = command.replace('/p:Platform="x86"', '/p:Platform="Win32"')
         self.run(command)
Exemple #9
0
    def build_vs(self):
        vs_version = int(str(self.settings.compiler.version))
        toolset = None
        if vs_version == 9:
            folder = 'vs2008'
        elif vs_version == 10:
            folder = 'vs2010'
        elif vs_version == 11:
            folder = 'vs2012'
        elif vs_version == 12:
            folder = 'vs2013'
        elif vs_version == 14:
            folder = 'vs2015'
        elif vs_version > 14:
            folder = 'vs2015'
            toolset = 'v141'
        runtime_library = {
            'MT': 'MultiThreaded',
            'MTd': 'MultiThreadedDebug',
            'MD': 'MultiThreadedDLL',
            'MDd': 'MultiThreadedDebugDLL'
        }.get(str(self.settings.compiler.runtime))

        libzmq_props = os.path.join('sources', 'builds', 'msvc', 'vs2015',
                                    'libzmq', 'libzmq.props')
        tools.replace_in_file(
            libzmq_props, '<ClCompile>',
            '<ClCompile><RuntimeLibrary>%s</RuntimeLibrary>' % runtime_library)

        if self.settings.build_type == 'Debug':
            config = 'DynDebug' if self.options.shared else 'StaticDebug'
        elif self.settings.build_type == 'Release':
            config = 'DynRelease' if self.options.shared else 'StaticRelease'
        with tools.chdir(os.path.join('sources', 'builds', 'msvc', folder)):
            command = tools.msvc_build_command(self.settings,
                                               'libzmq.sln',
                                               upgrade_project=False,
                                               build_type=config,
                                               targets=['libzmq'],
                                               toolset=toolset)
            if self.settings.arch == 'x86':
                command = command.replace('/p:Platform="x86"',
                                          '/p:Platform="Win32"')
            self.run(command)
Exemple #10
0
    def build(self):
        with tools.chdir(self.ZIP_FOLDER_NAME):
            files.mkdir("_build")
            with tools.chdir("_build"):
                if not tools.os_info.is_windows:
                    args = []
                    if self.options.shared:
                        args.append("--enable-shared=yes")
                        args.append("--enable-static=no")
                    else:
                        args.append("--enable-shared=no")
                        args.append("--enable-static=yes")

                    env_build = AutoToolsBuildEnvironment(self)
                    env_build.fpic = self.options.fPIC
                    env_build.configure("..", args=args)
                    env_build.make()
                else:
                    env_build = VisualStudioBuildEnvironment(self)
                    env_build.include_paths.append("../include")
                    with tools.environment_append(env_build.vars):
                        name = "libogg_{}".format(
                            "dynamic" if self.options.shared else "static")
                        target = "libogg" if self.options.shared else name
                        msbuild = tools.msvc_build_command(
                            self.settings,
                            r"..\win32\VS2015\{}.sln".format(name),
                            targets=[target],
                            arch="Win32"
                            if self.settings.arch == "x86" else "x64",
                            upgrade_project=True)
                        # TODO: msvc_build_command arch arg seems to have no effect!
                        msbuild += " /p:Platform={}".format(
                            "Win32" if self.settings.arch == "x86" else "x64")
                        command = "{vcvars} && {msbuild}".format(
                            vcvars=tools.vcvars_command(self.settings),
                            msbuild=msbuild)
                        self.run(command)
Exemple #11
0
    def msvc_build_command_test(self):
        if platform.system() != "Windows":
            return
        settings = Settings.loads(default_settings_yml)
        settings.os = "Windows"
        settings.compiler = "Visual Studio"
        settings.compiler.version = "14"
        # test build_type and arch override, for multi-config packages
        cmd = tools.msvc_build_command(settings, "project.sln", build_type="Debug", arch="x86")
        self.assertIn('msbuild project.sln /p:Configuration=Debug /p:Platform="x86"', cmd)
        self.assertIn('vcvarsall.bat', cmd)

        # tests errors if args not defined
        with self.assertRaisesRegexp(ConanException, "Cannot build_sln_command"):
            tools.msvc_build_command(settings, "project.sln")
        settings.arch = "x86"
        with self.assertRaisesRegexp(ConanException, "Cannot build_sln_command"):
            tools.msvc_build_command(settings, "project.sln")

        # succesful definition via settings
        settings.build_type = "Debug"
        cmd = tools.msvc_build_command(settings, "project.sln")
        self.assertIn('msbuild project.sln /p:Configuration=Debug /p:Platform="x86"', cmd)
        self.assertIn('vcvarsall.bat', cmd)
Exemple #12
0
 def test_msvc_build_command(self):
     with six.assertRaisesRegex(
             self, ConanV2Exception,
             "Conan v2 incompatible: 'tools.msvc_build_command' is deprecated"
     ):
         tools.msvc_build_command(settings=None, sln_path=None)