pyncbitk-runtime 29.6.0.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. pyncbitk_runtime-29.6.0.0a1/CMakeLists.txt +31 -0
  2. pyncbitk_runtime-29.6.0.0a1/CMakeUserPresets.json +9 -0
  3. pyncbitk_runtime-29.6.0.0a1/COPYING +21 -0
  4. pyncbitk_runtime-29.6.0.0a1/PKG-INFO +52 -0
  5. pyncbitk_runtime-29.6.0.0a1/README.md +7 -0
  6. pyncbitk_runtime-29.6.0.0a1/conanfile.txt +13 -0
  7. pyncbitk_runtime-29.6.0.0a1/deployer.py +58 -0
  8. pyncbitk_runtime-29.6.0.0a1/pyproject.toml +81 -0
  9. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/README.md +368 -0
  10. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/conandata.yml +81 -0
  11. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/conanfile.py +368 -0
  12. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/dependencies-0.0.yml +242 -0
  13. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/dependencies-27.0.yml +229 -0
  14. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/dependencies-28.0.yml +230 -0
  15. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/dependencies-29.0.yml +243 -0
  16. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/requirements-0.0.yml +31 -0
  17. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/requirements-27.0.yml +28 -0
  18. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/requirements-28.0.yml +27 -0
  19. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/dependencies/requirements-29.0.yml +31 -0
  20. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/patches/27.0.0-compiler.patch +11 -0
  21. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/patches/27.0.0-definitions.patch +11 -0
  22. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/patches/27.0.0-install.patch +15 -0
  23. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/patches/29.0.0-ncbiptb.patch +11 -0
  24. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/test_package/CMakeLists.txt +7 -0
  25. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/test_package/basic_sample.cpp +100 -0
  26. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/test_package/conanfile.py +24 -0
  27. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/test_v1_package/CMakeLists.txt +8 -0
  28. pyncbitk_runtime-29.6.0.0a1/vendor/ncbi-cxx-toolkit-conan/test_v1_package/conanfile.py +19 -0
@@ -0,0 +1,31 @@
1
+ cmake_minimum_required(VERSION 3.20)
2
+
3
+ if(DEFINED SKBUILD_PROJECT_NAME)
4
+ project(${SKBUILD_PROJECT_NAME} VERSION ${SKBUILD_PROJECT_VERSION})
5
+ else()
6
+ project(pyncbitk-runtime)
7
+ endif()
8
+
9
+ enable_language(C)
10
+ enable_language(CXX)
11
+
12
+ set(BUILD_SHARED_LIBS OFF)
13
+ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
14
+
15
+ # Detect required NCBI C++ Toolkit libraries
16
+ #find_package(PCRE REQUIRED)
17
+ #find_package(lzo REQUIRED)
18
+ #find_package(libunwind REQUIRED)
19
+ #find_package(ncbi-cxx-toolkit-public COMPONENTS algo core seqext REQUIRED)
20
+
21
+ # Configure Toolkit build
22
+ set(NCBI_WITHOUT_MT ON)
23
+
24
+ # Install all dependencies into `pyncbitk-runtime` wheel
25
+ if("${SKBUILD_STATE}" STREQUAL "wheel")
26
+ execute_process(
27
+ COMMAND conan install ${CMAKE_SOURCE_DIR}
28
+ -nr --deployer deployer
29
+ --deployer-folder "${SKBUILD_PLATLIB_DIR}/${SKBUILD_PROJECT_NAME}"
30
+ -s compiler.cppstd=20)
31
+ endif()
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 4,
3
+ "vendor": {
4
+ "conan": {}
5
+ },
6
+ "include": [
7
+ "build/Release/generators/CMakePresets.json"
8
+ ]
9
+ }
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Martin Larralde <martin.larralde@embl.de>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,52 @@
1
+ Metadata-Version: 2.2
2
+ Name: pyncbitk-runtime
3
+ Version: 29.6.0.0a1
4
+ Summary: Runtime component of the NCBI C++ Toolkit to use in PyNCBItk.
5
+ Keywords: bioinformatics,blast,sequence,alignment,ncbi
6
+ Author-Email: Martin Larralde <martin.larralde@embl.de>
7
+ License: MIT License
8
+
9
+ Copyright (c) 2024 Martin Larralde <martin.larralde@embl.de>
10
+
11
+ Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions:
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
28
+
29
+ Classifier: Development Status :: 3 - Alpha
30
+ Classifier: Intended Audience :: Developers
31
+ Classifier: Intended Audience :: Science/Research
32
+ Classifier: License :: OSI Approved :: MIT License
33
+ Classifier: Operating System :: OS Independent
34
+ Classifier: Programming Language :: C++
35
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
36
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
37
+ Project-URL: Documentation, https://pyncbitk.readthedocs.io/en/stable/
38
+ Project-URL: Bug Tracker, https://github.com/althonos/pyncbitk/issues
39
+ Project-URL: Changelog, https://github.com/althonos/pyncbitk/blob/master/CHANGELOG.md
40
+ Project-URL: Coverage, https://codecov.io/gh/althonos/pyncbitk/
41
+ Project-URL: Builds, https://github.com/althonos/pyncbitk/actions
42
+ Project-URL: PyPI, https://pypi.org/project/pyncbitk
43
+ Requires-Python: >=3.7
44
+ Description-Content-Type: text/markdown
45
+
46
+ # 🧬🧰 PyNCBItk [![Stars](https://img.shields.io/github/stars/althonos/pyncbitk.svg?style=social&maxAge=3600&label=Star)](https://github.com/althonos/pyncbitk/stargazers)
47
+
48
+ *(Unofficial) [Cython](https://cython.org/) bindings and Python interface to the [NCBI C++ Toolkit](https://www.ncbi.nlm.nih.gov/toolkit).*
49
+
50
+ This package contains the runtime components of PyNCBItk to allow reusing them
51
+ across versions of the Cython bindings without having to rebuild. See
52
+ [`pyncbitk`](https://pypi.org/project/pyncbitk) for more information.
@@ -0,0 +1,7 @@
1
+ # 🧬🧰 PyNCBItk [![Stars](https://img.shields.io/github/stars/althonos/pyncbitk.svg?style=social&maxAge=3600&label=Star)](https://github.com/althonos/pyncbitk/stargazers)
2
+
3
+ *(Unofficial) [Cython](https://cython.org/) bindings and Python interface to the [NCBI C++ Toolkit](https://www.ncbi.nlm.nih.gov/toolkit).*
4
+
5
+ This package contains the runtime components of PyNCBItk to allow reusing them
6
+ across versions of the Cython bindings without having to rebuild. See
7
+ [`pyncbitk`](https://pypi.org/project/pyncbitk) for more information.
@@ -0,0 +1,13 @@
1
+ [requires]
2
+ ncbi-cxx-toolkit-public/29.6.0
3
+ libiconv/1.17
4
+ [options]
5
+ ncbi-cxx-toolkit-public/*:with_components=algo;core;objects;seqext;loaders
6
+ ncbi-cxx-toolkit-public/*:without_req=BerkeleyDB;GRPC
7
+ ncbi-cxx-toolkit-public/*:shared=True
8
+ [layout]
9
+ cmake_layout
10
+ [generators]
11
+ CMakeDeps
12
+ CMakeToolchain
13
+ VirtualRunEnv
@@ -0,0 +1,58 @@
1
+ import filecmp
2
+ import os
3
+ import glob
4
+ import shutil
5
+ import fnmatch
6
+
7
+ from conan.internal.cache.home_paths import HomePaths
8
+ from conan.api.output import ConanOutput
9
+ from conan.internal.loader import load_python_file
10
+ from conan.internal.errors import conanfile_exception_formatter
11
+ from conan.errors import ConanException
12
+ from conan.internal.util.files import rmdir, mkdir
13
+
14
+
15
+ def _deploy_single(dep, conanfile, output_folder, folder_name):
16
+ new_folder = os.path.join(output_folder, folder_name)
17
+ rmdir(new_folder)
18
+ symlinks = conanfile.conf.get("tools.deployer:symlinks", check_type=bool, default=True)
19
+ try:
20
+ shutil.copytree(dep.package_folder, new_folder, symlinks=symlinks)
21
+ if os.path.exists(os.path.join(new_folder, "bin")):
22
+ shutil.rmtree(os.path.join(new_folder, "bin"))
23
+ except Exception as e:
24
+ if "WinError 1314" in str(e):
25
+ ConanOutput().error("full_deploy: Symlinks in Windows require admin privileges "
26
+ "or 'Developer mode = ON'", error_type="exception")
27
+ raise ConanException(f"full_deploy: The copy of '{dep}' files failed: {e}.\nYou can "
28
+ f"use 'tools.deployer:symlinks' conf to disable symlinks")
29
+ dep.set_deploy_folder(new_folder)
30
+
31
+ config_file = os.path.join(output_folder, f"{dep.ref.name}-config.cmake")
32
+ libfiles = glob.glob(os.path.join(new_folder, "lib", "*"))
33
+ libs = " ".join(
34
+ f"${{CMAKE_CURRENT_LIST_DIR}}/{folder_name}/lib/{os.path.basename(libfile)}"
35
+ for libfile in libfiles
36
+ )
37
+
38
+ with open(config_file, "w") as dst:
39
+ dst.write(f"set({dep.ref.name}_INCLUDE_DIRS ${{CMAKE_CURRENT_LIST_DIR}}/{folder_name}/include)\n")
40
+ dst.write(f"set({dep.ref.name}_LIBRARIES {libs})\n")
41
+
42
+
43
+
44
+
45
+ def deploy(graph, output_folder, **kwargs):
46
+ conanfile = graph.root.conanfile
47
+ for dep in conanfile.dependencies.values():
48
+ if dep.package_folder is None:
49
+ continue
50
+ folder_name = dep.ref.name #os.path.join("full_deploy", dep.context, dep.ref.name, str(dep.ref.version))
51
+ build_type = dep.info.settings.get_safe("build_type")
52
+ arch = dep.info.settings.get_safe("arch")
53
+ #if build_type:
54
+ # folder_name = os.path.join(folder_name, build_type)
55
+ #if arch:
56
+ # folder_name = os.path.join(folder_name, arch)
57
+ #print("install dep:", dep)
58
+ _deploy_single(dep, conanfile, output_folder, folder_name)
@@ -0,0 +1,81 @@
1
+ [build-system]
2
+ build-backend = "scikit_build_core_conan.build"
3
+ requires = [
4
+ "scikit-build-core-conan==0.7.1 ; python_version <= '3.8'",
5
+ "scikit-build-core-conan>=0.8.0 ; python_version > '3.8'",
6
+ "cython >=3.0"
7
+ ]
8
+
9
+ [project]
10
+ name = "pyncbitk-runtime"
11
+ version = "29.6.0.0-alpha.1"
12
+ description = "Runtime component of the NCBI C++ Toolkit to use in PyNCBItk."
13
+ readme = "README.md"
14
+ requires-python = ">=3.7"
15
+ license = { file = "COPYING" }
16
+ authors = [
17
+ { name = "Martin Larralde", email = "martin.larralde@embl.de" },
18
+ ]
19
+ keywords = ["bioinformatics", "blast", "sequence", "alignment", "ncbi"]
20
+ classifiers = [
21
+ "Development Status :: 3 - Alpha",
22
+ "Intended Audience :: Developers",
23
+ "Intended Audience :: Science/Research",
24
+ "License :: OSI Approved :: MIT License",
25
+ "Operating System :: OS Independent",
26
+ "Programming Language :: C++",
27
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
28
+ "Topic :: Scientific/Engineering :: Medical Science Apps.",
29
+ ]
30
+
31
+ [project.urls]
32
+ "Documentation" = "https://pyncbitk.readthedocs.io/en/stable/"
33
+ "Bug Tracker" = "https://github.com/althonos/pyncbitk/issues"
34
+ "Changelog" = "https://github.com/althonos/pyncbitk/blob/master/CHANGELOG.md"
35
+ "Coverage" = "https://codecov.io/gh/althonos/pyncbitk/"
36
+ "Builds" = "https://github.com/althonos/pyncbitk/actions"
37
+ "PyPI" = "https://pypi.org/project/pyncbitk"
38
+
39
+ [tool.scikit-build-core-conan]
40
+ path = "."
41
+ build = "missing"
42
+ output-folder = "."
43
+ config = ["tools.cmake.cmaketoolchain:generator=Ninja"]
44
+ settings = ["compiler.cppstd=20"]
45
+
46
+ [[tool.scikit-build-core-conan.local-recipes]]
47
+ path = "vendor/ncbi-cxx-toolkit-conan"
48
+ name = "ncbi-cxx-toolkit-public"
49
+ version = "29.6.0"
50
+
51
+ [tool.scikit-build]
52
+ build-dir = "build/{build_type}"
53
+ wheel.py-api = "py3"
54
+ cmake.build-type = "Release"
55
+
56
+ [[tool.scikit-build-overrides]]
57
+ if.env.SCCACHE = true
58
+ cmake.define.CMAKE_C_COMPILER_LAUNCHER = "sccache"
59
+ cmake.define.CMAKE_CXX_COMPILER_LAUNCHER = "sccache"
60
+
61
+ [[tool.scikit-build-overrides]]
62
+ if.env.MOLD = true
63
+ cmake.define.CMAKE_LINKER_TYPE = "mold"
64
+
65
+ [tool.cibuildwheel]
66
+ build-frontend = { name = "build", args = [] }
67
+ build-verbosity = 1
68
+ manylinux-x86_64-image = "althonos/pyncbitk-manylinux_2_34:release"
69
+
70
+ [tool.cibuildwheel.macos]
71
+ archs = ["x86_64", "arm64"]
72
+ repair-wheel-command = "cp {wheel} {dest_dir}"
73
+
74
+ [tool.cibuildwheel.macos.environment]
75
+ CC = "/usr/bin/clang"
76
+ CXX = "/usr/bin/clang++"
77
+ MACOSX_DEPLOYMENT_TARGET = "13.3"
78
+
79
+ [tool.cibuildwheel.linux]
80
+ repair-wheel-command = "auditwheel repair -w {dest_dir} {wheel} --strip --zip-compression-level 9"
81
+
@@ -0,0 +1,368 @@
1
+ # NCBI C++ Toolkit package recipe
2
+
3
+ 1. [What is Conan and why you might need it?](#recipe_Conan)
4
+ 2. [Preparing work environment.](#recipe_Env)
5
+ 3. [Building your project.](#recipe_Build)
6
+ 4. [Define build options.](#recipe_Options)
7
+ 5. [Semantic components of the Toolkit.](#recipe_Components)
8
+ 6. [Supported 3rd party packages.](#recipe_Other)
9
+ 7. [Data serialization support.](#recipe_Serial)
10
+ 8. [NCBIptb build process management.](#recipe_NCBIptb)
11
+
12
+
13
+ <a name="recipe_Conan"></a>
14
+ ## What is Conan and why you might need it?
15
+
16
+ [Conan](https://docs.conan.io/2/) is an Open Source package manager for C and C++ development,
17
+ allowing development teams to easily and efficiently
18
+ manage their packages and dependencies across platforms and build systems. Conan can manage any number of different
19
+ binaries for different build configurations, including different architectures, compilers, compiler versions, runtimes,
20
+ C++ standard library, etc. When binaries are not available for one configuration, they can be built from sources on-demand.
21
+
22
+ When using NCBI C++ Toolkit at NCBI, there is good chance you do not need Conan.
23
+ Different versions of Toolkit libraries and applications are readily available, as well as a long list of third party libraries.
24
+ Still, there is always a chance you need something special. Conan might be the answer.
25
+
26
+ Using NCBI C++ Toolkit outside of NCBI is much more tricky. You need to download and build certain third party libraries,
27
+ then the Toolkit itself. It is not always clear what exactly is required. Conan's help might be very useful in this scenario.
28
+
29
+
30
+ <a name="recipe_Env"></a>
31
+ ## Preparing work environment.
32
+
33
+ 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/2/installation.html).
34
+
35
+ 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.
36
+
37
+ The Toolkit recipe is fully compatible both with Conan 1.X and 2.X. We strongly recommend using Conan2.
38
+
39
+ Install Conan:
40
+
41
+ pip install conan
42
+
43
+ or, to install a specific version:
44
+
45
+ pip install conan==2.13.0
46
+
47
+ If needed, upgrade Conan installation:
48
+
49
+ pip install conan --upgrade
50
+
51
+ Next, check the list of Conan repositories and add *center.conan.io*:
52
+
53
+ $ conan remote add conancenter https://center2.conan.io
54
+ $ conan remote list
55
+ conancenter: https://center2.conan.io [Verify SSL: True]
56
+
57
+ Make sure *cmake* is found in *PATH*. On MacOS and Windows this might require correcting the *PATH* environment variable.
58
+ Finally. NCBI C++ Toolkit is large. Building it locally requires a lot of disk space. By default, Conan's local cache is located
59
+ in user home directory, which, most likely does not have enough space. To place Conan's cache into another location,
60
+ you should define [CONAN_HOME](https://docs.conan.io/2/reference/environment.html) environment variable.
61
+
62
+ Check the list of Conan [profiles](https://docs.conan.io/2/reference/commands/profile.html). Create *default* one:
63
+
64
+ conan profile list
65
+ conan profile detect
66
+ conan profile show
67
+
68
+ Profiles can only be edited manually. Find profile location:
69
+
70
+ conan profile path default
71
+
72
+ Clone this repository and export the recipe into the local Conan cache:
73
+
74
+ git clone https://github.com/ncbi/ncbi-cxx-toolkit-conan.git
75
+ cd ncbi-cxx-toolkit-conan
76
+ conan export . --version 29.0.0
77
+
78
+ Please check *conandata.yml* file in this repository for the list of existing NCBI C++ Toolkit versions.
79
+
80
+
81
+ <a name="recipe_Build"></a>
82
+ ## Building your project.
83
+
84
+ 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.
85
+ It requires one source file and some unknown number of the Toolkit libraries.
86
+ What we know for sure is that we need *blastinput* library.
87
+
88
+ Copy *blast_demo.cpp* into a local directory. Next to it, create [*conanfile.py*](https://docs.conan.io/2/reference/conanfile.html):
89
+
90
+ from conan import ConanFile
91
+ from conan.tools.cmake import cmake_layout
92
+ class NCBIapp(ConanFile):
93
+ settings = "os", "compiler", "build_type", "arch"
94
+ generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
95
+ def requirements(self):
96
+ self.requires("ncbi-cxx-toolkit-public/[>=29]")
97
+ def layout(self):
98
+ cmake_layout(self, src_folder=".")
99
+
100
+ It is also possible to use [*conanfile.txt*](https://docs.conan.io/2/reference/conanfile_txt.html) - a simplified version of *conanfile.py*:
101
+
102
+ [requires]
103
+ ncbi-cxx-toolkit-public/29.0.0
104
+ [layout]
105
+ cmake_layout
106
+ [generators]
107
+ CMakeDeps
108
+ CMakeToolchain
109
+ VirtualRunEnv
110
+
111
+ It is difficult to say what is better, but *conanfile.py* definitely provides greater
112
+ [flexibility](https://docs.conan.io/2/tutorial/consuming_packages/the_flexibility_of_conanfile_py.html)
113
+
114
+ Add *CMakeLists.txt* (*blastinput* library is included into *blast* [component](#recipe_Components)):
115
+
116
+ cmake_minimum_required(VERSION 3.16)
117
+ project(conanapp)
118
+ set(ncbitk ncbi-cxx-toolkit-public)
119
+ find_package(${ncbitk} REQUIRED)
120
+ add_executable(blast_demo blast_demo.cpp)
121
+ target_link_libraries(blast_demo ${ncbitk}::blast)
122
+
123
+ Install build requirements, in the source directory run
124
+
125
+ conan install . --build missing -s build_type=Release
126
+
127
+ In the source directory, [*CMakeToolchain*](https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html)
128
+ generates [*CMakeUserPresets.json*](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html).
129
+ To list available presets, run
130
+
131
+ cmake --list-presets
132
+
133
+ Run cmake to [configure](https://cmake.org/cmake/help/latest/manual/cmake.1.html#generate-a-project-buildsystem)
134
+ the build (*conan-release* is the name of the preset):
135
+
136
+ cmake --preset conan-release
137
+
138
+ and finally, [build](https://cmake.org/cmake/help/latest/manual/cmake.1.html#build-a-project):
139
+
140
+ cmake --build --preset conan-release
141
+
142
+
143
+ <a name="recipe_Options"></a>
144
+ ## Define build options.
145
+
146
+ NCBI C++ Toolkit libraries can be built as either shared or static ones. The same applies to external packages.
147
+ The recommended way is to specify that in [*conan install*](https://docs.conan.io/2/reference/commands/install.html) command,
148
+ or in [Conan profiles](https://docs.conan.io/2/reference/commands/profile.html).
149
+ For example, the following instructs Conan to use NCBI C++ Toolkit shared libraries:
150
+
151
+ conan install . --build missing -s build_type=Release -o ncbi-cxx-toolkit-public/*:shared=True
152
+
153
+ To configure Debug build, use *build_type* settings:
154
+
155
+ conan install . --build missing -s build_type=Debug
156
+ cmake --preset conan-debug
157
+ cmake --build --preset conan-debug
158
+
159
+ Normally, defining build flags (compilation and linking) is the responsibility of the user.
160
+ Still, it is possible to request the Toolkit to set flags which were used by the Toolkit itself - by
161
+ setting *NCBI_PTBCFG_NCBI_BUILD_FLAGS* variable before finding the package:
162
+
163
+ set(NCBI_PTBCFG_NCBI_BUILD_FLAGS ON)
164
+ find_package(ncbi-cxx-toolkit-core REQUIRED)
165
+
166
+ In this case, it is also possible to request additional customizations by defining
167
+ [*compilation features*](https://ncbi.github.io/cxx-toolkit/pages/ch_cmconfig#ch_cmconfig._Configure), for example:
168
+
169
+ set(NCBI_PTBCFG_NCBI_BUILD_FLAGS ON)
170
+ set(NCBI_PTBCFG_PROJECT_FEATURES MaxDebug)
171
+ find_package(ncbi-cxx-toolkit-core REQUIRED)
172
+
173
+ Yet another option is using CTest framework provided by the Toolkit. Define *NCBI_PTBCFG_ADDTEST* variable:
174
+
175
+ set(NCBI_PTBCFG_ADDTEST ON)
176
+ find_package(ncbi-cxx-toolkit-core REQUIRED)
177
+
178
+
179
+ <a name="recipe_Components"></a>
180
+ ## Semantic components of the Toolkit.
181
+
182
+ The whole Toolkit contains about 220 libraries. No application will ever need all of them. There are a couple of options in the Toolkit recipe to limit the number.
183
+
184
+ *ncbi-cxx-toolkit-public:with_targets* specifies the required libraries. There is no need to list all of them, because the dependent ones will be added automatically.
185
+ In the *blast_demo* example above, we request *blastinput* only. The build system then builds and uses 58 libraries.
186
+
187
+ *ncbi-cxx-toolkit-public:with_components* lists required semantic components. Each component is a set of libraries that share a common or related purpose.
188
+ Components are then defined as CMake [Imported Libraries](https://cmake.org/cmake/help/latest/command/add_library.html#imported-libraries), and it is possible to
189
+ use them in *target_link_libraries* directives. For example, *CMakeLists.txt* for *blast_demo* application could look like this:
190
+
191
+ cmake_minimum_required(VERSION 3.16)
192
+ project(conanapp)
193
+ set(ncbitk ncbi-cxx-toolkit-public)
194
+ find_package(${ncbitk} REQUIRED)
195
+ add_executable(blast_demo blast_demo.cpp)
196
+ target_link_libraries(blast_demo ${ncbitk}::blast)
197
+
198
+ Here is the list of the Toolkit components:
199
+
200
+ |Component|Libraries|
201
+ |-----------|----------|
202
+ |algo| cobalt composition_adjustment fastme phytree_format prosplign proteinkmer utrtprof xalgoalignnw xalgoalignsplign xalgoalignutil xalgoblastdbindex xalgocontig_assembly xalgodustmask xalgognomon xalgophytree xalgosegmask xalgoseq xalgoseqqa xalgotext xalgowinmask xblast xblastformat xid_mapper xprimer|
203
+ |algo-ms| omssa pepXML xomssa|
204
+ |algo-structure| xbma_refiner xcd_utils xstruct_dp xstruct_thread xstruct_util|
205
+ |align-format| align_format xalntool|
206
+ |bamread| bamread|
207
+ |blast| blast_sra_input blastinput gumbelparams igblast vdb2blast xalgoblastdbindex_search xmergetree xngalign|
208
+ |core| sequtil tables xalgovmerge xcompress xconnect xconnext xconnserv xdiff xncbi xqueryparse xregexp xser xthrserv xutil xxconnect2 zcf|
209
+ |dbapi| ct_ftds14 dbapi dbapi_driver dbapi_util_blobstore ncbi_xdbapi_ftds ncbi_xdbapi_ftds14 sdbapi tds_ftds14|
210
+ |eutils| egquery ehistory einfo elink epost esearch espell esummary eutils eutils_client linkout uilist|
211
+ |grpc| grpc_integration|
212
+ |image| ximage|
213
+ |loader-asncache| asn_cache bdb ncbi_xcache_bdb ncbi_xloader_asn_cache|
214
+ |loader-bam| ncbi_xloader_bam|
215
+ |loader-blastdb| ncbi_xloader_blastdb ncbi_xloader_blastdb_rmt|
216
+ |loader-cdd| cdd_access ncbi_xloader_cdd|
217
+ |loader-genbank| eMyNCBI_result ncbi_xloader_genbank ncbi_xreader ncbi_xreader_cache ncbi_xreader_gicache ncbi_xreader_id1 ncbi_xreader_id2 ncbi_xreader_pubseqos ncbi_xreader_pubseqos2 xobjsimple|
218
+ |loader-lds2| lds2 ncbi_xloader_lds2|
219
+ |loader-snp| dbsnp_ptis ncbi_xloader_snp|
220
+ |loader-sra| ncbi_xloader_csra ncbi_xloader_sra|
221
+ |loader-wgs| ncbi_xloader_vdbgraph ncbi_xloader_wgs|
222
+ |loaders| data_loaders_util ncbi_xloader_patcher xflatfile|
223
+ |objects| access biblio biotree blastdb blastxml blastxml2 cdd cn3d docsum efetch entrez2 entrez2cli entrezgene featdef gbproj gbseq gencoll_client generalasn genesbyloc genome_collection homologene insdseq local_taxon macro medlars medline mim mmdb ncbimime objcoords objprt pcassay pcassay2 pcsubstance proj pub pubmed remap remapcli scoremat searchbyrsid seq seqcode seqedit seqset seqtest submit taxon1 taxon3 tinyseq trackmgr trackmgrcli variation xnetblast xnetblastcli|
224
+ |psg-client| psg_client psg_protobuf|
225
+ |seqext| blast_services blastdb_format id1 id1cli id2 id2_split id2cli seqdb seqmasks_io seqsplit snputil uudutil valerr valid variation_utils writedb xalnmgr xcleanupxdiscrepancy xformat xhugeasn xlogging xobjedit xobjimport xobjmanip xobjmgr xobjread xobjreadex xobjutil xobjwrite xunittestutil xvalidate|
226
+ |sqlitewrapp| sqlitewrapp|
227
+ |sraread| sraread srareadx|
228
+ |xmlwrapp| xmlreaders xmlwrapp|
229
+ |web| ncbi_web xcgi xcgi_redirect xhtml xsoap xsoap_server|
230
+
231
+
232
+ <a name="recipe_Other"></a>
233
+ ## Supported 3rd party packages.
234
+
235
+ The Toolkit uses a number of 3-rd party packages. In the Toolkit code they are known by their aliases.
236
+ The following is the list of packages supported by *ncbi-cxx-toolkit-public* Conan recipe, as of October 2024:
237
+
238
+ |Alias|Conan package|
239
+ |--------|------------|
240
+ |BACKWARD|backward-cpp|
241
+ |BerkeleyDB|libdb|
242
+ |BZ2|bzip2|
243
+ |GIF|giflib|
244
+ |GRPC|grpc|
245
+ |JPEG|libjpeg|
246
+ |LMDB|lmdb|
247
+ |LZO|lzo|
248
+ |NGHTTP2|libnghttp2|
249
+ |PCRE|pcre|
250
+ |PNG|libpng|
251
+ |PROTOBUF|protobuf|
252
+ |SQLITE3|sqlite3|
253
+ |TIFF|libtiff|
254
+ |UNWIND|libunwind|
255
+ |UV|libuv|
256
+ |XML|libxml2|
257
+ |XSLT|libxslt|
258
+ |Z|zlib|
259
+ |ZSTD|zstd|
260
+
261
+
262
+ These packages are available for download from [*conancenter*](https://conan.io/center) repository.
263
+
264
+
265
+ <a name="recipe_Serial"></a>
266
+ ## Data serialization support.
267
+
268
+ ### Datatool.
269
+
270
+ 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.
271
+ To add code generation into a project, use *NCBI_generate_cpp* command. For example:
272
+
273
+ cmake_minimum_required(VERSION 3.16)
274
+ project(conanapp)
275
+ find_package(ncbi-cxx-toolkit-public REQUIRED)
276
+ NCBI_generate_cpp(GEN_SOURCES GEN_HEADERS sample.asn)
277
+ add_executable(asn_demo asn_demo.cpp ${GEN_SOURCES} ${GEN_HEADERS})
278
+ target_link_libraries(asn_demo ncbi-cxx-toolkit-public::core)
279
+
280
+ First two parameters to *NCBI_generate_cpp* receive lists of generated files - sources and headers. After that goes one or more data specifications. Files will be generated during the build in the directory where the specification is. To put generated files into another directory, use *GEN_SRCOUT* and *GEN_HDROUT* parameters:
281
+
282
+ NCBI_generate_cpp(GEN_SOURCES GEN_HEADERS sample.asn GEN_SRCOUT generated_sources GEN_HDROUT generated_headers)
283
+
284
+
285
+ ### Protocol buffers and gRPC.
286
+
287
+ [gRPC](https://grpc.io) is an open source high performance Remote Procedure Call framework. By default, gRPC uses [Protocol Buffers](https://developers.google.com/protocol-buffers/docs/overview), Google’s open source mechanism for serializing structured data.
288
+
289
+ First, make sure your project contains proper requirements. For example, conanfile.txt may request *protobuf* and *grpc*:
290
+
291
+ [requires]
292
+ ncbi-cxx-toolkit-public/29.0.0
293
+ protobuf/5.27.0
294
+ grpc/1.67.1
295
+
296
+ Next, you can use their own mechanisms, or the same NCBI function *NCBI_generate_cpp*:
297
+
298
+ cmake_minimum_required(VERSION 3.16)
299
+ project(conanapp)
300
+ find_package(ncbi-cxx-toolkit-public REQUIRED)
301
+ NCBI_generate_cpp(GEN_SOURCES GEN_HEADRS grpc_test.proto)
302
+ add_library(grpc_sample ${GEN_SOURCES} ${GEN_HEADRS})
303
+ target_link_libraries(grpc_sample ncbi-cxx-toolkit-public::grpc)
304
+
305
+ By default, *NCBI_generate_cpp* generates *protocol buffers* files only. To instruct it to generate gRPC ones as well, use *GEN_OPTIONS* flags, like this:
306
+
307
+ NCBI_generate_cpp(GEN_SOURCES GEN_HEADERS sample.proto GEN_OPTIONS grpc)
308
+
309
+
310
+ <a name="recipe_NCBIptb"></a>
311
+ ## NCBI build process management.
312
+
313
+ NCBI C++ Toolkit includes [NCBIptb](https://ncbi.github.io/cxx-toolkit/pages/ch_cmconfig) - CMake wrapper, which can also be used with Conan.
314
+
315
+ For example, *CMakeLists.txt* for [blast_demo](#recipe_Build) project might as well look like the following:
316
+
317
+ cmake_minimum_required(VERSION 3.16)
318
+ project(conanapp)
319
+ find_package(ncbi-cxx-toolkit-public REQUIRED)
320
+ NCBIptb_setup()
321
+
322
+ NCBI_begin_app(blast_demo)
323
+ NCBI_sources(blast_demo)
324
+ NCBI_uses_toolkit_libraries(blastinput)
325
+ NCBI_end_app()
326
+
327
+ Note the use of *NCBIptb_setup()* function. It adds functionalty **required** by *NCBIptb*. It also gives a second chance to request
328
+ NCBI-specific build flags, add compilation features and NCBI CTest framework. The function has the following optional arguments:
329
+
330
+ |Argument|Meaning|
331
+ |--------|----------|
332
+ |NCBI_BUILD_FLAGS | Set build flags which were used by the Toolkit itself |
333
+ |NCBI_CTEST | Enable NCBI CTest framework provided by the Toolkit |
334
+ |NCBI_LOCAL_COMPONENTS | In addition to Conan packages, look for locally defined 3rd party packages |
335
+ |FEATURES list | List of additional [compilation features](https://ncbi.github.io/cxx-toolkit/pages/ch_cmconfig#ch_cmconfig._Configure) defined by the Toolkit |
336
+ |COMPONENTS list | explicitly enable or disable listed [3rd party packages](https://ncbi.github.io/cxx-toolkit/pages/ch_cmconfig#ch_cmconfig._Configure) |
337
+
338
+ For example:
339
+
340
+ NCBIptb_setup( NCBI_BUILD_FLAGS NCBI_CTEST FEATURES MaxDebug Coverage)
341
+
342
+ *NCBIptb* expects source tree root to have *include* and *src* subdirectories:
343
+
344
+ - root
345
+ - include
346
+ - ...
347
+ - src
348
+ - ...
349
+
350
+ All header files are then expected to be in *include* and its subdirectories; sources - in *src*.
351
+
352
+ In other words, your root *CMakeLists.txt* should look like this:
353
+
354
+ cmake_minimum_required(VERSION 3.16)
355
+ project(conanapp)
356
+ find_package(ncbi-cxx-toolkit-public REQUIRED)
357
+ NCBIptb_setup()
358
+ NCBI_add_subdirectory(src)
359
+
360
+ The *blast_demo* example above will also work, of course. But as long as you add more and more projects, it is practically imperative that you adopt the standard NCBIptb source tree structure.
361
+
362
+ In case of data serialization projects, you should follow the standard *NCBIptb* practice - use *NCBI_dataspecs* function call. For example:
363
+
364
+ NCBI_begin_lib(asn_sample_lib)
365
+ NCBI_dataspecs(asn_sample_lib.asn)
366
+ NCBI_uses_toolkit_libraries(xser)
367
+ NCBI_end_lib()
368
+