def _build_visual_studio(self): with tools.chdir(self._source_subfolder): # Assume we're using the latest Visual Studio and default to libusb_2019.sln # (or libusb_2017.sln for libusb < 1.0.24). # If we're not using the latest Visual Studio, select an appropriate solution file. solution_msvc_year = 2019 if tools.Version( self.version) >= "1.0.24" else 2017 solution_msvc_year = { "11": 2012, "12": 2013, "14": 2015, "15": 2017 }.get(str(self.settings.compiler.version), solution_msvc_year) solution_file = os.path.join( "msvc", "libusb_{}.sln".format(solution_msvc_year)) platforms = {"x86": "Win32"} properties = { # Enable LTO when CFLAGS contains -GL "WholeProgramOptimization": "true" if any( re.finditer("(^| )[/-]GL($| )", tools.get_env( "CFLAGS", ""))) else "false", } msbuild = MSBuild(self) msbuild.build(solution_file, platforms=platforms, upgrade_project=False, properties=properties)
def build(self): with tools.chdir(os.path.join(self._subfolder, "source", "Irrlicht")): if self.settings.compiler == "Visual Studio": msbuild = MSBuild(self) if self.options.shared: build_type = self.settings.build_type else: build_type = "Static lib - %s" % self.settings.build_type msbuild.build("Irrlicht11.0.sln", build_type=build_type, use_env=False) else: autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) if self.settings.os != 'Windows': autotools.fpic = self.options.fPIC if tools.os_info.is_windows: self._patch_mingw() make_target = "sharedlib_win32" if self.options.shared else "staticlib_win32" elif tools.os_info.is_macos: self._patch_macos() autotools.include_paths.append(os.getcwd()) make_target = "sharedlib_osx" if self.options.shared else "staticlib_osx" else: self._patch_linux() make_target = "sharedlib" if self.options.shared else "staticlib" compiler = self.settings.compiler if compiler == "clang": autotools.flags.append("-Wno-register") autotools.make(target=make_target)
def build(self): if self.settings.compiler == "Visual Studio": msbuild = MSBuild(self) msbuild.build("../source/%s/source/Irrlicht/Irrlicht11.0.sln" % self._subfolder) # TBD.... else: with tools.chdir( os.path.join(self._subfolder, "source", "Irrlicht")): autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) if self.settings.os != 'Windows': autotools.fpic = self.options.fPIC if tools.os_info.is_windows: self._patch_mingw() make_target = "sharedlib_win32" if self.options.shared else "staticlib_win32" elif tools.os_info.is_macos: self._patch_macos() autotools.include_paths.append(os.getcwd()) make_target = "sharedlib_osx" if self.options.shared else "staticlib_osx" else: self._patch_linux() make_target = "sharedlib" if self.options.shared else "staticlib" autotools.make(target=make_target)
def build(self): self._patch_sources() if self.settings.compiler == "Visual Studio": with tools.vcvars( self.settings ) if self.settings.compiler == "Visual Studio" else tools.no_op(): with tools.environment_append( { "CC": "cl", "CXX": "cl" } ) if self.settings.compiler == "Visual Studio" else tools.no_op( ): with tools.chdir(self._source_subfolder): # Do not use AutoToolsBuildEnvironment because we want to run configure as ./configure self.run("./configure {}".format(" ".join( self._autotools_args)), win_bash=tools.os_info.is_windows) msbuild = MSBuild(self) # Do not use the 2015 solution: unresolved external symbols: test_hooks_libc_hook and test_hooks_arena_new_hook sln_file = os.path.join(self._source_subfolder, "msvc", "jemalloc_vc2017.sln") msbuild.build(sln_file, targets=["jemalloc"], build_type=self._msvc_build_type) else: autotools = self._configure_autotools() autotools.make()
def build(self): config = "debug" if self.settings.build_type == "Debug" else "release" architecture = "x86" if self.settings.arch == "x86" else "x86_64" with tools.chdir(self._source_subfolder): if self.settings.compiler == "Visual Studio": self.run("premake5 --os=windows vs2015") with tools.chdir(os.path.join("make", "windows")): build_type = "release" if self.settings.build_type == "Debug": build_type = "debug" msbuild = MSBuild(self) msbuild.build("SOIL2.sln", targets=["soil2-static-lib"], platforms={"x86": "Win32"}, build_type=build_type) else: the_os = "macosx" if self.settings.os == "Macos" else "linux" self.run("premake5 --os={} gmake".format(the_os)) with tools.chdir(os.path.join("make", the_os)): env_build = AutoToolsBuildEnvironment(self) env_build.make(args=[ "soil2-static-lib", "config={}".format(config + "_" + architecture) ])
def _build_msvc(self): # windows\INSTALL-MSVC.txt if self.settings.compiler.version == 15: # emulate VS2019+ meaning of WindowsTargetPlatformVersion == "10.0" # undocumented method, but officially recommended workaround by microsoft at at # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"), "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>", "<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>") tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"), "<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>", "<WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>") msvc_version = "vs2017" if Version(self.settings.compiler.version) >= "15" else "vs2013" with tools.chdir(os.path.join(self._source_subfolder, "windows", msvc_version)): target = "liblzma_dll" if self.options.shared else "liblzma" msbuild = MSBuild(self) msbuild.build( "xz_win.sln", targets=[target], build_type=self._effective_msbuild_type(), platforms={"x86": "Win32", "x86_64": "x64"}, use_env=False, upgrade_project=False)
def _build_msvc(self): for filename in sorted(glob.glob("patches/*.patch")): self.output.info('applying patch "%s"' % filename) tools.patch(base_path=self._source_subfolder, patch_file=filename) tools.replace_in_file(os.path.join(self._source_subfolder, "build", "vs", "pjproject-vs14-common-defaults.props"), "<OutputFile>..\lib\$(ProjectName)-$(TargetCPU)-$(Platform)-vc$(VSVer)-$(Configuration).lib</OutputFile>", "<OutputFile>..\lib\$(ProjectName)-.lib</OutputFile>") for root, _, filenames in os.walk(self._source_subfolder): for filename in filenames: if fnmatch.fnmatch(filename, "*.vcxproj"): fullname = os.path.join(root, filename) print("process", fullname) tools.replace_in_file(fullname, "-$(TargetCPU)-$(Platform)-vc$(VSVer)-$(Configuration).lib</OutputFile>", "-.lib</OutputFile>", strict=False) #raise ConanInvalidConfiguration("enough") # https://trac.pjsip.org/repos/wiki/Getting-Started/Windows with tools.chdir(self._source_subfolder): tools.save(os.path.join("pjlib", "include", "pj", "config_site.h"), "") version = Version(str(self.settings.compiler.version)) sln_file = "pjproject-vs14.sln" if version >= "14.0" else "pjproject-vs8.sln" build_type = "Debug" if self.settings.build_type == "Debug" else "Release" if str(self.settings.compiler.runtime) in ["MT", "MTd"]: build_type += "-Static" else: build_type += "-Dynamic" msbuild = MSBuild(self) msbuild.build(project_file=sln_file, targets=["pjsua"], build_type=build_type, platforms={"x86": "Win32", "x86_64": "x64"})
def _build_msvc(self): sln = os.path.join(self._source_subfolder, "mDNSResponder.sln") if "MD" in self.settings.compiler.runtime: # could use glob and replace_in_file(strict=False, ...) dll_vcxproj = os.path.join(self._source_subfolder, "mDNSWindows", "DLL", "dnssd.vcxproj") dllstub_vcxproj = os.path.join(self._source_subfolder, "mDNSWindows", "DLLStub", "DLLStub.vcxproj") dns_sd_vcxproj = os.path.join(self._source_subfolder, "Clients", "DNS-SD.VisualStudio", "dns-sd.vcxproj") for vcxproj in [dll_vcxproj, dllstub_vcxproj, dns_sd_vcxproj]: tools.replace_in_file( vcxproj, "<RuntimeLibrary>MultiThreaded</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>") tools.replace_in_file( vcxproj, "<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>", "<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>") # could use glob and replace_in_file(strict=False, ...) dll_rc = os.path.join(self._source_subfolder, "mDNSWindows", "DLL", "dll.rc") dns_sd_rc = os.path.join(self._source_subfolder, "Clients", "DNS-SD.VisualStudio", "dns-sd.rc") for rc in [dll_rc, dns_sd_rc]: tools.replace_in_file(rc, "afxres.h", "winres.h") msbuild = MSBuild(self) msbuild.build(sln, targets=self._msvc_targets, platforms=self._msvc_platforms, definitions=self._msvc_definitions)
def build(self): if self.settings.compiler == "Visual Studio": generator = "vs" + { "16": "2019", "15": "2017", "14": "2015", "12": "2013", "11": "2012", "10": "2010", "9": "2008", "8": "2005" }.get(str(self.settings.compiler.version)) else: generator = "gmake2" subdir = os.path.join(self._source_subfolder, "build", "subdir") os.makedirs(subdir) with tools.chdir(subdir): os.rename(os.path.join("..", "premake5.lua"), "premake5.lua") self.run("premake5 %s" % generator) if self.settings.compiler == "Visual Studio": msbuild = MSBuild(self) msbuild.build("NativeFileDialog.sln") else: config = "debug" if self.settings.build_type == "Debug" else "release" config += "_x86" if self.settings.arch == "x86" else "_x64" env_build = AutoToolsBuildEnvironment(self) env_build.make(args=["config=%s" % config])
def _build_visual_studio(self): with tools.chdir(os.path.join(self._source_subfolder, "Projects", "VC2013")): target = "lcms2_DLL" if self.options.shared else "lcms2_static" upgrade_project = Version(self.settings.compiler.version) > "12" # run build msbuild = MSBuild(self) msbuild.build("lcms2.sln", targets=[target], platforms={"x86": "Win32"}, upgrade_project=upgrade_project)
def build(self): #with tools.chdir(self.source_subfolder): # with tools.environment_append({ # 'PKG_CONFIG_PATH' : "%s/lib/pkgconfig"%(self.deps_cpp_info["libtiff"].rootpath), # 'LIBRARY_PATH':"%s/lib"%(self.deps_cpp_info["libtiff"].rootpath), # 'C_INCLUDE_PATH':"%s/include"%(self.deps_cpp_info["libtiff"].rootpath) # }): # _args = ["--prefix=%s/builddir"%(os.getcwd()),"--disable-silent-rules"] # if self.options.shared: # _args.extend(['--enable-shared=yes','--enable-static=no']) # else: # _args.extend(['--enable-shared=no','--enable-static=yes']) # self.run("sh ./autogen.sh && sh ./configure %s"%(' '.join(_args))) # self.run("make") # self.run("make install") if self.settings.os == 'Windows': with tools.chdir(os.path.join(self._source_subfolder, "src")): msbuild = MSBuild(self) msbuild.build("libspandsp.2008.sln", upgrade_project=True, platforms={ 'x86': 'Win32', 'x86_64': 'x64' })
def build(self): #replace_in_file("win32\\openssl.props", "libeay32.lib;", "") msbuild = MSBuild(self) msbuild.build_env.runtime = [ "MD", "MDd" ][self.settings.get_safe("build_type") == "Debug"] msbuild.build("win32\\cyrus-sasl-common.sln")
def build_with_visual_studio(self): def update_projects_in_solution(solution_folder, shared): """ Update vs projects in solution_folder to build with ogg dependency from conan :param solution_folder: solution folder :param shared: True or False :returns solution filename """ suffix = "_dynamic" if shared else "_static" for project in [ "vorbisenc", "vorbisdec", "libvorbis", "libvorbisfile" ]: filename = project + suffix + ".vcxproj" path = os.path.join(solution_folder, project, filename) libdirs = "<AdditionalLibraryDirectories>" libdirs_ext = "<AdditionalLibraryDirectories>$(LIB);" updated_content = tools \ .load(path) \ .replace("libogg.lib", "ogg.lib") \ .replace("libogg_static.lib", "ogg.lib") \ .replace(libdirs, libdirs_ext) tools.save(path, updated_content) return "vorbis" + suffix + ".sln" sln_folder = os.path.join(self.source_subfolder, "win32", "VS2010") sln_filename = update_projects_in_solution(sln_folder, self.options.shared) with tools.chdir(sln_folder): msbuild = MSBuild(self) msbuild.build(sln_filename, platforms={"x86": "Win32"})
def _build_msbuild(self): msbuild = MSBuild(self) platforms = { "x86": "Win32", "x86_64": "Win64" } msbuild.build("win/sassc.sln", platforms=platforms)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) vcxproj = os.path.join(self._source_subfolder, "vs2015", "Argon2OptDll", "Argon2OptDll.vcxproj") argon2_header = os.path.join(self._source_subfolder, "include", "argon2.h") if not self.options.shared: tools.replace_in_file(argon2_header, "__declspec(dllexport)", "") tools.replace_in_file(vcxproj, "DynamicLibrary", "StaticLibrary") tools.replace_in_file( vcxproj, "<ClCompile>", "<ClCompile><AdditionalIncludeDirectories>$(SolutionDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>" ) if self.settings.compiler == "Visual Studio": msbuild = MSBuild(self) msbuild.build( os.path.join(self._source_subfolder, "Argon2.sln"), targets=("Argon2OptDll", )) #, platforms={"x86": "Win32"}) if self.options.shared: tools.replace_in_file(argon2_header, "__declspec(dllexport)", "__declspec(dllimport)") else: with tools.chdir(self._source_subfolder): autotools = AutoToolsBuildEnvironment( self, win_bash=tools.os_info.is_windows) with tools.environment_append(autotools.vars): autotools.make(args=self._make_args, target="libs")
def build(self): if self.settings.compiler == "Visual Studio": msbuild = MSBuild(self) msbuild.build("hidapi/windows/hidapi.sln") else: cmake = CMake(self) self.run('cmake hello %s' % cmake.command_line) self.run("cmake --build . %s" % cmake.build_config)
def build(self): msbuild = MSBuild(self) msbuild.build("libgizmo/src/LibGizmo.sln", build_type="Release", arch="x64") msbuild.build("libgizmo/src/LibGizmo.sln", build_type="Debug", arch="x64")
def build(self): with tools.chdir("source"): if os_info.is_windows: msbuild = MSBuild(self) msbuild.build("FreeImage.2017.sln") else: autotools = AutoToolsBuildEnvironment(self) autotools.make()
def build(self): if self.settings.os == "Windows": msbuild = MSBuild(self) msbuild.build("ConanHelloVS.sln", platforms={"x86": "Win32"}) else: env_build = AutoToolsBuildEnvironment(self) with tools.environment_appen(env_build.vars): self.run("Make -C ConanHelloVS -f Makefile.mk")
def build_with_vs(self): msbuild = MSBuild(self) msbuild.build(os.path.join(self.folder, "VisualC", "SDL_ttf.sln"), platforms={ "x86": "Win32", "x86_64": "x64" }, toolset=self.settings.compiler.toolset)
def _build_vs(self): includedir = os.path.abspath(os.path.join(self._source_subfolder, "include")) with tools.chdir(os.path.join(self._source_subfolder, "win32", "VS2015")): msbuild = MSBuild(self) msbuild.build_env.include_paths.append(includedir) msbuild.build(project_file="opusfile.sln", targets=["opusfile"], platforms={"x86": "Win32"}, upgrade_project=False)
def _build_msvc(self): # error C2491: 'rint': definition of dllimport function not allowed tools.replace_in_file( os.path.join(self._source_subfolder, 'examples', 'encoder_example.c'), 'static double rint(double x)', 'static double rint_(double x)') def format_libs(libs): return ' '.join([l + '.lib' for l in libs]) # fix hard-coded library names project = 'libtheora' config = "dynamic" if self.options.shared else "static" vcvproj = '%s_%s.vcproj' % (project, config) vcvproj_path = os.path.join(self._source_subfolder, 'win32', 'VS2008', project, vcvproj) tools.replace_in_file(vcvproj_path, 'libogg.lib', format_libs(self.deps_cpp_info['ogg'].libs), strict=False) tools.replace_in_file(vcvproj_path, 'libogg_static.lib', format_libs(self.deps_cpp_info['ogg'].libs), strict=False) tools.replace_in_file(vcvproj_path, 'libvorbis.lib', format_libs(self.deps_cpp_info['vorbis'].libs), strict=False) tools.replace_in_file(vcvproj_path, 'libvorbis_static.lib', format_libs(self.deps_cpp_info['vorbis'].libs), strict=False) if "MT" in self.settings.compiler.runtime: tools.replace_in_file(vcvproj_path, 'RuntimeLibrary="2"', 'RuntimeLibrary="0"') tools.replace_in_file(vcvproj_path, 'RuntimeLibrary="3"', 'RuntimeLibrary="1"') with tools.chdir( os.path.join(self._source_subfolder, 'win32', 'VS2008', 'libtheora')): proj = 'libtheora_dynamic' if self.options.shared else 'libtheora_static' msbuild = MSBuild(self) try: # upgrade .vcproj msbuild.build(proj + '.vcproj', platforms={ 'x86': 'Win32', 'x86_64': 'x64' }) except: # build .vcxproj msbuild.build(proj + '.vcxproj', platforms={ 'x86': 'Win32', 'x86_64': 'x64' })
def build(self): with tools.chdir(self._source_subfolder): if self.settings.os == "Linux": libpcap_include_path = self.deps_cpp_info[ "libpcap"].include_paths[0] libpcap_lib_path = self.deps_cpp_info["libpcap"].lib_paths[0] config_command = ( "./configure-linux.sh --libpcap-include-dir %s --libpcap-lib-dir %s" % (libpcap_include_path, libpcap_lib_path)) if self.options.immediate_mode: config_command += " --use-immediate-mode" self.run(config_command) env_build = AutoToolsBuildEnvironment(self) env_build.make() elif self.settings.os == "Macos": libpcap_include_path = self.deps_cpp_info[ "libpcap"].include_paths[0] libpcap_lib_path = self.deps_cpp_info["libpcap"].lib_paths[0] config_command = ( "./configure-mac_os_x.sh --libpcap-include-dir %s --libpcap-lib-dir %s" % (libpcap_include_path, libpcap_lib_path)) if self.options.immediate_mode: config_command += " --use-immediate-mode" self.run(config_command) env_build = AutoToolsBuildEnvironment(self) env_build.make() elif self.settings.os == "Windows": if self.settings.compiler != "Visual Studio": raise ConanInvalidConfiguration( "Compiler %s is not supported" % self.settings.compiler) vs_version = "vs2015" if self.settings.compiler.version == "15": vs_version = "vs2017" elif self.settings.compiler.version == "16": vs_version = "vs2019" sln_file = "mk/%s/PcapPlusPlus.sln" % (vs_version) winpcap_path = self.deps_cpp_info["winpcap"].rootpath pthreads_path = self.deps_cpp_info["pthreads4w"].rootpath self.run( "configure-windows-visual-studio.bat --vs-version %s --pcap-sdk %s --pthreads-home %s" % (vs_version, winpcap_path, pthreads_path)) self.generate_directory_build_props_file() msbuild = MSBuild(self) msbuild.build( sln_file, targets=self._vs_projects_to_build, use_env=False, properties={"WholeProgramOptimization": "None"}, )
def build(self): if self.settings.compiler != "Visual Studio": raise "Only Visual Studio is supported at the moment" replace_in_file("msvc\\libhunspell.vcxproj", "v140_xp", "v140") msbuild = MSBuild(self) build_type = None if self.options.shared: build_type = {"Release":"Release_dll", "Debug":"Debug_dll"}[str(self.settings.build_type)] msbuild.build("msvc\\Hunspell.sln", targets=["libhunspell"], build_type=build_type, platforms={"x86":"Win32"})
def build(self): self._patch_sources() if self.settings.compiler == "Visual Studio": with tools.chdir(os.path.join(self._source_subfolder, "build", self._msvc_build_dirname)): msbuild = MSBuild(self) msbuild.build("Premake5.sln", platforms={"x86": "Win32", "x86_64": "x64"}) else: with tools.chdir(os.path.join(self._source_subfolder, "build", self._gmake_build_dirname)): env_build = AutoToolsBuildEnvironment(self) env_build.make(target="Premake5", args=["verbose=1", "config={}".format(self._gmake_config)])
def build(self): if self.settings.os == "Windows": msbuild = MSBuild(self) msbuild.build("FreeImage/FreeImage.2013.sln", upgrade_project=False, use_env=False) elif self.settings.os == "Linux": with tools.chdir("FreeImage"): atools = AutoToolsBuildEnvironment(self) atools.make()
def _build_vs(self): with tools.chdir(os.path.join(self._source_subfolder, 'Mkfiles', 'vc10')): with tools.vcvars(self.settings, arch=str(self.settings.arch_build), force=True): msbuild = MSBuild(self) if self.settings.arch_build == "x86": msbuild.build_env.link_flags.append('/MACHINE:X86') elif self.settings.arch_build == "x86_64": msbuild.build_env.link_flags.append('/SAFESEH:NO /MACHINE:X64') msbuild.build(project_file="yasm.sln", arch=self.settings.arch_build, build_type="Release", targets=["yasm"], platforms={"x86": "Win32"}, force_vcvars=True)
def build(self): if self.settings.compiler == "Visual Studio": msbuild = MSBuild(self) msbuild.build(self._source_subfolder+"\\build\\msw\\wx.sln") else: autotools = self._configure_autotools() autotools.make() if self.options.stc : with tools.environment_append(autotools.vars): self.run("cd contrib/src/stc && make && cd ../../..")
def _build_visual(self): sln_path = os.path.join(self.build_folder, self._source_subfolder, "builds", "msvc", self._vs_sln_folder, "libsodium.sln") msbuild = MSBuild(self) msbuild.build(sln_path, upgrade_project=False, platforms={"x86": "Win32"}, build_type=self._vs_configuration)
def _build_vs(self): with tools.chdir(self._msvc_subfolder): msbuild = MSBuild(self) if self.settings.arch == "x86": msbuild.build_env.link_flags.append("/MACHINE:X86") elif self.settings.arch == "x86_64": msbuild.build_env.link_flags.append("/SAFESEH:NO /MACHINE:X64") msbuild.build(project_file="yasm.sln", targets=["yasm"], platforms={"x86": "Win32"}, force_vcvars=True)
def build(self): msbuild = MSBuild(self) msbuild.build("win32\\cyrus-sasl-gssapiv2.sln")
def build(self): #replace_in_file("win32\\openssl.props", "libeay32.lib;", "") msbuild = MSBuild(self) msbuild.build_env.runtime = ["MD","MDd"][self.settings.get_safe("build_type") == "Debug"] msbuild.build("win32\\cyrus-sasl-common.sln")
def build(self): msbuild = MSBuild(self) msbuild.build("win32\\cyrus-sasl-core.sln")