def source(self): tgz_name = "2.3.2.tar.gz" download("https://github.com/SFML/SFML/archive/%s" % tgz_name, tgz_name) check_sha256(tgz_name, "55e7c864938e03ceb7d6d05c66f8e0dc886e632805d0ae17c222da317ba14e4c") # unzip falls back to untargz in the case of tar.gz extension unzip(tgz_name) os.unlink(tgz_name) patch(base_path=self.ZIP_FOLDER_NAME, patch_string=SFML_GCC_PATCH)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) cmake = self._configure_cmake() cmake.build()
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch)
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) # No warnings as errors for Visual Studio also tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "/WX", "")
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "set_target_properties(${STATIC_LIB} PROPERTIES POSITION_INDEPENDENT_CODE ON)", "")
def _build_msvc(self): for patch in self.conan_data.get("patches", {}).get(self.version, {}): tools.patch(**patch) # FIXME: package LiquidRescale aka liblqr tools.replace_in_file( os.path.join("VisualMagick", "lqr", "Config.txt"), "#define MAGICKCORE_LQR_DELEGATE", "", ) # FIXME: package LibRaw tools.replace_in_file( os.path.join("VisualMagick", "libraw", "Config.txt"), "#define MAGICKCORE_RAW_R_DELEGATE", "", ) # FIXME: package FLIF (FLIF: Free Lossless Image Format) tools.replace_in_file( os.path.join("VisualMagick", "flif", "Config.txt"), "#define MAGICKCORE_FLIF_DELEGATE", "", ) # FIXME: package librsvg tools.replace_in_file( os.path.join("VisualMagick", "librsvg", "Config.txt"), "#define MAGICKCORE_RSVG_DELEGATE", "", ) if not self.options.shared: for module in self._modules: tools.replace_in_file( os.path.join("VisualMagick", module, "Config.txt"), "[DLL]", "[STATIC]", ) tools.replace_in_file( os.path.join("VisualMagick", "coders", "Config.txt"), "[DLLMODULE]", "[STATIC]\n[DEFINES]\n_MAGICKLIB_", ) if self.settings.arch == "x86_64": project = os.path.join("VisualMagick", "configure", "configure.vcxproj") tools.replace_in_file(project, "Win32", "x64") tools.replace_in_file(project, "/MACHINE:I386", "/MACHINE:x64") with tools.chdir(os.path.join("VisualMagick", "configure")): toolset = tools.msvs_toolset(self) tools.replace_in_file( "configure.vcxproj", "<PlatformToolset>v120</PlatformToolset>", "<PlatformToolset>%s</PlatformToolset>" % toolset, ) msbuild = MSBuild(self) # fatal error C1189: #error: Please use the /MD switch for _AFXDLL builds msbuild.build_env.flags = ["/MD"] msbuild.build( project_file="configure.vcxproj", platforms={"x86": "Win32"}, force_vcvars=True, ) # https://github.com/ImageMagick/ImageMagick-Windows/blob/master/AppVeyor/Build.ps1 command = ["configure.exe", "/noWizard"] msvc_version = { 9: "/VS2002", 10: "/VS2010", 11: "/VS2012", 12: "/VS2013", 14: "/VS2015", 15: "/VS2017", 16: "/VS2019", 17: "/VS2022", }.get(int(str(self.settings.compiler.version))) runtime = { "MT": "/smt", "MTd": "/smtd", "MD": "/dmt", "MDd": "/mdt" }.get(str(self.settings.compiler.runtime)) command.append(runtime) command.append(msvc_version) command.append("/hdri" if self.options.hdri else "/noHdri") command.append("/Q%s" % self.options.quantum_depth) if self.settings.arch == "x86_64": command.append("/x64") command = " ".join(command) self.output.info(command) self.run(command, run_environment=True) # disable incorrectly detected OpenCL baseconfig = os.path.join(self._source_subfolder, "MagickCore", "magick-baseconfig.h") tools.replace_in_file( baseconfig, "#define MAGICKCORE__OPENCL", "#undef MAGICKCORE__OPENCL", strict=False, ) tools.replace_in_file( baseconfig, "#define MAGICKCORE_HAVE_CL_CL_H", "#undef MAGICKCORE_HAVE_CL_CL_H", strict=False, ) suffix = { "MT": "StaticMT", "MTd": "StaticMTD", "MD": "DynamicMT", "MDd": "DynamicMT", }.get(str(self.settings.compiler.runtime)) # GdiPlus requires C++, but ImageMagick has *.c files project = ("IM_MOD_emf_%s.vcxproj" % suffix if self.options.shared else "CORE_coders_%s.vcxproj" % suffix) tools.replace_in_file( os.path.join("VisualMagick", "coders", project), '<ClCompile Include="..\\..\\ImageMagick\\coders\\emf.c">', '<ClCompile Include="..\\..\\ImageMagick\\coders\\emf.c">\n' "<CompileAs>CompileAsCpp</CompileAs>", ) for module in self._modules: with tools.chdir(os.path.join("VisualMagick", module)): msbuild = MSBuild(self) msbuild.build( project_file="CORE_%s_%s.vcxproj" % (module, suffix), upgrade_project=False, platforms={ "x86": "Win32", "x86_64": "x64" }, ) with tools.chdir(os.path.join("VisualMagick", "coders")): pattern = ("IM_MOD_*_%s.vcxproj" % suffix if self.options.shared else "CORE_coders_%s.vcxproj" % suffix) projects = glob.glob(pattern) for project in projects: msbuild = MSBuild(self) msbuild.build( project_file=project, upgrade_project=False, platforms={ "x86": "Win32", "x86_64": "x64" }, )
def build(self): self._disable_werror() if self.options.header_only: tools.patch(**self.conan_data["patches"][self.version]) cmake = self._configure_cmake() cmake.build()
def build(self): for patch in self.conan_data.get('patches', {}).get(self.version, []): tools.patch(**patch) with tools.chdir(self._source_subfolder): self.run(self._configure_cmd) self.run(self._make_cmd)
def source(self): tools.get(**self.conan_data["sources"][self.version]) shutil.move("qt-everywhere-src-%s" % self.version, "qt5") for p in self.conan_data["patches"][self.version]: tools.patch(**p)
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.original_version, []): tools.patch(**patch) # Provide relocatable protobuf::protoc target and Protobuf_PROTOC_EXECUTABLE cache variable # TODO: some of the following logic might be disabled when conan will # allow to create executable imported targets in package_info() protobuf_config_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-config.cmake.in") tools.replace_in_file( protobuf_config_cmake, "@_protobuf_FIND_ZLIB@", "# BEGIN CONAN PATCH\n#_protobuf_FIND_ZLIB@\n# END CONAN PATCH") exe_ext = ".exe" if self.settings.os == "Windows" else "" protoc_filename = "protoc" + exe_ext module_folder_depth = len( os.path.normpath(self._cmake_install_base_path).split(os.path.sep)) protoc_rel_path = "{}bin/{}".format( "".join(["../"] * module_folder_depth), protoc_filename) protoc_target = textwrap.dedent("""\ if(NOT TARGET protobuf::protoc) if(CMAKE_CROSSCOMPILING) find_program(PROTOC_PROGRAM protoc PATHS ENV PATH NO_DEFAULT_PATH) endif() if(NOT PROTOC_PROGRAM) set(PROTOC_PROGRAM \"${{CMAKE_CURRENT_LIST_DIR}}/{protoc_rel_path}\") endif() get_filename_component(PROTOC_PROGRAM \"${{PROTOC_PROGRAM}}\" ABSOLUTE) set(Protobuf_PROTOC_EXECUTABLE ${{PROTOC_PROGRAM}} CACHE FILEPATH \"The protoc compiler\") add_executable(protobuf::protoc IMPORTED) set_property(TARGET protobuf::protoc PROPERTY IMPORTED_LOCATION ${{Protobuf_PROTOC_EXECUTABLE}}) endif() """.format(protoc_rel_path=protoc_rel_path)) tools.replace_in_file( protobuf_config_cmake, "include(\"${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake\")", protoc_target) # Set DYLD_LIBRARY_PATH in command line to avoid issues with shared protobuf # (even with virtualrunenv, this fix might be required due to SIP) # Only works with cmake, cmake_find_package or cmake_find_package_multi generators if tools.is_apple_os(self.settings.os): tools.replace_in_file( protobuf_config_cmake, "add_custom_command(", ("set(CUSTOM_DYLD_LIBRARY_PATH ${CONAN_LIB_DIRS} ${Protobuf_LIB_DIRS} ${Protobuf_LIB_DIRS_RELEASE} ${Protobuf_LIB_DIRS_DEBUG} ${Protobuf_LIB_DIRS_RELWITHDEBINFO} ${Protobuf_LIB_DIRS_MINSIZEREL})\n" "string(REPLACE \";\" \":\" CUSTOM_DYLD_LIBRARY_PATH \"${CUSTOM_DYLD_LIBRARY_PATH}\")\n" "add_custom_command(")) tools.replace_in_file( protobuf_config_cmake, "COMMAND protobuf::protoc", "COMMAND ${CMAKE_COMMAND} -E env \"DYLD_LIBRARY_PATH=${CUSTOM_DYLD_LIBRARY_PATH}\" $<TARGET_FILE:protobuf::protoc>" ) # Disable a potential warning in protobuf-module.cmake.in # TODO: remove this patch? Is it really useful? protobuf_module_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-module.cmake.in") tools.replace_in_file( protobuf_module_cmake, "if(DEFINED Protobuf_SRC_ROOT_FOLDER)", "if(0)\nif(DEFINED Protobuf_SRC_ROOT_FOLDER)", ) tools.replace_in_file( protobuf_module_cmake, "# Define upper case versions of output variables", "endif()", )
def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True) for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch)
def source(self): tools.get(**self.conan_data["sources"][self.version]) extracted_dir = self.name + "-" + self.version os.rename(extracted_dir, self._source_subfolder) for patch in self.conan_data["patches"][self.version]: tools.patch(**patch)
def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("boost_%s" % self.version.replace(".", "_"), self._source_subfolder) for patch in self.conan_data["patches"].get(self.version, []): tools.patch(**patch)
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) # drop conflicting CMake files # LASzip works fine for module in ("ZSTD", "ICONV", "GeoTIFF", "Curl"): os.remove( os.path.join(self._source_subfolder, "cmake", "modules", "Find" + module + ".cmake")) top_cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") util_cmakelists = os.path.join(self._source_subfolder, "pdal", "util", "CMakeLists.txt") # disabling libxml2 support is only done via patching if not self.options.with_xml: tools.replace_in_file(top_cmakelists, "include(${PDAL_CMAKE_DIR}/libxml2.cmake)", "") # disabling libunwind support is only done via patching if not self.options.get_safe("with_unwind", False): tools.replace_in_file(util_cmakelists, "include(${PDAL_CMAKE_DIR}/unwind.cmake)", "") # remove vendored eigen tools.rmdir(os.path.join(self._source_subfolder, "vendor", "eigen")) # remove vendored nanoflann. include path is patched tools.rmdir(os.path.join(self._source_subfolder, "vendor", "nanoflann")) # remove vendored boost tools.rmdir(os.path.join(self._source_subfolder, "vendor", "pdalboost")) tools.replace_in_file(top_cmakelists, "add_subdirectory(vendor/pdalboost)", "") tools.replace_in_file(util_cmakelists, "${PDAL_BOOST_LIB_NAME}", "${CONAN_LIBS}") tools.replace_in_file( os.path.join(self._source_subfolder, "pdal", "util", "FileUtils.cpp"), "pdalboost::", "boost::") # No rpath manipulation tools.replace_in_file(top_cmakelists, "include(${PDAL_CMAKE_DIR}/rpath.cmake)", "") # No reexport tools.replace_in_file( top_cmakelists, "set(PDAL_REEXPORT \"-Wl,-reexport_library,$<TARGET_FILE:${PDAL_UTIL_LIB_NAME}>\")", "") # fix static build if not self.options.shared: tools.replace_in_file(top_cmakelists, "add_definitions(\"-DPDAL_DLL_EXPORT=1\")", "") tools.replace_in_file( top_cmakelists, "${PDAL_BASE_LIB_NAME} ${PDAL_UTIL_LIB_NAME}", "${PDAL_BASE_LIB_NAME} ${PDAL_UTIL_LIB_NAME} ${PDAL_ARBITER_LIB_NAME} ${PDAL_KAZHDAN_LIB_NAME}" ) tools.replace_in_file( os.path.join(self._source_subfolder, "cmake", "macros.cmake"), " install(TARGETS ${_name}", " endif()\n if (PDAL_LIB_TYPE STREQUAL \"STATIC\" OR NOT ${_library_type} STREQUAL \"STATIC\")\n install(TARGETS ${_name}" ) tools.replace_in_file( util_cmakelists, "PDAL_ADD_FREE_LIBRARY(${PDAL_UTIL_LIB_NAME} SHARED ${PDAL_UTIL_SOURCES})", "PDAL_ADD_FREE_LIBRARY(${PDAL_UTIL_LIB_NAME} ${PDAL_LIB_TYPE} ${PDAL_UTIL_SOURCES})" )
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") cmakelists_tools = os.path.join(self._source_subfolder, "tools", "CMakeLists.txt") occt_toolkit_cmake = os.path.join(self._source_subfolder, "adm", "cmake", "occt_toolkit.cmake") occt_csf_cmake = os.path.join(self._source_subfolder, "adm", "cmake", "occt_csf.cmake") occt_defs_flags_cmake = os.path.join(self._source_subfolder, "adm", "cmake", "occt_defs_flags.cmake") # Inject conanbuildinfo, upstream build files are not ready for a CMake wrapper (too much modifications required) # Also inject compile flags tools.replace_in_file( cmakelists, "project (OCCT)", "project (OCCT)\n" "include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\n" "conan_basic_setup(TARGETS)\n" "conan_global_flags()") # Avoid to add system include/libs directories tools.replace_in_file(cmakelists, "3RDPARTY_INCLUDE_DIRS", "CONAN_INCLUDE_DIRS") tools.replace_in_file(cmakelists, "3RDPARTY_LIBRARY_DIRS", "CONAN_LIB_DIRS") tools.replace_in_file(cmakelists_tools, "3RDPARTY_INCLUDE_DIRS", "CONAN_INCLUDE_DIRS") tools.replace_in_file(cmakelists_tools, "3RDPARTY_LIBRARY_DIRS", "CONAN_LIB_DIRS") # Do not fail due to "fragile" upstream logic to find dependencies tools.replace_in_file(cmakelists, "if (3RDPARTY_NOT_INCLUDED)", "if(0)") tools.replace_in_file(cmakelists, "if (3RDPARTY_NO_LIBS)", "if(0)") tools.replace_in_file(cmakelists, "if (3RDPARTY_NO_DLLS)", "if(0)") # Inject dependencies from conan, and avoid to rely on upstream custom CMake files conan_targets = [] ## freetype conan_targets.append("CONAN_PKG::freetype") tools.replace_in_file( cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/freetype\")", "") tools.replace_in_file( occt_csf_cmake, "set (CSF_FREETYPE \"freetype\")", "set (CSF_FREETYPE \"{}\")".format(" ".join( self.deps_cpp_info["freetype"].libs))) ## tcl conan_targets.append("CONAN_PKG::tcl") tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tcl\")", "") csf_tcl_libs = "set (CSF_TclLibs \"{}\")".format(" ".join( self.deps_cpp_info["tcl"].libs)) tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs \"tcl86\")", csf_tcl_libs) tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs Tcl)", csf_tcl_libs) tools.replace_in_file(occt_csf_cmake, "set (CSF_TclLibs \"tcl8.6\")", csf_tcl_libs) ## tk conan_targets.append("CONAN_PKG::tk") tools.replace_in_file(cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tk\")", "") csf_tk_libs = "set (CSF_TclTkLibs \"{}\")".format(" ".join( self.deps_cpp_info["tk"].libs)) tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs \"tk86\")", csf_tk_libs) tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs Tk)", csf_tk_libs) tools.replace_in_file(occt_csf_cmake, "set (CSF_TclTkLibs \"tk8.6\")", csf_tk_libs) ## fontconfig if self._is_linux: conan_targets.append("CONAN_PKG::fontconfig") tools.replace_in_file( occt_csf_cmake, "set (CSF_fontconfig \"fontconfig\")", "set (CSF_fontconfig \"{}\")".format(" ".join( self.deps_cpp_info["fontconfig"].libs))) ## tbb if self.options.with_tbb: conan_targets.append("CONAN_PKG::tbb") tools.replace_in_file( cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/tbb\")", "") tools.replace_in_file( occt_csf_cmake, "set (CSF_TBB \"tbb tbbmalloc\")", "set (CSF_TBB \"{}\")".format(" ".join( self.deps_cpp_info["tbb"].libs))) ## ffmpeg if self.options.with_ffmpeg: conan_targets.append("CONAN_PKG::ffmpeg") tools.replace_in_file( cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/ffmpeg\")", "") tools.replace_in_file( occt_csf_cmake, "set (CSF_FFmpeg \"avcodec avformat swscale avutil\")", "set (CSF_FFmpeg \"{}\")".format(" ".join( self.deps_cpp_info["ffmpeg"].libs))) ## freeimage if self.options.with_freeimage: conan_targets.append("CONAN_PKG::freeimage") tools.replace_in_file( cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/freeimage\")", "") tools.replace_in_file( occt_csf_cmake, "set (CSF_FreeImagePlus \"freeimage\")", "set (CSF_FreeImagePlus \"{}\")".format(" ".join( self.deps_cpp_info["freeimage"].libs))) ## openvr if self.options.with_openvr: conan_targets.append("CONAN_PKG::openvr") tools.replace_in_file( cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/openvr\")", "") tools.replace_in_file( occt_csf_cmake, "set (CSF_OpenVR \"openvr_api\")", "set (CSF_OpenVR \"{}\")".format(" ".join( self.deps_cpp_info["openvr"].libs))) ## rapidjson if self.options.with_rapidjson: conan_targets.append("CONAN_PKG::rapidjson") tools.replace_in_file( cmakelists, "OCCT_INCLUDE_CMAKE_FILE (\"adm/cmake/rapidjson\")", "") ## Inject conan targets tools.replace_in_file( occt_toolkit_cmake, "${USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT}", "${{USED_EXTERNAL_LIBS_BY_CURRENT_PROJECT}} {}".format( " ".join(conan_targets))) # Do not install pdb files tools.replace_in_file( occt_toolkit_cmake, """ install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb CONFIGURATIONS Debug RelWithDebInfo DESTINATION "${INSTALL_DIR_BIN}\\${OCCT_INSTALL_BIN_LETTER}")""", "") # Honor fPIC option, compiler.cppstd and compiler.libcxx tools.replace_in_file(occt_defs_flags_cmake, "-fPIC", "") tools.replace_in_file(occt_defs_flags_cmake, "-std=c++0x", "") tools.replace_in_file(occt_defs_flags_cmake, "-std=gnu++0x", "") tools.replace_in_file(occt_defs_flags_cmake, "-stdlib=libc++", "") tools.replace_in_file(occt_csf_cmake, "set (CSF_ThreadLibs \"pthread rt stdc++\")", "set (CSF_ThreadLibs \"pthread rt\")") # No hardcoded link through #pragma tools.replace_in_file( os.path.join(self._source_subfolder, "src", "Font", "Font_FontMgr.cxx"), "#pragma comment (lib, \"freetype.lib\")", "") tools.replace_in_file( os.path.join(self._source_subfolder, "src", "Draw", "Draw.cxx"), """#pragma comment (lib, "tcl" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib") #pragma comment (lib, "tk" STRINGIZE2(TCL_MAJOR_VERSION) STRINGIZE2(TCL_MINOR_VERSION) ".lib")""", "")
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) with self._build_context(): autotools = self._configure_autotools() autotools.make(args=["V=1"])
def build(self): tools.patch(base_path=self._source_subfolder, patch_file="gtest.patch") cmake = self._configure_cmake() cmake.build()
def source(self): self.run("gclient config --spec=\"%s\"" % self._make_spec(), run_environment=True) self.run("gclient sync --no-history", run_environment=True) tools.patch(base_path=os.path.join(self._source_dir, "third_party/mini_chromium/mini_chromium"), patch_file="patches/dynamic_crt.patch")
def apply_patches(self, patchfiles): for patch in patchfiles: patchfile = os.path.join('patches', patch) tools.patch(base_path=os.path.join('sources'), patch_file=patchfile, strip=1)
def build(self): for filename in glob.glob("patches/*.patch"): self.output.info('applying patch "%s"' % filename) tools.patch(base_path=self._source_subfolder, patch_file=filename) if self._is_msvc: run_configure_icu_file = os.path.join(self._source_subfolder, 'source', 'runConfigureICU') flags = "-%s" % self.settings.compiler.runtime if self.settings.get_safe("build_type") == 'Debug': flags += " -FS" tools.replace_in_file(run_configure_icu_file, "-MDd", flags) tools.replace_in_file(run_configure_icu_file, "-MD", flags) # self._replace_pythonpath() # ICU 64.1 # self._workaround_icu_20545() # self.output.info('******************************************************************') # conans.client.build.compiler_flags.libcxx_define = libcxx_define_replacement # self.output.info('******************************************************************') self._env_build = KnuthAutoToolsBuildEnvironment(self) # self.output.info('******************************************************************') # conans.client.build.compiler_flags.libcxx_define = libcxx_define_replacement # self.output.info('******************************************************************') # self.output.info(self.settings.compiler) # self.output.info(self.settings.compiler.libcxx) # abif = conans.client.build.compiler_flags.libcxx_define(self.settings.compiler, self.settings.compiler.libcxx) # self.output.info('------------------------------------------------------------------') # self.output.info(abif) self.output.info('------------------------------------------------------------------') self.output.info(self._env_build.cxx_flags) self.output.info('------------------------------------------------------------------') # if self.options.get_safe("glibcxx_supports_cxx11_abi"): # self.output.info(self.options.glibcxx_supports_cxx11_abi) # if self.options.glibcxx_supports_cxx11_abi: # # self._env_build.cxx_flags.append('-D_GLIBCXX_USE_CXX11_ABI=1') # self._env_build.cxx_flags.insert(0, '-D_GLIBCXX_USE_CXX11_ABI=1') # else: # # self._env_build.cxx_flags.append('-D_GLIBCXX_USE_CXX11_ABI=0') # self._env_build.cxx_flags.insert(0, '-D_GLIBCXX_USE_CXX11_ABI=0') # # if float(str(self.settings.compiler.version)) >= 5: # # cxx11_abi_str = '-D_GLIBCXX_USE_CXX11_ABI=1' # # else: # # cxx11_abi_str = '-D_GLIBCXX_USE_CXX11_ABI=0' # self.output.info('------------------------------------------------------------------') # self.output.info(self._env_build.cxx_flags) # self.output.info('------------------------------------------------------------------') if not self.options.get_safe("shared"): self._env_build.defines.append("U_STATIC_IMPLEMENTATION") if tools.is_apple_os(self._the_os): self._env_build.defines.append("_DARWIN_C_SOURCE") if self.settings.get_safe("os.version"): self._env_build.flags.append(tools.apple_deployment_target_flag(self._the_os, self.settings.os.version)) build_dir = os.path.join(self.build_folder, self._source_subfolder, 'build') os.mkdir(build_dir) with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): with tools.environment_append(self._env_build.vars): with tools.chdir(build_dir): # workaround for https://unicode-org.atlassian.net/browse/ICU-20531 os.makedirs(os.path.join("data", "out", "tmp")) self.run(self._build_config_cmd, win_bash=tools.os_info.is_windows) if self._silent: silent = '--silent' if self._silent else 'VERBOSE=1' else: silent = '--silent' command = "make {silent} -j {cpu_count}".format(silent=silent, cpu_count=tools.cpu_count()) self.run(command, win_bash=tools.os_info.is_windows) if self.options.get_safe("tests"): command = "make {silent} check".format(silent=silent) self.run(command, win_bash=tools.os_info.is_windows) command = "make {silent} install".format(silent=silent) self.run(command, win_bash=tools.os_info.is_windows) self._install_name_tool() self.output.info('------------------------------------------------------------------') self.output.info(self._env_build.cxx_flags) self.output.info('------------------------------------------------------------------')
def source(self): tools.get(**self.conan_data["sources"][self.version]) for patch in self.conan_data["patches"][self.version]: tools.patch(**patch)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) if not self.options.header_only: cmake = self._configure_cmake() cmake.build()
def build(self): for patch in self.conan_data["patches"][self.version]: tools.patch(**patch) cmake = self._configure_cmake() cmake.build()
def _apply_patches(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)
def _patch_sources(self): for patch in self.conan_data["patches"][self.version]: tools.patch(**patch)
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) tools.replace_in_file( os.path.join(self._source_subfolder, "CMakeLists.txt"), "POSITION_INDEPENDENT_CODE TRUE", "")
def _patch_files(self): if self.version in self.conan_data["patches"]: for patch in self.conan_data["patches"][self.version]: tools.patch(**patch)
def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) if self._is_py3 and tools.Version(self._version_number_only) < "3.10": tools.replace_in_file( os.path.join(self._source_subfolder, "setup.py"), ":libmpdec.so.2", "mpdec") if self.settings.compiler == "Visual Studio": runtime_library = { "MT": "MultiThreaded", "MTd": "MultiThreadedDebug", "MD": "MultiThreadedDLL", "MDd": "MultiThreadedDebugDLL", }[str(self.settings.compiler.runtime)] self.output.info("Patching runtime") tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pyproject.props"), "MultiThreadedDLL", runtime_library) tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pyproject.props"), "MultiThreadedDebugDLL", runtime_library) # Remove vendored packages tools.rmdir( os.path.join(self._source_subfolder, "Modules", "_decimal", "libmpdec")) tools.rmdir(os.path.join(self._source_subfolder, "Modules", "expat")) if self.options.get_safe("with_curses", False): # FIXME: this will link to ALL libraries of ncurses. Only need to link to ncurses(w) (+ eventually tinfo) tools.replace_in_file( os.path.join(self._source_subfolder, "setup.py"), "curses_libs = ", "curses_libs = {} #".format( repr(self.deps_cpp_info["ncurses"].libs + self.deps_cpp_info["ncurses"].system_libs))) # Enable static MSVC cpython if not self.options.shared: tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pythoncore.vcxproj"), "<PreprocessorDefinitions>", "<PreprocessorDefinitions>Py_NO_BUILD_SHARED;") tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pythoncore.vcxproj"), "Py_ENABLE_SHARED", "Py_NO_ENABLE_SHARED") tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pythoncore.vcxproj"), "DynamicLibrary", "StaticLibrary") tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "python.vcxproj"), "<Link>", "<Link><AdditionalDependencies>shlwapi.lib;ws2_32.lib;pathcch.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>" ) tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "python.vcxproj"), "<PreprocessorDefinitions>", "<PreprocessorDefinitions>Py_NO_ENABLE_SHARED;") tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pythonw.vcxproj"), "<Link>", "<Link><AdditionalDependencies>shlwapi.lib;ws2_32.lib;pathcch.lib;version.lib;%(AdditionalDependencies)</AdditionalDependencies>" ) tools.replace_in_file( os.path.join(self._source_subfolder, "PCbuild", "pythonw.vcxproj"), "<ItemDefinitionGroup>", "<ItemDefinitionGroup><ClCompile><PreprocessorDefinitions>Py_NO_ENABLE_SHARED;%(PreprocessorDefinitions)</PreprocessorDefinitions></ClCompile>" )
def build(self): if self.settings.os == "Windows" and self.options.pthread_windows: self._download_windows_pthreads() source_location = os.path.join(self.source_folder, "cppTango") idl_location = os.path.join(self.source_folder, "tango-idl") os.makedirs("tango-idl/include", exist_ok=True) shutil.copy(os.path.join(idl_location, "tango.idl"), os.path.join(self.build_folder, "tango-idl/include/")) # tango seems to only support in-source builds right now copytree(source_location, self.build_folder, ignore=shutil.ignore_patterns(".git")) # Apply all patches for patch in PATCHES: self.output.info("Applying patch: {0}".format(patch)) tools.patch(patch_file=os.path.join(self.source_folder, patch)) # Disable installation of the wrong variant (shared/static) if self.settings.os == "Linux": cmake_linux = os.path.join(self.build_folder, "configure/cmake_linux.cmake") if not self.options.shared: self._cmake_comment_out( cmake_linux, 'install(TARGETS tango LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")' ) else: self._cmake_comment_out( cmake_linux, 'install(TARGETS tango-static ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}")' ) # Replace library dependencies by what conan provides if self.settings.os == "Windows": new_dependency_settings = [ 'set(OMNIORB_PKG_LIBRARIES {0})\n'.format(';'.join( self.deps_cpp_info["omniorb"].libs)), 'set(ZMQ_PKG_LIBRARIES {0})\n'.format(';'.join( self.deps_cpp_info["zmq"].libs)), 'set(PTHREAD_WIN_PKG_LIBRARIES "")\n', 'link_directories(${ZMQ_BASE}/lib)\n', ] prepend_file_with( os.path.join(self.build_folder, "configure/CMakeLists.txt"), new_dependency_settings) cmake_windows = os.path.join(self.build_folder, "configure/cmake_win.cmake") dependency_variables = [ "OMNIORB_PKG_LIBRARIES", "ZMQ_PKG_LIBRARIES", "PTHREAD_WIN_PKG_LIBRARIES" ] for dependency_suffix in ["DYN", "STA"]: for variable in dependency_variables: tools.replace_in_file( cmake_windows, '${{{1}_{0}}}'.format(dependency_suffix, variable), '${{{0}}}'.format(variable)) target = "tango" if self.options.shared else "tango-static" cmake = self._configured_cmake() cmake.build(target=target)
def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, {}): tools.patch(**patch) self._patch_clang_libcxx() cmake = self._configure_cmake() cmake.build()