From 160ab64f902803402fd3c3d621589ba92d2ef295 Mon Sep 17 00:00:00 2001 From: "Gourianov, Andrei" Date: Mon, 20 Mar 2023 13:47:24 -0400 Subject: [PATCH] v27 recipe. JIRA: CXX-12545 --- README.md | 100 ++---- conandata.yml | 12 +- conanfile.py | 499 ++++++++++++++--------------- dependencies/dependencies-0.0.yml | 229 +++++++++++++ dependencies/dependencies-27.0.yml | 229 +++++++++++++ dependencies/requirements-0.0.yml | 43 +++ dependencies/requirements-27.0.yml | 43 +++ test_package/CMakeLists.txt | 21 +- test_package/conanfile.py | 20 +- test_v1_package/CMakeLists.txt | 10 + test_v1_package/basic_sample.cpp | 100 ++++++ test_v1_package/conanfile.py | 17 + 12 files changed, 967 insertions(+), 356 deletions(-) create mode 100644 dependencies/dependencies-0.0.yml create mode 100644 dependencies/dependencies-27.0.yml create mode 100644 dependencies/requirements-0.0.yml create mode 100644 dependencies/requirements-27.0.yml create mode 100644 test_v1_package/CMakeLists.txt create mode 100644 test_v1_package/basic_sample.cpp create mode 100644 test_v1_package/conanfile.py diff --git a/README.md b/README.md index e6255e3..e617823 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,6 @@ 6. [There are few things to note.](#recipe_Notes) 7. [Data serialization support.](#recipe_Serial) 8. [NCBIptb build process management.](#recipe_NCBIptb) -9. [Recap.](#recipe_Recap) -10. [NCBI C++ Toolkit in JFrog ConanCenter.](#recipe_Center) @@ -32,7 +30,13 @@ then the Toolkit itself. It is not always clear what exactly is required. Conan' ## Preparing work environment. -First, you need Conan (and, to install Conan, you need Python). For instructions of how to install Conan, please refer to [Conan's documentation](https://docs.conan.io/en/latest/installation.html). Note that Conan evolves, recipes change. As of March 2022, you need at least version 1.43. If needed, upgrade Conan installation: +First, you need Conan (and, to install Conan, you need Python). For instructions of how to install Conan, please refer to [Conan's documentation](https://docs.conan.io/en/latest/installation.html). Note that Conan evolves, recipes change. As of March 2023, you need at least version 1.53. + +On February 22, 2023 Conan 2.0 was released. It is a major upgrade, which features new public API, new build system integration and new graph model to represent relations between packages. What is important is that it is not always backward compatible with Conan 1.X. + +The Toolkit recipe is fully compatible both with Conan 1.X and 2.0, but some of the dependent packages are not. Sure, over time, things will change and those recipes will be fixed. + +If needed, upgrade Conan installation: pip install conan --upgrade @@ -45,7 +49,7 @@ Next, check the list of Conan repositories and add *center.conan.io*: Make sure *cmake* is found in *PATH*. On MacOS and Windows this might require correcting the *PATH* environment variable. Finally. NCBI C++ Toolkit is large. Building it locally requires a lot of disk space. By default, Conan's local cache is located in user home directory, which, most likely does not have enough space. To place Conan's cache into another location, -you should define [CONAN_USER_HOME](https://docs.conan.io/en/latest/reference/env_vars.html) environment variable. +you should define [CONAN_USER_HOME](https://docs.conan.io/en/latest/reference/env_vars.html) environment variable. In Conan 2.0, one can define [CONAN_HOME](https://docs.conan.io/2/reference/environment.html) instead. Note that its meaning is different. Check the list of Conan [profiles](https://docs.conan.io/en/latest/reference/commands/misc/profile.html). Create *default* one: @@ -60,26 +64,26 @@ When using GCC on Linux, check profile and specify that [new ABI should be used] Clone this repository and export the recipe into the local Conan cache: - git clone https://github.com/ncbi/ncbi-cxx-toolkit-conan + git clone ssh://git@bitbucket.be-md.ncbi.nlm.nih.gov:9418/cxx/ncbi-cxx-toolkit-conan.git cd ncbi-cxx-toolkit-conan conan export . NCBI C++ Toolkit versions: -- 0.0.0 - most recent source code from [GitHub/master](https://github.com/ncbi/ncbi-cxx-toolkit-public/tree/master) -- 26.0.0 - Toolkit release [v26.0.0](https://github.com/ncbi/ncbi-cxx-toolkit-public/releases) +- 0.0.0 - most recent source code from [GitHub/master](https://github.com/ncbi/ncbi-cxx-toolkit-public) +- 27.0.0 - The Toolkit v27.0 from [GitHub](https://github.com/ncbi/ncbi-cxx-toolkit-public/releases/tag/release-27.0.0) ## Building your project. -Let us build [blast_demo](https://github.com/ncbi/ncbi-cxx-toolkit-public/blob/master/src/sample/app/blast/CMakeLists.blast_demo.app.txt) sample application. It requires one source file and some unknown number of the Toolkit libraries. +Let us build [blast_demo](https://bitbucket.ncbi.nlm.nih.gov/projects/CXX/repos/ncbi-cxx-toolkit-public/browse/src/sample/app/blast/CMakeLists.blast_demo.app.txt) sample application. It requires one source file and some unknown number of the Toolkit libraries. What we know for sure is that we need *blastinput* library. Copy *blast_demo.cpp* into a local directory. Next to it, create *conanfile.txt*: [requires] - ncbi-cxx-toolkit-public/26.0.0 + ncbi-cxx-toolkit-public/27.0.0 [options] ncbi-cxx-toolkit-public:with_targets=blastinput [generators] @@ -88,7 +92,7 @@ Copy *blast_demo.cpp* into a local directory. Next to it, create *conanfile.txt* and *CMakeLists.txt*: - cmake_minimum_required(VERSION 3.15) + cmake_minimum_required(VERSION 3.16) project(conanapp) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() @@ -118,12 +122,12 @@ Or, on Windows: ## Define build options. -NCBI C++ Toolkit libraries can be built as either shared or static ones. +NCBI C++ Toolkit libraries can be built as either shared or static ones. The same applies to external packages. You can request desired options in conanfile.txt. For example, the following instructs Conan to use NCBI C++ Toolkit shared libraries: [requires] - ncbi-cxx-toolkit-public/26.0.0 + ncbi-cxx-toolkit-public/27.0.0 [options] ncbi-cxx-toolkit-public:with_targets=blastinput ncbi-cxx-toolkit-public:shared=True @@ -141,16 +145,16 @@ To switch between Debug and Release build types, you can use command line when i ## Supported 3rd party packages. The Toolkit uses a number of 3-rd party packages. The following is the list of packages supported by *ncbi-cxx-toolkit-public* -Conan recipe (as of July 2021): +Conan recipe (as of March 2023): - BerkeleyDB, BZ2, CASSANDRA, EXSLT, GIF, GRPC, JPEG, LMDB, LZO, MySQL, NGHTTP2, - PCRE, PNG, PROTOBUF, SQLITE3, TIFF, XML, XSLT, UV, Z + BACKWARD, BerkeleyDB, BZ2, GIF, GRPC, JPEG, LMDB, LZO, NGHTTP2, + PCRE, PNG, PROTOBUF, SQLITE3, TIFF, XML, XSLT, UV, UNWIND, Z, ZSTD ## There are few things to note. -The whole Toolkit contains about 250 libraries. You probably do not need all of them. That is why it is highly +The whole Toolkit contains about 250 libraries. You probably do not need all of them. That is why it is recommended that you specify what exactly you need in options section of conanfile.txt. It is possible to list several libraries here using semicolon separator: @@ -165,17 +169,6 @@ library Conan will build and use 58 ones. all 250 toolkit libraries, as well as all external ones will be in that blob. This might work. The linker will figure out what exactly it needs, but it definitely will be overwhelmed. Also, it takes more time to build libraries which you do not really need. -Note that using *CONAN_LIBS* is not a requirement. It is perfectly possible to reference *blastinput* directly. Change your CMakeLists.txt to look as follows: - - cmake_minimum_required(VERSION 3.15) - project(conanapp) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - conan_basic_setup() - add_executable(blast_demo blast_demo.cpp) - target_link_libraries(blast_demo blastinput) - -This approach is better in a sense that you can drop *ncbi-cxx-toolkit-public:with_targets* setting in conanfile.txt configuration file. Yes, *CONAN_LIBS* macro will include all the libraries, but you do not use it any longer. Also, once the Toolkit installation contains all libraries, it is possible to reuse it in different projects. When you do not know exactly what does your project require, you can add libraries into the *target_link_libraries* command one by one. - ## Data serialization support. @@ -185,7 +178,7 @@ This approach is better in a sense that you can drop *ncbi-cxx-toolkit-public:wi The Toolkit contains [datatool](https://ncbi.github.io/cxx-toolkit/pages/ch_app.html#ch_app.datatool) application, which can generate C++ data storage classes from ASN.1, DTD, XML schema or JSON schema specification. These classes can then be used to [read and write data](https://ncbi.github.io/cxx-toolkit/pages/ch_ser) in ASN.1, XML or JSON format. To add code generation into a project, use *NCBI_generate_cpp* command. For example: - cmake_minimum_required(VERSION 3.15) + cmake_minimum_required(VERSION 3.16) project(conanapp) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() @@ -202,9 +195,9 @@ First two parameters to *NCBI_generate_cpp* receive lists of generated files - s First, make sure your project contains proper requirements. For example, conanfile.txt can request *protobuf* and *grpc*: [requires] - ncbi-cxx-toolkit-public/26.0.0 - protobuf/3.17.1 - grpc/1.38.0 + ncbi-cxx-toolkit-public/27.0.0 + protobuf/3.21.4 + grpc/1.50.1 Next, you can use their own mechanisms, or the same NCBI function *NCBI_generate_cpp*: @@ -227,10 +220,11 @@ NCBI C++ Toolkit includes [NCBIptb](https://ncbi.github.io/cxx-toolkit/pages/ch_ For example, *CMakeLists.txt* for [blast_demo](#recipe_Build) project might as well look like the following: - cmake_minimum_required(VERSION 3.15) + cmake_minimum_required(VERSION 3.16) project(conanapp) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() + NCBIptb_setup() NCBI_begin_app(blast_demo) NCBI_sources(blast_demo) @@ -249,7 +243,7 @@ All header files are then expected to be in *include* and its subdirectories; so In other words, your root *CMakeLists.txt* should look like this: - cmake_minimum_required(VERSION 3.15) + cmake_minimum_required(VERSION 3.16) project(conanapp) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() @@ -264,43 +258,3 @@ In case of data serialization projects, you should follow the standard *NCBIptb* NCBI_uses_toolkit_libraries(xser) NCBI_end_lib() - - - -## Recap. - -Clone this repository and export the recipe into the local Conan cache: - - git clone https://github.com/ncbi/ncbi-cxx-toolkit-conan - cd ncbi-cxx-toolkit-conan - conan export . - -Reference the package in *conanfile.txt* of your project: - - [requires] - ncbi-cxx-toolkit-public/26.0.0 - [options] - ncbi-cxx-toolkit-public:with_targets=xncbi - -Install the requirements and configure the projects - - conan install . --build missing - cmake . - - - -## NCBI C++ Toolkit in JFrog ConanCenter. -For the Toolkit recipe, it is possible to use either [JFrog ConanCenter](https://conan.io/center/ncbi-cxx-toolkit-public) or this repository. -To use *ConanCenter* recipe, **do not** clone this repository, **do not** export the recipe, and specify version 26.0.1 in project requirements (in *conanfile.txt*) - - [requires] - ncbi-cxx-toolkit-public/26.0.1 - -*ConanCenter* recipe does not support *GRPC* and *PROTOBUF* 3-rd party packages. -Note that Conan tries to reuse (download from *ConanCenter*) already existing binary packages which match your build configuration. -If for some reason the build fails, rebuild the Toolkit locally when configuring: - - conan install .. --build missing --build ncbi-cxx-toolkit-public - - - diff --git a/conandata.yml b/conandata.yml index 9d06ff1..8d0d4b7 100644 --- a/conandata.yml +++ b/conandata.yml @@ -2,12 +2,6 @@ sources: "0.0.0": git: "https://github.com/ncbi/ncbi-cxx-toolkit-public.git" branch: "master" - svn: "https://anonsvn.ncbi.nlm.nih.gov/repos/v1/trunk/c++" - "26.0.0": - url: "https://github.com/ncbi/ncbi-cxx-toolkit-public/archive/refs/tags/release-26.0.0.tar.gz" - sha256: "e0db8f3cd1bfaf1e235b3ada8d6d40c72961c5fe20d09bc7321ff8a2667d046c" - git: "https://github.com/ncbi/ncbi-cxx-toolkit-public.git" - branch: "release/26-dev" - "26.0.1": - url: "https://github.com/ncbi/ncbi-cxx-toolkit-public/archive/refs/tags/release-26.0.1.tar.gz" - sha256: "aba79da5c8d0407ffc92b7831f4f8f8a8096a15e47a016ada81b6568f9d280cc" + "27.0.0": + url: "https://github.com/ncbi/ncbi-cxx-toolkit-public/archive/refs/tags/release-27.0.0.tar.gz" + sha256: "c8fb3f99c6fce4f170b381f3a7789c76a2ff1c23c094c9852e2e3de1fdc57277" diff --git a/conanfile.py b/conanfile.py index f0c6b8b..72f65ba 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,19 +1,10 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile, conan_version +from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake, cmake_layout +from conan.errors import ConanInvalidConfiguration, ConanException +from conan import tools import os -import shutil -import subprocess -import tempfile -import sys -import stat - -def _remove_readonly(fn, path, excinfo): - try: - os.chmod(path, stat.S_IWRITE) - fn(path) - except Exception as exc: - print("Skipped: ", path, " because ", exc) +import yaml + class NcbiCxxToolkit(ConanFile): name = "ncbi-cxx-toolkit-public" @@ -25,20 +16,20 @@ class NcbiCxxToolkit(ConanFile): "genome", "genetic", "sequence", "alignment", "blast", "biological", "toolkit", "c++") settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" short_paths = False - - tk_tmp_tree = "" - tk_src_tree = "" - all_NCBI_requires = {} + tk_dependencies = None + tk_requirements = None + tk_componenttargets = set() options = { "shared": [True, False], "fPIC": [True, False], - "with_projects": "ANY", - "with_targets": "ANY", - "with_tags": "ANY", - "with_local": [True, False] + "with_projects": ["ANY"], + "with_targets": ["ANY"], + "with_tags": ["ANY"], + "with_components": ["ANY"], + "with_local": [True, False], + "with_internal": [True, False] } default_options = { "shared": False, @@ -46,85 +37,23 @@ class NcbiCxxToolkit(ConanFile): "with_projects": "", "with_targets": "", "with_tags": "", - "with_local": False - } - NCBI_to_Conan_requires = { - "BACKWARD": "backward-cpp/1.6", - "UNWIND": "libunwind/1.6.2", - "BerkeleyDB": "libdb/5.3.28", - "Boost": "boost/1.79.0", - "BZ2": "bzip2/1.0.8", - "CASSANDRA": "cassandra-cpp-driver/2.15.3", - "GIF": "giflib/5.2.1", - "GRPC": "grpc/1.43.2", - "JPEG": "libjpeg/9d", - "LMDB": "lmdb/0.9.29", - "LZO": "lzo/2.10", - "MySQL": "libmysqlclient/8.0.25", - "NGHTTP2": "libnghttp2/1.47.0", - "PCRE": "pcre/8.45", - "PNG": "libpng/1.6.37", - "PROTOBUF": "protobuf/3.20.0", - "SQLITE3": "sqlite3/3.38.1", - "TIFF": "libtiff/4.3.0", - "XML": "libxml2/2.9.13", - "XSLT": "libxslt/1.1.34", - "UV": "libuv/1.44.1", - "Z": "zlib/1.2.12", - - "OpenSSL": "openssl/1.1.1n" - } - Conan_package_options = { - "libnghttp2": { - "with_app": False, - "with_hpack": False - }, - "grpc": { - "cpp_plugin": True, - "csharp_plugin": False, - "node_plugin": False, - "objective_c_plugin": False, - "php_plugin": False, - "python_plugin": False, - "ruby_plugin": False - } + "with_components": "", + "with_local": False, + "with_internal": False } #---------------------------------------------------------------------------- - def set_version(self): - if self.version == None: - self.version = "26.0.0" - - def __del__(self): - if os.path.isdir(self.tk_tmp_tree): - print("Just a moment...") - self._remove_tmp_tree(self.tk_tmp_tree) - - def _remove_tmp_tree(self, path): - if os.path.isdir(path): - os.chdir(os.path.join(self.tk_tmp_tree, "..")) - try: - shutil.rmtree(path, onerror=_remove_readonly) - except: - print("Cannot remove directory: ", path) - print("Please remove it manually") +# def set_version(self): +# if self.version == None: +# self.version = "0.0.0" -#---------------------------------------------------------------------------- - def _get_RequiresMapKeys(self): - return self.NCBI_to_Conan_requires.keys() - -#---------------------------------------------------------------------------- - def _translate_ReqKey(self, key): - if key in self.NCBI_to_Conan_requires.keys(): -#ATTENTION - if (key == "BACKWARD" or key == "UNWIND") and (self.settings.os == "Windows" or self.settings.os == "Macos"): - return None - if key == "BerkeleyDB" and self.settings.os == "Windows": - return None - if key == "CASSANDRA" and (self.settings.os == "Windows" or self.settings.os == "Macos"): - return None - return self.NCBI_to_Conan_requires[key] - return None + def export(self): + tools.files.copy(self, self._dependencies_filename, + os.path.join(self.recipe_folder, self._dependencies_folder), + os.path.join(self.export_folder, self._dependencies_folder)) + tools.files.copy(self, self._requirements_filename, + os.path.join(self.recipe_folder, self._dependencies_folder), + os.path.join(self.export_folder, self._dependencies_folder)) #---------------------------------------------------------------------------- @property @@ -132,83 +61,74 @@ def _source_subfolder(self): return "src" @property - def _build_subfolder(self): -#ATTENTION: v26 does not support "build_subfolder" - return "b" if tools.Version(self.version).major != "26" else "." + def _dependencies_folder(self): + return "dependencies" - def _get_Source(self): - self.tk_tmp_tree = tempfile.mkdtemp(dir=os.getcwd()) - src = os.path.normpath(os.path.join(self.recipe_folder, "..", "source", self._source_subfolder)) - src_found = False; - if os.path.isdir(src): - self.tk_src_tree = src - src_found = True; - else: - print("getting Toolkit sources...") - tk_url = self.conan_data["sources"][self.version]["url"] if "url" in self.conan_data["sources"][self.version].keys() else "" - tk_git = self.conan_data["sources"][self.version]["git"] if "git" in self.conan_data["sources"][self.version].keys() else "" - tk_branch = self.conan_data["sources"][self.version]["branch"] if "branch" in self.conan_data["sources"][self.version].keys() else "master" - tk_svn = self.conan_data["sources"][self.version]["svn"] if "svn" in self.conan_data["sources"][self.version].keys() else "" - - if tk_url != "": - print("from url: " + tk_url) - curdir = os.getcwd() - os.chdir(self.tk_tmp_tree) - tools.get(tk_url, strip_root = True) - os.chdir(curdir) - src_found = True; + @property + def _dependencies_filename(self): + return "dependencies-{}.{}.yml".format(tools.scm.Version(self.version).major, tools.scm.Version(self.version).minor) + + @property + def _requirements_filename(self): + return "requirements-{}.{}.yml".format(tools.scm.Version(self.version).major, tools.scm.Version(self.version).minor) - if not src_found and tk_git != "": - print("from git: " + tk_git + "/" + tk_branch) - try: - git = tools.Git(self.tk_tmp_tree) - git.clone(tk_git, branch = tk_branch, args = "--single-branch", shallow = True) - src_found = True; - except Exception: - print("git failed") - - if not src_found and tk_svn != "": - print("from svn: " + tk_svn) - try: - svn = tools.SVN(self.tk_tmp_tree) - svn.checkout(tk_svn) - src_found = True; - except Exception: - print("svn failed") - - if not src_found: - raise ConanException("Failed to find the Toolkit sources") - self.tk_src_tree = os.path.join(self.tk_tmp_tree, self._source_subfolder) + @property + def _tk_dependencies(self): + if self.tk_dependencies is None: + dependencies_filepath = os.path.join(self.recipe_folder, self._dependencies_folder, self._dependencies_filename) + if not os.path.isfile(dependencies_filepath): + raise ConanException("Cannot find {}".format(dependencies_filepath)) + self.tk_dependencies = yaml.safe_load(open(dependencies_filepath)) + return self.tk_dependencies + + @property + def _tk_requirements(self): + if self.tk_requirements is None: + requirements_filepath = os.path.join(self.recipe_folder, self._dependencies_folder, self._requirements_filename) + if not os.path.isfile(requirements_filepath): + raise ConanException("Cannot find {}".format(requirements_filepath)) + self.tk_requirements = yaml.safe_load(open(requirements_filepath)) + return self.tk_requirements #---------------------------------------------------------------------------- - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["NCBI_PTBCFG_PACKAGING"] = "TRUE" - if self.options.shared: - cmake.definitions["NCBI_PTBCFG_ALLOW_COMPOSITE"] = "TRUE" - cmake.definitions["NCBI_PTBCFG_PROJECT_LIST"] = str(self.options.with_projects) + ";-app/netcache" - if self.options.with_targets != "": - cmake.definitions["NCBI_PTBCFG_PROJECT_TARGETS"] = self.options.with_targets - if self.options.with_tags != "": - cmake.definitions["NCBI_PTBCFG_PROJECT_TAGS"] = self.options.with_tags - if self.options.with_local: - cmake.definitions["NCBI_PTBCFG_USELOCAL"] = "TRUE" - if self.settings.compiler == "Visual Studio": - cmake.definitions["CMAKE_CONFIGURATION_TYPES"] = self.settings.build_type - return cmake + def _translate_req(self, key): + if "Boost" in key: + key = "Boost" + if key in self._tk_requirements["disabled"].keys(): + if self.settings.os in self._tk_requirements["disabled"][key]: + return None + if self.options.with_internal: + if key in self._tk_requirements["internal-requirements"].keys(): + return self._tk_requirements["internal-requirements"][key] + if key in self._tk_requirements["requirements"].keys(): + return self._tk_requirements["requirements"][key] + return None + + def _parse_option(self, data): + _res = set() + if data != "": + _data = str(data) + _data = _data.replace(",", ";") + _data = _data.replace(" ", ";") + _res.update(_data.split(";")) + if "" in _res: + _res.remove("") + return _res #---------------------------------------------------------------------------- def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + tools.build.check_min_cppstd(self, 17) if self.settings.os not in ["Linux", "Macos", "Windows"]: raise ConanInvalidConfiguration("This operating system is not supported") - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "16": - raise ConanInvalidConfiguration("This version of Visual Studio is not supported") - if self.settings.compiler == "Visual Studio" and self.options.shared and "MT" in self.settings.compiler.runtime: - raise ConanInvalidConfiguration("This configuration is not supported") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "7": + if tools.microsoft.is_msvc(self): + tools.microsoft.check_min_vs(self, "190") + if self.options.shared and tools.microsoft.is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("This configuration is not supported") + if self.settings.compiler == "gcc" and tools.scm.Version(self.settings.compiler.version) < "7": raise ConanInvalidConfiguration("This version of GCC is not supported") + if tools.build.cross_building(self): + raise ConanInvalidConfiguration("Cross compilation is not supported") def config_options(self): if self.settings.os == "Windows": @@ -216,115 +136,194 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if "options" in self._tk_requirements.keys(): + for pkg in self._tk_requirements["options"]: + dest = vars(self.options[pkg + "*"])["_dict" if conan_version.major == "1" else "_data"] + options = self._tk_requirements["options"][pkg] + for opt in options.keys(): + dest[opt] = options[opt] + + def layout(self): + cmake_layout(self) + self.folders.source = self._source_subfolder #---------------------------------------------------------------------------- - def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - self.build_requires("{}/{}".format(self.name, self.version)) +# def build_requirements(self): +# if cross_building(self): +# self.tool_requires("{}/{}".format(self.name, self.version)) def requirements(self): - if not self.version in self.conan_data["sources"].keys(): - raise ConanException("Invalid Toolkit version requested. Available: " + ' '.join(self.conan_data["sources"].keys())) - self.output.info("Analyzing requirements. Please wait...") - curdir = os.getcwd() - self._get_Source() - os.chdir(self.tk_tmp_tree) - shared = "ON" if self.options.shared else "OFF" - subprocess.run(["cmake", self.tk_src_tree, - "-DNCBI_PTBCFG_COLLECT_REQUIRES=ON", - "-DNCBI_PTBCFG_COLLECT_REQUIRES_FILE=req", - "-DBUILD_SHARED_LIBS='%s'" % shared, - "-DNCBI_PTBCFG_PROJECT_TARGETS='%s'" % self.options.with_targets, - "-DNCBI_PTBCFG_PROJECT_LIST='%s'" % self.options.with_projects, - "-DNCBI_PTBCFG_PROJECT_TAGS='%s'" % self.options.with_tags], - stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL) - reqfile = os.path.join(self.tk_src_tree, "..", "req") - if os.path.isfile(reqfile): - self.all_NCBI_requires = set(open(reqfile).read().split()) - for req in self.all_NCBI_requires: - if "Boost" in req: - req = "Boost" - pkg = self._translate_ReqKey(req) - if pkg is not None: + _alltargets = self._parse_option(self.options.with_targets) + _required_components = set() + for _t in _alltargets: + for _component in self._tk_dependencies["components"]: + _libraries = self._tk_dependencies["libraries"][_component] + if _t in _libraries: + _required_components.add(_component) + break + + _allcomponents = self._parse_option(self.options.with_components) + _required_components.update(_allcomponents) + + if len(_required_components) > 0: + _todo = _required_components.copy() + _required_components.clear() + _next = set() + while len(_todo) > 0: + for _component in _todo: + if not _component in _required_components: + _required_components.add(_component) + if _component in self._tk_dependencies["dependencies"].keys(): + for _n in self._tk_dependencies["dependencies"][_component]: + if not _n in _required_components: + _next.add(_n) + _todo = _next.copy() + _next.clear() + + if len(_required_components) == 0: + _required_components.update( self._tk_dependencies["components"]) + else: + for component in _required_components: + self.tk_componenttargets.update(self._tk_dependencies["libraries"][component]) + + requirements = set() + for component in _required_components: + libraries = self._tk_dependencies["libraries"][component] + for lib in libraries: + if lib in self._tk_dependencies["requirements"].keys(): + requirements.update(self._tk_dependencies["requirements"][lib]) + + for req in requirements: + pkgs = self._translate_req(req) + if pkgs is not None: + for pkg in pkgs: print("Package requires ", pkg) self.requires(pkg) - pkg = pkg[:pkg.find("/")] -#ATTENTION - if req == "MySQL": - self.requires(self._translate_ReqKey("OpenSSL")) - if req == "CASSANDRA": - self.requires(self._translate_ReqKey("OpenSSL")) - if pkg == "libnghttp2": - self.options[pkg].with_app = False - self.options[pkg].with_hpack = False - if pkg == "grpc": - self.options[pkg].cpp_plugin = True - self.options[pkg].csharp_plugin = False - self.options[pkg].node_plugin = False - self.options[pkg].objective_c_plugin = False - self.options[pkg].php_plugin = False - self.options[pkg].python_plugin = False - self.options[pkg].ruby_plugin = False - os.remove(reqfile) - os.chdir(curdir) #---------------------------------------------------------------------------- def source(self): - if self.tk_tmp_tree == "": - self._get_Source() - shutil.move(os.path.join(self.tk_tmp_tree, "include"), ".") - shutil.move(os.path.join(self.tk_tmp_tree, self._source_subfolder), ".") - if os.path.isdir(os.path.join(self.tk_tmp_tree, "scripts")): - shutil.move(os.path.join(self.tk_tmp_tree, "scripts"), ".") - if os.path.isdir(os.path.join(self.tk_tmp_tree, "doc")): - shutil.move(os.path.join(self.tk_tmp_tree, "doc"), ".") - self._remove_tmp_tree(self.tk_tmp_tree) + src_found = False; + print("getting Toolkit sources...") + tk_url = self.conan_data["sources"][self.version]["url"] if "url" in self.conan_data["sources"][self.version].keys() else "" + tk_git = self.conan_data["sources"][self.version]["git"] if "git" in self.conan_data["sources"][self.version].keys() else "" + tk_branch = self.conan_data["sources"][self.version]["branch"] if "branch" in self.conan_data["sources"][self.version].keys() else "main" + + if tk_url != "": + print("from url: " + tk_url) + tools.files.get(self, tk_url, strip_root = True) + src_found = True; + + if not src_found and tk_git != "": + print("from git: " + tk_git + "/" + tk_branch) + try: + git = tools.scm.Git(self) + git.clone(tk_git, target = ".", args = ["--single-branch", "--branch", tk_branch, "--depth", "1"]) + src_found = True; + except Exception: + print("git failed") + + if not src_found: + raise ConanException("Failed to find the Toolkit sources") + root = os.path.join(os.getcwd(), "CMakeLists.txt") + with open(root, "w") as f: + f.write("cmake_minimum_required(VERSION 3.15)\n") + f.write("project(ncbi-cpp)\n") + f.write("include(src/build-system/cmake/CMake.NCBItoolkit.cmake)\n") + f.write("add_subdirectory(src)\n") + +#---------------------------------------------------------------------------- + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NCBI_PTBCFG_PACKAGING"] = True + if self.options.shared: + tc.variables["NCBI_PTBCFG_ALLOW_COMPOSITE"] = True + tc.variables["NCBI_PTBCFG_PROJECT_LIST"] = str(self.options.with_projects) + ";-app/netcache" + if self.options.with_targets != "": + tc.variables["NCBI_PTBCFG_PROJECT_TARGETS"] = self.options.with_targets + if len(self.tk_componenttargets) != 0: + tc.variables["NCBI_PTBCFG_PROJECT_COMPONENTTARGETS"] = ";".join(self.tk_componenttargets) + tc.variables["NCBI_PTBCFG_PROJECT_TAGS"] = str(self.options.with_tags) + ";-test;-demo;-sample" + if self.options.with_local: + tc.variables["NCBI_PTBCFG_USELOCAL"] = True + if tools.microsoft.is_msvc(self): + tc.variables["NCBI_PTBCFG_CONFIGURATION_TYPES"] = self.settings.build_type + tc.generate() + cmdep = CMakeDeps(self) + cmdep.generate() #---------------------------------------------------------------------------- def build(self): - cmake = self._configure_cmake() - cmake.configure(source_folder=self._source_subfolder, build_folder = self._build_subfolder) + cmake = CMake(self) + cmake.configure() # Visual Studio sometimes runs "out of heap space" - if self.settings.compiler == "Visual Studio": + if tools.microsoft.is_msvc(self): cmake.parallel = False cmake.build() #---------------------------------------------------------------------------- def package(self): - cmake = self._configure_cmake() - cmake.install(build_dir = self._build_subfolder) - -# def imports(self): -# self.copy("license*", dst="licenses", folder=True, ignore_case=True) + cmake = CMake(self) + cmake.install() #---------------------------------------------------------------------------- def package_info(self): + impfile = os.path.join(self.package_folder, "res", "ncbi-cpp-toolkit.imports") + allexports = set(open(impfile).read().split()) + absent = [] + for component in self._tk_dependencies["components"]: + c_libs = [] + libraries = self._tk_dependencies["libraries"][component] + for lib in libraries: + if lib in allexports: + c_libs.append(lib) + if len(c_libs) == 0 and not len(libraries) == 0: + absent.append(component) + for component in self._tk_dependencies["components"]: + c_libs = [] + c_reqs = [] + n_reqs = set() + c_deps = self._tk_dependencies["dependencies"][component] + for c in c_deps: + if c in absent: + c_deps.remove(c) + c_reqs.extend(c_deps) + libraries = self._tk_dependencies["libraries"][component] + for lib in libraries: + if lib in allexports: + c_libs.append(lib) + if lib in self._tk_dependencies["requirements"].keys(): + n_reqs.update(self._tk_dependencies["requirements"][lib]) + for req in n_reqs: + pkgs = self._translate_req(req) + if pkgs is not None: + for pkg in pkgs: + pkg = pkg[:pkg.find("/")] + ref = pkg + "::" + pkg + c_reqs.append(ref) + if not len(c_libs) == 0 or (len(libraries) == 0 and not len(c_reqs) == 0): + self.cpp_info.components[component].libs = c_libs + self.cpp_info.components[component].requires = c_reqs - self.cpp_info.includedirs = ["include"] - self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == "Windows": - self.cpp_info.system_libs = ["ws2_32", "dbghelp"] - elif self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "rt", "m", "pthread", "resolv"] - elif self.settings.os == "Macos": - self.cpp_info.system_libs = ["dl", "c", "m", "pthread", "resolv"] -#---------------------------------------------------------------------------- - if self.settings.os == "Windows": - self.cpp_info.defines.append("_UNICODE") - self.cpp_info.defines.append("_CRT_SECURE_NO_WARNINGS=1") + self.cpp_info.components["core"].defines.append("_UNICODE") + self.cpp_info.components["core"].defines.append("_CRT_SECURE_NO_WARNINGS=1") else: - self.cpp_info.defines.append("_MT") - self.cpp_info.defines.append("_REENTRANT") - self.cpp_info.defines.append("_THREAD_SAFE") - self.cpp_info.defines.append("_LARGEFILE_SOURCE") - self.cpp_info.defines.append("_LARGEFILE64_SOURCE") - self.cpp_info.defines.append("_FILE_OFFSET_BITS=64") + self.cpp_info.components["core"].defines.append("_MT") + self.cpp_info.components["core"].defines.append("_REENTRANT") + self.cpp_info.components["core"].defines.append("_THREAD_SAFE") + self.cpp_info.components["core"].defines.append("_FILE_OFFSET_BITS=64") if self.options.shared: - self.cpp_info.defines.append("NCBI_DLL_BUILD") + self.cpp_info.components["core"].defines.append("NCBI_DLL_BUILD") if self.settings.build_type == "Debug": - self.cpp_info.defines.append("_DEBUG") + self.cpp_info.components["core"].defines.append("_DEBUG") else: - self.cpp_info.defines.append("NDEBUG") - self.cpp_info.builddirs.append("res") - self.cpp_info.build_modules = ["res/build-system/cmake/CMake.NCBIpkg.conan.cmake"] + self.cpp_info.components["core"].defines.append("NDEBUG") + if self.settings.os == "Windows": + self.cpp_info.components["core"].system_libs = ["ws2_32", "dbghelp"] + elif self.settings.os == "Linux": + self.cpp_info.components["core"].system_libs = ["dl", "rt", "m", "pthread", "resolv"] + elif self.settings.os == "Macos": + self.cpp_info.components["core"].system_libs = ["dl", "c", "m", "pthread", "resolv"] + self.cpp_info.components["core"].builddirs.append("res") + self.cpp_info.components["core"].build_modules = ["res/build-system/cmake/CMake.NCBIpkg.conan.cmake"] diff --git a/dependencies/dependencies-0.0.yml b/dependencies/dependencies-0.0.yml new file mode 100644 index 0000000..5165ed3 --- /dev/null +++ b/dependencies/dependencies-0.0.yml @@ -0,0 +1,229 @@ +version: 0.0 +#---------------------------------------------------------------------------- +components: + - algo + - algo-ms + - algo-structure + - align-format + - bamread + - blast + - core + - dbapi + - eutils + - grpc + - image + - loader-asncache + - loader-bam + - loader-blastdb + - loader-cdd + - loader-genbank + - loader-lds2 + - loader-snp + - loader-sra + - loader-wgs + - loaders + - objects + - psg-client + - seqext + - sqlitewrapp + - sraread + - xmlwrapp + - web +#---------------------------------------------------------------------------- +libraries: + algo: ["ncbi_algo", + "cobalt","phytree_format","prosplign","proteinkmer","xalgoalignsplign", + "xalgocontig_assembly","xprimer","xalgoalignnw","xalgoalignutil", + "xblastformat","xblast","xalgoblastdbindex","xalgodustmask", + "xalgoseqqa","xalgognomon","xalgophytree","xalgosegmask", + "xalgoseq","xalgotext","xalgowinmask","composition_adjustment", + "fastme","utrtprof" + ] + algo-ms: ["ncbi_algo_ms", + "xomssa","omssa","pepXML" + ] + algo-structure: + ["ncbi_algo_structure", + "xbma_refiner","xcd_utils","xstruct_util","xstruct_dp","xstruct_thread" + ] + align-format: + ["xalntool", + "ncbi_align_format", + "align_format" + ] + bamread: ["bamread"] + blast: ["xngalign", "igblast", + "vdb2blast", "blast_sra_input", + "ncbi_blastinput", + "blastinput", + "xmergetree", + "xalgoblastdbindex_search", + "gumbelparams" + ] + core: ["xconnext", + "ncbi_core", + "xconnserv","xcompress","xthrserv","sequtil","xconnect", + "xdiff","xqueryparse","xregexp","xser","xutil","tables","xncbi", + "xxconnect2" + ] + dbapi: ["sdbapi", + "ncbi_xdbapi_ftds","ncbi_xdbapi_ftds100", + "ct_ftds100","tds_ftds100", + "ncbi_dbapi", + "dbapi", + "dbapi_util_blobstore", + "ncbi_dbapi_driver", + "dbapi_driver" + ] + eutils: ["eutils_client", + "ncbi_eutils", + "eutils", "egquery", "ehistory", "einfo", "elink", + "epost", "esearch", "espell", "esummary", + "linkout", "uilist" + ] + grpc: ["grpc_integration"] + image: ["ncbi_image", + "ximage" + ] + loader-asncache: + [ + "ncbi_xloader_asn_cache", + "asn_cache", + "ncbi_xcache_bdb", + "ncbi_bdb", + "bdb" + ] + loader-bam: ["ncbi_xloader_bam"] + loader-blastdb: + ["ncbi_xloader_blastdb_rmt", + "ncbi_xloader_blastdb" + ] + loader-cdd: + ["ncbi_xloader_cdd", + "cdd_access" + ] + loader-genbank: + [ + "ncbi_xobjsimple", + "xobjsimple", + "ncbi_xloader_genbank", + "ncbi_xreader_cache", + "ncbi_xreader_gicache", + "ncbi_xreader_id1", + "ncbi_xreader_id2", + "ncbi_xreader_pubseqos", + "ncbi_xreader_pubseqos2", + "ncbi_xreader", + "eMyNCBI_result" + ] + loader-lds2: + ["ncbi_xloader_lds2", + "ncbi_lds2", + "lds2" + ] + loader-snp: ["ncbi_xloader_snp", "dbsnp_ptis"] + loader-sra: ["ncbi_xloader_sra", "ncbi_xloader_csra"] + loader-wgs: ["ncbi_xloader_vdbgraph", "ncbi_xloader_wgs"] + loaders: ["xflatfile", + "data_loaders_util", + "ncbi_xloader_patcher" + ] + objects: ["searchbyrsid", + "ncbi_trackmgr", + "gbproj","trackmgrcli","trackmgr", + "ncbi_mmdb", + "ncbimime","cdd","cn3d","mmdb", + "pcassay2", + "ncbi_misc", + "proj","pcassay","pcsubstance","entrez2cli","biotree", + "access","docsum","entrez2","entrezgene","featdef","gbseq", + "genesbyloc","insdseq","mim","objcoords","objprt","remapcli", + "remap","tinyseq", + "macro", + "gencoll_client", + "homologene", + "local_taxon", + "ncbi_seq", + "blastdb","genome_collection","xnetblastcli","xnetblast","scoremat", + "seqtest","taxon1","taxon3","variation","seqset","seq","seqedit","submit", + "blastxml","blastxml2","seqcode", + "ncbi_pub", + "mlacli","mla","medlars","pub","pubmed","medline","biblio", + "ncbi_general", + "generalasn", + "efetch" + ] + psg-client: ["psg_client", + "psg_protobuf" + ] + seqext: ["gene_info_writer", + "ncbi_validator", + "xvalidate", + "ncbi_xdiscrepancy", + "xdiscrepancy", + "ncbi_seqext", + "blast_services","blastdb_format","gene_info","id1cli","id1","id2cli","id2", + "id2_split","writedb","seqdb","seqmasks_io","seqsplit","snputil","uudutil", + "valerr","valid","variation_utils","xformat","xalnmgr","xcleanup", + "xobjedit","xobjreadex","xobjwrite","xobjread","xlogging","xobjimport", + "xobjmanip","xunittestutil","xobjutil","xobjmgr", + ] + sqlitewrapp: ["sqlitewrapp"] + sraread: ["sraread"] + xmlwrapp: ["xmlreaders", + "xmlwrapp" + ] + web: ["xsoap_server", "xsoap", + "ncbi_web", + "xcgi_redirect","xcgi","xhtml", "xfcgi" + ] +#---------------------------------------------------------------------------- +requirements: + bamread: ["VDB"] + bdb: ["BerkeleyDB"] + blast_sra_input: ["VDB"] + dbsnp_ptis: ["GRPC", "PROTOBUF"] + grpc_integration: ["GRPC", "PROTOBUF"] + psg_protobuf: ["GRPC", "PROTOBUF"] + seqdb: ["LMDB"] + sqlitewrapp: ["SQLITE3"] + sraread: ["VDB"] + vdb2blast: ["VDB"] + writedb: ["LMDB"] + xcompress: ["Z", "BZ2", "LZO", "ZSTD"] + xregexp: ["PCRE"] + ximage: ["Z", "JPEG", "PNG", "GIF", "TIFF"] + xmlwrapp: ["XML", "XSLT"] + xncbi: ["BACKWARD", "UNWIND"] + xxconnect2: ["UV", "NGHTTP2"] + xfcgi: ["FASTCGI"] +#---------------------------------------------------------------------------- +dependencies: + algo: ["align-format","sqlitewrapp"] + algo-ms: ["algo"] + algo-structure: ["algo","objects"] + align-format: ["loader-genbank", "web"] + bamread: ["objects"] + blast: ["loader-blastdb", "algo", "sraread"] + core: [] + dbapi: ["core"] + eutils: ["objects","xmlwrapp"] + grpc: ["core"] + image: ["core"] + loader-asncache: ["seqext"] + loader-bam: ["bamread", "seqext"] + loader-blastdb: ["seqext"] + loader-cdd: ["seqext"] + loader-genbank: ["psg-client", "dbapi"] + loader-lds2: ["seqext", "sqlitewrapp"] + loader-snp: ["sraread", "grpc"] + loader-sra: ["sraread"] + loader-wgs: ["sraread"] + loaders: ["loader-asncache", "loader-blastdb", "loader-genbank", "loader-lds2"] + objects: ["sqlitewrapp","core"] + psg-client: ["seqext"] + seqext: ["eutils", "objects"] + sqlitewrapp: ["core"] + sraread: ["seqext"] + xmlwrapp: ["core"] + web: ["core"] diff --git a/dependencies/dependencies-27.0.yml b/dependencies/dependencies-27.0.yml new file mode 100644 index 0000000..d90b228 --- /dev/null +++ b/dependencies/dependencies-27.0.yml @@ -0,0 +1,229 @@ +version: 27.0 +#---------------------------------------------------------------------------- +components: + - algo + - algo-ms + - algo-structure + - align-format + - bamread + - blast + - core + - dbapi + - eutils + - grpc + - image + - loader-asncache + - loader-bam + - loader-blastdb + - loader-cdd + - loader-genbank + - loader-lds2 + - loader-snp + - loader-sra + - loader-wgs + - loaders + - objects + - psg-client + - seqext + - sqlitewrapp + - sraread + - xmlwrapp + - web +#---------------------------------------------------------------------------- +libraries: + algo: ["ncbi_algo", + "cobalt","phytree_format","prosplign","proteinkmer","xalgoalignsplign", + "xalgocontig_assembly","xprimer","xalgoalignnw","xalgoalignutil", + "xblastformat","xblast","xalgoblastdbindex","xalgodustmask", + "xalgoseqqa","xalgognomon","xalgophytree","xalgosegmask", + "xalgoseq","xalgotext","xalgowinmask","composition_adjustment", + "fastme","utrtprof" + ] + algo-ms: ["ncbi_algo_ms", + "xomssa","omssa","pepXML" + ] + algo-structure: + ["ncbi_algo_structure", + "xbma_refiner","xcd_utils","xstruct_util","xstruct_dp","xstruct_thread" + ] + align-format: + ["xalntool", + "ncbi_align_format", + "align_format" + ] + bamread: ["bamread"] + blast: ["xngalign", "igblast", + "vdb2blast", "blast_sra_input", + "ncbi_blastinput", + "blastinput", + "xmergetree", + "xalgoblastdbindex_search", + "gumbelparams" + ] + core: ["xconnext", + "ncbi_core", + "xconnserv","xcompress","xthrserv","sequtil","xconnect", + "xdiff","xqueryparse","xregexp","xser","xutil","tables","xncbi", + "xxconnect2" + ] + dbapi: ["sdbapi", + "ncbi_xdbapi_ftds","ncbi_xdbapi_ftds100", + "ct_ftds100","tds_ftds100", + "ncbi_dbapi", + "dbapi", + "dbapi_util_blobstore", + "ncbi_dbapi_driver", + "dbapi_driver" + ] + eutils: ["eutils_client", + "ncbi_eutils", + "eutils", "egquery", "ehistory", "einfo", "elink", + "epost", "esearch", "espell", "esummary", + "linkout", "uilist" + ] + grpc: ["grpc_integration"] + image: ["ncbi_image", + "ximage" + ] + loader-asncache: + [ + "ncbi_xloader_asn_cache", + "asn_cache", + "ncbi_xcache_bdb", + "ncbi_bdb", + "bdb" + ] + loader-bam: ["ncbi_xloader_bam"] + loader-blastdb: + ["ncbi_xloader_blastdb_rmt", + "ncbi_xloader_blastdb" + ] + loader-cdd: + ["ncbi_xloader_cdd", + "cdd_access" + ] + loader-genbank: + [ + "ncbi_xobjsimple", + "xobjsimple", + "ncbi_xloader_genbank", + "ncbi_xreader_cache", + "ncbi_xreader_gicache", + "ncbi_xreader_id1", + "ncbi_xreader_id2", + "ncbi_xreader_pubseqos", + "ncbi_xreader_pubseqos2", + "ncbi_xreader", + "eMyNCBI_result" + ] + loader-lds2: + ["ncbi_xloader_lds2", + "ncbi_lds2", + "lds2" + ] + loader-snp: ["ncbi_xloader_snp", "dbsnp_ptis"] + loader-sra: ["ncbi_xloader_sra", "ncbi_xloader_csra"] + loader-wgs: ["ncbi_xloader_vdbgraph", "ncbi_xloader_wgs"] + loaders: ["xflatfile", + "data_loaders_util", + "ncbi_xloader_patcher" + ] + objects: ["searchbyrsid", + "ncbi_trackmgr", + "gbproj","trackmgrcli","trackmgr", + "ncbi_mmdb", + "ncbimime","cdd","cn3d","mmdb", + "pcassay2", + "ncbi_misc", + "proj","pcassay","pcsubstance","entrez2cli","biotree", + "access","docsum","entrez2","entrezgene","featdef","gbseq", + "genesbyloc","insdseq","mim","objcoords","objprt","remapcli", + "remap","tinyseq", + "macro", + "gencoll_client", + "homologene", + "local_taxon", + "ncbi_seq", + "blastdb","genome_collection","xnetblastcli","xnetblast","scoremat", + "seqtest","taxon1","taxon3","variation","seqset","seq","seqedit","submit", + "blastxml","blastxml2","seqcode", + "ncbi_pub", + "mlacli","mla","medlars","pub","pubmed","medline","biblio", + "ncbi_general", + "generalasn", + "efetch" + ] + psg-client: ["psg_client", + "psg_protobuf" + ] + seqext: ["gene_info_writer", + "ncbi_validator", + "xvalidate", + "ncbi_xdiscrepancy", + "xdiscrepancy", + "ncbi_seqext", + "blast_services","blastdb_format","gene_info","id1cli","id1","id2cli","id2", + "id2_split","writedb","seqdb","seqmasks_io","seqsplit","snputil","uudutil", + "valerr","valid","variation_utils","xformat","xalnmgr","xcleanup", + "xobjedit","xobjreadex","xobjwrite","xobjread","xlogging","xobjimport", + "xobjmanip","xunittestutil","xobjutil","xobjmgr", + ] + sqlitewrapp: ["sqlitewrapp"] + sraread: ["sraread"] + xmlwrapp: ["xmlreaders", + "xmlwrapp" + ] + web: ["xsoap_server", "xsoap", + "ncbi_web", + "xcgi_redirect","xcgi","xhtml", "xfcgi" + ] +#---------------------------------------------------------------------------- +requirements: + bamread: ["VDB"] + bdb: ["BerkeleyDB"] + blast_sra_input: ["VDB"] + dbsnp_ptis: ["GRPC", "PROTOBUF"] + grpc_integration: ["GRPC", "PROTOBUF"] + psg_protobuf: ["GRPC", "PROTOBUF"] + seqdb: ["LMDB"] + sqlitewrapp: ["SQLITE3"] + sraread: ["VDB"] + vdb2blast: ["VDB"] + writedb: ["LMDB"] + xcompress: ["Z", "BZ2", "LZO", "ZSTD"] + xregexp: ["PCRE"] + ximage: ["Z", "JPEG", "PNG", "GIF", "TIFF"] + xmlwrapp: ["XML", "XSLT"] + xncbi: ["BACKWARD", "UNWIND"] + xxconnect2: ["UV", "NGHTTP2"] + xfcgi: ["FASTCGI"] +#---------------------------------------------------------------------------- +dependencies: + algo: ["align-format","sqlitewrapp"] + algo-ms: ["algo"] + algo-structure: ["algo","objects"] + align-format: ["loader-genbank", "web"] + bamread: ["objects"] + blast: ["loader-blastdb", "algo", "sraread"] + core: [] + dbapi: ["core"] + eutils: ["objects","xmlwrapp"] + grpc: ["core"] + image: ["core"] + loader-asncache: ["seqext"] + loader-bam: ["bamread", "seqext"] + loader-blastdb: ["seqext"] + loader-cdd: ["seqext"] + loader-genbank: ["psg-client", "dbapi"] + loader-lds2: ["seqext", "sqlitewrapp"] + loader-snp: ["sraread", "grpc"] + loader-sra: ["sraread"] + loader-wgs: ["sraread"] + loaders: ["loader-asncache", "loader-blastdb", "loader-genbank", "loader-lds2"] + objects: ["sqlitewrapp","core"] + psg-client: ["seqext"] + seqext: ["eutils", "objects"] + sqlitewrapp: ["core"] + sraread: ["seqext"] + xmlwrapp: ["core"] + web: ["core"] diff --git a/dependencies/requirements-0.0.yml b/dependencies/requirements-0.0.yml new file mode 100644 index 0000000..019bd32 --- /dev/null +++ b/dependencies/requirements-0.0.yml @@ -0,0 +1,43 @@ +version: 0.0 +#---------------------------------------------------------------------------- +requirements: + BACKWARD: ["backward-cpp/1.6"] + UNWIND: ["libunwind/1.6.2"] + BerkeleyDB: ["libdb/5.3.28"] + BZ2: ["bzip2/1.0.8"] + GIF: ["giflib/5.2.1"] + GRPC: ["grpc/1.50.1"] + JPEG: ["libjpeg/9e"] + LMDB: ["lmdb/0.9.29"] + LZO: ["lzo/2.10"] + NGHTTP2: ["libnghttp2/1.51.0"] + PCRE: ["pcre/8.45"] + PNG: ["libpng/1.6.39"] + PROTOBUF: ["protobuf/3.21.9"] + SQLITE3: ["sqlite3/3.41.1"] + TIFF: ["libtiff/4.4.0"] + XML: ["libxml2/2.10.3"] + XSLT: ["libxslt/1.1.34"] + UV: ["libuv/1.44.2"] + Z: ["zlib/1.2.13"] + ZSTD: ["zstd/1.5.4"] + +internal-requirements: + FASTCGI: ["ncbi-fastcgi/2.4.2"] + VDB: ["ncbi-vdb/3.0.1"] + +disabled: + BACKWARD: ["Windows", "Macos"] + UNWIND: ["Windows", "Macos"] + BerkeleyDB: ["Windows"] + FASTCGI: ["Windows", "Macos"] + +options: + grpc: + cpp_plugin: True + csharp_plugin: False + node_plugin: False + objective_c_plugin: False + php_plugin: False + python_plugin: False + ruby_plugin: False diff --git a/dependencies/requirements-27.0.yml b/dependencies/requirements-27.0.yml new file mode 100644 index 0000000..c01d7c1 --- /dev/null +++ b/dependencies/requirements-27.0.yml @@ -0,0 +1,43 @@ +version: 27.0 +#---------------------------------------------------------------------------- +requirements: + BACKWARD: ["backward-cpp/1.6"] + UNWIND: ["libunwind/1.6.2"] + BerkeleyDB: ["libdb/5.3.28"] + BZ2: ["bzip2/1.0.8"] + GIF: ["giflib/5.2.1"] + GRPC: ["grpc/1.50.1"] + JPEG: ["libjpeg/9e"] + LMDB: ["lmdb/0.9.29"] + LZO: ["lzo/2.10"] + NGHTTP2: ["libnghttp2/1.51.0"] + PCRE: ["pcre/8.45"] + PNG: ["libpng/1.6.39"] + PROTOBUF: ["protobuf/3.21.9"] + SQLITE3: ["sqlite3/3.41.1"] + TIFF: ["libtiff/4.4.0"] + XML: ["libxml2/2.10.3"] + XSLT: ["libxslt/1.1.34"] + UV: ["libuv/1.44.2"] + Z: ["zlib/1.2.13"] + ZSTD: ["zstd/1.5.4"] + +internal-requirements: + FASTCGI: ["ncbi-fastcgi/2.4.2"] + VDB: ["ncbi-vdb/3.0.1"] + +disabled: + BACKWARD: ["Windows", "Macos"] + UNWIND: ["Windows", "Macos"] + BerkeleyDB: ["Windows"] + FASTCGI: ["Windows", "Macos"] + +options: + grpc: + cpp_plugin: True + csharp_plugin: False + node_plugin: False + objective_c_plugin: False + php_plugin: False + python_plugin: False + ruby_plugin: False diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 4f04141..2dd502a 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -1,18 +1,7 @@ -cmake_minimum_required(VERSION 3.9) +cmake_minimum_required(VERSION 3.16) project(PackageTest) +set(PackageName ncbi-cxx-toolkit-public) -set(CMAKE_CXX_STANDARD 17) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() -# the following is not working in the toolkit v26 -#conan_basic_setup(TARGETS) -find_package(ncbi-cxx-toolkit-public REQUIRED) - -NCBI_begin_app(basic_sample) - NCBI_sources(basic_sample) - NCBI_uses_toolkit_libraries(xncbi) -NCBI_end_app() - -add_executable(basic_sample2 basic_sample.cpp) -target_link_libraries(basic_sample2 ${CONAN_LIBS}) - +find_package(${PackageName} REQUIRED) +add_executable(basic_sample basic_sample.cpp) +target_link_libraries(basic_sample ${PackageName}::${PackageName}) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index b5f66c6..ef86afd 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -1,11 +1,17 @@ import os - -from conans import ConanFile, CMake, tools - +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import cross_building class NcbiCxxToolkitTest(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,7 +19,5 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "basic_sample"), run_environment=True) - self.run(os.path.join("bin", "basic_sample2"), run_environment=True) - + if not cross_building(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "basic_sample"), env="conanrun") diff --git a/test_v1_package/CMakeLists.txt b/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000..1d43c91 --- /dev/null +++ b/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.16) +project(PackageTest) +set(PackageName ncbi-cxx-toolkit-public) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +find_package(${PackageName} REQUIRED) + +add_executable(basic_sample basic_sample.cpp) +target_link_libraries(basic_sample ${PackageName}::${PackageName}) diff --git a/test_v1_package/basic_sample.cpp b/test_v1_package/basic_sample.cpp new file mode 100644 index 0000000..9a54b22 --- /dev/null +++ b/test_v1_package/basic_sample.cpp @@ -0,0 +1,100 @@ +/* + * =========================================================================== + * + * PUBLIC DOMAIN NOTICE + * National Center for Biotechnology Information + * + * This software/database is a "United States Government Work" under the + * terms of the United States Copyright Act. It was written as part of + * the author's official duties as a United States Government employee and + * thus cannot be copyrighted. This software/database is freely available + * to the public for use. The National Library of Medicine and the U.S. + * Government have not placed any restriction on its use or reproduction. + * + * Although all reasonable efforts have been taken to ensure the accuracy + * and reliability of the software and data, the NLM and the U.S. + * Government do not and cannot warrant the performance or results that + * may be obtained by using this software or data. The NLM and the U.S. + * Government disclaim all warranties, express or implied, including + * warranties of performance, merchantability or fitness for any particular + * purpose. + * + * Please cite the author in any work or product based on this material. + * + * =========================================================================== + * + * File Description: + * Minimalistic application + * + */ + +#include +#include +#include +#include + +USING_NCBI_SCOPE; + + +///////////////////////////////////////////////////////////////////////////// +// CSampleBasicApplication:: + +class CSampleBasicApplication : public CNcbiApplication +{ +private: + virtual void Init(void); + virtual int Run(void); + virtual void Exit(void); +}; + + +///////////////////////////////////////////////////////////////////////////// +// Init test for all different types of arguments + +void CSampleBasicApplication::Init(void) +{ + // // Set error posting and tracing on maximum + // SetDiagTrace(eDT_Enable); + // SetDiagPostFlag(eDPF_All); + // SetDiagPostLevel(eDiag_Info); + + // Create command-line argument descriptions class + unique_ptr arg_desc(new CArgDescriptions); + + // Specify USAGE context + arg_desc->SetUsageContext(GetArguments().GetProgramBasename(), + "Basic sample demo program"); + // Setup arg.descriptions for this application + SetupArgDescriptions(arg_desc.release()); +} + + +///////////////////////////////////////////////////////////////////////////// +// Run test (printout arguments obtained from command-line) + +int CSampleBasicApplication::Run(void) +{ + cout << "NCBI C++ Toolkit ready" << endl; + return 0; +} + + +///////////////////////////////////////////////////////////////////////////// +// Cleanup + +void CSampleBasicApplication::Exit(void) +{ + // Do your after-Run() cleanup here +} + + +///////////////////////////////////////////////////////////////////////////// +// MAIN + +int NcbiSys_main(int argc, ncbi::TXChar* argv[]) +{ + // Execute main application function; change argument list to + // (argc, argv, 0, eDS_Default, 0) if there's no point in trying + // to look for an application-specific configuration file. + return CSampleBasicApplication().AppMain(argc, argv); +} diff --git a/test_v1_package/conanfile.py b/test_v1_package/conanfile.py new file mode 100644 index 0000000..1c86f7a --- /dev/null +++ b/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class NcbiCxxToolkitTest(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "basic_sample"), run_environment=True) +