Exemple #1
0
 def build(self,
           project_file,
           targets=None,
           upgrade_project=True,
           build_type=None,
           arch=None,
           parallel=True,
           force_vcvars=False,
           toolset=None,
           platforms=None,
           use_env=True,
           vcvars_ver=None,
           winsdk_version=None):
     with tools.environment_append(self.build_env.vars):
         # Path for custom properties file
         props_file_contents = self._get_props_file_contents()
         with tmp_file(props_file_contents) as props_file_path:
             vcvars = vcvars_command(self._conanfile.settings,
                                     force=force_vcvars,
                                     vcvars_ver=vcvars_ver,
                                     winsdk_version=winsdk_version)
             command = self.get_command(project_file,
                                        props_file_path,
                                        targets=targets,
                                        upgrade_project=upgrade_project,
                                        build_type=build_type,
                                        arch=arch,
                                        parallel=parallel,
                                        toolset=toolset,
                                        platforms=platforms,
                                        use_env=use_env)
             command = "%s && %s" % (vcvars, command)
             return self._conanfile.run(command)
Exemple #2
0
    def build(self):
        self.output.warn('Using Qt: conan-{0}'.format(
            self.info.requires["Qt"].full_package_id))

        if self.options.shared == "True":
            tools.replace_in_file(
                "{0}/{0}.vcxproj".format(componentName),
                "<ConfigurationType>StaticLibrary</ConfigurationType>",
                "<ConfigurationType>DynamicLibrary</ConfigurationType>")

        libMachine = {
            "x86": "MachineX86",
            'x86_64': 'MachineX64'
        }.get(self.settings.get_safe("arch"), "")

        libMachine_node = "<Lib>" \
                       "<TargetMachine>{}</TargetMachine>" \
                       "</Lib>".format(libMachine) if libMachine else ""

        runtime_library = {
            "MT": "MultiThreaded",
            "MTd": "MultiThreadedDebug",
            "MD": "MultiThreadedDLL",
            "MDd": "MultiThreadedDebugDLL"
        }.get(self.settings.get_safe("compiler.runtime"), "")

        runtime_node = "<RuntimeLibrary>" \
                       "{}" \
                       "</RuntimeLibrary>".format(runtime_library) if runtime_library else ""

        props_file_contents = """<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemDefinitionGroup>
    {0}
    <ClCompile>
      {1}
    </ClCompile>
    
  </ItemDefinitionGroup>
</Project>""".format(libMachine_node, runtime_node)

        with tmp_file(props_file_contents) as props_file_path:
            msbuild = MSBuild(self)
            msbuild.build(
                "{0}/{0}.vcxproj".format(componentName),
                toolset=self.settings.compiler.toolset,
                platforms={
                    "x86": "Win32",
                    'x86_64': 'x64'
                },
                properties={"ForceImportBeforeCppTargets": props_file_path})
Exemple #3
0
 def build(self, project_file, targets=None, upgrade_project=True, build_type=None, arch=None,
           parallel=True, force_vcvars=False, toolset=None, platforms=None, use_env=True):
     with tools.environment_append(self.build_env.vars):
         # Path for custom properties file
         props_file_contents = self._get_props_file_contents()
         with tmp_file(props_file_contents) as props_file_path:
             vcvars = vcvars_command(self._conanfile.settings, force=force_vcvars)
             command = self.get_command(project_file, props_file_path,
                                        targets=targets, upgrade_project=upgrade_project,
                                        build_type=build_type, arch=arch, parallel=parallel,
                                        toolset=toolset, platforms=platforms,
                                        use_env=use_env)
             command = "%s && %s" % (vcvars, command)
             return self._conanfile.run(command)
    def build(self):
        os.chdir("depends/7z1701-src/CPP/7zip/Bundles/StaticLib")

        makeHeader = ""

        if self.options.shared == "False":
            makeHeader += "STATIC_LIB=1\n"
            makeHeader += "NO_DEFAULT_RES=1\n"

        if self.settings.compiler.runtime == "MD" or self.settings.compiler.runtime == "MDd":
            makeHeader += "MY_SINGLE_THREAD=1\n"

        if self.settings.build_type == "Debug":
            makeHeader += "MY_DEBUG=1\n"

        makeHeader += '!include "makefile.base"\n'

        tools.save("makefile.conan", makeHeader)

        if self.settings.os == "Windows":
            vcvars = tools.vcvars_command(self.settings)
            build_command = ""
            print("{0} && nmake -f makefile.conan".format(vcvars))
            self.run("{0} && nmake -f makefile.conan".format(vcvars))

        os.chdir("../../../../../..")
        os.chdir('SevenZip++')

        libMachine = {
            "x86": "MachineX86",
            'x86_64': 'MachineX64'
        }.get(self.settings.get_safe("arch"), "")

        libMachine_node = "<Lib>" \
                       "<TargetMachine>{}</TargetMachine>" \
                       "</Lib>".format(libMachine) if libMachine else ""

        runtime_library = {
            "MT": "MultiThreaded",
            "MTd": "MultiThreadedDebug",
            "MD": "MultiThreadedDLL",
            "MDd": "MultiThreadedDebugDLL"
        }.get(self.settings.get_safe("compiler.runtime"), "")

        runtime_node = "<RuntimeLibrary>" \
                       "{}" \
                       "</RuntimeLibrary>".format(runtime_library) if runtime_library else ""

        props_file_contents = """<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemDefinitionGroup>
    {0}
    <ClCompile>
      {1}
    </ClCompile>
    
  </ItemDefinitionGroup>
</Project>""".format(libMachine_node, runtime_node)
        with tmp_file(props_file_contents) as props_file_path:
            msbuild = MSBuild(self)
            msbuild.build(
                "SevenZip++.vcxproj",
                toolset=self.settings.compiler.toolset,
                platforms={
                    "x86": "Win32",
                    'x86_64': 'x64'
                },
                properties={"ForceImportBeforeCppTargets": props_file_path})