diff --git a/recipes/ncbi-cxx-toolkit-public/all/conandata.yml b/recipes/ncbi-cxx-toolkit-public/all/conandata.yml new file mode 100755 index 0000000000000..e13ff3ab11ab9 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "27.0.0": + url: "https://github.com/ncbi/ncbi-cxx-toolkit-public/archive/refs/tags/release-27.0.0.tar.gz" + sha256: "c8fb3f99c6fce4f170b381f3a7789c76a2ff1c23c094c9852e2e3de1fdc57277" + +patches: + "27.0.0": + - patch_file: "patches/27.0.0-compiler.patch" + patch_description: "Corrected version check of GCC compiler" + patch_type: "portability" + - patch_file: "patches/27.0.0-install.patch" + patch_description: "Replaced hard-coded configuration with cmake generator expression" + patch_type: "conan" diff --git a/recipes/ncbi-cxx-toolkit-public/all/conanfile.py b/recipes/ncbi-cxx-toolkit-public/all/conanfile.py new file mode 100755 index 0000000000000..00b4320e781c3 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/conanfile.py @@ -0,0 +1,313 @@ +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file +from conan.tools.build import check_min_cppstd, cross_building, can_run +from conan.tools.scm import Version +from conan.tools.cmake import CMakeDeps, CMakeToolchain, CMake, cmake_layout +from conan.tools.env import VirtualRunEnv, VirtualBuildEnv +import os +import yaml +import re + +required_conan_version = ">=1.53.0" + + +class NcbiCxxToolkit(ConanFile): + name = "ncbi-cxx-toolkit-public" + description = "NCBI C++ Toolkit -- a cross-platform application framework and a collection of libraries for working with biological data." + license = "CC0-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://ncbi.github.io/cxx-toolkit" + topics = ("ncbi", "biotechnology", "bioinformatics", "genbank", "gene", + "genome", "genetic", "sequence", "alignment", "blast", + "biological", "toolkit", "c++") + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_targets": ["ANY"], + "with_components": ["ANY"] + } + default_options = { + "shared": False, + "fPIC": True, + "with_targets": "", + "with_components": "" + } + short_paths = True + _dependencies = None + _requirements = None + _componenttargets = set() + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + @property + def _dependencies_folder(self): + return "dependencies" + + @property + def _dependencies_filename(self): + return f"dependencies-{Version(self.version).major}.{Version(self.version).minor}.yml" + + @property + def _requirements_filename(self): + return f"requirements-{Version(self.version).major}.{Version(self.version).minor}.yml" + + @property + def _tk_dependencies(self): + if self._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(f"Cannot find {dependencies_filepath}") + with open(dependencies_filepath, "r", encoding="utf-8") as f: + self._dependencies = yaml.safe_load(f) + return self._dependencies + + @property + def _tk_requirements(self): + if self._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(f"Cannot find {requirements_filepath}") + with open(requirements_filepath, "r", encoding="utf-8") as f: + self._requirements = yaml.safe_load(f) + return self._requirements + + def _translate_req(self, key): + if "Boost" in key: + key = "Boost" + if key == "BerkeleyDB" and conan_version.major > "1": + return None + if key in self._tk_requirements["disabled"].keys(): + if self.settings.os in self._tk_requirements["disabled"][key]: + return None + 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 export(self): + copy(self, self._dependencies_filename, + os.path.join(self.recipe_folder, self._dependencies_folder), + os.path.join(self.export_folder, self._dependencies_folder)) + copy(self, self._requirements_filename, + os.path.join(self.recipe_folder, self._dependencies_folder), + os.path.join(self.export_folder, self._dependencies_folder)) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + _alltargets = self._parse_option(self.options.with_targets) + _required_components = set() + for _t in _alltargets: + _re = re.compile(_t) + for _component in self._tk_dependencies["components"]: + _libraries = self._tk_dependencies["libraries"][_component] + for _lib in _libraries: + if _re.match(_lib) != None: + _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"]) + for component in _required_components: + self._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 != None: + for pkg in pkgs: + self.requires(pkg) + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if self.settings.os not in ["Linux", "Macos", "Windows"]: + raise ConanInvalidConfiguration("This operating system is not supported") + if is_msvc(self): + check_min_vs(self, 192) + if self.options.shared and is_msvc_static_runtime(self) and Version(self.version) < "28": + raise ConanInvalidConfiguration("This configuration is not supported") + else: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"This version of {self.settings.compiler} is not supported") + if cross_building(self): + raise ConanInvalidConfiguration("Cross compilation is not supported") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + 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"] = "-app/netcache" + if self.options.with_targets != "": + tc.variables["NCBI_PTBCFG_PROJECT_TARGETS"] = self.options.with_targets + if len(self._componenttargets) != 0: + tc.variables["NCBI_PTBCFG_PROJECT_COMPONENTTARGETS"] = ";".join(self._componenttargets) + if is_msvc(self): + tc.variables["NCBI_PTBCFG_CONFIGURATION_TYPES"] = self.settings.build_type + tc.variables["NCBI_PTBCFG_PROJECT_TAGS"] = "-demo;-sample" + tc.generate() + CMakeDeps(self).generate() + VirtualBuildEnv(self).generate() + if can_run(self): + VirtualRunEnv(self).generate(scope="build") + + def _patch_sources(self): + apply_conandata_patches(self) + if self.settings.os == "Macos": + grpc = os.path.join(self.source_folder, "src", "build-system", "cmake", "CMake.NCBIptb.grpc.cmake") + replace_in_file(self, grpc, + "COMMAND ${_cmd}", + "COMMAND ${CMAKE_COMMAND} -E env \"DYLD_LIBRARY_PATH=$ENV{DYLD_LIBRARY_PATH}\" ${_cmd}") + root = os.path.join(self.source_folder, "CMakeLists.txt") + with open(root, "w", encoding="utf-8") 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 build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() +# Visual Studio sometimes runs "out of heap space" +# if is_msvc(self): +# cmake.parallel = False + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + @property + def _module_file_rel_path(self): + return os.path.join("res", "build-system", "cmake", "CMake.NCBIpkg.conan.cmake") + + def package_info(self): + impfile = os.path.join(self.package_folder, "res", "ncbi-cpp-toolkit.imports") + with open(impfile, "r", encoding="utf-8") as f: + allexports = set(f.read().split()).intersection(self._componenttargets) + 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 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 != None: + for pkg in pkgs: + pkg = pkg[:pkg.find("/")] + ref = pkg + "::" + pkg + c_reqs.append(ref) + if len(c_libs) != 0 or (len(libraries) == 0 and len(c_reqs) != 0): + self.cpp_info.components[component].libs = c_libs + self.cpp_info.components[component].requires = c_reqs + + if self.settings.os == "Windows": + self.cpp_info.components["core"].defines.append("_UNICODE") + self.cpp_info.components["core"].defines.append("_CRT_SECURE_NO_WARNINGS=1") + else: + 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.components["core"].defines.append("NCBI_DLL_BUILD") + if self.settings.build_type == "Debug": + self.cpp_info.components["core"].defines.append("_DEBUG") + else: + 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"].frameworks = ["ApplicationServices"] + self.cpp_info.components["core"].builddirs.append("res") + build_modules = [self._module_file_rel_path] + self.cpp_info.components["core"].build_modules = build_modules + self.cpp_info.set_property("cmake_build_modules", build_modules) diff --git a/recipes/ncbi-cxx-toolkit-public/all/dependencies/dependencies-27.0.yml b/recipes/ncbi-cxx-toolkit-public/all/dependencies/dependencies-27.0.yml new file mode 100755 index 0000000000000..1b21b391dc7fd --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/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" + ] +#---------------------------------------------------------------------------- +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/recipes/ncbi-cxx-toolkit-public/all/dependencies/requirements-27.0.yml b/recipes/ncbi-cxx-toolkit-public/all/dependencies/requirements-27.0.yml new file mode 100755 index 0000000000000..540b64e19d665 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/dependencies/requirements-27.0.yml @@ -0,0 +1,28 @@ +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: [] + SQLITE3: ["sqlite3/3.41.1"] + TIFF: ["libtiff/4.4.0"] + XML: ["libxml2/2.11.6"] + XSLT: ["libxslt/1.1.34"] + UV: ["libuv/1.44.2"] + Z: ["zlib/1.2.13"] + ZSTD: ["zstd/1.5.5"] + +disabled: + BACKWARD: ["Windows", "Macos"] + UNWIND: ["Windows", "Macos"] + BerkeleyDB: ["Windows"] diff --git a/recipes/ncbi-cxx-toolkit-public/all/patches/27.0.0-compiler.patch b/recipes/ncbi-cxx-toolkit-public/all/patches/27.0.0-compiler.patch new file mode 100755 index 0000000000000..6208df24fc5d1 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/patches/27.0.0-compiler.patch @@ -0,0 +1,11 @@ +--- src/build-system/cmake/CMakeChecks.compiler.cmake ++++ src/build-system/cmake/CMakeChecks.compiler.cmake +@@ -477,7 +477,7 @@ set(_ggdb1 "-ggdb1") + set(_gdw4r "-gdwarf-4") + if(NCBI_COMPILER_GCC) + +- if("${NCBI_COMPILER_VERSION}" LESS "730") ++ if("${NCBI_COMPILER_VERSION}" LESS "700") + add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0) + endif() + if(BinRelease IN_LIST NCBI_PTBCFG_PROJECT_FEATURES) diff --git a/recipes/ncbi-cxx-toolkit-public/all/patches/27.0.0-install.patch b/recipes/ncbi-cxx-toolkit-public/all/patches/27.0.0-install.patch new file mode 100755 index 0000000000000..9379374856798 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/patches/27.0.0-install.patch @@ -0,0 +1,15 @@ +--- a/src/build-system/cmake/CMake.NCBIptb.install.cmake ++++ b/src/build-system/cmake/CMake.NCBIptb.install.cmake +@@ -312,11 +312,7 @@ function(NCBI_internal_install_root _variable _access) + + if(NCBI_PTBCFG_PACKAGING) + if (WIN32 OR XCODE) +- if(DEFINED CONAN_SETTINGS_BUILD_TYPE) +- install( DIRECTORY ${NCBI_CFGINC_ROOT}/${CONAN_SETTINGS_BUILD_TYPE}/ DESTINATION ${NCBI_DIRNAME_INCLUDE}) +- else() +- install( DIRECTORY ${NCBI_CFGINC_ROOT}/Release/ DESTINATION ${NCBI_DIRNAME_INCLUDE}) +- endif() ++ install( DIRECTORY ${NCBI_CFGINC_ROOT}/$/ DESTINATION ${NCBI_DIRNAME_INCLUDE}) + else() + install( DIRECTORY ${NCBI_CFGINC_ROOT}/ DESTINATION ${NCBI_DIRNAME_INCLUDE}) + endif() diff --git a/recipes/ncbi-cxx-toolkit-public/all/test_package/CMakeLists.txt b/recipes/ncbi-cxx-toolkit-public/all/test_package/CMakeLists.txt new file mode 100755 index 0000000000000..3c2845864bd6f --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) +set(PackageName ncbi-cxx-toolkit-public) + +find_package(${PackageName} REQUIRED CONFIG) +add_executable(${PROJECT_NAME} basic_sample.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ${PackageName}::${PackageName}) diff --git a/recipes/ncbi-cxx-toolkit-public/all/test_package/basic_sample.cpp b/recipes/ncbi-cxx-toolkit-public/all/test_package/basic_sample.cpp new file mode 100755 index 0000000000000..9a54b227bac92 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/test_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/recipes/ncbi-cxx-toolkit-public/all/test_package/conanfile.py b/recipes/ncbi-cxx-toolkit-public/all/test_package/conanfile.py new file mode 100755 index 0000000000000..244d28df911e8 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class NcbiCxxToolkitTest(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ncbi-cxx-toolkit-public/all/test_v1_package/CMakeLists.txt b/recipes/ncbi-cxx-toolkit-public/all/test_v1_package/CMakeLists.txt new file mode 100755 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ncbi-cxx-toolkit-public/all/test_v1_package/conanfile.py b/recipes/ncbi-cxx-toolkit-public/all/test_v1_package/conanfile.py new file mode 100755 index 0000000000000..6d925d4043007 --- /dev/null +++ b/recipes/ncbi-cxx-toolkit-public/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class NcbiCxxToolkitTestV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/ncbi-cxx-toolkit-public/config.yml b/recipes/ncbi-cxx-toolkit-public/config.yml index 25761214128f4..59c15151743f7 100644 --- a/recipes/ncbi-cxx-toolkit-public/config.yml +++ b/recipes/ncbi-cxx-toolkit-public/config.yml @@ -1,3 +1,5 @@ versions: "26.0.1": folder: "26" + "27.0.0": + folder: "all"