Compare commits

..

31 Commits

Author SHA1 Message Date
Damien Nguyen b67f19b9a0
Fix compilation issues 2022-03-16 18:01:26 +01:00
Damien Nguyen dd065fa28b
Remove include_directories() in external_libs/ 2022-03-16 16:53:59 +01:00
Damien Nguyen 80deb84e98
Use CMAKE_POSITION_INDEPENDENT_CODE, CMAKE_CXX/CUDA_STANDARD...
...instead of modifying CMAKE_C/CXX_FLAGS or similar variables
2022-03-16 16:53:58 +01:00
Damien Nguyen 6c52a94d7c
Create CMake option to enable/disable -Werror 2022-03-16 16:53:58 +01:00
Damien Nguyen 1345f5e38e
Add support for system pkgs: cppjieba 2022-03-16 13:43:05 +01:00
Damien Nguyen 740537bf3e
Add support for system pkgs: grpc 2022-03-16 13:43:05 +01:00
Damien Nguyen cb716482fd
Add support for system pkgs: flatbuffers 2022-03-16 13:43:05 +01:00
Damien Nguyen ba139e8d35
Add support for system pkgs: OpenCV 2022-03-16 13:43:05 +01:00
Damien Nguyen 2609b6ff67
Add support for system pkgs: nccl 2022-03-16 13:43:04 +01:00
Damien Nguyen ac9b9e7743
Add support for system pkgs: ompi 2022-03-16 13:43:04 +01:00
Damien Nguyen 67d5bf2358
Add support for system pkgs: onednn 2022-03-16 13:43:04 +01:00
Damien Nguyen 116703d769
Add support for system pkgs: gtest 2022-03-16 13:43:04 +01:00
Damien Nguyen 6f686d981e
Add support for system pkgs: libtiff
Fix finding libtiff
2022-03-16 13:43:04 +01:00
Damien Nguyen e6311e89ac
Add support for system pkgs: protobuf, sentencepiece 2022-03-16 13:43:03 +01:00
Damien Nguyen 1127b645b7
Add support for system pkgs: c-ares & update to c-ares 1.17.2 2022-03-16 13:43:03 +01:00
Damien Nguyen aad4118626
Add support for system pkgs: abseil-cpp 2022-03-16 13:43:03 +01:00
Damien Nguyen 2aac1f21ad
Add support for system pkgs: libevent 2022-03-16 13:43:03 +01:00
Damien Nguyen 17ba5e8dee
Add support for system pkgs: re2 2022-03-16 13:43:03 +01:00
Damien Nguyen 1292087099
Add support for system pkgs: tinyxml2 2022-03-16 13:43:03 +01:00
Damien Nguyen b8e61f718e
Add support for system pkgs: icu4c 2022-03-16 13:43:02 +01:00
Damien Nguyen f693e52518
Add support for system pkgs: google-glog 2022-03-16 13:43:02 +01:00
Damien Nguyen a55deaa2e0
Add support for system pkgs: Zlib 2022-03-16 13:43:02 +01:00
Damien Nguyen d3c122d8d8
Add support for system pkgs: TurboJPEG 2022-03-16 13:43:02 +01:00
Damien Nguyen e3f518e3cd
Add support for system pkgs: sqlite3 2022-03-16 13:43:02 +01:00
Damien Nguyen c1dfe18e53
Add support for system pkgs: nlohnmann_json 2022-03-16 13:43:02 +01:00
Damien Nguyen bee122200e
Add support for system pkgs: OpenSSL 2022-03-16 13:43:02 +01:00
Damien Nguyen 53eb6cbc89
Add support for system pkgs: Eigen3, pybind11 2022-03-16 13:43:01 +01:00
Damien Nguyen d6acfd84fd
Introduce FindTemplate.cmake and update utils.cmake
- Add FindTemplate.cmake, _find_utils_begin.cmake and _find_utils_end.cmake
- Fix missing success messages when looking for packages
- Replace message("XXX") with message(STATUS "XXX")
- Fix issues with package names capitalization and FetchContent(...)
- Add version check to account for libraries with versions like OpenSSL (X.Y.Za)
- Renamed MS_PREFER_LOCAL_PKG to MS_PREFER_SYSTEM_PKGS
- Renamed MS_{pkg}_PREFER_LOCAL to MS_{pkg}_PREFER_SYSTEM
- Allow "alias of alias" in __create_target_aliases
- Add support for specifying multiple packages using the MS_PREFER_SYSTEM_PKGS
  variable and a comma separated list
- Add LIBS_CMAKE_NAMES to mindspore_add_pkg
- Add to_cmake_path function
- Update mindspore_add_pkg to allow for exact version match
- Generate pseudo-CMake config files for non-CMake projects
2022-03-16 13:43:01 +01:00
Damien Nguyen 2ae66df602
Add TARGET_ALIAS to mindspore_add_pkg 2022-03-15 12:27:20 +01:00
Damien Nguyen db3397602a
Add some repository configuration files 2022-03-15 12:27:20 +01:00
Damien Nguyen 4a227d0585
Avoid naming collision with matmul 2022-03-14 08:25:15 +01:00
6872 changed files with 87930 additions and 181194 deletions

86
.cmake-format.yaml Normal file
View File

@ -0,0 +1,86 @@
markup:
first_comment_is_literal: true
format:
disable: false
line_width: 120
tab_size: 2
use_tabchars: false
max_subgroups_hwrap: 2
max_pargs_hwrap: 6
max_rows_cmdline: 2
separate_ctrl_name_with_space: false
separate_fn_name_with_space: false
dangle_parens: false
dangle_align: prefix
min_prefix_chars: 4
max_prefix_chars: 10
max_lines_hwrap: 2
line_ending: unix
command_case: canonical
keyword_case: unchanged
enable_sort: true
autosort: false
require_valid_layout: false
parse:
additional_commands:
test_compile_option:
pargs:
nargs: 1+
flags:
- AUTO_ADD_CO
kwargs:
LANGS: +
FLAGS: +
GENEX: 1
test_link_option:
pargs:
nargs: 1+
flags:
- AUTO_ADD_LO
- VERBATIM
kwargs:
LANGS: +
FLAGS: +
GENEX: 1
mindspore_add_pkg:
pargs:
nargs: 1
flags:
- FORCE_EXACT_VERSION
- CMAKE_PKG_NO_COMPONENTS
- GEN_CMAKE_CONFIG
- FORCE_CONFIG_SEARCH
- BUILD_OPTION_PASS_PREFIX
kwargs:
URL: 1
MD5: 1
GIT_REPOSITORY: 1
GIT_TAG: 1
VER: 1
EXE: 1
DIR: 1
HEAD_ONLY: 1
CMAKE_PATH: 1
RELEASE: 1
LIB_PATH: 1
CUSTOM_CMAKE: 1
NS_NAME: 1
CMAKE_OPTION: +
LIBS: +
LIBS_CMAKE_NAMES: +
PRE_CONFIGURE_COMMAND: +
CONFIGURE_COMMAND: +
BUILD_OPTION: +
INSTALL_INCS: +
INSTALL_LIBS: +
PATCHES: +
SUBMODULES: +
SOURCEMODULES: +
ONLY_MAKE: +
ONLY_MAKE_INCS: +
ONLY_MAKE_LIBS: +
TARGET_ALIAS: 2
lint:
argument_var_pattern: _?[a-z][a-z0-9_]+
local_var_pattern: _?([a-z][a-z0-9_]+|[A-Z][A-Z0-9_]+)
macro_pattern: '[0-9a-z_]+'

21
.editorconfig Normal file
View File

@ -0,0 +1,21 @@
root = true
[*]
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = false
indent_style = space
indent_size = 4
[*.{yml,yaml}]
indent_size = 2
[{CMakeLists.txt,*.cmake}]
indent_size = 2
tab_width = 8
[*.{h,hpp,hxx,c,cpp,cxx}]
tab_width = 8
[{Makefile,**.mk}]
indent_style = tab

View File

@ -26,7 +26,6 @@
"mindspore/mindspore/ccsrc/plugin/device/ascend/hal/device/ascend_memory_manager.cc" "nullPointerArithmeticRedundantCheck"
"mindspore/mindspore/ccsrc/pipeline/jit/static_analysis/auto_monad.cc" "containerOutOfBounds"
"mindspore/mindspore/core/load_mindir/anf_model_parser.cc" "stlIfStrFind"
"mindspore/mindspore/ccsrc/frontend/optimizer/ad/kpynative.cc" "containerOutOfBounds"
# MindData
"mindspore/mindspore/ccsrc/minddata/dataset/engine/dataset_iterator.cc" "useStlAlgorithm"
@ -49,5 +48,3 @@
"mindspore/mindspore/lite/tools/converter/quantizer/quantize_util.cc" "useStlAlgorithm"
"mindspore/mindspore/lite/src/runtime/kernel/opencl/kernel/" "unreadVariable"
"mindspore/mindspore/lite/src/runtime/kernel/opencl/cl/" "unreadVariable"
"mindspore/mindspore/lite/examples/quick_start_micro/" "syntaxError"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental" "unreadVariable"

View File

@ -37,7 +37,7 @@
# Lite
"mindspore/mindspore/lite/include/lite_utils.h" "build/include_what_you_use"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/" "readability/casting"
"mindspore/mindspore/lite/nnacl/" "readability/casting"
"mindspore/mindspore/lite/tools/converter/micro/coder/wrapper/" "readability/casting"
"mindspore/mindspore/lite/tools/converter/parser/tflite/tflite_node_parser.h" "runtime/references"
"mindspore/mindspore/lite/tools/converter/model_parser.h" "build/namespaces"
@ -67,6 +67,3 @@
"mindspore/mindspore/lite/examples/quick_start_c/main.c" "readability/casting"
"mindspore/mindspore/lite/examples/quick_start_c/main.c" "runtime/threadsafe_fn"
"mindspore/mindspore/lite/examples/quick_start_micro" "readability/casting"
"mindspore/mindspore/core/mindrt/include/async/try.h" "runtime/explicit"
"mindspore/mindspore/core/mindrt/include/async/failure.h" "runtime/explicit"
"mindspore/mindspore/core/mindrt/include/async/defer.h" "runtime/explicit"

View File

@ -1,48 +0,0 @@
# akg-third-party
# file directory: mindspore/akg/third_party/incubator-tvm/
https://docs.tvm.ai/vta/tutorials/index.html
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/blogpost/vta_stack.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/passupdomain_problem.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/stage_graph.png:align
https://docs.tvm.ai/tutorials/get_started.html#sphx-glr-tutorials-get-started-py
http://docs.tvm.ai/tutorials/deployment/cross_compilation_and_rpc.html#sphx-glr-tutorials-deployment-cross-compilation-and-rpc-py
https://docs.tvm.ai/api/python/module.html#tvm.module.Module.time_evaluatornum
https://arxiv.org/abs/1509.09308https://github.com/andravin/wincnn
https://homes.cs.washington.edu/~cyulin/media/gnn_model/gcn_%s.torch
https://docs.tvm.ai/api/python/schedule.html#tvm.schedule.Stage.storage_align
https://homes.cs.washington.edu/~haichen/
https://docs.tvm.ai/dev/relay_pass_infra.html
https://en.cppreference.com/w/cpp/numeric/math/roundhttps://en.cppreference.com/w/cpp/numeric/math/nearbyint
https://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.csr_matrix.htmlandhttps://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.sparse.bsr_matrix.htmlfor
https://arxiv.org/abs/1706.02515alpha
https://tinyurl.com/y5k6fz5w.We
https://tinyurl.com/y4d7hrzf.We
https://raw.githubusercontent.com/uwsampl/tvm-distro/master/tophub
https://arxiv.org/abs/1409.3215-
https://arxiv.org/abs/1706.02515alpha
https://discuss.tvm.ai/t/pool2d-gives-bad-output-for-integer-inputs/3377low
http://www.apache.org/licenses/LICENSE-2.0////
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/gatherbound.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/inferbound_traversal.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/relay/let_scope.png:align
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/blogpost/vta_overview.png:align
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/developer/dataflow.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/inferbound_phases.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/passupdomain_div.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/passupdomain_min.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/relay/dataflow.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/relay/dataflow_vs_func.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/gatherbound_problem.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/relations.png:align
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/developer/vta_instructions.png:align
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/developer/gemm_core.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/union.png:align
https://raw.githubusercontent.com/tvmai/tvmai.github.io/master/images/docs/inferbound/passupdomain_nodiv.png:align
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/developer/alu_core.png:align
http://raw.githubusercontent.com/uwsaml/web-data/master/vta/developer/2d_dma.png:align
https://raw.githubusercontent.com/dmlc/web-data/master/tensorflow/models/object_detection/ssd_mobilenet_v1_coco_2018_01_28_nopp.tgz
https://github.com/google/googletestcd
https://github.com/dmlc/dgl/blob/master/examples/pytorch/gcn/train.pyfrom
https://github.com/FrozenGene/tflite/releases/download/v1.13.1/tflite-1.13.1-py3-none-any.whlpip3
https://github.com/siju-samuel/darknet/blob/master/

View File

@ -11,9 +11,7 @@
"mindspore/mindspore/python/mindspore/_check_deps_version.py" "broad-except"
"mindspore/mindspore/python/mindspore/_check_version.py" "unused-import"
"mindspore/mindspore/python/mindspore/_check_version.py" "broad-except"
"mindspore/mindspore/python/mindspore/common/api.py" "protected-access"
"mindspore/mindspore/python/mindspore/common/parameter.py" "protected-access"
"mindspore/mindspore/python/mindspore/common/hook_handle.py" "protected-access"
"mindspore/mindspore/python/mindspore/common/dtype.py" "undefined-all-variable"
"mindspore/mindspore/python/mindspore/context.py" "protected-access"
"mindspore/mindspore/python/mindspore/ops/operations" "super-init-not-called"
@ -30,7 +28,6 @@
"mindspore/mindspore/python/mindspore/nn/cell.py" "assignment-from-none"
"mindspore/mindspore/python/mindspore/_extends/parse/resources.py" "bad-whitespace"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "broad-except"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "protected-access"
"mindspore/mindspore/python/mindspore/_extends/parse/parser.py" "eval-used"
"mindspore/mindspore/python/mindspore/nn/cell.py" "protected-access"
"mindspore/mindspore/python/mindspore/nn/optim/ftrl.py" "unused-import"
@ -38,12 +35,6 @@
"mindspore/mindspore/python/mindspore/train/serialization.py" "protected-access"
"mindspore/mindspore/python/mindspore/train/model.py" "protected-access"
"mindspore/mindspore/python/mindspore/log.py" "protected-access"
"mindspore/mindspore/python/mindspore/rewrite/api/node.py" "protected-access"
"mindspore/mindspore/python/mindspore/rewrite/node.py" "protected-access"
"mindspore/mindspore/python/mindspore/rewrite/symbol_tree.py" "protected-access"
"mindspore/mindspore/python/mindspore/rewrite/parser_register.py" "protected-access"
"mindspore/mindspore/python/mindspore/rewrite/api/pattern_engine.py" "protected-access"
"mindspore/mindspore/python/mindspore/rewrite/symbol_tree.py" "inconsistent-return-statements"
"mindspore/model_zoo/official/cv" "missing-docstring"
"mindspore/model_zoo/official/cv" "c-extension-no-member"
"mindspore/model_zoo/official/nlp/bert_thor/src/bert_model.py" "redefined-outer-name"
@ -107,10 +98,6 @@
"mindspore/tests/ut/python/pynative_mode" "unused-variable"
"mindspore/tests/ut/python/pynative_mode/test_stop_gradient.py" "redefined-outer-name"
"mindspore/tests/ut/python/pynative_mode/test_stop_gradient.py" "super-init-not-called"
"mindspore/tests/ut/python/rewrite/test_flatten_recursive_stmt.py" "consider-using-ternary"
"mindspore/tests/ut/python/rewrite/test_node.py" "syntax-error"
"mindspore/tests/ut/python/rewrite/test_node.py" "protected-access"
"mindspore/tests/ut/python/rewrite/test_symbol_tree.py" "len-as-condition"
"mindspore/tests/ut/python/test_log.py" "possibly-unused-variable"
"mindspore/tests/ut/python/test_log.py" "protected-access"
"mindspore/tests/ut/python/train/summary/test_summary_collector.py" "protected-access"
@ -133,6 +120,6 @@
"mindspore/tests/ut/python/optimizer/test_auto_grad.py" "broad-except"
#MindSpore Lite
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/generator.py" "redefined-builtin"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/generator.py" "exec-used"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/generator.py" "global-variable-undefined"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/generator.py" "redefined-builtin"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/generator.py" "exec-used"
"mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/generator.py" "global-variable-undefined"

View File

@ -3,7 +3,6 @@
# Scene2:
# file_path:function_name1, function_name2
#
mindspore/mindspore/core/mindrt/src/thread/actor_threadpool.cc:mindspore::ActorWorker::RunWithSpin
mindspore/mindspore/lite/src/ops/primitive_c.cc:mindspore::lite::PrimitiveC::Create
mindspore/mindspore/ccsrc/minddata/dataset/engine/datasetops/source/csv_op.cc:mindspore::dataset::CsvOp::CsvParser::InitCsvParser
mindspore/mindspore/lite/tools/converter/graphdef_transform.cc:mindspore::lite::GraphDefTransform::Transform
@ -101,101 +100,100 @@ mindspore/mindspore/ccsrc/backend/common/session/gpu_session.cc:mindspore::sessi
mindspore/mindspore/ccsrc/debug/dump_proto.cc:mindspore::ProtoExporter::SetNodeOutputType
mindspore/mindspore/ccsrc/debug/dump_proto.cc:mindspore::ProtoExporter::SetValueToProto
mindspore/mindspore/ccsrc/debug/dump_proto.cc:mindspore::ProtoExporter::SetScalarToProto
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_10x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_10x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_11x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_11x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_7x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_7x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_9x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_9x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_8x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_8x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_8x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_8x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_9x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_9x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_7x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_7x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_12x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_12x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_10x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_10x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_11x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_11x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_8x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_8x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_12x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_12x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_7x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_7x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_10x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_10x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_11x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_11x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_7x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_7x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_9x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_9x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_8x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_8x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_8x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_8x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_9x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_9x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_7x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_7x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_4x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_4x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_12x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_12x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_10x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_10x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_11x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_11x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x80_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x80_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_8x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_8x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_3x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_3x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_12x32_kernel_nhwc_fp32.c:nnacl_gemm_avx512_12x32_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_1x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_1x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_2x96_kernel_nhwc_fp32.c:nnacl_gemm_avx512_2x96_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_7x16_kernel_nhwc_fp32.c:nnacl_gemm_avx512_7x16_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_5x48_kernel_nhwc_fp32.c:nnacl_gemm_avx512_5x48_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_avx512/nnacl_gemm_avx512_6x64_kernel_nhwc_fp32.c:nnacl_gemm_avx512_6x64_kernel_nhwc_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_2x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_3x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_6x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_8x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_6x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_11x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_10x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_3x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_4x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_12x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x8_kernel_nc8hw8_fp32
mindspore/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc:mindspore::kernel::MatmulFp32BaseCPUKernel::init_global_variable
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_1x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_1x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/HPC-generator/gemm_fma/nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_3x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_1x24_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_1x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_5x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_7x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_4x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_5x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_9x8_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_4x16_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_2x32_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32.c:nnacl_gemm_fma_2x24_kernel_nc8hw8_fp32
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experiment/HPC-generator/gemm_fma/nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32_asm.c:nnacl_gemm_fma_1x32_kernel_nc8hw8_fp32
mindspore/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc:mindspore::kernel::MatmulFp32BaseCPUKernel::Run
mindspore/mindspore/ccsrc/frontend/parallel/auto_parallel/rec_core/rec_partition.cc:mindspore::parallel::GetWeights
mindspore/mindspore/ccsrc/frontend/parallel/auto_parallel/rec_core/rec_partition.cc:mindspore::parallel::PartitionNode
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp16/instance_norm_fp16.c:InstanceNormNC8HW8Fp16
mindspore/mindspore/lite/src/runtime/kernel/arm/fp32/matmul_fp32_base.cc:mindspore::kernel::MatmulFp32BaseCPUKernel::init_global_variable
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/fp32/conv_winograd_fp32.c:ConvWinogardFp32
mindspore/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/lamb_next_mv_with_decay_v1_rule.cc:mindspore::opt::MatchAdd5Pattern
mindspore/mindspore/ccsrc/plugin/device/cpu/kernel/nnacl/experimental/conv_fp32_nchwx_avx512.c:conv2d_compute_fp32_nchwx_avx512
mindspore/mindspore/ccsrc/plugin/device/ascend/optimizer/ir_fusion/lamb_next_mv_with_decay_v1_rule.cc:mindspore::opt::MatchAdd5Pattern

View File

@ -17,29 +17,12 @@ MS_ALL:
include/api
mindspore/core
mindspore/ccsrc/cxx_api
mindspore/ccsrc/backend/common
mindspore/ccsrc/plugin/device/cpu/kernel/nnacl
mindspore/ccsrc/minddata
mindspore/ccsrc/CMakeLists.txt
mindspore/lite/java
mindspore/lite/src/train
mindspore/lite/src/runtime/kernel/arm/fp32
mindspore/lite/src/runtime/kernel/arm/fp32_grad
mindspore/ccsrc/backend/kernel_compiler
mindspore/ccsrc/fl
mindspore/ccsrc/ps
mindspore/ccsrc/backend
MS_CLOUD:
mindspore/python
mindspore/ccsrc
tests/st
MS_LITE:
include/c_api
include/api/allocator.h
include/api/delegate.h
include/api/kernel.h
include/api/model_parallel_runner.h
mindspore/lite/
cmake/package_lite.cmake
cmake/package_lite
MS_CLOUD_UT:
tests/ut
MS_CLOUD_UT_CPP:

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.14.0)
cmake_minimum_required(VERSION 3.17.0)
project(MindSpore)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@ -19,9 +19,51 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wno-inconsistent-missing-override \
-Wno-unused-lambda-capture -Wno-unneeded-internal-declaration -Wno-unused-variable \
-Wno-return-std-move -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
# find appropriate macosx SDK and set SDKROOT
if(NOT DEFINED ENV{SDKROOT})
# arm64: macosx11.x
# x86_64: macosx10.x, macosx11.x
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64")
set(MACOSX_SDK_REGEX "MacOSX11(\\.\\d+)?")
else()
set(MACOSX_SDK_REGEX "MacOSX1[01](\\.\\d+)?")
endif()
exec_program(xcrun ARGS --show-sdk-path OUTPUT_VARIABLE MACOSX_SDK_PATH)
get_filename_component(MACOSX_SDK_PATH ${MACOSX_SDK_PATH} DIRECTORY)
file(GLOB ALL_SDK_NAME RELATIVE ${MACOSX_SDK_PATH} ${MACOSX_SDK_PATH}/*)
# get highest SDK version meets the requirements
execute_process(
COMMAND bash -c "echo '${ALL_SDK_NAME}' | grep -Eo '${MACOSX_SDK_REGEX}' | sort -n | tail -1 | tr -d '\\n'"
OUTPUT_VARIABLE MACOSX_FIND_SDK_NAME
)
if(NOT MACOSX_FIND_SDK_NAME)
message(FATAL_ERROR "can not find appropriate macosx SDK, you may need upgrade xcode")
endif()
set(ENV{SDKROOT} "${MACOSX_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
endif()
message("macosx sdkroot: $ENV{SDKROOT}")
# set macosx deployment target based on SDK
if(NOT DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
execute_process(
COMMAND bash -c "cat $ENV{SDKROOT}/SDKSettings.json | \
grep -Eo 'MACOSX_DEPLOYMENT_TARGET\\\":\\\"\\d{2}\\.\\d+' | cut -d '\"' -f 3 | tr -d '\\n'"
OUTPUT_VARIABLE MACOSX_FIND_SDK_VERSION
)
if(NOT MACOSX_FIND_SDK_VERSION)
message(FATAL_ERROR "can not find MACOSX_DEPLOYMENT_TARGET in SDKROOT, \
please check whether it's a valid SDK path")
endif()
set(CMAKE_OSX_DEPLOYMENT_TARGET ${MACOSX_FIND_SDK_VERSION} CACHE STRING
"minimum macosx deployment target version" FORCE)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
endif()
endif()
message("macosx deployment target version: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Winconsistent-missing-override -Wno-user-defined-warnings \
-Wno-return-std-move -Wno-unused-private-field -Wno-unused-lambda-capture -Wno-sign-compare \
-Wno-overloaded-virtual -Wno-unneeded-internal-declaration -Wno-unused-variable -Wno-pessimizing-move \
-Wno-inconsistent-missing-override -DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
elseif(ENABLE_SYM_FILE)
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -g -ggdb -Wl,--allow-shlib-undefined \
-DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2")
@ -34,22 +76,30 @@ if(ENABLE_PYTHON)
add_compile_definitions(ENABLE_PYTHON)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
-D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 -DHALF_ENABLE_CPP11_USER_LITERALS=0 \
-D_FORTIFY_SOURCE=2 -Wno-cpp -Wno-inconsistent-missing-override -Wno-unused-lambda-capture \
-Wno-unneeded-internal-declaration -Wno-unused-variable -Wno-return-std-move")
else()
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
-Wl,--allow-shlib-undefined -D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 \
-DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2 -Wno-cpp")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -g2 -ggdb -fno-inline-functions -fno-omit-frame-pointer \
-Wl,--allow-shlib-undefined -D_LIBCPP_INLINE_VISIBILITY='' -D_LIBCPP_DISABLE_EXTERN_TEMPLATE=1 \
-DHALF_ENABLE_CPP11_USER_LITERALS=0 -D_FORTIFY_SOURCE=2 -Wno-cpp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/include -std=c++17 \
-Werror -Wall -Wno-deprecated-declarations -fPIC")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
if(CUDAToolkit_VERSION VERSION_LESS 11.0)
set(CMAKE_CUDA_STANDARD 14)
else()
set(CMAKE_CUDA_STANDARD 17)
endif()
if(NOT CMAKE_CUDA_ARCHITECTURES)
set(CMAKE_CUDA_ARCHITECTURES 60 70)
endif()
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr")
set(CMAKE_CUDA_STANDARD_REQUIRED TRUE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/local/include \
-Wall -Wno-deprecated-declarations")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(PYBIND11_CPP_STANDARD -std=c++17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTION_CXX_FLAGS}")
if(ENABLE_AKG AND CMAKE_SYSTEM_NAME MATCHES "Linux")
@ -103,14 +153,6 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
add_subdirectory(mindspore/ccsrc)
add_subdirectory(mindspore/core)
if(DEFINED ENV{ENABLE_CLOUD_AND_LITE})
set(ENABLE_CLOUD_AND_LITE $ENV{ENABLE_CLOUD_AND_LITE})
endif()
if(ENABLE_CLOUD_AND_LITE)
add_subdirectory(mindspore/lite)
endif()
if(ENABLE_TESTCASES OR ENABLE_CPP_ST)
add_subdirectory(tests)
endif()

2
OWNERS
View File

@ -3,8 +3,6 @@ approvers:
- guoqi1024
- baochong
- zhaizhiqiang
- stsuteng
- kisnwang
files:
"akg":

View File

@ -48,14 +48,15 @@ For more details please check out our [Architecture Guide](https://www.mindspore
### Automatic Differentiation
Currently, there are two automatic differentiation techniques in mainstream deep learning frameworks:
There are currently three automatic differentiation techniques in mainstream deep learning frameworks:
- **Operator Overloading (OO)**: Overloading the basic operators of the programming language to encapsulate their gradient rules. Record the operation trajectory of the network during forward execution in an operator overloaded manner, then apply the chain rule to the dynamically generated data flow graph to implement automatic differentiation.
- **Source Transformation (ST)**: This technology is evolving from the functional programming framework and performs automatic differential transformation on the intermediate expression (the expression form of the program during the compilation process) in the form of just-in-time compilation (JIT), supporting complex control flow scenarios, higher-order functions and closures.
- **Conversion based on static compute graph**: Convert the network into a static data flow graph at compile time, then turn the chain rule into a data flow graph to implement automatic differentiation.
- **Conversion based on dynamic compute graph**: Record the operation trajectory of the network during forward execution in an operator overloaded manner, then apply the chain rule to the dynamically generated data flow graph to implement automatic differentiation.
- **Conversion based on source code**: This technology is evolving from the functional programming framework and performs automatic differential transformation on the intermediate expression (the expression form of the program during the compilation process) in the form of just-in-time compilation (JIT), supporting complex control flow scenarios, higher-order functions and closures.
PyTorch used OO. Compared to ST, OO generates gradient graph in runtime, so it does not need to take function call and control flow into consideration, which makes it easier to develop. However, OO can not perform gradient graph optimization in compilation time and the control flow has to be unfolded in runtime, so it is difficult to achieve extreme optimization in performance.
TensorFlow adopted static calculation diagrams in the early days, whereas PyTorch used dynamic calculation diagrams. Static maps can utilize static compilation technology to optimize network performance, however, building a network or debugging it is very complicated. The use of dynamic graphics is very convenient, but it is difficult to achieve extreme optimization in performance.
MindSpore implemented automatic differentiation based on ST. On the one hand, it supports automatic differentiation of automatic control flow, so it is quite convenient to build models like PyTorch. On the other hand, MindSpore can perform static compilation optimization on neural networks to achieve great performance.
But MindSpore finds another way, automatic differentiation based on source code conversion. On the one hand, it supports automatic differentiation of automatic control flow, so it is quite convenient to build models like PyTorch. On the other hand, MindSpore can perform static compilation optimization on neural networks to achieve great performance.
<img src="https://gitee.com/mindspore/mindspore/raw/master/docs/Automatic-differentiation.png" alt="Automatic Differentiation" width="600"/>
@ -239,7 +240,7 @@ please check out [docker](https://gitee.com/mindspore/mindspore/blob/master/scri
## Quickstart
See the [Quick Start](https://www.mindspore.cn/tutorials/en/master/beginner/quick_start.html)
See the [Quick Start](https://www.mindspore.cn/tutorials/en/master/quick_start.html)
to implement the image classification.
## Docs

View File

@ -45,14 +45,15 @@ MindSpore提供了友好的设计和高效的执行旨在提升数据科学
### 自动微分
当前主流深度学习框架中有种自动微分技术:
当前主流深度学习框架中有种自动微分技术:
- **操作符重载法** 通过操作符重载对编程语言中的基本操作语义进行重定义,封装其微分规则。 在程序运行时记录算子过载正向执行时网络的运行轨迹,对动态生成的数据流图应用链式法则,实现自动微分。
- **代码变换法** 该技术是从功能编程框架演进而来以即时编译Just-in-time CompilationJIT的形式对中间表达式程序在编译过程中的表达式进行自动差分转换支持复杂的控制流场景、高阶函数和闭包。
- **基于静态计算图的转换**:编译时将网络转换为静态数据流图,将链式法则应用于数据流图,实现自动微分。
- **基于动态计算图的转换**:记录算子过载正向执行时网络的运行轨迹,对动态生成的数据流图应用链式法则,实现自动微分。
- **基于源码的转换**该技术是从功能编程框架演进而来以即时编译Just-in-time CompilationJIT的形式对中间表达式程序在编译过程中的表达式进行自动差分转换支持复杂的控制流场景、高阶函数和闭包。
PyTorch采用的是操作符重载法。相较于代码变换法操作符重载法是在运行时生成微分计算图的 无需考虑函数调用与控制流等情况, 开发更为简单。 但该方法不能在编译时刻做微分图的优化, 控制流也需要根据运行时的信息来展开, 很难实现性能的极限优化。
TensorFlow早期采用的是静态计算图PyTorch采用的是动态计算图。静态映射可以利用静态编译技术来优化网络性能但是构建网络或调试网络非常复杂。动态图的使用非常方便很难实现性能的极限优化。
MindSpore则采用的是代码变换法。一方面它支持自动控制流的自动微分因此像PyTorch这样的模型构建非常方便。另一方面MindSpore可以对神经网络进行静态编译优化以获得更好的性能。
MindSpore找到了另一种方法,即基于源代码转换的自动微分。一方面它支持自动控制流的自动微分因此像PyTorch这样的模型构建非常方便。另一方面MindSpore可以对神经网络进行静态编译优化以获得更好的性能。
<img src="https://gitee.com/mindspore/mindspore/raw/master/docs/Automatic-differentiation.png" alt="Automatic Differentiation" width="600"/>
@ -235,7 +236,7 @@ MindSpore的Docker镜像托管在[Docker Hub](https://hub.docker.com/r/mindspore
## 快速入门
参考[快速入门](https://www.mindspore.cn/tutorials/zh-CN/master/beginner/quick_start.html)实现图片分类。
参考[快速入门](https://www.mindspore.cn/tutorials/zh-CN/master/quick_start.html)实现图片分类。
## 文档

2
akg

@ -1 +1 @@
Subproject commit 0ddab6d9cad4c4c9faf72585e5a52faf79f55e4d
Subproject commit a9cbf642063fb1086a93e8bc6be6feb145689817

View File

@ -21,8 +21,16 @@ SET BUILD_PATH=%BASE_PATH%/build
SET threads=8
SET ENABLE_GITEE=OFF
set VERSION_STR=''
for /f "tokens=1" %%a in (version.txt) do (set VERSION_STR=%%a)
set VERSION_MAJOR=''
set VERSION_MINOR=''
set ERSION_REVISION=''
for /f "delims=\= tokens=2" %%a in ('findstr /C:"const int ms_version_major = " mindspore\lite\include\version.h') do (set x=%%a)
set VERSION_MAJOR=%x:~1,1%
for /f "delims=\= tokens=2" %%b in ('findstr /C:"const int ms_version_minor = " mindspore\lite\include\version.h') do (set y=%%b)
set VERSION_MINOR=%y:~1,1%
for /f "delims=\= tokens=2" %%c in ('findstr /C:"const int ms_version_revision = " mindspore\lite\include\version.h') do (set z=%%c)
set VERSION_REVISION=%z:~1,1%
ECHO %2%|FINDSTR "^[0-9][0-9]*$"
IF %errorlevel% == 0 (
@ -44,14 +52,16 @@ IF NOT EXIST "%BUILD_PATH%/mindspore" (
cd %BUILD_PATH%/mindspore
IF "%1%" == "lite" (
echo "======Start building MindSpore Lite %VERSION_STR%======"
echo "======Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%======"
rd /s /q "%BASE_PATH%\output"
(git log -1 | findstr "^commit") > %BUILD_PATH%\.commit_id
IF defined VisualStudioVersion (
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off -DVERSION_STR=%VERSION_STR% ^
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off ^
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
-DCMAKE_BUILD_TYPE=Release -G "Ninja" "%BASE_PATH%/mindspore/lite"
) ELSE (
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off -DVERSION_STR=%VERSION_STR% ^
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off ^
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
-DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
)
) ELSE (

View File

@ -1,10 +1,9 @@
approvers:
- zhoufeng54
- ouwenchang
- hangangqiang
- jpc_chenjianping
- tiancixiao
reviewers:
- nicholas_yhr
- liubuyu
- chengxb7532
- shenwei41

View File

@ -84,58 +84,3 @@ if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
find_required_package(FLEX)
endif()
endif()
# for macos, find appropriate macosx SDK then set SDKROOT and MACOSX_DEPLOYMENT_TARGET
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if(NOT DEFINED ENV{SDKROOT})
# arm64: macosx11.x
# x86_64: macosx10.x, macosx11.x
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64")
set(MACOSX_SDK_REGEX "MacOSX11(\\.\\d+)?")
else()
set(MACOSX_SDK_REGEX "MacOSX1[01](\\.\\d+)?")
endif()
set(MACOSX_XCODE_SDK_PATH "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs")
set(MACOSX_CLT_SDK_PATH "/Library/Developer/CommandLineTools/SDKs")
set(MACOSX_SDK_SEARCH_PATHS "${MACOSX_XCODE_SDK_PATH}/*" "${MACOSX_CLT_SDK_PATH}/*")
file(GLOB ALL_SDK_NAME ${MACOSX_SDK_SEARCH_PATHS})
# get highest SDK version meets the requirements
execute_process(
COMMAND bash -c "echo '${ALL_SDK_NAME}' | grep -Eo '${MACOSX_SDK_REGEX}' | sort -n | tail -1 | tr -d '\\n'"
OUTPUT_VARIABLE MACOSX_FIND_SDK_NAME
)
if(NOT MACOSX_FIND_SDK_NAME)
message(FATAL_ERROR
"can not find appropriate macosx SDK, find in ${ALL_SDK_NAME}, you may set SDKROOT manually"
)
endif()
if(IS_DIRECTORY "${MACOSX_XCODE_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
set(ENV{SDKROOT} "${MACOSX_XCODE_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
else()
set(ENV{SDKROOT} "${MACOSX_CLT_SDK_PATH}/${MACOSX_FIND_SDK_NAME}.sdk")
endif()
endif()
message("macosx sdkroot: $ENV{SDKROOT}")
# set macosx deployment target based on SDK
if(NOT DEFINED ENV{MACOSX_DEPLOYMENT_TARGET})
execute_process(
COMMAND bash -c "cat $ENV{SDKROOT}/SDKSettings.json | \
grep -Eo 'MACOSX_DEPLOYMENT_TARGET\\\":\\\"\\d{2}\\.\\d+' | cut -d '\"' -f 3 | tr -d '\\n'"
OUTPUT_VARIABLE MACOSX_FIND_SDK_VERSION
)
if(NOT MACOSX_FIND_SDK_VERSION)
message(FATAL_ERROR "can not find MACOSX_DEPLOYMENT_TARGET in SDKROOT, \
please check whether it's a valid SDK path")
endif()
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "arm64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
elseif(${MACOSX_FIND_SDK_VERSION} VERSION_LESS "10.15")
set(CMAKE_OSX_DEPLOYMENT_TARGET ${MACOSX_FIND_SDK_VERSION} CACHE STRING
"minimum macosx deployment target version" FORCE)
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
endif()
endif()
message("macosx deployment target version: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif()

View File

@ -11,7 +11,7 @@ function(find_submodule_lib module name path)
find_library(${module}_LIBRARY_DIR NAMES ${name} NAMES_PER_DIR PATHS ${path}
PATH_SUFFIXES lib
)
if("${${module}_LIBRARY_DIR}" STREQUAL "${module}_LIBRARY_DIR-NOTFOUND")
if(NOT ${module}_LIBRARY_DIR)
message(FATAL_ERROR "${name} not found in any of following paths: ${path}")
endif()
add_library(${module} SHARED IMPORTED)
@ -43,6 +43,7 @@ if(ENABLE_TESTCASES OR MODE_ASCEND_ALL OR MODE_ASCEND_ACL)
endforeach()
ge_protobuf_generate(GE_PROTO_SRCS GE_PROTO_HDRS ${GE_PROTO_FILE})
add_library(graph SHARED ${GE_PROTO_SRCS})
target_link_libraries(graph PUBLIC mindspore::protobuf)
else()
message(FATAL_ERROR "No compile option defined for GraphEngine, exiting")
endif()

View File

@ -1,39 +1,27 @@
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "https://gitee.com/src-openeuler/abseil-cpp.git")
set(GIT_TAG "openEuler-22.03-LTS")
set(MD5 "06c9554d9f9776bb1a4b848ca206c0af")
set(ABSL_SRC "${TOP_DIR}/build/mindspore/_deps/absl-src")
__download_pkg_with_git(absl ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
execute_process(COMMAND tar -xf ${ABSL_SRC}/abseil-cpp-20210324.2.tar.gz --strip-components 1 -C ${ABSL_SRC})
else()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/abseil-cpp/repository/archive/20210324.2.tar.gz")
set(MD5 "e0b585398b89ee92a10d8c68ef7eed48")
set(REQ_URL "https://gitee.com/mirrors/abseil-cpp/repository/archive/20200923.3.tar.gz")
set(MD5 "daba6e99c7a84e2242a0107bbd873669")
else()
set(REQ_URL "https://github.com/abseil/abseil-cpp/archive/20210324.2.tar.gz")
set(MD5 "e0b585398b89ee92a10d8c68ef7eed48")
endif()
set(REQ_URL "https://github.com/abseil/abseil-cpp/archive/20200923.3.tar.gz")
set(MD5 "daba6e99c7a84e2242a0107bbd873669")
endif()
if(NOT ENABLE_GLIBCXX)
set(absl_CXXFLAGS "${absl_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
set(absl_CXXFLAGS "${absl_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
mindspore_add_pkg(absl
VER 20210324.2
LIBS absl_strings absl_throw_delegate absl_raw_logging_internal absl_int128 absl_bad_optional_access
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION
-DCMAKE_BUILD_TYPE:STRING=Release
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
-DCMAKE_CXX_STANDARD=11
)
include_directories(${absl_INC})
add_library(mindspore::absl_strings ALIAS absl::absl_strings)
add_library(mindspore::absl_throw_delegate ALIAS absl::absl_throw_delegate)
add_library(mindspore::absl_raw_logging_internal ALIAS absl::absl_raw_logging_internal)
add_library(mindspore::absl_int128 ALIAS absl::absl_int128)
add_library(mindspore::absl_bad_optional_access ALIAS absl::absl_bad_optional_access)
mindspore_add_pkg(
absl
VER 20200923.3
FORCE_EXACT_VERSION
LIBS absl_strings absl_throw_delegate absl_raw_logging_internal absl_int128 absl_bad_optional_access
LIBS_CMAKE_NAMES strings throw_delegate raw_logging_internal int128 bad_optional_access
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE -DCMAKE_CXX_STANDARD=11
PATCHES ${TOP_DIR}/third_party/patch/absl/absl.patch001
TARGET_ALIAS mindspore::absl_strings absl::strings
TARGET_ALIAS mindspore::absl_throw_delegate absl::throw_delegate
TARGET_ALIAS mindspore::absl_raw_logging_internal absl::raw_logging_internal
TARGET_ALIAS mindspore::absl_int128 absl::int128
TARGET_ALIAS mindspore::absl_bad_optional_access absl::bad_optional_access)

View File

@ -1,22 +1,18 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/c-ares/repository/archive/cares-1_15_0.tar.gz")
set(MD5 "459876e53724a2c87ed2876312b96aed")
set(REQ_URL "https://gitee.com/mirrors/c-ares/repository/archive/cares-1_17_2.tar.gz")
set(MD5 "59cd1207df8f9522797535245e12b871")
else()
set(REQ_URL "https://github.com/c-ares/c-ares/releases/download/cares-1_15_0/c-ares-1.15.0.tar.gz")
set(MD5 "d2391da274653f7643270623e822dff7")
set(REQ_URL "https://github.com/c-ares/c-ares/releases/download/cares-1_17_2/c-ares-1.17.2.tar.gz")
set(MD5 "3802264830c6886411dac606c66fdbf8")
endif()
mindspore_add_pkg(c-ares
VER 1.15.0
LIBS cares
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release
-DCARES_SHARED:BOOL=OFF
-DCARES_STATIC:BOOL=ON
-DCARES_STATIC_PIC:BOOL=ON
-DHAVE_LIBNSL:BOOL=OFF
PATCHES ${TOP_DIR}/third_party/patch/c-ares/CVE-2021-3672.patch)
include_directories(${c-ares_INC})
add_library(mindspore::cares ALIAS c-ares::cares)
mindspore_add_pkg(
c-ares
VER 1.17.2
LIBS cares
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/c-ares/c-ares.patch001
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DCARES_SHARED:BOOL=OFF -DCARES_STATIC:BOOL=ON
-DCARES_STATIC_PIC:BOOL=ON -DHAVE_LIBNSL:BOOL=OFF
TARGET_ALIAS mindspore::cares c-ares::cares)

View File

@ -2,20 +2,20 @@ set(cppjieba_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(cppjieba_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/cppjieba/repository/archive/v5.0.3.tar.gz")
set(MD5 "06fcc22b4db6c332dc1b0bd353bdf6f2")
set(REQ_URL "https://gitee.com/mirrors/cppjieba/repository/archive/v5.0.3.tar.gz")
set(MD5 "06fcc22b4db6c332dc1b0bd353bdf6f2")
else()
set(REQ_URL "https://github.com/yanyiwu/cppjieba/archive/v5.0.3.tar.gz")
set(MD5 "b8b3f7a73032c9ce9daafa4f67196c8c")
set(REQ_URL "https://github.com/yanyiwu/cppjieba/archive/v5.0.3.tar.gz")
set(MD5 "b8b3f7a73032c9ce9daafa4f67196c8c")
endif()
mindspore_add_pkg(cppjieba
VER 5.0.3
HEAD_ONLY ./
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/cppjieba/cppjieba.patch001)
include_directories(${cppjieba_INC}include)
include_directories(${cppjieba_INC}deps)
add_library(mindspore::cppjieba ALIAS cppjieba)
mindspore_add_pkg(
cppjieba
VER 5.0.3
LIBS cppjieba
CMAKE_OPTION " "
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/cppjieba/cppjieba.patch001
${TOP_DIR}/third_party/patch/cppjieba/cppjieba.patch002
TARGET_ALIAS mindspore::cppjieba cppjieba::cppjieba)

View File

@ -1,18 +1,13 @@
set(Eigen3_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(Eigen3_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(REQ_URL "https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz")
set(MD5 "609286804b0f79be622ccf7f9ff2b660")
mindspore_add_pkg(Eigen3
VER 3.3.9
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF)
find_package(Eigen3 3.3.9 REQUIRED ${MS_FIND_NO_DEFAULT_PATH})
include_directories(${Eigen3_INC})
include_directories(${EIGEN3_INCLUDE_DIR})
set_property(TARGET Eigen3::Eigen PROPERTY IMPORTED_GLOBAL TRUE)
add_library(mindspore::eigen ALIAS Eigen3::Eigen)
mindspore_add_pkg(
Eigen3
VER 3.3.9
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF
TARGET_ALIAS mindspore::eigen Eigen3::Eigen)

View File

@ -1,151 +1,126 @@
if(MSVC)
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
else()
set(flatbuffers_CXXFLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong")
set(flatbuffers_CFLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong")
set(flatbuffers_CXXFLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong")
set(flatbuffers_CFLAGS "-fPIC -fPIE -D_FORTIFY_SOURCE=2 -O2 -fstack-protector-strong")
endif()
if(WIN32)
set(flatbuffers_USE_STATIC_LIBS ON)
set(flatbuffers_USE_STATIC_LIBS ON)
endif()
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "https://gitee.com/src-openeuler/flatbuffers.git")
set(GIT_TAG "openEuler-22.03-LTS")
set(MD5 "f1c724296be49a29ded69278a9a770c7")
set(FLATBUFFER_SRC "${TOP_DIR}/mindspore/lite/build/_deps/flatbuffers-src")
set(FLATBUFFER_DIR "${FLATBUFFER_SRC}/flatbuffers-2.0.0")
__download_pkg_with_git(flatbuffers ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
execute_process(COMMAND tar -xf ${FLATBUFFER_SRC}/v2.0.0.tar.gz WORKING_DIRECTORY ${FLATBUFFER_SRC})
foreach(_SUBMODULE_FILE ${PKG_SUBMODULES})
STRING(REGEX REPLACE "(.+)_(.+)" "\\1" _SUBMODEPATH ${_SUBMODULE_FILE})
STRING(REGEX REPLACE "(.+)/(.+)" "\\2" _SUBMODENAME ${_SUBMODEPATH})
file(GLOB ${pkg_name}_INSTALL_SUBMODULE ${_SUBMODULE_FILE}/*)
file(COPY ${${pkg_name}_INSTALL_SUBMODULE} DESTINATION ${${pkg_name}_SOURCE_DIR}/3rdparty/${_SUBMODENAME})
endforeach()
else()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/flatbuffers/repository/archive/v2.0.0.tar.gz")
set(MD5 "5c23d17c0486b81d4c11907e8f7bf36b")
set(REQ_URL "https://gitee.com/mirrors/flatbuffers/repository/archive/v2.0.0.tar.gz")
set(MD5 "5c23d17c0486b81d4c11907e8f7bf36b")
else()
set(REQ_URL "https://github.com/google/flatbuffers/archive/v2.0.0.tar.gz")
set(MD5 "a27992324c3cbf86dd888268a23d17bd")
endif()
set(REQ_URL "https://github.com/google/flatbuffers/archive/v2.0.0.tar.gz")
set(MD5 "a27992324c3cbf86dd888268a23d17bd")
endif()
if(APPLE)
set(flatbuffers_CXXFLAGS "${flatbuffers_CXXFLAGS} -Wno-deprecated")
set(flatbuffers_CXXFLAGS "${flatbuffers_CXXFLAGS} -Wno-deprecated")
endif()
if(APPLE)
mindspore_add_pkg(flatbuffers
VER 2.0.0
LIBS flatbuffers
EXE flatc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib)
set(CMAKE_OPTION -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib)
else()
mindspore_add_pkg(flatbuffers
VER 2.0.0
LIBS flatbuffers
EXE flatc
URL ${REQ_URL}
MD5 ${MD5}
DIR ${FLATBUFFER_DIR}
CMAKE_OPTION -DCMAKE_C_COMPILER=${FLATC_GCC_COMPILER} -DCMAKE_CXX_COMPILER=${FLATC_GXX_COMPILER}
-DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release)
set(CMAKE_OPTION -DCMAKE_C_COMPILER=${FLATC_GCC_COMPILER} -DCMAKE_CXX_COMPILER=${FLATC_GXX_COMPILER}
-DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_INSTALL_LIBDIR=lib -DCMAKE_BUILD_TYPE=Release)
endif()
include_directories(${flatbuffers_INC})
add_library(mindspore::flatbuffers ALIAS flatbuffers::flatbuffers)
add_executable(mindspore::flatc ALIAS flatbuffers::flatc)
function(ms_build_flatbuffers source_schema_files
source_schema_dirs
custom_target_name
generated_output_dir)
if(MS_PREFER_SYSTEM_PKGS OR MS_FLATBUFFERS_PREFER_SYSTEM)
# Most Linux distributions are likely to ship at least the shared library
set(_flatbuffer_lib_name flatbuffers_shared)
else()
set(_flatbuffer_lib_name flatbuffers)
endif()
set(total_schema_dirs "")
set(total_generated_files "")
set(FLATC mindspore::flatc)
foreach(schema_dir ${source_schema_dirs})
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
endforeach()
mindspore_add_pkg(
Flatbuffers
VER 2.0.0
LIBS flatbuffers
LIBS_CMAKE_NAMES ${_flatbuffer_lib_name}
EXE flatc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION ${CMAKE_OPTION}
TARGET_ALIAS mindspore::flatbuffers flatbuffers::${_flatbuffer_lib_name}
TARGET_ALIAS mindspore::flatc flatbuffers::flatc)
foreach(schema IN LISTS ${source_schema_files})
get_filename_component(filename ${schema} NAME_WE)
if(NOT ${generated_output_dir} STREQUAL "")
set(generated_file ${generated_output_dir}/${filename}_generated.h)
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} --gen-mutable
--reflect-names --gen-object-api -o ${generated_output_dir}
${total_schema_dirs}
-c -b --reflect-types ${schema}
DEPENDS ${FLATC} ${schema}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running C++ flatbuffers compiler on ${schema}" VERBATIM)
list(APPEND total_generated_files ${generated_file})
endif()
endforeach()
add_custom_target(${custom_target_name} ALL
DEPENDS ${total_generated_files})
function(ms_build_flatbuffers source_schema_files source_schema_dirs custom_target_name generated_output_dir)
set(total_schema_dirs "")
set(total_generated_files "")
set(FLATC mindspore::flatc)
foreach(schema_dir ${source_schema_dirs})
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
endforeach()
foreach(schema IN LISTS ${source_schema_files})
get_filename_component(filename ${schema} NAME_WE)
if(NOT ${generated_output_dir} STREQUAL "")
include_directories(${generated_output_dir})
set_property(TARGET ${custom_target_name}
PROPERTY GENERATED_OUTPUT_DIR
${generated_output_dir})
set(generated_file ${generated_output_dir}/${filename}_generated.h)
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} --gen-mutable --reflect-names --gen-object-api -o ${generated_output_dir} ${total_schema_dirs}
-c -b --reflect-types ${schema}
DEPENDS ${FLATC} ${schema}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running C++ flatbuffers compiler on ${schema}"
VERBATIM)
list(APPEND total_generated_files ${generated_file})
endif()
endforeach()
add_custom_target(${custom_target_name} ALL DEPENDS ${total_generated_files})
if(NOT ${generated_output_dir} STREQUAL "")
include_directories(${generated_output_dir})
set_property(TARGET ${custom_target_name} PROPERTY GENERATED_OUTPUT_DIR ${generated_output_dir})
endif()
endfunction()
function(ms_build_flatbuffers_lite
source_schema_files source_schema_dirs custom_target_name generated_output_dir if_inner)
function(ms_build_flatbuffers_lite source_schema_files source_schema_dirs custom_target_name generated_output_dir
if_inner)
set(total_schema_dirs "")
set(total_generated_files "")
set(FLATC mindspore::flatc)
foreach(schema_dir ${source_schema_dirs})
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
endforeach()
foreach(schema IN LISTS ${source_schema_files})
get_filename_component(filename ${schema} NAME_WE)
if(NOT ${generated_output_dir} STREQUAL "")
set(generated_file ${generated_output_dir}/${filename}_generated.h)
if(if_inner MATCHES "inner")
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} --gen-mutable
--reflect-names --gen-object-api -o ${generated_output_dir}
${total_schema_dirs}
-c -b --reflect-types ${schema}
DEPENDS ${FLATC} ${schema}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running C++ flatbuffers compiler on ${schema}" VERBATIM)
else()
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} -o ${generated_output_dir}
${total_schema_dirs}
-c -b ${schema}
DEPENDS ${FLATC} ${schema}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running C++ flatbuffers compiler on ${schema}" VERBATIM)
endif()
list(APPEND total_generated_files ${generated_file})
endif()
endforeach()
add_custom_target(${custom_target_name} ALL
DEPENDS ${total_generated_files})
set(total_schema_dirs "")
set(total_generated_files "")
set(FLATC mindspore::flatc)
foreach(schema_dir ${source_schema_dirs})
set(total_schema_dirs -I ${schema_dir} ${total_schema_dirs})
endforeach()
foreach(schema IN LISTS ${source_schema_files})
get_filename_component(filename ${schema} NAME_WE)
if(NOT ${generated_output_dir} STREQUAL "")
include_directories(${generated_output_dir})
set_property(TARGET ${custom_target_name}
PROPERTY GENERATED_OUTPUT_DIR
${generated_output_dir})
set(generated_file ${generated_output_dir}/${filename}_generated.h)
if(if_inner MATCHES "inner")
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} --gen-mutable --reflect-names --gen-object-api -o ${generated_output_dir}
${total_schema_dirs} -c -b --reflect-types ${schema}
DEPENDS ${FLATC} ${schema}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running C++ flatbuffers compiler on ${schema}"
VERBATIM)
else()
add_custom_command(
OUTPUT ${generated_file}
COMMAND ${FLATC} -o ${generated_output_dir} ${total_schema_dirs} -c -b ${schema}
DEPENDS ${FLATC} ${schema}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Running C++ flatbuffers compiler on ${schema}"
VERBATIM)
endif()
list(APPEND total_generated_files ${generated_file})
endif()
endforeach()
add_custom_target(${custom_target_name} ALL DEPENDS ${total_generated_files})
if(NOT ${generated_output_dir} STREQUAL "")
include_directories(${generated_output_dir})
set_property(TARGET ${custom_target_name} PROPERTY GENERATED_OUTPUT_DIR ${generated_output_dir})
endif()
endfunction()

View File

@ -1,52 +1,59 @@
if(BUILD_LITE)
if(MSVC)
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
else()
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private")
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_C_FLAGS}")
set(glog_LDFLAGS "${SECURE_SHARED_LINKER_FLAGS}")
endif()
set(glog_patch "")
set(glog_lib glog)
else()
if(MSVC)
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_C_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
else()
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private")
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(glog_patch ${CMAKE_SOURCE_DIR}/third_party/patch/glog/glog.patch001)
set(glog_lib mindspore_glog)
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_C_FLAGS}")
set(glog_LDFLAGS "${SECURE_SHARED_LINKER_FLAGS}")
endif()
set(glog_patch "")
else()
set(glog_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 ${SECURE_CXX_FLAGS} -Dgoogle=mindspore_private")
set(glog_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(glog_patch ${CMAKE_SOURCE_DIR}/third_party/patch/glog/glog.patch001)
endif()
if(NOT ENABLE_GLIBCXX)
set(glog_CXXFLAGS "${glog_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
set(glog_CXXFLAGS "${glog_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/glog/repository/archive/v0.4.0.tar.gz")
set(MD5 "9a7598a00c569a11ff1a419076de4ed7")
set(REQ_URL "https://gitee.com/mirrors/glog/repository/archive/v0.4.0.tar.gz")
set(MD5 "9a7598a00c569a11ff1a419076de4ed7")
else()
set(REQ_URL "https://github.com/google/glog/archive/v0.4.0.tar.gz")
set(MD5 "0daea8785e6df922d7887755c3d100d0")
set(REQ_URL "https://github.com/google/glog/archive/v0.4.0.tar.gz")
set(MD5 "0daea8785e6df922d7887755c3d100d0")
endif()
set(glog_option -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON -DWITH_GFLAGS=OFF
-DCMAKE_BUILD_TYPE=Release)
-DCMAKE_BUILD_TYPE=Release)
if(WIN32 AND NOT MSVC)
execute_process(COMMAND "${CMAKE_C_COMPILER}" -dumpmachine
OUTPUT_VARIABLE i686_or_x86_64
)
if(i686_or_x86_64 MATCHES "^i686-")
set(glog_option ${glog_option} -DHAVE_DBGHELP=ON)
endif()
execute_process(COMMAND "${CMAKE_C_COMPILER}" -dumpmachine OUTPUT_VARIABLE i686_or_x86_64)
if(i686_or_x86_64 MATCHES "^i686-")
set(glog_option ${glog_option} -DHAVE_DBGHELP=ON)
endif()
endif()
mindspore_add_pkg(glog
VER 0.4.0
LIBS ${glog_lib}
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${glog_patch}
CMAKE_OPTION ${glog_option})
include_directories(${glog_INC})
add_library(mindspore::glog ALIAS glog::${glog_lib})
mindspore_add_pkg(
glog
VER 0.4.0
LIBS glog
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${glog_patch}
CMAKE_OPTION ${glog_option}
TARGET_ALIAS mindspore::glog glog::glog)
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_GLOG_PREFER_SYSTEM)
set(MS_PATCHED_GLOG_NAME
TRUE
CACHE INTERNAL "")
target_compile_definitions(glog::glog INTERFACE MS_PATCHED_GLOG_NAME)
else()
set(MS_PATCHED_GLOG_NAME
FALSE
CACHE INTERNAL "")
endif()

View File

@ -1,129 +1,150 @@
set(grpc_USE_STATIC_LIBS OFF)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2 \
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 -O2 \
-Dgrpc=mindspore_grpc -Dgrpc_impl=mindspore_grpc_impl -Dgrpc_core=mindspore_grpc_core")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
else()
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2 \
set(grpc_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2 \
-Dgrpc=mindspore_grpc -Dgrpc_impl=mindspore_grpc_impl -Dgrpc_core=mindspore_grpc_core")
if(NOT ENABLE_GLIBCXX)
set(grpc_CXXFLAGS "${grpc_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(NOT ENABLE_GLIBCXX)
set(grpc_CXXFLAGS "${grpc_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(grpc_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(grpc_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
if(EXISTS ${protobuf_ROOT}/lib64)
set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "${protobuf_ROOT}/lib64/cmake/protobuf")
else()
set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "${protobuf_ROOT}/lib/cmake/protobuf")
endif()
message("grpc using Protobuf_DIR : " ${_FINDPACKAGE_PROTOBUF_CONFIG_DIR})
file(GLOB _dirs "${_MS_LIB_CACHE}/*")
list(PREPEND CMAKE_PREFIX_PATH ${_dirs})
if(EXISTS ${absl_ROOT}/lib64)
set(_FINDPACKAGE_ABSL_CONFIG_DIR "${absl_ROOT}/lib64/cmake/absl")
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_PROTOBUF_PREFER_SYSTEM)
if(NOT protobuf_DIR)
find_package(protobuf CONFIG QUIET)
endif()
set(_FINDPACKAGE_PROTOBUF_CONFIG_DIR "-DProtobuf_DIR:PATH=${protobuf_DIR}")
message("grpc using Protobuf_DIR : " ${_FINDPACKAGE_PROTOBUF_CONFIG_DIR})
else()
set(_FINDPACKAGE_ABSL_CONFIG_DIR "${absl_ROOT}/lib/cmake/absl")
# We rely on system discovery anyway so should work when building grpc
endif()
if(NOT absl_DIR)
find_package(absl CONFIG QUIET)
endif()
set(_FINDPACKAGE_ABSL_CONFIG_DIR "-Dabsl_DIR:PATH=${absl_DIR}")
message("grpc using absl_DIR : " ${_FINDPACKAGE_ABSL_CONFIG_DIR})
if(EXISTS ${re2_ROOT}/lib64)
set(_FINDPACKAGE_RE2_CONFIG_DIR "${re2_ROOT}/lib64/cmake/re2")
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_RE2_PREFER_SYSTEM)
if(NOT re2_DIR)
find_package(re2 CONFIG QUIET)
endif()
set(_FINDPACKAGE_RE2_CONFIG_DIR "-Dre2_DIR:PATH=${re2_DIR}")
message("grpc using re2_DIR : " ${_FINDPACKAGE_RE2_CONFIG_DIR})
else()
set(_FINDPACKAGE_RE2_CONFIG_DIR "${re2_ROOT}/lib/cmake/re2")
# We rely on system discovery anyway so should work when building grpc
endif()
message("grpc using re2_DIR : " ${_FINDPACKAGE_RE2_CONFIG_DIR})
if(EXISTS ${openssl_ROOT})
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "-DOPENSSL_ROOT_DIR:PATH=${openssl_ROOT}")
list(POP_FRONT CMAKE_PREFIX_PATH)
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_OPENSSL_PREFER_SYSTEM)
foreach(_dir ${_dirs})
if(_dir MATCHES ".*OpenSSL.*")
set(OpenSSL_ROOT ${_dir})
break()
endif()
endforeach()
message(STATUS "OpenSSL_ROOT = ${OpenSSL_ROOT}")
if(EXISTS ${OpenSSL_ROOT})
set(_CMAKE_ARGS_OPENSSL_ROOT_DIR "-DOPENSSL_ROOT_DIR:PATH=${OpenSSL_ROOT}")
endif()
else()
# We rely on system discovery anyway so should work when building grpc
endif()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/grpc/repository/archive/v1.36.1.tar.gz")
set(MD5 "71252ebcd8e9e32a818a907dfd4b63cc")
set(REQ_URL "https://gitee.com/mirrors/grpc/repository/archive/v1.36.1.tar.gz")
set(MD5 "71252ebcd8e9e32a818a907dfd4b63cc")
else()
set(REQ_URL "https://github.com/grpc/grpc/archive/v1.36.1.tar.gz")
set(MD5 "90c93203e95e89af5f46738588217057")
set(REQ_URL "https://github.com/grpc/grpc/archive/v1.36.1.tar.gz")
set(MD5 "90c93203e95e89af5f46738588217057")
endif()
mindspore_add_pkg(grpc
VER 1.36.1
LIBS mindspore_grpc++ mindspore_grpc mindspore_gpr mindspore_upb mindspore_address_sorting
EXE grpc_cpp_plugin
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/grpc/grpc.patch001
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS=ON
-DgRPC_INSTALL:BOOL=ON
-DgRPC_BUILD_TESTS:BOOL=OFF
-DgRPC_PROTOBUF_PROVIDER:STRING=package
-DgRPC_PROTOBUF_PACKAGE_TYPE:STRING=CONFIG
-DProtobuf_DIR:PATH=${_FINDPACKAGE_PROTOBUF_CONFIG_DIR}
-DgRPC_ZLIB_PROVIDER:STRING=package
-DZLIB_ROOT:PATH=${zlib_ROOT}
-DgRPC_ABSL_PROVIDER:STRING=package
-Dabsl_DIR:PATH=${_FINDPACKAGE_ABSL_CONFIG_DIR}
-DgRPC_CARES_PROVIDER:STRING=package
-Dc-ares_DIR:PATH=${c-ares_ROOT}/lib/cmake/c-ares
-DgRPC_SSL_PROVIDER:STRING=package
${_CMAKE_ARGS_OPENSSL_ROOT_DIR}
-DgRPC_RE2_PROVIDER:STRING=package
-Dre2_DIR:PATH=${_FINDPACKAGE_RE2_CONFIG_DIR}
)
include_directories(${grpc_INC})
add_library(mindspore::grpc++ ALIAS grpc::mindspore_grpc++)
# link other grpc libs
target_link_libraries(grpc::mindspore_grpc++ INTERFACE grpc::mindspore_grpc grpc::mindspore_gpr grpc::mindspore_upb
grpc::mindspore_address_sorting)
mindspore_add_pkg(
gRPC
VER 1.36.1
LIBS mindspore_grpc++ mindspore_grpc mindspore_gpr mindspore_upb mindspore_address_sorting
LIBS_CMAKE_NAMES grpc++ grpc gpr upb address_sorting
EXE grpc_cpp_plugin
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/grpc/grpc.patch001
CMAKE_OPTION
-DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS=ON
-DgRPC_INSTALL:BOOL=ON
-DgRPC_BUILD_TESTS:BOOL=OFF
-DgRPC_PROTOBUF_PROVIDER:STRING=package
-DgRPC_PROTOBUF_PACKAGE_TYPE:STRING=CONFIG
${_FINDPACKAGE_PROTOBUF_CONFIG_DIR}
-DgRPC_ZLIB_PROVIDER:STRING=package
-DZLIB_ROOT:PATH=${zlib_ROOT}
-DgRPC_ABSL_PROVIDER:STRING=package
${_FINDPACKAGE_ABSL_CONFIG_DIR}
-DgRPC_CARES_PROVIDER:STRING=package
-Dc-ares_DIR:PATH=${c-ares_ROOT}/lib/cmake/c-ares
-DgRPC_SSL_PROVIDER:STRING=package
${_CMAKE_ARGS_OPENSSL_ROOT_DIR}
-DgRPC_RE2_PROVIDER:STRING=package
${_FINDPACKAGE_RE2_CONFIG_DIR}
TARGET_ALIAS mindspore::grpc++ gRPC::grpc++)
# modify mindspore macro define
add_compile_definitions(grpc=mindspore_grpc)
add_compile_definitions(grpc_impl=mindspore_grpc_impl)
add_compile_definitions(grpc_core=mindspore_grpc_core)
# add_compile_definitions(grpc=mindspore_grpc)
# add_compile_definitions(grpc_impl=mindspore_grpc_impl)
# add_compile_definitions(grpc_core=mindspore_grpc_core)
function(ms_grpc_generate c_var h_var)
if(NOT ARGN)
message(SEND_ERROR "Error: ms_grpc_generate() called without any proto files")
return()
endif()
if(NOT ARGN)
message(SEND_ERROR "Error: ms_grpc_generate() called without any proto files")
return()
endif()
set(${c_var})
set(${h_var})
set(${c_var})
set(${h_var})
foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.h")
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.h")
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc --version
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto
--grpc_out=${CMAKE_BINARY_DIR}/proto
--plugin=protoc-gen-grpc=$<TARGET_FILE:grpc::grpc_cpp_plugin> ${abs_file}
DEPENDS protobuf::protoc grpc::grpc_cpp_plugin ${abs_file}
COMMENT "Running C++ gRPC compiler on ${file}" VERBATIM)
endforeach()
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc" "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.cc" "${CMAKE_BINARY_DIR}/proto/${file_name}.grpc.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc --version
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto --grpc_out=${CMAKE_BINARY_DIR}/proto
--plugin=protoc-gen-grpc=$<TARGET_FILE:gRPC::grpc_cpp_plugin> ${abs_file}
DEPENDS protobuf::protoc gRPC::grpc_cpp_plugin ${abs_file}
COMMENT "Running C++ gRPC compiler on ${file}"
VERBATIM)
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
set(${c_var}
${${c_var}}
PARENT_SCOPE)
set(${h_var}
${${h_var}}
PARENT_SCOPE)
endfunction()

View File

@ -1,67 +1,59 @@
set(gtest_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(gtest_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(CMAKE_OPTION
-DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON)
set(CMAKE_OPTION -DBUILD_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON
-DCMAKE_MACOSX_RPATH=TRUE -Dgtest_disable_pthreads=ON -Dgtest_build_samples=OFF
-Dgtest_build_tests=OFF)
if(BUILD_LITE)
if(PLATFORM_ARM64)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=arm64-v8a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=${ANDROID_STL}
${CMAKE_OPTION})
endif()
if(PLATFORM_ARM32)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=armeabi-v7a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=${ANDROID_STL}
${CMAKE_OPTION})
endif()
if(PLATFORM_ARM64)
set(CMAKE_OPTION
-DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=arm64-v8a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=${ANDROID_STL}
${CMAKE_OPTION})
endif()
if(PLATFORM_ARM32)
set(CMAKE_OPTION
-DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=armeabi-v7a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=${ANDROID_STL}
${CMAKE_OPTION})
endif()
endif()
if(NOT ENABLE_GLIBCXX)
set(gtest_CXXFLAGS "${gtest_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
set(gtest_CXXFLAGS "${gtest_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/googletest/repository/archive/release-1.8.1.tar.gz")
set(MD5 "2e6fbeb6a91310a16efe181886c59596")
set(REQ_URL "https://gitee.com/mirrors/googletest/repository/archive/release-1.11.0.tar.gz")
set(MD5 "e8a8df240b6938bb6384155d4c37d937")
else()
set(REQ_URL "https://github.com/google/googletest/archive/release-1.8.1.tar.gz")
set(MD5 "2e6fbeb6a91310a16efe181886c59596")
set(REQ_URL "https://github.com/google/googletest/archive/release-1.11.0.tar.gz")
set(MD5 "e8a8df240b6938bb6384155d4c37d937")
endif()
mindspore_add_pkg(gtest
VER 1.8.1
LIBS gtest gmock
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION ${CMAKE_OPTION})
include_directories(${gtest_INC})
add_library(mindspore::gtest ALIAS gtest::gtest)
add_library(mindspore::gmock ALIAS gtest::gmock)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
file(COPY ${gtest_DIRPATH}/bin/libgtest${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
file(COPY ${gtest_DIRPATH}/bin/libgtest_main${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
file(COPY ${gtest_DIRPATH}/bin/libgmock_main${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
file(COPY ${gtest_DIRPATH}/bin/libgmock${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
else()
file(COPY ${gtest_LIBPATH}/libgtest${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
file(COPY ${gtest_LIBPATH}/libgtest_main${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
file(COPY ${gtest_LIBPATH}/libgmock${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
file(COPY ${gtest_LIBPATH}/libgmock_main${CMAKE_SHARED_LIBRARY_SUFFIX} DESTINATION
${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
endif()
mindspore_add_pkg(
GTest
VER 1.8.1
LIBS gtest gmock gtest_main gmock_main
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION ${CMAKE_OPTION}
TARGET_ALIAS mindspore::gtest GTest::gtest
TARGET_ALIAS mindspore::gmock GTest::gmock)
foreach(_tgt GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main)
foreach(_prop IMPORTED_LOCATION_RELEASE IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_NOCONFIG)
get_target_property(_lib ${_tgt} ${_prop})
if(_lib)
file(COPY ${_lib} DESTINATION ${CMAKE_BINARY_DIR}/googletest/googlemock/gtest)
endif()
endforeach()
endforeach()

View File

@ -2,68 +2,55 @@ set(LIB_ICU_COMMON icuuc)
set(LIB_ICU_DATA icudata)
set(LIB_ICU_I18N icui18n)
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "https://gitee.com/src-openeuler/icu.git")
set(GIT_TAG "openEuler-22.03-LTS")
set(MD5 "fa4070da839ce75469a8de962f2a0c2a")
set(ICU4C_SRC "${TOP_DIR}/build/mindspore/_deps/icu4c-src/icu4c")
set(ICU4C_TAR_SRC "${TOP_DIR}/build/mindspore/_deps/icu4c-src")
__download_pkg_with_git(icu4c ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
execute_process(COMMAND mkdir ${ICU4C_SRC})
execute_process(COMMAND tar -xf ${ICU4C_TAR_SRC}/icu4c-69_1-src.tgz --strip-components 1 -C ${ICU4C_SRC})
else()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/icu/repository/archive/release-69-1.tar.gz")
set(MD5 "9f218f0eee9d49831e7e48fd136e689c")
set(REQ_URL "https://gitee.com/mirrors/icu/repository/archive/release-67-1.tar.gz")
set(MD5 "0c2662a2b0bc80b0eb56495205247c8f")
else()
set(REQ_URL "https://github.com/unicode-org/icu/archive/release-69-1.tar.gz")
set(MD5 "135125f633864285d637db5c01e0388b")
endif()
set(REQ_URL "https://github.com/unicode-org/icu/archive/release-67-1.tar.gz")
set(MD5 "fd525fb47d8827b0b7da78b51dd2d93f")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
message("icu4c thirdparty do not support windows currently.")
message("icu4c thirdparty do not support windows currently.")
else()
set(JSON_FILE "{ \n\
set(JSON_FILE
"{ \n\
\"strategy\": \"additive\",\n\
\"featureFilters\": {\n\
\"normalization\": \"include\"\n\
}\n\
}\
")
file(WRITE ${CMAKE_BINARY_DIR}/icu4c_filter.json ${JSON_FILE})
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
mindspore_add_pkg(icu4c
VER 69.1
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/icu4c/icu4c.patch01
CONFIGURE_COMMAND ./icu4c/source/runConfigureICU MacOSX --disable-tests
--disable-samples --disable-icuio --disable-extras
ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json
)
else()
mindspore_add_pkg(icu4c
VER 69.1
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/icu4c/icu4c.patch01
CONFIGURE_COMMAND ./icu4c/source/runConfigureICU Linux --enable-rpath --disable-tests --disable-samples
--disable-icuio --disable-extras
ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json
)
endif()
include_directories(${icu4c_INC})
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
include(${CMAKE_SOURCE_DIR}/cmake/change_rpath.cmake)
changerpath($<TARGET_FILE:icu4c::${LIB_ICU_COMMON}> ${LIB_ICU_COMMON} "libicuuc;libicudata")
changerpath($<TARGET_FILE:icu4c::${LIB_ICU_DATA}> ${LIB_ICU_DATA} "libicudata")
changerpath($<TARGET_FILE:icu4c::${LIB_ICU_I18N}> ${LIB_ICU_I18N} "libicuuc;libicudata;libicui18n")
endif()
add_library(mindspore::icuuc ALIAS icu4c::${LIB_ICU_COMMON})
add_library(mindspore::icudata ALIAS icu4c::${LIB_ICU_DATA})
add_library(mindspore::icui18n ALIAS icu4c::${LIB_ICU_I18N})
add_definitions(-D ENABLE_ICU4C)
file(WRITE ${CMAKE_BINARY_DIR}/icu4c_filter.json ${JSON_FILE})
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/icu4c/icu4c.patch01)
set(CONFIGURE_COMMAND ./icu4c/source/runConfigureICU MacOSX --disable-tests --disable-samples --disable-icuio
--disable-extras ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json)
else()
set(PATCHES ${TOP_DIR}/third_party/patch/icu4c/icu4c.patch01)
set(CONFIGURE_COMMAND ./icu4c/source/runConfigureICU Linux --enable-rpath --disable-tests --disable-samples
--disable-icuio --disable-extras ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json)
endif()
mindspore_add_pkg(
ICU
VER 67.1
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
LIBS_CMAKE_NAMES uc data i18n
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${PATCHES}
CONFIGURE_COMMAND ${CONFIGURE_COMMAND}
GEN_CMAKE_CONFIG
TARGET_ALIAS mindspore::icuuc ICU::uc
TARGET_ALIAS mindspore::icudata ICU::data
TARGET_ALIAS mindspore::icui18n ICU::i18n)
if(CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT MS_ICU_PREFER_SYSTEM)
include(${CMAKE_SOURCE_DIR}/cmake/change_rpath.cmake)
changerpath($<TARGET_FILE:ICU::uc> ${LIB_ICU_COMMON} "libicuuc;libicudata")
changerpath($<TARGET_FILE:ICU::data> ${LIB_ICU_DATA} "libicudata")
changerpath($<TARGET_FILE:ICU::i18n> ${LIB_ICU_I18N} "libicuuc;libicudata;libicui18n")
endif()
add_definitions(-DENABLE_ICU4C)
endif()

View File

@ -1,56 +1,58 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/libjpeg-turbo/repository/archive/2.0.4.tar.gz")
set(MD5 "44c43e4a9fb352f47090804529317c88")
set(REQ_URL "https://gitee.com/mirrors/libjpeg-turbo/repository/archive/2.0.4.tar.gz")
set(MD5 "44c43e4a9fb352f47090804529317c88")
else()
set(REQ_URL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.4.tar.gz")
set(MD5 "44c43e4a9fb352f47090804529317c88")
set(REQ_URL "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.4.tar.gz")
set(MD5 "44c43e4a9fb352f47090804529317c88")
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 \
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 \
-O2")
else()
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC \
set(jpeg_turbo_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC \
-D_FORTIFY_SOURCE=2 -O2")
endif()
set(jpeg_turbo_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack,-s")
set(jpeg_turbo_USE_STATIC_LIBS ON)
set(JPEG_TURBO_PATCHE ${CMAKE_SOURCE_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
set(CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=TRUE -DWITH_SIMD=ON)
if(BUILD_LITE)
set(jpeg_turbo_USE_STATIC_LIBS OFF)
set(JPEG_TURBO_PATCHE ${TOP_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
if(PLATFORM_ARM64)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=arm64-v8a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
if(PLATFORM_ARM32)
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=armeabi-v7a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
set(jpeg_turbo_USE_STATIC_LIBS OFF)
set(JPEG_TURBO_PATCHE ${TOP_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
if(PLATFORM_ARM64)
set(CMAKE_OPTION
-DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=arm64-v8a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=c++_shared
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
if(PLATFORM_ARM32)
set(CMAKE_OPTION
-DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
-DANDROID_NATIVE_API_LEVEL=19
-DANDROID_NDK=$ENV{ANDROID_NDK}
-DANDROID_ABI=armeabi-v7a
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
-DANDROID_STL=c++_shared
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
endif()
endif()
mindspore_add_pkg(jpeg_turbo
VER 2.0.4
LIBS jpeg turbojpeg
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION ${CMAKE_OPTION}
PATCHES ${JPEG_TURBO_PATCHE}
)
include_directories(${jpeg_turbo_INC})
add_library(mindspore::jpeg_turbo ALIAS jpeg_turbo::jpeg)
add_library(mindspore::turbojpeg ALIAS jpeg_turbo::turbojpeg)
mindspore_add_pkg(
TurboJPEG
VER 2.0.4
LIBS JPEG TurboJPEG
URL ${REQ_URL}
MD5 ${MD5}
GEN_CMAKE_CONFIG
CMAKE_OPTION ${CMAKE_OPTION}
PATCHES ${JPEG_TURBO_PATCHE}
TARGET_ALIAS mindspore::jpeg_turbo TurboJPEG::JPEG
TARGET_ALIAS mindspore::turbojpeg TurboJPEG::TurboJPEG)

View File

@ -1,26 +1,27 @@
if(MSVC)
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(flatbuffers_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_CFLAGS "${CMAKE_CXX_FLAGS}")
set(flatbuffers_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
else()
set(nlohmann_json373_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json373_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json373_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(nlohmann_json373_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
endif()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.7.3.zip")
set(MD5 "b758acca4f3e133bacf919e31ca302e3")
set(INCLUDE "./include")
set(REQ_URL "https://gitee.com/mirrors/JSON-for-Modern-CPP/repository/archive/v3.7.3.tar.gz")
set(MD5 "b758acca4f3e133bacf919e31ca302e3")
set(INCLUDE "./include")
else()
set(REQ_URL "https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip")
set(MD5 "fb96f95cdf609143e998db401ca4f324")
set(INCLUDE "./include")
set(REQ_URL "https://github.com/nlohmann/json/archive/v3.7.3.tar.gz")
set(MD5 "846bbc611ce9ecd7d45d6554679245e1")
set(INCLUDE "./include")
endif()
mindspore_add_pkg(nlohmann_json373
VER 3.7.3
HEAD_ONLY ${INCLUDE}
URL ${REQ_URL}
MD5 ${MD5})
include_directories(${nlohmann_json373_INC})
add_library(mindspore::json ALIAS nlohmann_json373)
mindspore_add_pkg(
nlohmann_json
VER 3.7.3
CMAKE_PKG_NO_COMPONENTS
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DBUILD_TESTING=OFF -DJSON_MultipleHeaders=ON
TARGET_ALIAS mindspore::json nlohmann_json::nlohmann_json)

View File

@ -1,30 +1,30 @@
set(libevent_CFLAGS "-fstack-protector-all -D_FORTIFY_SOURCE=2 -O2")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(libevent_LDFLAGS "-Wl,-z,now")
set(libevent_LDFLAGS "-Wl,-z,now")
endif()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/libevent/repository/archive/release-2.1.12-stable.tar.gz")
set(MD5 "0d5a27436bf7ff8253420c8cf09f47ca")
set(REQ_URL "https://gitee.com/mirrors/libevent/repository/archive/release-2.1.12-stable.tar.gz")
set(MD5 "0d5a27436bf7ff8253420c8cf09f47ca")
else()
set(REQ_URL
set(REQ_URL
"https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz")
set(MD5 "b5333f021f880fe76490d8a799cd79f4")
set(MD5 "b5333f021f880fe76490d8a799cd79f4")
endif()
message("libevent using openssl stub dir: " ${openssl_ROOT})
mindspore_add_pkg(libevent
VER 2.1.12
LIBS event event_pthreads event_core event_openssl
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/libevent/libevent.patch001
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING=OFF -DOPENSSL_ROOT_DIR:PATH=${openssl_ROOT})
include_directories(${libevent_INC})
add_library(mindspore::event ALIAS libevent::event)
add_library(mindspore::event_pthreads ALIAS libevent::event_pthreads)
add_library(mindspore::event_core ALIAS libevent::event_core)
add_library(mindspore::event_openssl ALIAS libevent::event_openssl)
mindspore_add_pkg(
Libevent
NS_NAME libevent
VER 2.1.12
LIBS event_pthreads event_core event_extra event_openssl
LIBS_CMAKE_NAMES pthreads core extra openssl
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/libevent/libevent.patch001
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING=OFF -DOPENSSL_ROOT_DIR:PATH=${openssl_ROOT}
TARGET_ALIAS mindspore::event_extra libevent::extra
TARGET_ALIAS mindspore::event_pthreads libevent::pthreads
TARGET_ALIAS mindspore::event_core libevent::core
TARGET_ALIAS mindspore::event_openssl libevent::openssl)

View File

@ -1,36 +1,49 @@
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(tiff_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \
set(tiff_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
set(tiff_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \
set(tiff_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -Wno-unused-result \
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
else()
set(tiff_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \
set(tiff_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
set(tiff_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \
set(tiff_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -Wno-unused-result \
-Wno-unused-but-set-variable -fPIC -D_FORTIFY_SOURCE=2 -O2")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(tiff_CFLAGS "${tiff_CFLAGS} -Wno-int-to-pointer-cast -Wno-implicit-fallthrough -Wno-pointer-to-int-cast")
endif()
endif()
endif()
set(tiff_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/libtiff/repository/archive/v4.2.0.tar.gz")
set(MD5 "1b8f32e39940ffbdac3638f7081ba9e0")
set(REQ_URL "https://gitee.com/mirrors/libtiff/repository/archive/v4.2.0.tar.gz")
set(MD5 "1b8f32e39940ffbdac3638f7081ba9e0")
else()
set(REQ_URL "http://download.osgeo.org/libtiff/tiff-4.2.0.tar.gz")
set(MD5 "2bbf6db1ddc4a59c89d6986b368fc063")
set(REQ_URL "http://download.osgeo.org/libtiff/tiff-4.2.0.tar.gz")
set(MD5 "2bbf6db1ddc4a59c89d6986b368fc063")
endif()
mindspore_add_pkg(tiff
VER 4.2.0
LIBS tiff
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -Djbig=OFF -Dlzma=OFF -Djpeg12=OFF -Dzstd=OFF -Dpixarlog=OFF
-Dold-jpeg=OFF -Dwebp=OFF -DBUILD_SHARED_LIBS=OFF -Dlibdeflate=OFF
PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0561_and_CVE-2022-0562.patch001
PATCHES ${TOP_DIR}/third_party/patch/libtiff/CVE-2022-0908.patch002)
mindspore_add_pkg(
TIFF
VER 4.2.0
LIBS TIFF
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_PKG_NO_COMPONENTS GEN_CMAKE_CONFIG
CMAKE_OPTION
-DCMAKE_BUILD_TYPE=Release
-Djbig=OFF
-Dlzma=OFF
-Djpeg12=OFF
-Dzstd=OFF
-Dpixarlog=OFF
-Dold-jpeg=OFF
-Dwebp=OFF
-DBUILD_SHARED_LIBS=OFF
-Dlibdeflate=OFF)
set(tiff_INC "${TIFF_INCLUDE_DIR}")
set(tiff_LIB "${TIFF_LIBRARIES}")
message("tiff include = ${tiff_INC}")
message("tiff lib = ${tiff_LIB}")

View File

@ -1,46 +1,40 @@
set(onednn_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(onednn_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if(USE_MS_THREADPOOL_FOR_DNNL)
set(USE_MS_THREADPOOL "-DDNNL_CPU_RUNTIME=THREADPOOL")
set(USE_MS_THREADPOOL "-DDNNL_CPU_RUNTIME=THREADPOOL")
else()
set(USE_MS_THREADPOOL "")
endif()
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "git@gitee.com:src-openeuler/onednn.git")
set(GIT_TAG "0d726f1")
set(MD5 "6a062e36ea1bee03ff55bf44ee243e27")
__download_pkg_with_git(ONEDNN ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
set(ONE_DNN_SRC "${TOP_DIR}/mindspore/lite/build/_deps/onednn-src")
execute_process(COMMAND tar -xf ${ONE_DNN_SRC}/v2.2.tar.gz --strip-components 1 -C ${ONE_DNN_SRC})
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
mindspore_add_pkg(onednn
VER 2.2
LIBS dnnl mkldnn
HEAD_ONLY ./include
RELEASE on
URL http://tools.mindspore.cn/libs/dnnl/dnnl_win_2.2.0_cpu_vcomp.zip
MD5 139fcdbd601a970fb86dd15b30ba5ae3)
else()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/MKL-DNN/repository/archive/v2.2.tar.gz")
set(MD5 "49c650e0cc24ef9ae7033d4cb22ebfad")
else()
set(REQ_URL "https://github.com/oneapi-src/oneDNN/archive/v2.2.tar.gz")
set(MD5 "6a062e36ea1bee03ff55bf44ee243e27")
endif()
mindspore_add_pkg(onednn
VER 2.2
LIBS dnnl mkldnn
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0001-fix-user-threadpool-bug.patch
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0002-fix-pool-nthr-bug.patch
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/onednn/0003-fix-zero-threads-identified-on-AMD.patch
CMAKE_OPTION -DDNNL_ARCH_OPT_FLAGS='' -DDNNL_BUILD_EXAMPLES=OFF -DDNNL_BUILD_TESTS=OFF
${USE_MS_THREADPOOL} -DDNNL_ENABLE_CONCURRENT_EXEC=ON)
set(USE_MS_THREADPOOL "")
endif()
include_directories(${onednn_INC})
add_library(mindspore::dnnl ALIAS onednn::dnnl)
add_library(mindspore::mkldnn ALIAS onednn::mkldnn)
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(ARGS HEAD_ONLY ./include RELEASE on)
set(VERSION 2.2)
set(REQ_URL https://github.com/oneapi-src/oneDNN/releases/download/v2.2/dnnl_win_2.2.0_cpu_vcomp.zip)
set(MD5 fa12c693b2ec07700d174e1e99d60a7e)
else()
set(VERSION 2.5.0)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/MKL-DNN/repository/archive/v2.5.2.tar.gz")
set(MD5 "fe4819264dcac225596bd30a1756ce8c")
else()
set(REQ_URL "https://github.com/oneapi-src/oneDNN/archive/v2.5.2.tar.gz")
set(MD5 "fff1c259d9f0bc87f2b3ca257acd472e")
endif()
set(ARGS
CMAKE_OPTION
-DDNNL_ARCH_OPT_FLAGS=''
-DDNNL_BUILD_EXAMPLES=OFF
-DDNNL_BUILD_TESTS=OFF
${USE_MS_THREADPOOL}
-DDNNL_ENABLE_CONCURRENT_EXEC=ON)
endif()
mindspore_add_pkg(
DNNL
VER ${VERSION}
LIBS dnnl
URL ${REQ_URL}
MD5 ${MD5} ${ARGS}
TARGET_ALIAS mindspore::dnnl DNNL::dnnl
TARGET_ALIAS mindspore::mkldnn DNNL::dnnl)

View File

@ -1,19 +1,19 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/nccl/repository/archive/v2.7.6-1.tar.gz")
set(MD5 "6884364c2b1cf229f0bdaf94efcb5782")
set(REQ_URL "https://gitee.com/mirrors/nccl/repository/archive/v2.7.6-1.tar.gz")
set(MD5 "6884364c2b1cf229f0bdaf94efcb5782")
else()
set(REQ_URL "https://github.com/NVIDIA/nccl/archive/v2.7.6-1.tar.gz")
set(MD5 "073b19899f374c5ba07d2db02dc38f9f")
set(REQ_URL "https://github.com/NVIDIA/nccl/archive/v2.7.6-1.tar.gz")
set(MD5 "073b19899f374c5ba07d2db02dc38f9f")
endif()
set(nccl_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(nccl
VER 2.7.6-1
LIBS nccl
URL ${REQ_URL}
MD5 ${MD5}
BUILD_OPTION src.build
INSTALL_INCS build/include/*
INSTALL_LIBS build/lib/*)
include_directories(${nccl_INC})
add_library(mindspore::nccl ALIAS nccl::nccl)
mindspore_add_pkg(
nccl
VER 2.7.6
LIBS nccl
URL ${REQ_URL}
MD5 ${MD5}
BUILD_OPTION src.install
BUILD_OPTION_PASS_PREFIX
GEN_CMAKE_CONFIG
TARGET_ALIAS mindspore::nccl nccl::nccl)

View File

@ -1,18 +1,19 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/ompi/repository/archive/v4.0.3.tar.gz")
set(MD5 "70f764c26ab6cd99487d58be0cd8c409")
set(REQ_URL "https://gitee.com/mirrors/ompi/repository/archive/v4.0.3.tar.gz")
set(MD5 "70f764c26ab6cd99487d58be0cd8c409")
else()
set(REQ_URL "https://github.com/open-mpi/ompi/archive/v4.0.3.tar.gz")
set(MD5 "86cb724e8fe71741ad3be4e7927928a2")
set(REQ_URL "https://github.com/open-mpi/ompi/archive/v4.0.3.tar.gz")
set(MD5 "86cb724e8fe71741ad3be4e7927928a2")
endif()
set(ompi_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(ompi
VER 4.0.3
LIBS mpi
URL ${REQ_URL}
MD5 ${MD5}
PRE_CONFIGURE_COMMAND ./autogen.pl
CONFIGURE_COMMAND ./configure)
include_directories(${ompi_INC})
add_library(mindspore::ompi ALIAS ompi::mpi)
mindspore_add_pkg(
MPI
VER 3.0 # NB: in the case of MPI, this is the MPI standard version, not the actual library version
LIBS mpi
LIBS_CMAKE_NAMES C
URL ${REQ_URL}
MD5 ${MD5}
PRE_CONFIGURE_COMMAND ./autogen.pl
CONFIGURE_COMMAND ./configure
TARGET_ALIAS mindspore::ompi MPI::MPI_C)

View File

@ -1,16 +1,4 @@
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "git@gitee.com:src-openeuler/opencl-clhpp.git")
set(GIT_TAG "7347fa1bb52ebee9f3d6c44ff65ef3c4253cab79")
set(MD5 "d41d8cd98f00b204e9800998ecf8427e")
__download_pkg_with_git(OpenCL-CLHPP ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
set(OPENCL_CLHPP_SRC "${TOP_DIR}/mindspore/lite/build/_deps/opencl-clhpp-src")
execute_process(COMMAND tar -xf ${OPENCL_CLHPP_SRC}/v2.0.12.tar.gz --strip-components 1 -C ${OPENCL_CLHPP_SRC})
set(OPENCL_HEADER_SRC "${TOP_DIR}/mindspore/lite/build/_deps/opencl-headers-src")
execute_process(COMMAND mkdir -p ${OPENCL_HEADER_SRC})
execute_process(COMMAND tar -xf ${OPENCL_CLHPP_SRC}/v2020.12.18.tar.gz --strip-components 1 -C ${OPENCL_HEADER_SRC})
elseif(ENABLE_GITEE)
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/OpenCL-Headers/repository/archive/v2020.12.18.tar.gz")
set(MD5 "9a34e50198ac54b795bf3822bb6e429a")
__download_pkg(OpenCL-Headers ${REQ_URL} ${MD5})

View File

@ -1,139 +1,78 @@
if(MSVC)
set(opencv_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(opencv_CFLAGS "${CMAKE_C_FLAGS}")
set(opencv_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(opencv_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(opencv_CFLAGS "${CMAKE_C_FLAGS}")
set(opencv_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_LDFLAGS "-Wl")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_LDFLAGS "-Wl")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -Wno-attributes -Wno-unknown-pragmas")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -Wno-unused-value -Wno-implicit-fallthrough")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -Wno-attributes -Wno-unknown-pragmas")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -Wno-unused-value -Wno-implicit-fallthrough")
else()
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -O2")
if(NOT ENABLE_GLIBCXX)
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
set(opencv_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack -s")
set(opencv_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2")
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -O2")
if(NOT ENABLE_GLIBCXX)
set(opencv_CXXFLAGS "${opencv_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
set(opencv_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -D_FORTIFY_SOURCE=2 -O2")
set(opencv_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack -s")
endif()
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "https://gitee.com/src-openeuler/opencv.git")
set(GIT_TAG "openEuler-22.03-LTS")
set(MD5 "e2b5aa4946559d0a397148d6e1ab7284")
set(OPENCV_SRC "${TOP_DIR}/build/mindspore/_deps/opencv-src")
__download_pkg_with_git(opencv ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
execute_process(COMMAND tar -xf ${OPENCV_SRC}/opencv-4.5.2.tar.gz --strip-components 1 -C ${OPENCV_SRC})
else()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/opencv/repository/archive/4.5.2.tar.gz")
set(MD5 "d3141f649ab2d76595fdd8991ee15c55")
set(REQ_URL "https://gitee.com/mirrors/opencv/repository/archive/4.5.2.tar.gz")
set(MD5 "d3141f649ab2d76595fdd8991ee15c55")
else()
set(REQ_URL "https://github.com/opencv/opencv/archive/4.5.2.tar.gz")
set(MD5 "d3141f649ab2d76595fdd8991ee15c55")
endif()
set(REQ_URL "https://github.com/opencv/opencv/archive/4.5.2.tar.gz")
set(MD5 "d3141f649ab2d76595fdd8991ee15c55")
endif()
if(MSVC)
mindspore_add_pkg(opencv
VER 4.5.2
LIBS opencv_core452.lib opencv_imgcodecs452.lib opencv_imgproc452.lib
LIB_PATH x64/*/lib
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DWITH_PROTOBUF=OFF -DWITH_WEBP=OFF -DWITH_IPP=OFF
-DWITH_ADE=OFF
-DBUILD_ZLIB=ON
-DBUILD_JPEG=ON
-DBUILD_PNG=ON
-DBUILD_OPENEXR=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_opencv_apps=OFF
-DCMAKE_SKIP_RPATH=TRUE
-DBUILD_opencv_python3=OFF
-DBUILD_opencv_videoio=OFF
-DWITH_FFMPEG=OFF
-DWITH_TIFF=ON
-DBUILD_TIFF=OFF
-DWITH_JASPER=OFF
-DBUILD_JASPER=OFF
-DCV_TRACE=OFF # cause memory usage increacing
-DTIFF_INCLUDE_DIR=${tiff_INC}
-DTIFF_LIBRARY=${tiff_LIB})
elseif(WIN32)
mindspore_add_pkg(opencv
VER 4.5.2
LIBS libopencv_core452.dll.a libopencv_imgcodecs452.dll.a libopencv_imgproc452.dll.a
LIB_PATH x64/mingw/lib
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DWITH_PROTOBUF=OFF -DWITH_WEBP=OFF -DWITH_IPP=OFF
-DWITH_ADE=OFF
-DBUILD_ZLIB=ON
-DBUILD_JPEG=ON
-DBUILD_PNG=ON
-DBUILD_OPENEXR=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_opencv_apps=OFF
-DCMAKE_SKIP_RPATH=TRUE
-DBUILD_opencv_python3=OFF
-DBUILD_opencv_videoio=OFF
-DWITH_FFMPEG=OFF
-DWITH_TIFF=ON
-DBUILD_TIFF=OFF
-DWITH_JASPER=OFF
-DBUILD_JASPER=OFF
-DCV_TRACE=OFF # cause memory usage increacing
-DWITH_LAPACK=OFF
-DTIFF_INCLUDE_DIR=${tiff_INC}
-DTIFF_LIBRARY=${tiff_LIB})
else()
mindspore_add_pkg(opencv
VER 4.5.2
LIBS opencv_core opencv_imgcodecs opencv_imgproc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DWITH_PROTOBUF=OFF -DWITH_WEBP=OFF -DWITH_IPP=OFF
-DWITH_ADE=OFF
-DBUILD_ZLIB=ON
-DBUILD_JPEG=ON
-DBUILD_PNG=ON
-DBUILD_OPENEXR=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_opencv_apps=OFF
-DCMAKE_SKIP_RPATH=TRUE
-DBUILD_opencv_python3=OFF
-DWITH_FFMPEG=OFF
-DWITH_TIFF=ON
-DBUILD_TIFF=OFF
-DWITH_JASPER=OFF
-DBUILD_JASPER=OFF
-DCV_TRACE=OFF # cause memory usage increacing
-DWITH_LAPACK=OFF
-DTIFF_INCLUDE_DIR=${tiff_INC}
-DTIFF_LIBRARY=${tiff_LIB})
endif()
set(CMAKE_OPTION
-DCMAKE_BUILD_TYPE=Release
-DWITH_PROTOBUF=OFF
-DWITH_WEBP=OFF
-DWITH_IPP=OFF
-DWITH_ADE=OFF
-DBUILD_ZLIB=ON
-DBUILD_JPEG=ON
-DBUILD_PNG=ON
-DBUILD_OPENEXR=OFF
-DBUILD_TESTS=OFF
-DBUILD_PERF_TESTS=OFF
-DBUILD_opencv_apps=OFF
-DCMAKE_SKIP_RPATH=TRUE
-DBUILD_opencv_python3=OFF
-DWITH_FFMPEG=OFF
-DWITH_TIFF=ON
-DBUILD_TIFF=OFF
-DWITH_JASPER=OFF
-DBUILD_JASPER=OFF
-DCV_TRACE=OFF # cause memory usage increacing
-DTIFF_INCLUDE_DIR=${tiff_INC}
-DTIFF_LIBRARY=${tiff_LIB})
if(MSVC)
include_directories(${opencv_INC})
add_library(mindspore::opencv_core ALIAS opencv::opencv_core452.lib)
add_library(mindspore::opencv_imgcodecs ALIAS opencv::opencv_imgcodecs452.lib)
add_library(mindspore::opencv_imgproc ALIAS opencv::opencv_imgproc452.lib)
set(LIBS opencv_core452.lib opencv_imgcodecs452.lib opencv_imgproc452.lib)
set(LIB_PATH LIB_PATH x64/*/lib)
list(APPEND CMAKE OPTION -DBUILD_opencv_videoio=OFF)
elseif(WIN32)
include_directories(${opencv_INC})
add_library(mindspore::opencv_core ALIAS opencv::libopencv_core452.dll.a)
add_library(mindspore::opencv_imgcodecs ALIAS opencv::libopencv_imgcodecs452.dll.a)
add_library(mindspore::opencv_imgproc ALIAS opencv::libopencv_imgproc452.dll.a)
set(LIBS libopencv_core452.dll.a libopencv_imgcodecs452.dll.a libopencv_imgproc452.dll.a)
set(LIB_PATH LIB_PATH x64/mingw/lib)
list(APPEND CMAKE_OPTION -DBUILD_opencv_videoio=OFF -DWITH_LAPACK=OFF)
else()
include_directories(${opencv_INC}/opencv4)
add_library(mindspore::opencv_core ALIAS opencv::opencv_core)
add_library(mindspore::opencv_imgcodecs ALIAS opencv::opencv_imgcodecs)
add_library(mindspore::opencv_imgproc ALIAS opencv::opencv_imgproc)
list(APPEND CMAKE_OPTION -DWITH_LAPACK=OFF)
endif()
mindspore_add_pkg(
OpenCV
VER 4.5.2
LIBS opencv_core opencv_imgcodecs opencv_imgproc
LIBS_CMAKE_NAMES core imgcodecs imgproc ${LIB_PATH}
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION ${CMAKE_OPTION}
TARGET_ALIAS mindspore::opencv_core opencv_core
TARGET_ALIAS mindspore::opencv_imgcodecs opencv_imgcodecs
TARGET_ALIAS mindspore::opencv_imgproc opencv_imgproc)

View File

@ -1,78 +1,27 @@
set(VER 1.1.1m)
# patch 'm' -> 0d -> 13 ('a' -> 01 -> 1, 'f' -> 06 -> 6, 'p' -> 10 -> 16, etc.)
set(VER_FOR_COMP 1.1.1.13)
string(REPLACE "." "_" _url_ver ${VER})
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_1_1_1k.tar.gz")
set(MD5 "bdd51a68ad74618dd2519da8e0bcc759")
set(REQ_URL "https://gitee.com/mirrors/openssl/repository/archive/OpenSSL_${_url_ver}.tar.gz")
set(MD5 "710c2368d28f1a25ab92e25b5b9b11ec")
else()
set(REQ_URL "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1k.tar.gz")
set(MD5 "bdd51a68ad74618dd2519da8e0bcc759")
set(REQ_URL "https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_${_url_ver}.tar.gz")
set(MD5 "710c2368d28f1a25ab92e25b5b9b11ec")
endif()
if(BUILD_LITE)
set(OPENSSL_PATCH_ROOT ${TOP_DIR}/third_party/patch/openssl)
else()
set(OPENSSL_PATCH_ROOT ${CMAKE_SOURCE_DIR}/third_party/patch/openssl)
endif()
if(BUILD_LITE)
if(PLATFORM_ARM64 AND ANDROID_NDK_TOOLCHAIN_INCLUDED)
set(openssl_USE_STATIC_LIBS OFF)
set(ANDROID_NDK_ROOT $ENV{ANDROID_NDK})
set(PATH
${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:
${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:
$ENV{PATH})
mindspore_add_pkg(openssl
VER 1.1.1k
LIBS ssl crypto
URL ${REQ_URL}
MD5 ${MD5}
CONFIGURE_COMMAND ./Configure android-arm64 -D__ANDROID_API__=29 no-zlib
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3711.patch
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3712.patch
)
elseif(PLATFORM_ARM32 AND ANDROID_NDK_TOOLCHAIN_INCLUDED)
set(ANDROID_NDK_ROOT $ENV{ANDROID_NDK})
set(PATH
${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin:
${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:
$ENV{PATH})
mindspore_add_pkg(openssl
VER 1.1.1k
LIBS ssl crypto
URL ${REQ_URL}
MD5 ${MD5}
CONFIGURE_COMMAND ./Configure android-arm -D__ANDROID_API__=19 no-zlib
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3711.patch
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3712.patch
)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR APPLE)
mindspore_add_pkg(openssl
VER 1.1.1k
LIBS ssl crypto
URL ${REQ_URL}
MD5 ${MD5}
CONFIGURE_COMMAND ./config no-zlib
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3711.patch
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3712.patch
)
else()
MESSAGE(FATAL_ERROR "openssl does not support compilation for the current environment.")
endif()
include_directories(${openssl_INC})
add_library(mindspore::ssl ALIAS openssl::ssl)
add_library(mindspore::crypto ALIAS openssl::crypto)
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR APPLE)
mindspore_add_pkg(openssl
VER 1.1.1k
LIBS ssl crypto
URL ${REQ_URL}
MD5 ${MD5}
CONFIGURE_COMMAND ./config no-zlib no-shared
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3711.patch
PATCHES ${OPENSSL_PATCH_ROOT}/CVE-2021-3712.patch
)
include_directories(${openssl_INC})
add_library(mindspore::ssl ALIAS openssl::ssl)
add_library(mindspore::crypto ALIAS openssl::crypto)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux" OR APPLE)
mindspore_add_pkg(
OpenSSL
VER ${VER_FOR_COMP}
LIBS SSL Crypto
URL ${REQ_URL}
MD5 ${MD5}
CONFIGURE_COMMAND ./config no-zlib no-shared
GEN_CMAKE_CONFIG
TARGET_ALIAS mindspore::ssl OpenSSL::SSL
TARGET_ALIAS mindspore::crypto OpenSSL::Crypto)
endif()

View File

@ -1,34 +1,34 @@
set(protobuf_USE_STATIC_LIBS ON)
if(BUILD_LITE)
if(MSVC)
set(protobuf_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(protobuf_CFLAGS "${CMAKE_C_FLAGS}")
set(protobuf_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(_ms_tmp_CMAKE_STATIC_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
if(MSVC)
set(protobuf_CXXFLAGS "${CMAKE_CXX_FLAGS}")
set(protobuf_CFLAGS "${CMAKE_C_FLAGS}")
set(protobuf_LDFLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
set(_ms_tmp_CMAKE_STATIC_LIBRARY_PREFIX ${CMAKE_STATIC_LIBRARY_PREFIX})
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
if(NOT ENABLE_GLIBCXX)
set(protobuf_CXXFLAGS "${protobuf_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC \
-fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
if(NOT ENABLE_GLIBCXX)
set(protobuf_CXXFLAGS "${protobuf_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(NOT ENABLE_GLIBCXX)
set(protobuf_CXXFLAGS "${protobuf_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
else()
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC \
-fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
else()
set(protobuf_CXXFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter \
-fPIC -fvisibility=hidden -D_FORTIFY_SOURCE=2 -O2")
if(NOT ENABLE_GLIBCXX)
set(protobuf_CXXFLAGS "${protobuf_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
endif()
set(protobuf_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
set(_ms_tmp_CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
@ -37,131 +37,137 @@ string(REPLACE " -Wall" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz")
set(MD5 "53ab10736257b3c61749de9800b8ce97")
set(REQ_URL "https://gitee.com/mirrors/protobuf_source/repository/archive/v3.13.0.tar.gz")
set(MD5 "53ab10736257b3c61749de9800b8ce97")
else()
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz")
set(MD5 "1a6274bc4a65b55a6fa70e264d796490")
set(REQ_URL "https://github.com/protocolbuffers/protobuf/archive/v3.13.0.tar.gz")
set(MD5 "1a6274bc4a65b55a6fa70e264d796490")
endif()
if(BUILD_LITE)
set(PROTOBUF_PATCH_ROOT ${TOP_DIR}/third_party/patch/protobuf)
else()
set(PROTOBUF_PATCH_ROOT ${CMAKE_SOURCE_DIR}/third_party/patch/protobuf)
endif()
mindspore_add_pkg(
Protobuf
VER 3.13.0
NS_NAME protobuf
LIBS protobuf
LIBS_CMAKE_NAMES libprotobuf
FORCE_CONFIG_SEARCH
EXE protoc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_PATH cmake/
CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
-DCMAKE_POSITION_INDEPENDENT_CODE=ON
TARGET_ALIAS mindspore::protobuf protobuf::libprotobuf)
mindspore_add_pkg(protobuf
VER 3.13.0
LIBS protobuf
EXE protoc
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_PATH cmake/
CMAKE_OPTION -Dprotobuf_BUILD_TESTS=OFF -Dprotobuf_BUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Release
PATCHES ${PROTOBUF_PATCH_ROOT}/CVE-2021-22570.patch)
include_directories(${protobuf_INC})
add_library(mindspore::protobuf ALIAS protobuf::protobuf)
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS ${_ms_tmp_CMAKE_CXX_FLAGS})
if(MSVC)
set(CMAKE_STATIC_LIBRARY_PREFIX, ${_ms_tmp_CMAKE_STATIC_LIBRARY_PREFIX})
set(CMAKE_STATIC_LIBRARY_PREFIX, ${_ms_tmp_CMAKE_STATIC_LIBRARY_PREFIX})
endif()
function(common_protobuf_generate path c_var h_var)
if(NOT ARGN)
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
return()
endif()
if(NOT ARGN)
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
return()
endif()
set(${c_var})
set(${h_var})
set(${c_var})
set(${h_var})
foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
file(RELATIVE_PATH rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${file_dir})
list(APPEND ${c_var} "${path}/${file_name}.pb.cc")
list(APPEND ${h_var} "${path}/${file_name}.pb.h")
add_custom_command(
OUTPUT "${path}/${file_name}.pb.cc" "${path}/${file_name}.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${path} ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endforeach()
list(APPEND ${c_var} "${path}/${file_name}.pb.cc")
list(APPEND ${h_var} "${path}/${file_name}.pb.h")
add_custom_command(
OUTPUT "${path}/${file_name}.pb.cc" "${path}/${file_name}.pb.h"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${path}"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${path} ${abs_file}
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}"
VERBATIM)
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
set_source_files_properties(${${c_var}} ${${h_var}} PROPERTIES GENERATED TRUE)
set(${c_var}
${${c_var}}
PARENT_SCOPE)
set(${h_var}
${${h_var}}
PARENT_SCOPE)
endfunction()
function(ms_protobuf_generate c_var h_var)
if(NOT ENABLE_CLOUD_AND_LITE)
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto ${c_var} ${h_var} ${ARGN})
else()
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto/lite ${c_var} ${h_var} ${ARGN})
endif()
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto ${c_var} ${h_var} ${ARGN})
set(${c_var}
${${c_var}}
PARENT_SCOPE)
set(${h_var}
${${h_var}}
PARENT_SCOPE)
endfunction()
function(ms_protobuf_generate_py c_var h_var py_var)
if(NOT ARGN)
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
return()
if(NOT ARGN)
message(SEND_ERROR "Error: ms_protobuf_generate() called without any proto files")
return()
endif()
set(${c_var})
set(${h_var})
set(${py_var})
foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${py_var} "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py")
if(WIN32)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc" "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND perl -pi.bak -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
"${PROJECT_SOURCE_DIR}/mindspore/python/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}"
VERBATIM)
else()
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc" "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND perl -pi -e "s/import (.+_pb2.*)/from . import \\1/" "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND cp "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
"${PROJECT_SOURCE_DIR}/mindspore/python/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}"
VERBATIM)
endif()
set(${c_var})
set(${h_var})
set(${py_var})
foreach(file ${ARGN})
get_filename_component(abs_file ${file} ABSOLUTE)
get_filename_component(file_name ${file} NAME_WE)
get_filename_component(file_dir ${abs_file} PATH)
list(APPEND ${c_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc")
list(APPEND ${h_var} "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h")
list(APPEND ${py_var} "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py")
if(WIN32)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND perl -pi.bak -e "s/import (.+_pb2.*)/from . import \\1/"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
"${PROJECT_SOURCE_DIR}/mindspore/python/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
else()
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/proto/${file_name}.pb.cc"
"${CMAKE_BINARY_DIR}/proto/${file_name}.pb.h"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/proto"
COMMAND protobuf::protoc -I${file_dir} --cpp_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND protobuf::protoc -I${file_dir} --python_out=${CMAKE_BINARY_DIR}/proto ${abs_file}
COMMAND perl -pi -e "s/import (.+_pb2.*)/from . import \\1/"
"${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
COMMAND cp "${CMAKE_BINARY_DIR}/proto/${file_name}_pb2.py"
"${PROJECT_SOURCE_DIR}/mindspore/python/mindspore/train/"
DEPENDS protobuf::protoc ${abs_file}
COMMENT "Running C++ protocol buffer compiler on ${file}" VERBATIM)
endif()
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} ${${py_var}} PROPERTIES GENERATED TRUE)
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
set(${py_var} ${${py_var}} PARENT_SCOPE)
endforeach()
set_source_files_properties(${${c_var}} ${${h_var}} ${${py_var}} PROPERTIES GENERATED TRUE)
set(${c_var}
${${c_var}}
PARENT_SCOPE)
set(${h_var}
${${h_var}}
PARENT_SCOPE)
set(${py_var}
${${py_var}}
PARENT_SCOPE)
endfunction()

View File

@ -1,61 +1,43 @@
set(PYTHON_VERSION ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR})
if(ENABLE_GITEE)
if(PYTHON_VERSION MATCHES "3.9")
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.6.1.tar.gz")
set(MD5 "cd04f7bd275fedb97e8b583c115769e6")
elseif(PYTHON_VERSION MATCHES "3.8")
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.6.1.tar.gz")
set(MD5 "cd04f7bd275fedb97e8b583c115769e6")
elseif(PYTHON_VERSION MATCHES "3.7")
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.4.3.tar.gz")
set(MD5 "8f69438201bc824c63e5774bf8c1d422")
else()
message("Could not find 'Python 3.8' or 'Python 3.7' or 'Python 3.9'")
return()
endif()
if(PYTHON_VERSION VERSION_GREATER_EQUAL 3.8.0)
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.6.1.tar.gz")
set(MD5 "cd04f7bd275fedb97e8b583c115769e6")
elseif(PYTHON_VERSION VERSION_GREATER_EQUAL 3.7.0)
set(REQ_URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.4.3.tar.gz")
set(MD5 "8f69438201bc824c63e5774bf8c1d422")
else()
message("Could not find 'Python 3.8' or 'Python 3.7' or 'Python 3.9'")
return()
endif()
else()
if(PYTHON_VERSION MATCHES "3.9")
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz")
set(MD5 "32a7811f3db423df4ebfc731a28e5901")
elseif(PYTHON_VERSION MATCHES "3.8")
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz")
set(MD5 "32a7811f3db423df4ebfc731a28e5901")
elseif(PYTHON_VERSION MATCHES "3.7")
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz")
set(MD5 "62254c40f89925bb894be421fe4cdef2")
else()
message("Could not find 'Python 3.8' or 'Python 3.7' or 'Python 3.9'")
return()
endif()
if(PYTHON_VERSION VERSION_GREATER_EQUAL 3.8.0)
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.6.1.tar.gz")
set(MD5 "32a7811f3db423df4ebfc731a28e5901")
elseif(PYTHON_VERSION VERSION_GREATER_EQUAL 3.7.0)
set(REQ_URL "https://github.com/pybind/pybind11/archive/v2.4.3.tar.gz")
set(MD5 "62254c40f89925bb894be421fe4cdef2")
else()
message("Could not find 'Python 3.8' or 'Python 3.7' or 'Python 3.9'")
return()
endif()
endif()
set(pybind11_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2")
set(pybind11_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if(PYTHON_VERSION MATCHES "3.9")
mindspore_add_pkg(pybind11
VER 2.6.1
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DPYBIND11_TEST=OFF -DPYBIND11_LTO_CXX_FLAGS=FALSE
)
elseif(PYTHON_VERSION MATCHES "3.8")
mindspore_add_pkg(pybind11
VER 2.6.1
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DPYBIND11_TEST=OFF -DPYBIND11_LTO_CXX_FLAGS=FALSE
)
if(PYTHON_VERSION VERSION_GREATER_EQUAL 3.8.0)
set(VER 2.6.1)
elseif(PYTHON_VERSION VERSION_GREATER_EQUAL 3.7.0)
set(VER 2.4.3)
else()
mindspore_add_pkg(pybind11
VER 2.4.3
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DPYBIND11_TEST=OFF -DPYBIND11_LTO_CXX_FLAGS=FALSE
)
set(VER NOT-FOUND)
endif()
include_directories(${pybind11_INC})
find_package(pybind11 REQUIRED)
set_property(TARGET pybind11::module PROPERTY IMPORTED_GLOBAL TRUE)
add_library(mindspore::pybind11_module ALIAS pybind11::module)
mindspore_add_pkg(
pybind11
VER ${VER}
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DPYBIND11_TEST=OFF -DPYBIND11_LTO_CXX_FLAGS=FALSE
TARGET_ALIAS mindspore::pybind11_module pybind11::module)

View File

@ -1,22 +1,22 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/re2/repository/archive/2019-12-01.tar.gz")
set(MD5 "527eab0c75d6a1a0044c6eefd816b2fb")
set(REQ_URL "https://gitee.com/mirrors/re2/repository/archive/2019-12-01.tar.gz")
set(MD5 "527eab0c75d6a1a0044c6eefd816b2fb")
else()
set(REQ_URL "https://github.com/google/re2/archive/2019-12-01.tar.gz")
set(MD5 "527eab0c75d6a1a0044c6eefd816b2fb")
set(REQ_URL "https://github.com/google/re2/archive/2019-12-01.tar.gz")
set(MD5 "527eab0c75d6a1a0044c6eefd816b2fb")
endif()
if(NOT ENABLE_GLIBCXX)
set(re2_CXXFLAGS "${re2_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
set(re2_CXXFLAGS "${re2_CXXFLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
mindspore_add_pkg(re2
VER 20191201
LIBS re2
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE)
include_directories(${re2_INC})
add_library(mindspore::re2 ALIAS re2::re2)
mindspore_add_pkg(
re2
VER 20191201
LIBS re2
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/re2/re2.patch001
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release -DRE2_BUILD_TESTING:BOOL=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
TARGET_ALIAS mindspore::re2 re2::re2)

View File

@ -1,58 +1,44 @@
if(ENABLE_GITEE_EULER)
set(GIT_REPOSITORY "https://gitee.com/src-openeuler/sentencepiece.git")
set(GIT_TAG "master")
set(MD5 "4f88df28544b5f1a351f3dbf6b6413b8")
set(SENTENCEPIECE_SRC "${TOP_DIR}/build/mindspore/_deps/sentencepiece-src")
__download_pkg_with_git(sentencepiece ${GIT_REPOSITORY} ${GIT_TAG} ${MD5})
execute_process(COMMAND tar -xf ${SENTENCEPIECE_SRC}/v0.1.92.tar.gz --strip-components 1 -C ${SENTENCEPIECE_SRC})
else()
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/sentencepiece/repository/archive/v0.1.92.tar.gz")
set(MD5 "0fc99de9f09b9184398f49647791799f")
set(REQ_URL "https://gitee.com/mirrors/sentencepiece/repository/archive/v0.1.92.tar.gz")
set(MD5 "0fc99de9f09b9184398f49647791799f")
else()
set(REQ_URL "https://github.com/google/sentencepiece/archive/v0.1.92.tar.gz")
set(MD5 "5dfd2241914b5598a68b2a8542ed8e91")
endif()
set(REQ_URL "https://github.com/google/sentencepiece/archive/v0.1.92.tar.gz")
set(MD5 "5dfd2241914b5598a68b2a8542ed8e91")
endif()
set(CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_ENABLE_SHARED=OFF)
if(WIN32)
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-stringop-overflow \
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-stringop-overflow \
-Wno-format-extra-args -Wno-format")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=ON -DSPM_ENABLE_SHARED=OFF
MD5 ${MD5}
)
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
list(APPEND CMAKE_OPTION -DSPM_USE_BUILTIN_PROTOBUF=ON)
else()
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-sign-compare")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
if(ENABLE_GLIBCXX)
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=OFF -DSPM_ENABLE_SHARED=OFF
-DPROTOBUF_INC=${protobuf_INC} -DCMAKE_CXX_STANDARD=11
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001_cpu
)
else()
mindspore_add_pkg(sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=OFF -DSPM_ENABLE_SHARED=OFF
-DPROTOBUF_INC=${protobuf_INC}
MD5 ${MD5}
PATCHES ${TOP_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001
)
endif()
set(sentencepiece_CXXFLAGS "-D_FORTIFY_SOURCE=2 -O2 -Wno-unused-result -Wno-sign-compare")
set(sentencepiece_CFLAGS "-D_FORTIFY_SOURCE=2 -O2")
list(APPEND CMAKE_OPTION -DSPM_USE_BUILTIN_PROTOBUF=OFF)
if(ENABLE_GLIBCXX)
set(PATCHES PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001_cpu)
list(APPEND CMAKE_OPTION -DPROTOBUF_INC=${Protobuf_INC} -DCMAKE_CXX_STANDARD=11)
else()
set(PATCHES PATCHES ${TOP_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001)
list(APPEND CMAKE_OPTION -DPROTOBUF_INC=${Protobuf_INC})
endif()
endif()
include_directories(${sentencepiece_INC})
add_library(mindspore::sentencepiece ALIAS sentencepiece::sentencepiece)
add_library(mindspore::sentencepiece_train ALIAS sentencepiece::sentencepiece_train)
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_PROTOBUF_PREFER_SYSTEM)
list(APPEND CMAKE_OPTION -DCMAKE_PREFIX_PATH=${Protobuf_ROOT})
else()
# We rely on system discovery anyway so should work when building sentencepiece
endif()
mindspore_add_pkg(
sentencepiece
VER 0.1.92
LIBS sentencepiece sentencepiece_train
URL ${REQ_URL}
CMAKE_OPTION ${CMAKE_OPTION}
GEN_CMAKE_CONFIG
MD5 ${MD5} ${PATCHES}
TARGET_ALIAS mindspore::sentencepiece sentencepiece::sentencepiece
TARGET_ALIAS mindspore::sentencepiece_train sentencepiece::sentencepiece_train)

View File

@ -1,40 +1,35 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/sqlite/repository/archive/version-3.36.0.tar.gz")
set(MD5 "715df9c2d2ccf6207158d6c087f711cf")
set(REQ_URL "https://gitee.com/mirrors/sqlite/repository/archive/version-3.36.0.tar.gz")
set(MD5 "715df9c2d2ccf6207158d6c087f711cf")
else()
set(REQ_URL "https://github.com/sqlite/sqlite/archive/version-3.36.0.tar.gz")
set(MD5 "715df9c2d2ccf6207158d6c087f711cf")
set(REQ_URL "https://github.com/sqlite/sqlite/archive/version-3.36.0.tar.gz")
set(MD5 "715df9c2d2ccf6207158d6c087f711cf")
endif()
if(WIN32)
mindspore_add_pkg(sqlite
VER 3.36.0
LIBS sqlite3
URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip
MD5 c5d360c74111bafae1b704721ff18fe6
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/sqlite.windows.patch002
CMAKE_OPTION " "
)
set(REQ_URL https://sqlite.org/2021/sqlite-amalgamation-3360000.zip)
set(MD5 c5d360c74111bafae1b704721ff18fe6)
set(PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sqlite/sqlite.windows.patch002)
else()
set(sqlite_USE_STATIC_LIBS ON)
set(sqlite_CXXFLAGS)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(sqlite_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 \
set(SQLite3_USE_STATIC_LIBS ON)
set(SQLite3_CXXFLAGS "")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(SQLite3_CFLAGS "-fstack-protector-all -Wno-uninitialized -Wno-unused-parameter -fPIC -D_FORTIFY_SOURCE=2 \
-O2")
else()
set(sqlite_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC \
else()
set(SQLite3_CFLAGS "-fstack-protector-all -Wno-maybe-uninitialized -Wno-unused-parameter -fPIC \
-D_FORTIFY_SOURCE=2 -O2")
set(sqlite_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
mindspore_add_pkg(sqlite
VER 3.36.0
LIBS sqlite3
URL ${REQ_URL}
MD5 ${MD5}
CONFIGURE_COMMAND ./configure --enable-shared=no --disable-tcl --disable-editline --enable-json1)
set(SQLite3_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
set(CONFIGURE_COMMAND CONFIGURE_COMMAND ./configure --enable-shared=no --disable-tcl --disable-editline
--enable-json1)
endif()
include_directories(${sqlite_INC})
add_library(mindspore::sqlite ALIAS sqlite::sqlite3)
mindspore_add_pkg(
SQLite3
NS_NAME SQLite
VER 3.36.0
LIBS SQLite3
URL ${REQ_URL}
MD5 ${MD5} ${PATCHES} ${CONFIGURE_COMMAND}
GEN_CMAKE_CONFIG
TARGET_ALIAS mindspore::sqlite SQLite::SQLite3)

View File

@ -2,23 +2,23 @@ set(tinyxml2_CXXFLAGS "-fstack-protector -D_FORTIFY_SOURCE=2 -O2 -Wno-unused-res
set(tinyxml2_CFLAGS "-fstack-protector -D_FORTIFY_SOURCE=2 -O2")
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/tinyxml2/repository/archive/8.0.0.tar.gz")
set(MD5 "5dc535c8b34ee621fe2128f072d275b5")
set(REQ_URL "https://gitee.com/mirrors/tinyxml2/repository/archive/8.0.0.tar.gz")
set(MD5 "5dc535c8b34ee621fe2128f072d275b5")
else()
set(REQ_URL "https://github.com/leethomason/tinyxml2/archive/8.0.0.tar.gz")
set(MD5 "5dc535c8b34ee621fe2128f072d275b5")
set(REQ_URL "https://github.com/leethomason/tinyxml2/archive/8.0.0.tar.gz")
set(MD5 "5dc535c8b34ee621fe2128f072d275b5")
endif()
if(NOT WIN32 AND NOT APPLE)
set(tinyxml2_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
set(tinyxml2_LDFLAGS "-Wl,-z,relro,-z,now,-z,noexecstack")
endif()
mindspore_add_pkg(tinyxml2
VER 8.0.0
LIBS tinyxml2
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release
MD5 ${MD5})
include_directories(${tinyxml2_INC})
add_library(mindspore::tinyxml2 ALIAS tinyxml2::tinyxml2)
mindspore_add_pkg(
tinyxml2
VER 8.0.0
LIBS tinyxml2
URL ${REQ_URL}
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release
CMAKE_PKG_NO_COMPONENTS
MD5 ${MD5}
TARGET_ALIAS mindspore::tinyxml2 tinyxml2::tinyxml2)

View File

@ -1,17 +1,18 @@
if(ENABLE_GITEE)
set(REQ_URL "https://gitee.com/mirrors/zlib/repository/archive/v1.2.11.tar.gz")
set(MD5 "b0ecd8eda7c5d6ed9b4a4187363482fe")
set(REQ_URL "https://gitee.com/mirrors/zlib/repository/archive/v1.2.11.tar.gz")
set(MD5 "b0ecd8eda7c5d6ed9b4a4187363482fe")
else()
set(REQ_URL "https://github.com/madler/zlib/archive/v1.2.11.tar.gz")
set(MD5 "0095d2d2d1f3442ce1318336637b695f")
set(REQ_URL "https://github.com/madler/zlib/archive/v1.2.11.tar.gz")
set(MD5 "0095d2d2d1f3442ce1318336637b695f")
endif()
mindspore_add_pkg(zlib
VER 1.2.11
LIBS z
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release)
include_directories(${zlib_INC})
add_library(mindspore::z ALIAS zlib::z)
mindspore_add_pkg(
ZLIB
VER 1.2.11
LIBS z
LIBS_CMAKE_NAMES ZLIB
GEN_CMAKE_CONFIG
URL ${REQ_URL}
MD5 ${MD5}
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release
TARGET_ALIAS mindspore::z ZLIB::ZLIB)

View File

@ -14,17 +14,34 @@ include(cmake/utils.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/json.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/dependency_securec.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/openssl.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/zlib.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/protobuf.cmake)
if(MS_BUILD_GRPC)
# build dependencies of gRPC
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/openssl.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/absl.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/c-ares.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/zlib.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/re2.cmake)
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_GRPC_PREFER_SYSTEM)
# build dependencies of gRPC
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_ABSL_PREFER_SYSTEM)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/absl.cmake)
endif()
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_C-ARES_PREFER_SYSTEM)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/c-ares.cmake)
endif()
if(NOT MS_PREFER_SYSTEM_PKGS AND NOT MS_RE2_PREFER_SYSTEM)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/re2.cmake)
endif()
endif()
# build gRPC
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/grpc.cmake)
if(MS_PREFER_SYSTEM_PKGS OR MS_GRPC_PREFER_SYSTEM)
foreach(_lib strings throw_delegate raw_logging_internal int128 bad_optional_access)
if(NOT TARGET ${_lib})
add_library(mindspore::absl_${_lib} ALIAS absl::${_lib})
endif()
endforeach()
endif()
# build event
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/libevent.cmake)
endif()
@ -58,7 +75,6 @@ if(ENABLE_D OR ENABLE_ACL OR ENABLE_TESTCASES)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/external)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/inc/framework)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc/aicpu)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/third_party/fwkacllib/inc/toolchain)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc)
include_directories(${CMAKE_SOURCE_DIR}/graphengine/metadef/inc/external)
@ -67,7 +83,9 @@ endif()
if(ENABLE_MINDDATA)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/icu4c.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/libtiff.cmake)
if(NOT MS_OPENCV_PREFER_SYSTEM)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/libtiff.cmake)
endif()
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/opencv.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/sqlite.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/tinyxml2.cmake)

View File

@ -0,0 +1,231 @@
# ==============================================================================
#
# Copyright 2021 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindEigen3
---------
Find Eigen3 include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(Eigen3
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if Eigen3 is not found
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "Eigen3
CMake" build. For the latter case skip to the :ref:`Eigen3 CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``Eigen3_FOUND``
True if headers and requested libraries were found.
``Eigen3_INCLUDE_DIRS``
Eigen3 include directories.
``Eigen3_LIBRARY_DIRS``
Link directories for Eigen3 libraries.
``Eigen3_LIBRARIES``
Eigen3 component libraries to be linked.
``Eigen3_VERSION``
Eigen3 version number in ``X.Y`` format.
``Eigen3_VERSION_MAJOR``
Eigen3 major version number (``X`` in ``X.Y``).
``Eigen3_VERSION_MINOR``
Eigen3 minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``Eigen3_INCLUDE_DIR``
Directory containing Eigen3 headers.
``Eigen3_LIBRARY_DIR_RELEASE``
Directory containing release Eigen3 libraries.
``Eigen3_LIBRARY_DIR_DEBUG``
Directory containing debug Eigen3 libraries.
Hints
^^^^^
This module reads hints about search locations from variables:
``Eigen3_ROOT``, ``Eigen3ROOT``
Preferred installation prefix.
``Eigen3_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``Eigen3_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``Eigen3_NO_CMAKE``
Set to ``ON`` to disable searching for CMake configuration files.Default is ``OFF``.
``Eigen3_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``Eigen3``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the Eigen3 header files using the above hint variables (excluding ``Eigen3_LIBRARYDIR``) and
saves the result in ``Eigen3_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``Eigen3_INCLUDEDIR``), "lib" directories near ``Eigen3_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``Eigen3_LIBRARY_DIR_DEBUG`` and ``Eigen3_LIBRARY_DIR_RELEASE`` and
individual library locations in ``Eigen3_<COMPONENT>_LIBRARY_DEBUG`` and ``Eigen3_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``Eigen3::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(Eigen3)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
Other variables one may set to control this module are:
``Eigen3_DEBUG``
Set to ``ON`` to enable debug output from ``FindEigen3``. Please enable this before filing any bug report.
``Eigen3_LIBRARY_DIR``
Default value for ``Eigen3_LIBRARY_DIR_RELEASE`` and ``Eigen3_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find Eigen3 headers only:
.. code-block:: cmake
find_package(Eigen3 3.4.0)
if(Eigen3_FOUND)
include_directories(${Eigen3_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC Eigen3::Eigen3)
endif()
Find Eigen3 libraries and use imported targets:
.. code-block:: cmake
find_package(Eigen3 6.2.1 REQUIRED)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC Eigen3::Eigen3)
.. _`Eigen3 CMake`:
Eigen3 CMake
^^^^^^^^^^^^
If Eigen3 was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``Eigen3Config.cmake`` and stores the result in ``CACHE``
entry ``Eigen3_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the Eigen3 CMake package configuration for details on what it provides.
Set ``Eigen3_NO_CMAKE`` to ``ON``, to disable the search for Eigen3-cmake.
Eigen3 PkgConfig
^^^^^^^^^^^^^^^^
If Eigen3 was installed with its pkg-config files, this module may attempt to look for Eigen3 by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``Eigen3_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg Eigen3)
set(${_pkg}_INCLUDE_FILE signature_of_eigen3_matrix_library)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg} include/eigen3 eigen3)
set(${_pkg}_DEFAULT_COMPONENTS Eigen)
set(${_pkg}_Eigen_NAMES Eigen)
set(${_pkg}_Eigen_HEADER_ONLY TRUE)
# Extract EIGEN3 version from include directory
function(Eigen3_version_function include_dir)
set(_paths ${include_dir}/Eigen/src/Core/util/)
_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_paths")
find_file(
_Eigen3_h Macros.h
PATHS ${_paths}
NO_DEFAULT_PATH)
if(_Eigen3_h)
file(READ ${_Eigen3_h} _Eigen3_version_file)
string(REGEX REPLACE ".*#define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+).*" "\\1" Eigen3_VERSION_MAJOR
"${_Eigen3_version_file}")
string(REGEX REPLACE ".*#define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+).*" "\\1" Eigen3_VERSION_MINOR
"${_Eigen3_version_file}")
string(REGEX REPLACE ".*#define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+).*" "\\1" Eigen3_VERSION_PATCH
"${_Eigen3_version_file}")
else()
message(WARNING "Unable to determine Eigen3's version since Eigen/src/Core/util/Macros.h file cannot be found!")
set(Eigen3_VERSION_MAJOR 99)
set(Eigen3_VERSION_MINOR 99)
set(Eigen3_VERSION_PATCH 99)
endif()
set(Eigen3_VERSION "${Eigen3_VERSION_MAJOR}.${Eigen3_VERSION_MINOR}.${Eigen3_VERSION_PATCH}")
set(Eigen3_VERSION_MAJOR
${Eigen3_VERSION_MAJOR}
PARENT_SCOPE)
set(Eigen3_VERSION_MINOR
${Eigen3_VERSION_MINOR}
PARENT_SCOPE)
set(Eigen3_VERSION_PATCH
${Eigen3_VERSION_PATCH}
PARENT_SCOPE)
set(Eigen3_VERSION
${Eigen3_VERSION}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,94 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
include(_find_utils_begin)
set(_pkg Flatbuffers)
string(TOLOWER ${_pkg} _pkg_low)
set(${_pkg}_NAMESPACE flatbuffers)
set(${_pkg}_INCLUDE_FILE flatc.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg_low} ${_pkg_low})
set(${_pkg}_INCLUDE_DIR_UP_INDEX 1)
set(${_pkg}_DEFAULT_COMPONENTS flatbuffers_shared flatc)
set(${_pkg}_flatbuffers_shared_NAMES flatbuffers)
set(${_pkg}_flatc_NAMES flatc)
set(${_pkg}_flatc_TYPE EXECUTABLE)
# Update RE2 library search directories with pre-built paths
function(flatc_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
function(Flatbuffers_version_function include_dir)
find_file(
_flatbuffers_base_h base.h
PATHS ${include_dir}/flatbuffers
NO_DEFAULT_PATH)
if(_flatbuffers_base_h)
file(READ ${_flatbuffers_base_h} _flatbuffers_base_content)
string(REGEX MATCHALL "#define[ \t]+[a-zA-Z0-9_]+VERSION[a-zA-Z0-9_ ]+" _flatbuffers_base_content
"${_flatbuffers_base_content}")
list(APPEND _flatbuffers_base_content "")
if("${_flatbuffers_base_content}" MATCHES "#define[ \t]+FLATBUFFERS_VERSION_MAJOR[ \t]+([0-9]+)[^\\.]")
set(${_pkg}_VERSION_MAJOR ${CMAKE_MATCH_1})
endif()
if("${_flatbuffers_base_content}" MATCHES "#define[ \t]+FLATBUFFERS_VERSION_MINOR[ \t]+([0-9]+)[^\\.]")
set(${_pkg}_VERSION_MINOR ${CMAKE_MATCH_1})
endif()
if("${_flatbuffers_base_content}" MATCHES "#define[ \t]+FLATBUFFERS_VERSION_REVISION[ \t]+([0-9]+)[^\\.]")
set(${_pkg}_VERSION_PATCH ${CMAKE_MATCH_1})
endif()
endif()
if("${${_pkg}_VERSION_MAJOR}" STREQUAL "" AND "${${_pkg}_VERSION_MINOR}" STREQUAL "")
message(WARNING "Unable to determine Flatbuffers's version since flatbuffers/base.h file cannot be found!")
set(${_pkg}_VERSION_MAJOR 99)
set(${_pkg}_VERSION_MINOR 99)
set(${_pkg}_VERSION_PATCH 99)
endif()
set(${_pkg}_VERSION "${${_pkg}_VERSION_MAJOR}.${${_pkg}_VERSION_MINOR}.${${_pkg}_VERSION_PATCH}")
set(${_pkg}_VERSION_MAJOR
${${_pkg}_VERSION_MAJOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_MINOR
${${_pkg}_VERSION_MINOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_PATCH
${${_pkg}_VERSION_PATCH}
PARENT_SCOPE)
set(${_pkg}_VERSION
${${_pkg}_VERSION}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,246 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindGTest
---------
Find GTest include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(GTest
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if GTest is not found
[COMPONENTS <libs>...] # GTest libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "GTest
CMake" build. For the latter case skip to the :ref:`GTest CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``GTest_FOUND``
True if headers and requested libraries were found.
``GTest_INCLUDE_DIRS``
GTest include directories.
``GTest_LIBRARY_DIRS``
Link directories for GTest libraries.
``GTest_LIBRARIES``
GTest component libraries to be linked.
``GTest_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``GTest_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``GTest_VERSION``
GTest version number in ``X.Y`` format.
``GTest_VERSION_MAJOR``
GTest major version number (``X`` in ``X.Y``).
``GTest_VERSION_MINOR``
GTest minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``GTest_INCLUDE_DIR``
Directory containing GTest headers.
``GTest_LIBRARY_DIR_RELEASE``
Directory containing release GTest libraries.
``GTest_LIBRARY_DIR_DEBUG``
Directory containing debug GTest libraries.
``GTest_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``GTest_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``GTest_ROOT``, ``GTestROOT``
Preferred installation prefix.
``GTest_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``GTest_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``GTest_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``GTest``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the GTest header files using the above hint variables (excluding ``GTest_LIBRARYDIR``) and
saves the result in ``GTest_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``GTest_INCLUDEDIR``), "lib" directories near ``GTest_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``GTest_LIBRARY_DIR_DEBUG`` and ``GTest_LIBRARY_DIR_RELEASE`` and
individual library locations in ``GTest_<COMPONENT>_LIBRARY_DEBUG`` and ``GTest_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``GTest::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(GTest)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
GTest libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``GTest_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``GTest_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
GTest_FIND_RELEASE_ONLY is ``ON``).
``GTest_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``GTest_DEBUG``
Set to ``ON`` to enable debug output from ``FindGTest``. Please enable this before filing any bug report.
``GTest_LIBRARY_DIR``
Default value for ``GTest_LIBRARY_DIR_RELEASE`` and ``GTest_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find GTest headers only:
.. code-block:: cmake
find_package(GTest 2.0.0)
if(GTest_FOUND)
include_directories(${GTest_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC GTest::GTest)
endif()
Find GTest libraries and use imported targets:
.. code-block:: cmake
find_package(GTest 2.0.0 REQUIRED COMPONENTS GTest)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC GTest::GTest)
Find GTest headers and some *static* (release only) libraries:
.. code-block:: cmake
set(GTest_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(GTest_USE_RELEASE_LIBS ON) # only find release libs
find_package(GTest 2.0.0 COMPONENTS GTest)
if(GTest_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC GTest::GTest)
endif()
.. _`GTest CMake`:
GTest CMake
^^^^^^^^^^^
If GTest was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``GTestConfig.cmake`` and stores the result in ``CACHE``
entry ``GTest_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the GTest CMake package configuration for details on what it provides.
Set ``GTest_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`GTest pkg-config`:
GTest CMake
^^^^^^^^^^^
If GTest was installed with its pkg-config files, this module may attempt to look for GTest by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``GTest_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg GTest)
string(TOLOWER ${_pkg} _pkg_lower)
set(${_pkg}_INCLUDE_FILE gtest.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg_lower} ${_pkg_lower})
set(${_pkg}_DEFAULT_COMPONENTS gtest gmock)
set(${_pkg}_gtest_NAMES gtest)
set(${_pkg}_gmock_NAMES gmock)
set(${_pkg}_gtest_main_NAMES gtest_main)
set(${_pkg}_gmock_main_NAMES gmock_main)
# Update GTEST library search directories with pre-built paths
function(GTest_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,290 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindLibevent
---------
Find Libevent include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(Libevent
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if Libevent is not found
[COMPONENTS <libs>...] # Libevent libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "Libevent
CMake" build. For the latter case skip to the :ref:`Libevent CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``Libevent_FOUND``
True if headers and requested libraries were found.
``Libevent_INCLUDE_DIRS``
Libevent include directories.
``Libevent_LIBRARY_DIRS``
Link directories for Libevent libraries.
``Libevent_LIBRARIES``
Libevent component libraries to be linked.
``Libevent_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``Libevent_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``Libevent_VERSION``
Libevent version number in ``X.Y`` format.
``Libevent_VERSION_MAJOR``
Libevent major version number (``X`` in ``X.Y``).
``Libevent_VERSION_MINOR``
Libevent minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``Libevent_INCLUDE_DIR``
Directory containing Libevent headers.
``Libevent_LIBRARY_DIR_RELEASE``
Directory containing release Libevent libraries.
``Libevent_LIBRARY_DIR_DEBUG``
Directory containing debug Libevent libraries.
``Libevent_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``Libevent_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``Libevent_ROOT``, ``LibeventROOT``
Preferred installation prefix.
``Libevent_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``Libevent_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``Libevent_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``Libevent``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the Libevent header files using the above hint variables (excluding ``Libevent_LIBRARYDIR``) and
saves the result in ``Libevent_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``Libevent_INCLUDEDIR``), "lib" directories near ``Libevent_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``Libevent_LIBRARY_DIR_DEBUG`` and ``Libevent_LIBRARY_DIR_RELEASE`` and
individual library locations in ``Libevent_<COMPONENT>_LIBRARY_DEBUG`` and ``Libevent_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``Libevent::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(Libevent)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
Libevent libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``Libevent_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``Libevent_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
Libevent_FIND_RELEASE_ONLY is ``ON``).
``Libevent_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``Libevent_DEBUG``
Set to ``ON`` to enable debug output from ``FindLibevent``. Please enable this before filing any bug report.
``Libevent_LIBRARY_DIR``
Default value for ``Libevent_LIBRARY_DIR_RELEASE`` and ``Libevent_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find Libevent headers only:
.. code-block:: cmake
find_package(Libevent 2.0.0)
if(Libevent_FOUND)
include_directories(${Libevent_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC Libevent::Libevent)
endif()
Find Libevent libraries and use imported targets:
.. code-block:: cmake
find_package(Libevent 2.0.0 REQUIRED COMPONENTS Libevent)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC Libevent::Libevent)
Find Libevent headers and some *static* (release only) libraries:
.. code-block:: cmake
set(Libevent_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(Libevent_USE_RELEASE_LIBS ON) # only find release libs
find_package(Libevent 2.0.0 COMPONENTS Libevent)
if(Libevent_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC Libevent::Libevent)
endif()
.. _`Libevent CMake`:
Libevent CMake
^^^^^^^^^^^
If Libevent was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``LibeventConfig.cmake`` and stores the result in ``CACHE``
entry ``Libevent_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the Libevent CMake package configuration for details on what it provides.
Set ``Libevent_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`Libevent pkg-config`:
Libevent CMake
^^^^^^^^^^^
If Libevent was installed with its pkg-config files, this module may attempt to look for Libevent by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``Libevent_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg Libevent)
set(${_pkg}_NAMESPACE libevent)
set(${_pkg}_INCLUDE_FILE event.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS core extra pthreads openssl)
set(${_pkg}_core_NAMES event_core)
set(${_pkg}_extra_NAMES event_extra)
set(${_pkg}_pthreads_NAMES event_pthreads)
set(${_pkg}_openssl_NAMES event_openssl)
# Extract LIBEVENT version from include directory
function(Libevent_version_function include_dir)
set(_paths ${include_dir}/event2 ${include_dir}/event)
_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_paths")
find_file(
_event_config_h event-config.h
PATHS ${_paths}
NO_DEFAULT_PATH)
if(_event_config_h)
file(READ ${_event_config_h} _event_config_file)
set(_ver_type MAJOR MINOR PATCH)
foreach(_type ${_ver_type})
set(_var EVENT__VERSION_${_type})
if("${_event_config_file}" MATCHES ".*#define[ \t]+${_var}[ \t]+([0-9]+).*")
_debug_print("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" " ${_type} version read from ${_var}")
set(${_pkg}_VERSION_${_type} ${CMAKE_MATCH_1})
endif()
endforeach()
else()
message(WARNING "Unable to determine Libevent's version since event-config.h file cannot be found!")
set(${_pkg}_VERSION_MAJOR 99)
set(${_pkg}_VERSION_MINOR 99)
set(${_pkg}_VERSION_PATCH 99)
endif()
set(${_pkg}_VERSION "${${_pkg}_VERSION_MAJOR}.${${_pkg}_VERSION_MINOR}.${${_pkg}_VERSION_PATCH}")
set(${_pkg}_VERSION_MAJOR
${${_pkg}_VERSION_MAJOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_MINOR
${${_pkg}_VERSION_MINOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_PATCH
${${_pkg}_VERSION_PATCH}
PARENT_SCOPE)
set(${_pkg}_VERSION
${${_pkg}_VERSION}
PARENT_SCOPE)
endfunction()
# Update LIBEVENT library search directories with pre-built paths
function(Libevent_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,271 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindOpenCV
---------
Find OpenCV include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(OpenCV
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if OpenCV is not found
[COMPONENTS <libs>...] # OpenCV libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "OpenCV
CMake" build. For the latter case skip to the :ref:`OpenCV CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``OpenCV_FOUND``
True if headers and requested libraries were found.
``OpenCV_INCLUDE_DIRS``
OpenCV include directories.
``OpenCV_LIBRARY_DIRS``
Link directories for OpenCV libraries.
``OpenCV_LIBRARIES``
OpenCV component libraries to be linked.
``OpenCV_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``OpenCV_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``OpenCV_VERSION``
OpenCV version number in ``X.Y`` format.
``OpenCV_VERSION_MAJOR``
OpenCV major version number (``X`` in ``X.Y``).
``OpenCV_VERSION_MINOR``
OpenCV minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``OpenCV_INCLUDE_DIR``
Directory containing OpenCV headers.
``OpenCV_LIBRARY_DIR_RELEASE``
Directory containing release OpenCV libraries.
``OpenCV_LIBRARY_DIR_DEBUG``
Directory containing debug OpenCV libraries.
``OpenCV_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``OpenCV_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``OpenCV_ROOT``, ``OpenCVROOT``
Preferred installation prefix.
``OpenCV_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``OpenCV_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``OpenCV_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``OpenCV``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the OpenCV header files using the above hint variables (excluding ``OpenCV_LIBRARYDIR``) and
saves the result in ``OpenCV_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``OpenCV_INCLUDEDIR``), "lib" directories near ``OpenCV_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``OpenCV_LIBRARY_DIR_DEBUG`` and ``OpenCV_LIBRARY_DIR_RELEASE`` and
individual library locations in ``OpenCV_<COMPONENT>_LIBRARY_DEBUG`` and ``OpenCV_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``OpenCV::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(OpenCV)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
OpenCV libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``OpenCV_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``OpenCV_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
OpenCV_FIND_RELEASE_ONLY is ``ON``).
``OpenCV_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``OpenCV_DEBUG``
Set to ``ON`` to enable debug output from ``FindOpenCV``. Please enable this before filing any bug report.
``OpenCV_LIBRARY_DIR``
Default value for ``OpenCV_LIBRARY_DIR_RELEASE`` and ``OpenCV_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find OpenCV headers only:
.. code-block:: cmake
find_package(OpenCV 2.0.0)
if(OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC OpenCV::OpenCV)
endif()
Find OpenCV libraries and use imported targets:
.. code-block:: cmake
find_package(OpenCV 2.0.0 REQUIRED COMPONENTS OpenCV)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC OpenCV::OpenCV)
Find OpenCV headers and some *static* (release only) libraries:
.. code-block:: cmake
set(OpenCV_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(OpenCV_USE_RELEASE_LIBS ON) # only find release libs
find_package(OpenCV 2.0.0 COMPONENTS OpenCV)
if(OpenCV_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC OpenCV::OpenCV)
endif()
.. _`OpenCV CMake`:
OpenCV CMake
^^^^^^^^^^^
If OpenCV was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``OpenCVConfig.cmake`` and stores the result in ``CACHE``
entry ``OpenCV_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the OpenCV CMake package configuration for details on what it provides.
Set ``OpenCV_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`OpenCV pkg-config`:
OpenCV CMake
^^^^^^^^^^^
If OpenCV was installed with its pkg-config files, this module may attempt to look for OpenCV by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``OpenCV_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg OpenCV)
set(${_pkg}_INCLUDE_FILE version.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include/opencv2/core opencv2/core)
set(${_pkg}_DEFINE_PREFIX CV)
set(${_pkg}_INCLUDE_DIR_UP_INDEX 2)
set(${_pkg}_DEFAULT_COMPONENTS core)
if(WIN32)
# Extensions:
#
# * .ddl.a: shared libraries, MinGW flavor
# * .lib: shared libraries, MSVC flavor (static are *-static.a)
if(MSVC)
set(${_pkg}_FIND_LIBRARY_SUFFIXES .lib .a)
else()
set(${_pkg}_FIND_LIBRARY_SUFFIXES .dll .ddl.a .lib .a)
endif()
endif()
if(NOT OpenCV_FIND_VERSION_MAJOR)
set(OpenCV_FIND_VERSION_MAJOR 4)
endif()
if(NOT OpenCV_FIND_VERSION_MINOR)
set(OpenCV_FIND_VERSION_MINOR 5)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/opencv/${OpenCV_FIND_VERSION_MAJOR}.${OpenCV_FIND_VERSION_MINOR}.cmake)
# Update OPENCV library search directories with pre-built paths
function(OpenCV_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
function(OpenCV_post_process pkg)
foreach(_comp ${OpenCV_FIND_COMPONENTS})
if(NOT TARGET ${pkg}::${_comp} AND TARGET opencv_${_comp})
add_library(${pkg}::${_comp} ALIAS opencv_${_comp})
endif()
endforeach()
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,639 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindOpenSSL
-----------
Find the OpenSSL encryption library.
This module finds an installed OpenSSL library and determines its version.
.. versionadded:: 3.19
When a version is requested, it can be specified as a simple value or as a
range. For a detailed description of version range usage and capabilities,
refer to the :command:`find_package` command.
.. versionadded:: 3.18
Support for OpenSSL 3.0.
Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both
components have associated imported targets, as described below.
Imported Targets
^^^^^^^^^^^^^^^^
.. versionadded:: 3.4
This module defines the following :prop_tgt:`IMPORTED` targets:
``OpenSSL::SSL``
The OpenSSL ``ssl`` library, if found.
``OpenSSL::Crypto``
The OpenSSL ``crypto`` library, if found.
``OpenSSL::applink``
.. versionadded:: 3.18
The OpenSSL ``applink`` components that might be need to be compiled into
projects under MSVC. This target is available only if found OpenSSL version
is not less than 0.9.8. By linking this target the above OpenSSL targets can
be linked even if the project has different MSVC runtime configurations with
the above OpenSSL targets. This target has no effect on platforms other than
MSVC.
NOTE: Due to how ``INTERFACE_SOURCES`` are consumed by the consuming target,
unless you certainly know what you are doing, it is always preferred to link
``OpenSSL::applink`` target as ``PRIVATE`` and to make sure that this target is
linked at most once for the whole dependency graph of any library or
executable:
.. code-block:: cmake
target_link_libraries(myTarget PRIVATE OpenSSL::applink)
Otherwise you would probably encounter unexpected random problems when building
and linking, as both the ISO C and the ISO C++ standard claims almost nothing
about what a link process should be.
Result Variables
^^^^^^^^^^^^^^^^
This module will set the following variables in your project:
``OPENSSL_FOUND``
System has the OpenSSL library. If no components are requested it only
requires the crypto library.
``OPENSSL_INCLUDE_DIR``
The OpenSSL include directory.
``OPENSSL_CRYPTO_LIBRARY``
The OpenSSL crypto library.
``OPENSSL_CRYPTO_LIBRARIES``
The OpenSSL crypto library and its dependencies.
``OPENSSL_SSL_LIBRARY``
The OpenSSL SSL library.
``OPENSSL_SSL_LIBRARIES``
The OpenSSL SSL library and its dependencies.
``OPENSSL_LIBRARIES``
All OpenSSL libraries and their dependencies.
``OPENSSL_VERSION``
This is set to ``$major.$minor.$revision$patch`` (e.g. ``0.9.8s``).
``OPENSSL_APPLINK_SOURCE``
The sources in the target ``OpenSSL::applink`` that is mentioned above. This
variable shall always be undefined if found openssl version is less than
0.9.8 or if platform is not MSVC.
Hints
^^^^^
Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
.. versionadded:: 3.4
Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
.. versionadded:: 3.5
Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
#]=======================================================================]
macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (("${ssl_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")
OR ("${crypto_library}" MATCHES "\\${CMAKE_STATIC_LIBRARY_SUFFIX}$")))
set(_OpenSSL_has_dependencies TRUE)
find_package(Threads)
else()
set(_OpenSSL_has_dependencies FALSE)
endif()
endmacro()
function(_OpenSSL_add_dependencies libraries_var)
if(CMAKE_THREAD_LIBS_INIT)
list(APPEND ${libraries_var} ${CMAKE_THREAD_LIBS_INIT})
endif()
list(APPEND ${libraries_var} ${CMAKE_DL_LIBS})
set(${libraries_var}
${${libraries_var}}
PARENT_SCOPE)
endfunction()
function(_OpenSSL_target_add_dependencies target)
if(_OpenSSL_has_dependencies)
set_property(
TARGET ${target}
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads)
set_property(
TARGET ${target}
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS})
endif()
if(WIN32 AND OPENSSL_USE_STATIC_LIBS)
set_property(
TARGET ${target}
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES ws2_32)
set_property(
TARGET ${target}
APPEND
PROPERTY INTERFACE_LINK_LIBRARIES crypt32)
endif()
endfunction()
if(UNIX)
find_package(PkgConfig QUIET)
pkg_check_modules(_OPENSSL QUIET openssl)
endif()
# Support preference of static libs by adjusting CMAKE_FIND_LIBRARY_SUFFIXES
if(OPENSSL_USE_STATIC_LIBS)
set(_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
if(WIN32)
set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES})
else()
set(CMAKE_FIND_LIBRARY_SUFFIXES .a)
endif()
endif()
if(WIN32)
# http://www.slproweb.com/products/Win32OpenSSL.html
set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}
${OPENSSL_ROOT}
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
ENV
OPENSSL_ROOT_DIR
OPENSSL_ROOT)
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_arch "Win64")
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
else()
set(_arch "Win32")
set(_progfiles_x86 "ProgramFiles(x86)")
if(NOT "$ENV{${_progfiles_x86}}" STREQUAL "")
# under windows 64 bit machine
file(TO_CMAKE_PATH "$ENV{${_progfiles_x86}}" _programfiles)
else()
# under windows 32 bit machine
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _programfiles)
endif()
endif()
set(_OPENSSL_ROOT_PATHS "${_programfiles}/OpenSSL" "${_programfiles}/OpenSSL-${_arch}" "C:/OpenSSL/"
"C:/OpenSSL-${_arch}/")
unset(_programfiles)
unset(_arch)
else()
set(_OPENSSL_ROOT_HINTS ${OPENSSL_ROOT_DIR} ${OPENSSL_ROOT} ENV OPENSSL_ROOT_DIR OPENSSL_ROOT)
endif()
set(_OPENSSL_ROOT_HINTS_AND_PATHS HINTS ${_OPENSSL_ROOT_HINTS} PATHS ${_OPENSSL_ROOT_PATHS})
find_path(
OPENSSL_INCLUDE_DIR
NAMES openssl/ssl.h ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS ${_OPENSSL_INCLUDEDIR} ${_OPENSSL_INCLUDE_DIRS}
PATH_SUFFIXES include)
if(WIN32 AND NOT CYGWIN)
if(MSVC)
# /MD and /MDd are the standard values - if someone wants to use others, the libnames have to change here too use
# also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b enable OPENSSL_MSVC_STATIC_RT to get the libs
# build /MT (Multithreaded no-DLL) In Visual C++ naming convention each of these four kinds of Windows libraries has
# it's standard suffix: * MD for dynamic-release * MDd for dynamic-debug * MT for static-release * MTd for
# static-debug
# Implementation details: We are using the libraries located in the VC subdir instead of the parent directory even
# though : libeay32MD.lib is identical to ../libeay32.lib, and ssleay32MD.lib is identical to ../ssleay32.lib enable
# OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
if(OPENSSL_MSVC_STATIC_RT)
set(_OPENSSL_MSVC_RT_MODE "MT")
else()
set(_OPENSSL_MSVC_RT_MODE "MD")
endif()
# Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_OPENSSL_MSVC_ARCH_SUFFIX "64")
else()
set(_OPENSSL_MSVC_ARCH_SUFFIX "32")
endif()
if(OPENSSL_USE_STATIC_LIBS)
set(_OPENSSL_STATIC_SUFFIX "_static")
set(_OPENSSL_PATH_SUFFIXES "lib/VC/static" "VC/static" "lib")
else()
set(_OPENSSL_STATIC_SUFFIX "")
set(_OPENSSL_PATH_SUFFIXES "lib/VC" "VC" "lib")
endif()
find_library(
LIB_EAY_DEBUG
NAMES # When OpenSSL is built with default options, the static library name is suffixed with "_static". Looking
# the "libcrypto_static.lib" with a higher priority than "libcrypto.lib" which is the import library of
# "libcrypto.dll".
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libcrypto${_OPENSSL_STATIC_SUFFIX}d
libeay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libeay32${_OPENSSL_STATIC_SUFFIX}d
crypto${_OPENSSL_STATIC_SUFFIX}d
# When OpenSSL is built with the "-static" option, only the static build is produced, and it is not suffixed
# with "_static".
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libcrypto${_OPENSSL_MSVC_RT_MODE}d
libcryptod
libeay32${_OPENSSL_MSVC_RT_MODE}d
libeay32d
cryptod
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES})
find_library(
LIB_EAY_RELEASE
NAMES # When OpenSSL is built with default options, the static library name is suffixed with "_static". Looking
# the "libcrypto_static.lib" with a higher priority than "libcrypto.lib" which is the import library of
# "libcrypto.dll".
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libcrypto${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libcrypto${_OPENSSL_STATIC_SUFFIX}
libeay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libeay32${_OPENSSL_STATIC_SUFFIX}
crypto${_OPENSSL_STATIC_SUFFIX}
# When OpenSSL is built with the "-static" option, only the static build is produced, and it is not suffixed
# with "_static".
libcrypto${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libcrypto${_OPENSSL_MSVC_RT_MODE}
libcrypto
libeay32${_OPENSSL_MSVC_RT_MODE}
libeay32
crypto
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES})
find_library(
SSL_EAY_DEBUG
NAMES # When OpenSSL is built with default options, the static library name is suffixed with "_static". Looking
# the "libssl_static.lib" with a higher priority than "libssl.lib" which is the import library of
# "libssl.dll".
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libssl${_OPENSSL_STATIC_SUFFIX}d
ssleay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
ssleay32${_OPENSSL_STATIC_SUFFIX}d
ssl${_OPENSSL_STATIC_SUFFIX}d
# When OpenSSL is built with the "-static" option, only the static build is produced, and it is not suffixed
# with "_static".
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}d
libssl${_OPENSSL_MSVC_RT_MODE}d
libssld
ssleay32${_OPENSSL_MSVC_RT_MODE}d
ssleay32d
ssld
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES})
find_library(
SSL_EAY_RELEASE
NAMES # When OpenSSL is built with default options, the static library name is suffixed with "_static". Looking
# the "libssl_static.lib" with a higher priority than "libssl.lib" which is the import library of
# "libssl.dll".
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libssl${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libssl${_OPENSSL_STATIC_SUFFIX}
ssleay32${_OPENSSL_STATIC_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
ssleay32${_OPENSSL_STATIC_SUFFIX}
ssl${_OPENSSL_STATIC_SUFFIX}
# When OpenSSL is built with the "-static" option, only the static build is produced, and it is not suffixed
# with "_static".
libssl${_OPENSSL_MSVC_ARCH_SUFFIX}${_OPENSSL_MSVC_RT_MODE}
libssl${_OPENSSL_MSVC_RT_MODE}
libssl
ssleay32${_OPENSSL_MSVC_RT_MODE}
ssleay32
ssl
NAMES_PER_DIR
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES ${_OPENSSL_PATH_SUFFIXES})
set(LIB_EAY_LIBRARY_DEBUG "${LIB_EAY_DEBUG}")
set(LIB_EAY_LIBRARY_RELEASE "${LIB_EAY_RELEASE}")
set(SSL_EAY_LIBRARY_DEBUG "${SSL_EAY_DEBUG}")
set(SSL_EAY_LIBRARY_RELEASE "${SSL_EAY_RELEASE}")
include(SelectLibraryConfigurations.cmake)
select_library_configurations(LIB_EAY)
select_library_configurations(SSL_EAY)
mark_as_advanced(LIB_EAY_LIBRARY_DEBUG LIB_EAY_LIBRARY_RELEASE SSL_EAY_LIBRARY_DEBUG SSL_EAY_LIBRARY_RELEASE)
set(OPENSSL_SSL_LIBRARY ${SSL_EAY_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY_LIBRARY})
elseif(MINGW)
# same player, for MinGW
set(LIB_EAY_NAMES crypto libeay32)
set(SSL_EAY_NAMES ssl ssleay32)
find_library(
LIB_EAY
NAMES ${LIB_EAY_NAMES} NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES "lib/MinGW" "lib")
find_library(
SSL_EAY
NAMES ${SSL_EAY_NAMES} NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES "lib/MinGW" "lib")
mark_as_advanced(SSL_EAY LIB_EAY)
set(OPENSSL_SSL_LIBRARY ${SSL_EAY})
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY})
unset(LIB_EAY_NAMES)
unset(SSL_EAY_NAMES)
else()
# Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
find_library(
LIB_EAY
NAMES libcrypto libeay32 NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS ${_OPENSSL_LIBDIR}
PATH_SUFFIXES lib)
find_library(
SSL_EAY
NAMES libssl ssleay32 NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS ${_OPENSSL_LIBDIR}
PATH_SUFFIXES lib)
mark_as_advanced(SSL_EAY LIB_EAY)
set(OPENSSL_SSL_LIBRARY ${SSL_EAY})
set(OPENSSL_CRYPTO_LIBRARY ${LIB_EAY})
endif()
else()
find_library(
OPENSSL_SSL_LIBRARY
NAMES ssl ssleay32 ssleay32MD NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS ${_OPENSSL_LIBDIR} ${_OPENSSL_LIBRARY_DIRS}
PATH_SUFFIXES lib)
find_library(
OPENSSL_CRYPTO_LIBRARY
NAMES crypto NAMES_PER_DIR ${_OPENSSL_ROOT_HINTS_AND_PATHS}
HINTS ${_OPENSSL_LIBDIR} ${_OPENSSL_LIBRARY_DIRS}
PATH_SUFFIXES lib)
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
endif()
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
set(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
_openssl_test_and_find_dependencies("${OPENSSL_SSL_LIBRARY}" "${OPENSSL_CRYPTO_LIBRARY}")
if(_OpenSSL_has_dependencies)
_openssl_add_dependencies(OPENSSL_SSL_LIBRARIES)
_openssl_add_dependencies(OPENSSL_CRYPTO_LIBRARIES)
_openssl_add_dependencies(OPENSSL_LIBRARIES)
endif()
function(from_hex HEX DEC)
string(TOUPPER "${HEX}" HEX)
set(_res 0)
string(LENGTH "${HEX}" _strlen)
while(_strlen GREATER 0)
math(EXPR _res "${_res} * 16")
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
string(SUBSTRING "${HEX}" 1 -1 HEX)
if(NIBBLE STREQUAL "A")
math(EXPR _res "${_res} + 10")
elseif(NIBBLE STREQUAL "B")
math(EXPR _res "${_res} + 11")
elseif(NIBBLE STREQUAL "C")
math(EXPR _res "${_res} + 12")
elseif(NIBBLE STREQUAL "D")
math(EXPR _res "${_res} + 13")
elseif(NIBBLE STREQUAL "E")
math(EXPR _res "${_res} + 14")
elseif(NIBBLE STREQUAL "F")
math(EXPR _res "${_res} + 15")
else()
math(EXPR _res "${_res} + ${NIBBLE}")
endif()
string(LENGTH "${HEX}" _strlen)
endwhile()
set(${DEC}
${_res}
PARENT_SCOPE)
endfunction()
if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])+.*")
if(openssl_version_str)
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status The status gives if this is a developer
# or prerelease and is ignored here. Major, minor, and fix directly translate into the version numbers shown in the
# string. The patch field translates to the single character suffix that indicates the bug fix state, which 00 ->
# nothing, 01 -> a, 02 -> b and so on.
string(
REGEX
REPLACE
"^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F][0-9a-fA-F])([0-9a-fA-F]).*$"
"\\1;\\2;\\3;\\4;\\5"
OPENSSL_VERSION_LIST
"${openssl_version_str}")
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
from_hex("${OPENSSL_VERSION_MINOR}" OPENSSL_VERSION_MINOR)
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
if(NOT OPENSSL_VERSION_PATCH STREQUAL "00")
from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
# 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
unset(_tmp)
# Once anyone knows how OpenSSL would call the patch versions beyond 'z' this should be updated to handle that,
# too. This has not happened yet so it is simply ignored here for now.
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
endif()
set(OPENSSL_VERSION
"${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
# DNguyen: version for CMake comparison is major.minor.fix.patch with 'patch' in decimal e.g. 'l' == 0c == 12 e.g.
# 'm' == 0d == 13
from_hex(${OPENSSL_VERSION_PATCH} _patch)
set(OPENSSL_VERSION_4_COMPONENTS
"${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}.${_patch}")
set(_openssl_version_var OPENSSL_VERSION_4_COMPONENTS)
if(NOT OpenSSL_FIND_QUIETLY)
message(STATUS "OpenSSL version: ${OPENSSL_VERSION}, \
patch component: '${OPENSSL_VERSION_PATCH_STRING}' (${OPENSSL_VERSION_PATCH} -> ${_patch})")
message(STATUS "OpenSSL version in major.minor.fix.patch format: ${OPENSSL_VERSION_4_COMPONENTS}")
endif()
else()
# Since OpenSSL 3.0.0, the new version format is MAJOR.MINOR.PATCH and a new OPENSSL_VERSION_STR macro contains
# exactly that
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" OPENSSL_VERSION_STR
REGEX "^#[\t ]*define[\t ]+OPENSSL_VERSION_STR[\t ]+\"([0-9])+\\.([0-9])+\\.([0-9])+\".*")
string(REGEX REPLACE "^.*OPENSSL_VERSION_STR[\t ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*$" "\\1" OPENSSL_VERSION_STR
"${OPENSSL_VERSION_STR}")
set(OPENSSL_VERSION "${OPENSSL_VERSION_STR}")
set(_openssl_version_var OPENSSL_VERSION)
unset(OPENSSL_VERSION_STR)
endif()
endif()
foreach(_comp IN LISTS OpenSSL_FIND_COMPONENTS)
if(_comp STREQUAL "Crypto")
if(EXISTS "${OPENSSL_INCLUDE_DIR}"
AND (EXISTS "${OPENSSL_CRYPTO_LIBRARY}"
OR EXISTS "${LIB_EAY_LIBRARY_DEBUG}"
OR EXISTS "${LIB_EAY_LIBRARY_RELEASE}"))
set(OpenSSL_${_comp}_FOUND TRUE)
else()
set(OpenSSL_${_comp}_FOUND FALSE)
endif()
elseif(_comp STREQUAL "SSL")
if(EXISTS "${OPENSSL_INCLUDE_DIR}"
AND (EXISTS "${OPENSSL_SSL_LIBRARY}"
OR EXISTS "${SSL_EAY_LIBRARY_DEBUG}"
OR EXISTS "${SSL_EAY_LIBRARY_RELEASE}"))
set(OpenSSL_${_comp}_FOUND TRUE)
else()
set(OpenSSL_${_comp}_FOUND FALSE)
endif()
else()
message(WARNING "${_comp} is not a valid OpenSSL component")
set(OpenSSL_${_comp}_FOUND FALSE)
endif()
endforeach()
unset(_comp)
include(FindPackageHandleStandardArgs)
if("${_openssl_version_var}" STREQUAL "OPENSSL_VERSION_4_COMPONENTS")
set(_fail_msg
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR \
or OPENSSL_ROOT.
Found version ${OPENSSL_VERSION} (${OPENSSL_VERSION_4_COMPONENTS})
")
else()
set(_fail_msg
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR \
or OPENSSL_ROOT")
endif()
find_package_handle_standard_args(
OpenSSL
REQUIRED_VARS OPENSSL_CRYPTO_LIBRARY OPENSSL_INCLUDE_DIR
VERSION_VAR ${_openssl_version_var} HANDLE_VERSION_RANGE
HANDLE_COMPONENTS
FAIL_MESSAGE "${_fail_msg}")
mark_as_advanced(OPENSSL_INCLUDE_DIR)
if(OPENSSL_FOUND)
if(NOT TARGET OpenSSL::Crypto
AND (EXISTS "${OPENSSL_CRYPTO_LIBRARY}"
OR EXISTS "${LIB_EAY_LIBRARY_DEBUG}"
OR EXISTS "${LIB_EAY_LIBRARY_RELEASE}"))
add_library(OpenSSL::Crypto UNKNOWN IMPORTED)
set_target_properties(OpenSSL::Crypto PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
if(EXISTS "${OPENSSL_CRYPTO_LIBRARY}")
set_target_properties(OpenSSL::Crypto PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${OPENSSL_CRYPTO_LIBRARY}")
endif()
if(EXISTS "${LIB_EAY_LIBRARY_RELEASE}")
set_property(
TARGET OpenSSL::Crypto
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(OpenSSL::Crypto PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${LIB_EAY_LIBRARY_RELEASE}")
endif()
if(EXISTS "${LIB_EAY_LIBRARY_DEBUG}")
set_property(
TARGET OpenSSL::Crypto
APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(OpenSSL::Crypto PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${LIB_EAY_LIBRARY_DEBUG}")
endif()
_openssl_target_add_dependencies(OpenSSL::Crypto)
endif()
if(NOT TARGET OpenSSL::SSL
AND (EXISTS "${OPENSSL_SSL_LIBRARY}"
OR EXISTS "${SSL_EAY_LIBRARY_DEBUG}"
OR EXISTS "${SSL_EAY_LIBRARY_RELEASE}"))
add_library(OpenSSL::SSL UNKNOWN IMPORTED)
set_target_properties(OpenSSL::SSL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OPENSSL_INCLUDE_DIR}")
if(EXISTS "${OPENSSL_SSL_LIBRARY}")
set_target_properties(OpenSSL::SSL PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES "C" IMPORTED_LOCATION
"${OPENSSL_SSL_LIBRARY}")
endif()
if(EXISTS "${SSL_EAY_LIBRARY_RELEASE}")
set_property(
TARGET OpenSSL::SSL
APPEND
PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(OpenSSL::SSL PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "C"
IMPORTED_LOCATION_RELEASE "${SSL_EAY_LIBRARY_RELEASE}")
endif()
if(EXISTS "${SSL_EAY_LIBRARY_DEBUG}")
set_property(
TARGET OpenSSL::SSL
APPEND
PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(OpenSSL::SSL PROPERTIES IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "C"
IMPORTED_LOCATION_DEBUG "${SSL_EAY_LIBRARY_DEBUG}")
endif()
if(TARGET OpenSSL::Crypto)
set_target_properties(OpenSSL::SSL PROPERTIES INTERFACE_LINK_LIBRARIES OpenSSL::Crypto)
endif()
_openssl_target_add_dependencies(OpenSSL::SSL)
endif()
if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
if(MSVC)
if(EXISTS "${OPENSSL_INCLUDE_DIR}")
set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR})
endif()
find_file(
OPENSSL_APPLINK_SOURCE
NAMES openssl/applink.c ${_OPENSSL_applink_paths}
NO_DEFAULT_PATH)
if(OPENSSL_APPLINK_SOURCE)
set(_OPENSSL_applink_interface_srcs ${OPENSSL_APPLINK_SOURCE})
endif()
endif()
if(NOT TARGET OpenSSL::applink)
add_library(OpenSSL::applink INTERFACE IMPORTED)
set_property(
TARGET OpenSSL::applink
APPEND
PROPERTY INTERFACE_SOURCES ${_OPENSSL_applink_interface_srcs})
endif()
endif()
endif()
# Restore the original find library ordering
if(OPENSSL_USE_STATIC_LIBS)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_openssl_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
endif()

View File

@ -0,0 +1,285 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindTIFF
---------
Find TIFF include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(TIFF
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if TIFF is not found
[COMPONENTS <libs>...] # TIFF libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "TIFF
CMake" build. For the latter case skip to the :ref:`TIFF CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``TIFF_FOUND``
True if headers and requested libraries were found.
``TIFF_INCLUDE_DIRS``
TIFF include directories.
``TIFF_LIBRARY_DIRS``
Link directories for TIFF libraries.
``TIFF_LIBRARIES``
TIFF component libraries to be linked.
``TIFF_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``TIFF_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``TIFF_VERSION``
TIFF version number in ``X.Y`` format.
``TIFF_VERSION_MAJOR``
TIFF major version number (``X`` in ``X.Y``).
``TIFF_VERSION_MINOR``
TIFF minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``TIFF_INCLUDE_DIR``
Directory containing TIFF headers.
``TIFF_LIBRARY_DIR_RELEASE``
Directory containing release TIFF libraries.
``TIFF_LIBRARY_DIR_DEBUG``
Directory containing debug TIFF libraries.
``TIFF_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``TIFF_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``TIFF_ROOT``, ``TIFFROOT``
Preferred installation prefix.
``TIFF_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``TIFF_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``TIFF_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``TIFF``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the TIFF header files using the above hint variables (excluding ``TIFF_LIBRARYDIR``) and
saves the result in ``TIFF_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``TIFF_INCLUDEDIR``), "lib" directories near ``TIFF_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``TIFF_LIBRARY_DIR_DEBUG`` and ``TIFF_LIBRARY_DIR_RELEASE`` and
individual library locations in ``TIFF_<COMPONENT>_LIBRARY_DEBUG`` and ``TIFF_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``TIFF::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(TIFF)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
TIFF libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``TIFF_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``TIFF_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
TIFF_FIND_RELEASE_ONLY is ``ON``).
``TIFF_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``TIFF_DEBUG``
Set to ``ON`` to enable debug output from ``FindTIFF``. Please enable this before filing any bug report.
``TIFF_LIBRARY_DIR``
Default value for ``TIFF_LIBRARY_DIR_RELEASE`` and ``TIFF_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find TIFF headers only:
.. code-block:: cmake
find_package(TIFF 2.0.0)
if(TIFF_FOUND)
include_directories(${TIFF_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC TIFF::TIFF)
endif()
Find TIFF libraries and use imported targets:
.. code-block:: cmake
find_package(TIFF 2.0.0 REQUIRED COMPONENTS TIFF)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC TIFF::TIFF)
Find TIFF headers and some *static* (release only) libraries:
.. code-block:: cmake
set(TIFF_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(TIFF_USE_RELEASE_LIBS ON) # only find release libs
find_package(TIFF 2.0.0 COMPONENTS TIFF)
if(TIFF_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC TIFF::TIFF)
endif()
.. _`TIFF CMake`:
TIFF CMake
^^^^^^^^^^^
If TIFF was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``TIFFConfig.cmake`` and stores the result in ``CACHE``
entry ``TIFF_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the TIFF CMake package configuration for details on what it provides.
Set ``TIFF_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`TIFF pkg-config`:
TIFF CMake
^^^^^^^^^^^
If TIFF was installed with its pkg-config files, this module may attempt to look for TIFF by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``TIFF_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg TIFF)
set(${_pkg}_INCLUDE_FILE tiff.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS TIFF)
set(${_pkg}_TIFF_NAMES tiff libtiff tiff3 libtiff3)
if(MSVC)
# C++ bindings are built into the main tiff library.
set(${_pkg}_CXX_NAMES ${${_pkg}_TIFF_NAMES})
else()
set(${_pkg}_CXX_NAMES tiffxx libtiffxx tiff3xx libtiff3xx)
endif()
function(TIFF_version_function include_dir)
message(STATUS "${include_dir}")
find_file(
_tiffvers_h tiffvers.h
PATHS ${include_dir}
NO_DEFAULT_PATH)
if(_tiffvers_h)
file(STRINGS "${_tiffvers_h}" tiff_version_str REGEX "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version .*")
string(REGEX REPLACE "^#define[\t ]+TIFFLIB_VERSION_STR[\t ]+\"LIBTIFF, Version +([^ \\n]*).*" "\\1"
${_pkg}_VERSION "${tiff_version_str}")
endif()
if(${_pkg}_VERSION MATCHES "([0-9]+)\.([0-9]+)\.([0-9]+)")
set(${_pkg}_VERSION_MAJOR ${CMAKE_MATCH_1})
set(${_pkg}_VERSION_MINOR ${CMAKE_MATCH_2})
set(${_pkg}_VERSION_PATCH ${CMAKE_MATCH_3})
else()
message(WARNING "Unable to determine TIFF's version since tiffvers.h file cannot be found!")
set(${_pkg}_VERSION_MAJOR 99999999)
set(${_pkg}_VERSION_MINOR 99)
set(${_pkg}_VERSION_PATCH 0)
endif()
set(${_pkg}_VERSION_MAJOR
${${_pkg}_VERSION_MAJOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_MINOR
${${_pkg}_VERSION_MINOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_PATCH
${${_pkg}_VERSION_PATCH}
PARENT_SCOPE)
set(${_pkg}_VERSION
${${_pkg}_VERSION}
PARENT_SCOPE)
endfunction()
function(TIFF_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,334 @@
#.rst:
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindTurboJPEG
---------
Find TurboJPEG include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(TurboJPEG
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if TurboJPEG is not found
[COMPONENTS <libs>...] # TurboJPEG libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "TurboJPEG
CMake" build. For the latter case skip to the :ref:`TurboJPEG CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``TurboJPEG_FOUND``
True if headers and requested libraries were found.
``TurboJPEG_INCLUDE_DIRS``
TurboJPEG include directories.
``TurboJPEG_LIBRARY_DIRS``
Link directories for TurboJPEG libraries.
``TurboJPEG_LIBRARIES``
TurboJPEG component libraries to be linked.
``TurboJPEG_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``TurboJPEG_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``TurboJPEG_VERSION``
TurboJPEG version number in ``X.Y`` format.
``TurboJPEG_VERSION_MAJOR``
TurboJPEG major version number (``X`` in ``X.Y``).
``TurboJPEG_VERSION_MINOR``
TurboJPEG minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``TurboJPEG_INCLUDE_DIR``
Directory containing TurboJPEG headers.
``TurboJPEG_LIBRARY_DIR_RELEASE``
Directory containing release TurboJPEG libraries.
``TurboJPEG_LIBRARY_DIR_DEBUG``
Directory containing debug TurboJPEG libraries.
``TurboJPEG_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``TurboJPEG_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``TurboJPEG_ROOT``, ``TurboJPEGROOT``
Preferred installation prefix.
``TurboJPEG_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``TurboJPEG_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``TurboJPEG_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``TurboJPEG``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the TurboJPEG header files using the above hint variables (excluding ``TurboJPEG_LIBRARYDIR``) and
saves the result in ``TurboJPEG_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``TurboJPEG_INCLUDEDIR``), "lib" directories near ``TurboJPEG_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``TurboJPEG_LIBRARY_DIR_DEBUG`` and ``TurboJPEG_LIBRARY_DIR_RELEASE`` and
individual library locations in ``TurboJPEG_<COMPONENT>_LIBRARY_DEBUG`` and ``TurboJPEG_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``TurboJPEG::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(TurboJPEG)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
TurboJPEG libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``TurboJPEG_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``TurboJPEG_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
TurboJPEG_FIND_RELEASE_ONLY is ``ON``).
``TurboJPEG_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``TurboJPEG_DEBUG``
Set to ``ON`` to enable debug output from ``FindTurboJPEG``. Please enable this before filing any bug report.
``TurboJPEG_LIBRARY_DIR``
Default value for ``TurboJPEG_LIBRARY_DIR_RELEASE`` and ``TurboJPEG_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find TurboJPEG headers only:
.. code-block:: cmake
find_package(TurboJPEG 2.0.0)
if(TurboJPEG_FOUND)
include_directories(${TurboJPEG_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC TurboJPEG::TurboJPEG)
endif()
Find TurboJPEG libraries and use imported targets:
.. code-block:: cmake
find_package(TurboJPEG 2.0.0 REQUIRED COMPONENTS TurboJPEG)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC TurboJPEG::TurboJPEG)
Find TurboJPEG headers and some *static* (release only) libraries:
.. code-block:: cmake
set(TurboJPEG_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(TurboJPEG_USE_RELEASE_LIBS ON) # only find release libs
find_package(TurboJPEG 2.0.0 COMPONENTS TurboJPEG)
if(TurboJPEG_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC TurboJPEG::TurboJPEG)
endif()
.. _`TurboJPEG CMake`:
TurboJPEG CMake
^^^^^^^^^^^^^^^
If TurboJPEG was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``TurboJPEGConfig.cmake`` and stores the result in ``CACHE``
entry ``TurboJPEG_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the TurboJPEG CMake package configuration for details on what it provides.
Set ``TurboJPEG_NO_CMAKE`` to ``ON``, to disable the search for $the package using the CONFIG method.
.. _`TurboJPEG pkg-config`:
TurboJPEG PkgConfig
^^^^^^^^^^^^^^^^^^^
If TurboJPEG was installed with its pkg-config files, this module may attempt to look for TurboJPEG by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``TurboJPEG_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
.. _`TurboJpeg pkg-config`:
TurboJpeg CMake
^^^^^^^^^^^
If TurboJpeg was installed with its pkg-config files, this module may attempt to look for TurboJpeg by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``TurboJpeg_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg TurboJPEG)
set(${_pkg}_INCLUDE_FILE turbojpeg.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS JPEG TurboJPEG)
set(${_pkg}_TurboJPEG_NAMES turbojpeg) # names for the library
set(${_pkg}_JPEG_NAMES jpeg) # names for the library
if(WIN32)
# Extensions:
#
# * .ddl.a: shared libraries, MinGW flavor
# * .lib: shared libraries, MSVC flavor (static are *-static.a)
set(${_pkg}_FIND_LIBRARY_SUFFIXES .dll .ddl.a .lib .a)
set(win32_paths)
if(MSVC)
list(APPEND ${_pkg}_TurboJPEG_NAMES turbojpeg-static)
list(APPEND ${_pkg}_JPEG_NAMES jpeg-static)
list(APPEND win32_paths "$ENV{LOCALAPPDATA}/libjpeg-turbo64")
list(APPEND win32_paths "$ENV{LOCALAPPDATA}/libjpeg-turbo")
list(APPEND win32_paths "$ENV{ALLUSERSPROFILE}/libjpeg-turbo64")
list(APPEND win32_paths "$ENV{ALLUSERSPROFILE}/libjpeg-turbo")
list(APPEND win32_paths "C:/libjpeg-turbo64")
list(APPEND win32_paths "C:/libjpeg-turbo")
elseif(MINGW)
list(APPEND ${_pkg}_TurboJPEG_NAMES libturbojpeg)
list(APPEND ${_pkg}_JPEG_NAMES libjpeg)
list(APPEND win32_paths "$ENV{LOCALAPPDATA}/libjpeg-turbo-gcc64")
list(APPEND win32_paths "$ENV{LOCALAPPDATA}/libjpeg-turbo-gcc")
list(APPEND win32_paths "$ENV{ALLUSERSPROFILE}/libjpeg-turbo-gcc64")
list(APPEND win32_paths "$ENV{ALLUSERSPROFILE}/libjpeg-turbo-gcc")
list(APPEND win32_paths "C:/libjpeg-turbo-gcc64")
list(APPEND win32_paths "C:/libjpeg-turbo-gcc")
endif()
set(${_pkg}_INC_SYSTEM_PATHS)
set(${_pkg}_LIB_SYSTEM_PATHS)
foreach(_path ${win32_paths})
to_cmake_path(_path)
list(APPEND ${_pkg}_INC_SYSTEM_PATHS "${_path}")
list(APPEND ${_pkg}_LIB_SYSTEM_PATHS "${_path}")
endforeach()
endif()
# Extract TURBOJPEG version from include directory
function(TurboJPEG_version_function include_dir)
set(_paths ${include_dir}/)
_debug_print_var("${CMAKE_CURRENT_LIST_FILE}" "${CMAKE_CURRENT_LIST_LINE}" "_paths")
find_file(
_jconfig_h jconfig.h
PATHS ${_paths}
NO_DEFAULT_PATH)
if(_jconfig_h)
file(READ ${_jconfig_h} _jconfig_h_file)
endif()
if("${_jconfig_h_file}" MATCHES ".*#define LIBJPEG_TURBO_VERSION +([0-9]+)\\.([0-9]+)\\.*([0-9]+).*")
set(${_pkg}_VERSION_MAJOR ${CMAKE_MATCH_1})
set(${_pkg}_VERSION_MINOR ${CMAKE_MATCH_2})
set(${_pkg}_VERSION_PATCH ${CMAKE_MATCH_3})
else()
message(WARNING "Unable to determine TurboJPEG's version since jconfig.h file cannot be found!")
set(${_pkg}_VERSION_MAJOR 99)
set(${_pkg}_VERSION_MINOR 99)
set(${_pkg}_VERSION_PATCH 99)
endif()
set(${_pkg}_VERSION "${${_pkg}_VERSION_MAJOR}.${${_pkg}_VERSION_MINOR}.${${_pkg}_VERSION_PATCH}")
set(${_pkg}_VERSION_MAJOR
${${_pkg}_VERSION_MAJOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_MINOR
${${_pkg}_VERSION_MINOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_PATCH
${${_pkg}_VERSION_PATCH}
PARENT_SCOPE)
set(${_pkg}_VERSION
${${_pkg}_VERSION}
PARENT_SCOPE)
endfunction()
# Update TURBOJPEG library search directories with pre-built paths
function(TurboJPEG_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,289 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findabsl
---------
Find absl include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(absl
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if absl is not found
[COMPONENTS <libs>...] # absl libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "absl
CMake" build. For the latter case skip to the :ref:`absl CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``absl_FOUND``
True if headers and requested libraries were found.
``absl_INCLUDE_DIRS``
absl include directories.
``absl_LIBRARY_DIRS``
Link directories for absl libraries.
``absl_LIBRARIES``
absl component libraries to be linked.
``absl_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``absl_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``absl_VERSION``
absl version number in ``X.Y`` format.
``absl_VERSION_MAJOR``
absl major version number (``X`` in ``X.Y``).
``absl_VERSION_MINOR``
absl minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``absl_INCLUDE_DIR``
Directory containing absl headers.
``absl_LIBRARY_DIR_RELEASE``
Directory containing release absl libraries.
``absl_LIBRARY_DIR_DEBUG``
Directory containing debug absl libraries.
``absl_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``absl_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``absl_ROOT``, ``abslROOT``
Preferred installation prefix.
``absl_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``absl_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``absl_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``absl``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the absl header files using the above hint variables (excluding ``absl_LIBRARYDIR``) and
saves the result in ``absl_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``absl_INCLUDEDIR``), "lib" directories near ``absl_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``absl_LIBRARY_DIR_DEBUG`` and ``absl_LIBRARY_DIR_RELEASE`` and
individual library locations in ``absl_<COMPONENT>_LIBRARY_DEBUG`` and ``absl_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``absl::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(absl)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
absl libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``absl_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``absl_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
absl_FIND_RELEASE_ONLY is ``ON``).
``absl_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``absl_DEBUG``
Set to ``ON`` to enable debug output from ``Findabsl``. Please enable this before filing any bug report.
``absl_LIBRARY_DIR``
Default value for ``absl_LIBRARY_DIR_RELEASE`` and ``absl_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find absl headers only:
.. code-block:: cmake
find_package(absl 2.0.0)
if(absl_FOUND)
include_directories(${absl_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC absl::absl)
endif()
Find absl libraries and use imported targets:
.. code-block:: cmake
find_package(absl 2.0.0 REQUIRED COMPONENTS absl)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC absl::absl)
Find absl headers and some *static* (release only) libraries:
.. code-block:: cmake
set(absl_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(absl_USE_RELEASE_LIBS ON) # only find release libs
find_package(absl 2.0.0 COMPONENTS absl)
if(absl_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC absl::absl)
endif()
.. _`absl CMake`:
absl CMake
^^^^^^^^^^^
If absl was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``abslConfig.cmake`` and stores the result in ``CACHE``
entry ``absl_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the absl CMake package configuration for details on what it provides.
Set ``absl_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`absl pkg-config`:
absl CMake
^^^^^^^^^^^
If absl was installed with its pkg-config files, this module may attempt to look for absl by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``absl_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg absl)
set(${_pkg}_INCLUDE_FILE config.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include/${_pkg}/base ${_pkg}/base)
set(${_pkg}_INCLUDE_DIR_UP_INDEX 1)
set(${_pkg}_DEFAULT_COMPONENTS absl)
if(NOT absl_FIND_VERSION_MAJOR)
set(absl_FIND_VERSION_MAJOR 20200923)
endif()
include(${CMAKE_CURRENT_LIST_DIR}/absl/${absl_FIND_VERSION_MAJOR}.cmake)
function(absl_version_function include_dir)
find_file(
_absl_config_h config.h
PATHS ${include_dir}/base
NO_DEFAULT_PATH)
if(_absl_config_h)
file(READ ${_absl_config_h} _absl_content)
string(REGEX MATCHALL "#define[ \t]+[a-zA-Z0-9_]+LTS_RELEASE[a-zA-Z0-9_ ]+" _absl_content "${_absl_content}")
list(APPEND _absl_content "")
if("${_absl_content}" MATCHES "#define[ \t]+ABSL_LTS_RELEASE_VERSION[ \t]+([0-9]+)[^\\.]")
set(${_pkg}_VERSION_MAJOR ${CMAKE_MATCH_1})
endif()
if("${_absl_content}" MATCHES "#define[ \t]+ABSL_LTS_RELEASE_PATCH_LEVEL[ \t]+([0-9]+)[^\\.]")
set(${_pkg}_VERSION_MINOR ${CMAKE_MATCH_1})
endif()
set(${_pkg}_VERSION_PATCH 0)
endif()
if("${${_pkg}_VERSION_MAJOR}" STREQUAL "" AND "${${_pkg}_VERSION_MINOR}" STREQUAL "")
message(WARNING "Unable to determine absl's version since absl/base/config.h file cannot be found!")
set(${_pkg}_VERSION_MAJOR 99999999)
set(${_pkg}_VERSION_MINOR 99)
set(${_pkg}_VERSION_PATCH 0)
endif()
set(${_pkg}_VERSION "${${_pkg}_VERSION_MAJOR}.${${_pkg}_VERSION_MINOR}")
set(${_pkg}_VERSION_MAJOR
${${_pkg}_VERSION_MAJOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_MINOR
${${_pkg}_VERSION_MINOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_PATCH
${${_pkg}_VERSION_PATCH}
PARENT_SCOPE)
set(${_pkg}_VERSION
${${_pkg}_VERSION}
PARENT_SCOPE)
endfunction()
# Update ABSL library search directories with pre-built paths
function(absl_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,234 @@
#.rst:
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findc-ares
---------
Find c-ares include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(c-ares
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if c-ares is not found
[COMPONENTS <libs>...] # c-ares libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "c-ares
CMake" build. For the latter case skip to the :ref:`c-ares CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``c-ares_FOUND``
True if headers and requested libraries were found.
``c-ares_INCLUDE_DIRS``
c-ares include directories.
``c-ares_LIBRARY_DIRS``
Link directories for c-ares libraries.
``c-ares_LIBRARIES``
c-ares component libraries to be linked.
``c-ares_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``c-ares_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``c-ares_VERSION``
c-ares version number in ``X.Y`` format.
``c-ares_VERSION_MAJOR``
c-ares major version number (``X`` in ``X.Y``).
``c-ares_VERSION_MINOR``
c-ares minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``c-ares_INCLUDE_DIR``
Directory containing c-ares headers.
``c-ares_LIBRARY_DIR_RELEASE``
Directory containing release c-ares libraries.
``c-ares_LIBRARY_DIR_DEBUG``
Directory containing debug c-ares libraries.
``c-ares_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``c-ares_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``c-ares_ROOT``, ``c-aresROOT``
Preferred installation prefix.
``c-ares_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``c-ares_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``c-ares_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``c-ares``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the c-ares header files using the above hint variables (excluding ``c-ares_LIBRARYDIR``) and
saves the result in ``c-ares_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``c-ares_INCLUDEDIR``), "lib" directories near ``c-ares_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``c-ares_LIBRARY_DIR_DEBUG`` and ``c-ares_LIBRARY_DIR_RELEASE`` and
individual library locations in ``c-ares_<COMPONENT>_LIBRARY_DEBUG`` and ``c-ares_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``c-ares::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(c-ares)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
c-ares libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``c-ares_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``c-ares_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
c-ares_FIND_RELEASE_ONLY is ``ON``).
``c-ares_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``c-ares_DEBUG``
Set to ``ON`` to enable debug output from ``Findc-ares``. Please enable this before filing any bug report.
``c-ares_LIBRARY_DIR``
Default value for ``c-ares_LIBRARY_DIR_RELEASE`` and ``c-ares_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find c-ares headers only:
.. code-block:: cmake
find_package(c-ares 2.0.0)
if(c-ares_FOUND)
include_directories(${c-ares_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC c-ares::c-ares)
endif()
Find c-ares libraries and use imported targets:
.. code-block:: cmake
find_package(c-ares 2.0.0 REQUIRED COMPONENTS c-ares)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC c-ares::c-ares)
Find c-ares headers and some *static* (release only) libraries:
.. code-block:: cmake
set(c-ares_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(c-ares_USE_RELEASE_LIBS ON) # only find release libs
find_package(c-ares 2.0.0 COMPONENTS c-ares)
if(c-ares_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC c-ares::c-ares)
endif()
.. _`c-ares CMake`:
c-ares CMake
^^^^^^^^^^^
If c-ares was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``c-aresConfig.cmake`` and stores the result in ``CACHE``
entry ``c-ares_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the c-ares CMake package configuration for details on what it provides.
Set ``c-ares_NO_CMAKE`` to ``ON``, to disable the search for tbb-cmake.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg c-ares)
set(${_pkg}_INCLUDE_FILE ares.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS cares)
set(${_pkg}_DEFINE_PREFIX ARES)
set(${_pkg}_cares_NAMES cares)
# Update C-ARES library search directories with pre-built paths
function(c-ares_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,228 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findcppjieba
---------
Find cppjieba include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(cppjieba
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if cppjieba is not found
[COMPONENTS <libs>...] # cppjieba libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "cppjieba
CMake" build. For the latter case skip to the :ref:`cppjieba CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``cppjieba_FOUND``
True if headers and requested libraries were found.
``cppjieba_INCLUDE_DIRS``
cppjieba include directories.
``cppjieba_LIBRARY_DIRS``
Link directories for cppjieba libraries.
``cppjieba_LIBRARIES``
cppjieba component libraries to be linked.
``cppjieba_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``cppjieba_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``cppjieba_VERSION``
cppjieba version number in ``X.Y`` format.
``cppjieba_VERSION_MAJOR``
cppjieba major version number (``X`` in ``X.Y``).
``cppjieba_VERSION_MINOR``
cppjieba minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``cppjieba_INCLUDE_DIR``
Directory containing cppjieba headers.
``cppjieba_LIBRARY_DIR_RELEASE``
Directory containing release cppjieba libraries.
``cppjieba_LIBRARY_DIR_DEBUG``
Directory containing debug cppjieba libraries.
``cppjieba_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``cppjieba_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``cppjieba_ROOT``, ``cppjiebaROOT``
Preferred installation prefix.
``cppjieba_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``cppjieba_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``cppjieba_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``cppjieba``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the cppjieba header files using the above hint variables (excluding ``cppjieba_LIBRARYDIR``) and
saves the result in ``cppjieba_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``cppjieba_INCLUDEDIR``), "lib" directories near ``cppjieba_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``cppjieba_LIBRARY_DIR_DEBUG`` and ``cppjieba_LIBRARY_DIR_RELEASE`` and
individual library locations in ``cppjieba_<COMPONENT>_LIBRARY_DEBUG`` and ``cppjieba_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``cppjieba::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(cppjieba)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
cppjieba libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``cppjieba_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``cppjieba_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
cppjieba_FIND_RELEASE_ONLY is ``ON``).
``cppjieba_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``cppjieba_DEBUG``
Set to ``ON`` to enable debug output from ``Findcppjieba``. Please enable this before filing any bug report.
``cppjieba_LIBRARY_DIR``
Default value for ``cppjieba_LIBRARY_DIR_RELEASE`` and ``cppjieba_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find cppjieba headers only:
.. code-block:: cmake
find_package(cppjieba 2.0.0)
if(cppjieba_FOUND)
include_directories(${cppjieba_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC cppjieba::cppjieba)
endif()
Find cppjieba libraries and use imported targets:
.. code-block:: cmake
find_package(cppjieba 2.0.0 REQUIRED COMPONENTS cppjieba)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC cppjieba::cppjieba)
Find cppjieba headers and some *static* (release only) libraries:
.. code-block:: cmake
set(cppjieba_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(cppjieba_USE_RELEASE_LIBS ON) # only find release libs
find_package(cppjieba 2.0.0 COMPONENTS cppjieba)
if(cppjieba_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC cppjieba::cppjieba)
endif()
.. _`cppjieba CMake`:
cppjieba CMake
^^^^^^^^^^^^^^
If cppjieba was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``cppjiebaConfig.cmake`` and stores the result in
``CACHE`` entry ``cppjieba_DIR``. If found, the package configuration file is loaded and this module returns with no
further action. See documentation of the cppjieba CMake package configuration for details on what it provides.
Set ``cppjieba_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`cppjieba pkg-config`:
cppjieba CMake
^^^^^^^^^^^^^^
If cppjieba was installed with its pkg-config files, this module may attempt to look for cppjieba by relying on
pkg-config. If the components are found using this method, this module returns with no further action.
Set ``cppjieba_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg cppjieba)
set(${_pkg}_INCLUDE_FILE Jieba.hpp)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_INCLUDE_DIR_UP_INDEX 1)
set(${_pkg}_DEFAULT_COMPONENTS cppjieba)
set(${_pkg}_cppjieba_HEADER_ONLY TRUE)
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,378 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
FindgRPC
---------
Find gRPC include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(gRPC
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if gRPC is not found
[COMPONENTS <libs>...] # gRPC libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "gRPC
CMake" build. For the latter case skip to the :ref:`gRPC CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``gRPC_FOUND``
True if headers and requested libraries were found.
``gRPC_INCLUDE_DIRS``
gRPC include directories.
``gRPC_LIBRARY_DIRS``
Link directories for gRPC libraries.
``gRPC_LIBRARIES``
gRPC component libraries to be linked.
``gRPC_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``gRPC_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``gRPC_VERSION``
gRPC version number in ``X.Y`` format.
``gRPC_VERSION_MAJOR``
gRPC major version number (``X`` in ``X.Y``).
``gRPC_VERSION_MINOR``
gRPC minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``gRPC_INCLUDE_DIR``
Directory containing gRPC headers.
``gRPC_LIBRARY_DIR_RELEASE``
Directory containing release gRPC libraries.
``gRPC_LIBRARY_DIR_DEBUG``
Directory containing debug gRPC libraries.
``gRPC_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``gRPC_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``gRPC_ROOT``, ``gRPCROOT``
Preferred installation prefix.
``gRPC_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``gRPC_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``gRPC_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``gRPC``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the gRPC header files using the above hint variables (excluding ``gRPC_LIBRARYDIR``) and
saves the result in ``gRPC_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``gRPC_INCLUDEDIR``), "lib" directories near ``gRPC_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``gRPC_LIBRARY_DIR_DEBUG`` and ``gRPC_LIBRARY_DIR_RELEASE`` and
individual library locations in ``gRPC_<COMPONENT>_LIBRARY_DEBUG`` and ``gRPC_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``gRPC::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(gRPC)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
gRPC libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``gRPC_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``gRPC_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
gRPC_FIND_RELEASE_ONLY is ``ON``).
``gRPC_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``gRPC_DEBUG``
Set to ``ON`` to enable debug output from ``FindgRPC``. Please enable this before filing any bug report.
``gRPC_LIBRARY_DIR``
Default value for ``gRPC_LIBRARY_DIR_RELEASE`` and ``gRPC_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find gRPC headers only:
.. code-block:: cmake
find_package(gRPC 2.0.0)
if(gRPC_FOUND)
include_directories(${gRPC_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC gRPC::gRPC)
endif()
Find gRPC libraries and use imported targets:
.. code-block:: cmake
find_package(gRPC 2.0.0 REQUIRED COMPONENTS gRPC)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC gRPC::gRPC)
Find gRPC headers and some *static* (release only) libraries:
.. code-block:: cmake
set(gRPC_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(gRPC_USE_RELEASE_LIBS ON) # only find release libs
find_package(gRPC 2.0.0 COMPONENTS gRPC)
if(gRPC_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC gRPC::gRPC)
endif()
.. _`gRPC CMake`:
gRPC CMake
^^^^^^^^^^^
If gRPC was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``gRPCConfig.cmake`` and stores the result in ``CACHE``
entry ``gRPC_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the gRPC CMake package configuration for details on what it provides.
Set ``gRPC_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`gRPC pkg-config`:
gRPC CMake
^^^^^^^^^^^
If gRPC was installed with its pkg-config files, this module may attempt to look for gRPC by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``gRPC_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg gRPC)
string(TOLOWER ${_pkg} _pkg_lower)
set(${_pkg}_INCLUDE_FILE grpc.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include/${_pkg_lower} ${_pkg_lower})
set(${_pkg}_INCLUDE_DIR_UP_INDEX 1)
set(${_pkg}_DEFAULT_COMPONENTS
address_sorting
gpr
grpc
grpc_unsecure
grpc++
grpc++_alts
grpc++_error_details
grpc++_reflection
grpc++_unsecure
grpc_plugin_support
grpcpp_channelz
upb
grpc_cpp_plugin
grpc_csharp_plugin
grpc_node_plugin
grpc_objective_c_plugin
grpc_php_plugin
grpc_python_plugin
grpc_ruby_plugin)
set(_${_pkg}_exec_list
grpc_cpp_plugin
grpc_csharp_plugin
grpc_node_plugin
grpc_objective_c_plugin
grpc_php_plugin
grpc_python_plugin
grpc_ruby_plugin)
foreach(_exec ${_${_pkg}_exec_list})
set(${_pkg}_${_exec}_NAMES ${_exec})
set(${_pkg}_${_exec}_TYPE "EXECUTABLE")
endforeach()
# ==============================================================================
# Depend packages
set(${_pkg}_EXTERNAL_DEPENDENCIES ZLIB Protobuf OpenSSL c-ares absl re2)
set(${_pkg}_EXTERNAL_DEPENDENCY_ZLIB_COMPONENTS ZLIB)
set(${_pkg}_EXTERNAL_DEPENDENCY_ZLIB_FOUND_VARS ZLIB_FOUND)
set(${_pkg}_EXTERNAL_DEPENDENCY_ZLIB_FIND_ARGS)
set(${_pkg}_EXTERNAL_DEPENDENCY_Protobuf_FOUND_VARS Protobuf_FOUND PROTOBUF_FOUND)
set(${_pkg}_EXTERNAL_DEPENDENCY_OpenSSL_FOUND_VARS OPENSSL_FOUND)
set(${_pkg}_EXTERNAL_DEPENDENCY_c-ares_FOUND_VARS c-ares_FOUND)
set(${_pkg}_EXTERNAL_DEPENDENCY_absl_FOUND_VARS absl_FOUND)
set(${_pkg}_EXTERNAL_DEPENDENCY_absl_COMPONENTS
optional
time
synchronization
strings
str_format
status
memory
base
statusor
status
bind_front
inlined_vector
flat_hash_set
flat_hash_map)
set(${_pkg}_EXTERNAL_DEPENDENCY_re2_COMPONENTS re2)
set(${_pkg}_EXTERNAL_DEPENDENCY_re2_FOUND_VARS re2_FOUND)
# ==============================================================================
set(${_pkg}_address_sorting_NAMES address_sorting)
set(${_pkg}_gpr_NAMES gpr)
set(${_pkg}_gpr_EXTERNAL_DEPENDENCIES
absl::optional
absl::time
absl::synchronization
absl::strings
absl::str_format
absl::status
absl::memory
absl::base)
set(${_pkg}_grpc_NAMES grpc)
set(${_pkg}_grpc_DEPENDENCIES address_sorting upb gpr address_sorting upb)
set(${_pkg}_grpc_EXTERNAL_DEPENDENCIES
OpenSSL::SSL
OpenSSL::Crypto
ZLIB::ZLIB
c-ares::cares
re2::re2
dl
rt
m
pthread
absl::optional
absl::strings
absl::statusor
absl::status
absl::bind_front
absl::inlined_vector
absl::flat_hash_set
absl::flat_hash_map)
set(${_pkg}_grpc_unsecure_NAMES grpc_unsecure)
set(${_pkg}_grpc_unsecure_DEPENDENCIES address_sorting upb gpr address_sorting upb)
set(${_pkg}_grpc_unsecure_EXTERNAL_DEPENDENCIES
ZLIB::ZLIB
c-ares::cares
re2::re2
absl::optional
absl::strings
absl::statusor
absl::status
absl::inlined_vector
absl::flat_hash_map)
set(${_pkg}_grpc++_NAMES grpc++)
set(${_pkg}_grpc++_DEPENDENCIES grpc gpr address_sorting upb)
set(${_pkg}_grpc++_EXTERNAL_DEPENDENCIES protobuf::libprotobuf)
set(${_pkg}_grpc++_alts_NAMES grpc++_alts)
set(${_pkg}_grpc++_alts_DEPENDENCIES grpc++ grpc gpr address_sorting upb)
set(${_pkg}_grpc++_alts_EXTERNAL_DEPENDENCIES protobuf::libprotobuf)
set(${_pkg}_grpc++_error_details_NAMES grpc++_error_details)
set(${_pkg}_grpc++_error_details_DEPENDENCIES grpc++ grpc gpr address_sorting upb)
set(${_pkg}_grpc++_error_details_EXTERNAL_DEPENDENCIES protobuf::libprotobuf)
set(${_pkg}_grpc++_reflection_NAMES grpc++_reflection)
set(${_pkg}_grpc++_reflection_DEPENDENCIES grpc++ grpc gpr address_sorting upb)
set(${_pkg}_grpc++_reflection_EXTERNAL_DEPENDENCIES protobuf::libprotobuf)
set(${_pkg}_grpc++_unsecure_NAMES grpc++_unsecure)
set(${_pkg}_grpc++_unsecure_DEPENDENCIES grpc_unsecure gpr address_sorting upb)
set(${_pkg}_grpc++_unsecure_EXTERNAL_DEPENDENCIES protobuf::libprotobuf)
set(${_pkg}_grpc_plugin_support_NAMES grpc_plugin_support)
set(${_pkg}_grpc_plugin_support_EXTERNAL_DEPENDENCIES protobuf::libprotoc protobuf::libprotobuf)
set(${_pkg}_grpcpp_channelz_NAMES grpcpp_channelz)
set(${_pkg}_grpcpp_channelz_DEPENDENCIES grpc++ grpc gpr address_sorting upb)
set(${_pkg}_grpcpp_channelz_EXTERNAL_DEPENDENCIES protobuf::libprotobuf)
set(${_pkg}_upb_NAMES upb)
# Update GRPC library search directories with pre-built paths
function(gRPC_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,242 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findglog
---------
Find glog include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(glog
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if glog is not found
[COMPONENTS <libs>...] # glog libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "glog
CMake" build. For the latter case skip to the :ref:`glog CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``glog_FOUND``
True if headers and requested libraries were found.
``glog_INCLUDE_DIRS``
glog include directories.
``glog_LIBRARY_DIRS``
Link directories for glog libraries.
``glog_LIBRARIES``
glog component libraries to be linked.
``glog_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``glog_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``glog_VERSION``
glog version number in ``X.Y`` format.
``glog_VERSION_MAJOR``
glog major version number (``X`` in ``X.Y``).
``glog_VERSION_MINOR``
glog minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``glog_INCLUDE_DIR``
Directory containing glog headers.
``glog_LIBRARY_DIR_RELEASE``
Directory containing release glog libraries.
``glog_LIBRARY_DIR_DEBUG``
Directory containing debug glog libraries.
``glog_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``glog_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``glog_ROOT``, ``glogROOT``
Preferred installation prefix.
``glog_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``glog_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``glog_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``glog``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the glog header files using the above hint variables (excluding ``glog_LIBRARYDIR``) and
saves the result in ``glog_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``glog_INCLUDEDIR``), "lib" directories near ``glog_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``glog_LIBRARY_DIR_DEBUG`` and ``glog_LIBRARY_DIR_RELEASE`` and
individual library locations in ``glog_<COMPONENT>_LIBRARY_DEBUG`` and ``glog_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``glog::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(glog)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
glog libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``glog_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``glog_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
glog_FIND_RELEASE_ONLY is ``ON``).
``glog_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``glog_DEBUG``
Set to ``ON`` to enable debug output from ``Findglog``. Please enable this before filing any bug report.
``glog_LIBRARY_DIR``
Default value for ``glog_LIBRARY_DIR_RELEASE`` and ``glog_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find glog headers only:
.. code-block:: cmake
find_package(glog 0.5.0)
if(glog_FOUND)
include_directories(${glog_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC glog::glog)
endif()
Find glog libraries and use imported targets:
.. code-block:: cmake
find_package(glog 0.5.0 REQUIRED COMPONENTS glog)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC glog::glog)
Find glog headers and some *static* (release only) libraries:
.. code-block:: cmake
set(glog_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(glog_USE_RELEASE_LIBS ON) # only find release libs
find_package(glog 0.5.0 COMPONENTS glog)
if(glog_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC glog::glog)
endif()
.. _`glog CMake`:
glog CMake
^^^^^^^^^^^
If glog was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``glogConfig.cmake`` and stores the result in ``CACHE``
entry ``glog_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the glog CMake package configuration for details on what it provides.
Set ``glog_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`glog pkg-config`:
glog CMake
^^^^^^^^^^^
If glog was installed with its pkg-config files, this module may attempt to look for glog by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``glog_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
include(_find_utils_begin)
set(_pkg glog)
set(${_pkg}_INCLUDE_FILE stl_logging.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS glog)
set(${_pkg}_glog_NAMES glog)
function(glog_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/Relase)
list(APPEND ${componentlibvar} ${basedir}/MinSizeRel)
list(APPEND ${componentlibvar} ${basedir}/RelWithDebInfo)
list(APPEND ${componentlibvar} ${basedir}/Debug)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,242 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findnccl
---------
Find nccl include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(nccl
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if nccl is not found
[COMPONENTS <libs>...] # nccl libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "nccl
CMake" build. For the latter case skip to the :ref:`nccl CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``nccl_FOUND``
True if headers and requested libraries were found.
``nccl_INCLUDE_DIRS``
nccl include directories.
``nccl_LIBRARY_DIRS``
Link directories for nccl libraries.
``nccl_LIBRARIES``
nccl component libraries to be linked.
``nccl_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``nccl_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``nccl_VERSION``
nccl version number in ``X.Y`` format.
``nccl_VERSION_MAJOR``
nccl major version number (``X`` in ``X.Y``).
``nccl_VERSION_MINOR``
nccl minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``nccl_INCLUDE_DIR``
Directory containing nccl headers.
``nccl_LIBRARY_DIR_RELEASE``
Directory containing release nccl libraries.
``nccl_LIBRARY_DIR_DEBUG``
Directory containing debug nccl libraries.
``nccl_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``nccl_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``nccl_ROOT``, ``ncclROOT``
Preferred installation prefix.
``nccl_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``nccl_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``nccl_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``nccl``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the nccl header files using the above hint variables (excluding ``nccl_LIBRARYDIR``) and
saves the result in ``nccl_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``nccl_INCLUDEDIR``), "lib" directories near ``nccl_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``nccl_LIBRARY_DIR_DEBUG`` and ``nccl_LIBRARY_DIR_RELEASE`` and
individual library locations in ``nccl_<COMPONENT>_LIBRARY_DEBUG`` and ``nccl_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``nccl::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(nccl)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
nccl libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``nccl_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``nccl_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
nccl_FIND_RELEASE_ONLY is ``ON``).
``nccl_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``nccl_DEBUG``
Set to ``ON`` to enable debug output from ``Findnccl``. Please enable this before filing any bug report.
``nccl_LIBRARY_DIR``
Default value for ``nccl_LIBRARY_DIR_RELEASE`` and ``nccl_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find nccl headers only:
.. code-block:: cmake
find_package(nccl 2.0.0)
if(nccl_FOUND)
include_directories(${nccl_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC nccl::nccl)
endif()
Find nccl libraries and use imported targets:
.. code-block:: cmake
find_package(nccl 2.0.0 REQUIRED COMPONENTS nccl)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC nccl::nccl)
Find nccl headers and some *static* (release only) libraries:
.. code-block:: cmake
set(nccl_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(nccl_USE_RELEASE_LIBS ON) # only find release libs
find_package(nccl 2.0.0 COMPONENTS nccl)
if(nccl_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC nccl::nccl)
endif()
.. _`nccl CMake`:
nccl CMake
^^^^^^^^^^
If nccl was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``ncclConfig.cmake`` and stores the result in ``CACHE``
entry ``nccl_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the nccl CMake package configuration for details on what it provides.
Set ``nccl_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`nccl pkg-config`:
nccl CMake
^^^^^^^^^^
If nccl was installed with its pkg-config files, this module may attempt to look for nccl by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``nccl_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg nccl)
set(${_pkg}_INCLUDE_FILE nccl.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS nccl)
set(${_pkg}_nccl_NAMES nccl)
# Update NCCL library search directories with pre-built paths
function(nccl_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,228 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findnlohmann_json
---------
Find nlohmann_json include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(nlohmann_json
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if nlohmann_json is not found
[COMPONENTS <libs>...] # nlohmann_json libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "nlohmann_json
CMake" build. For the latter case skip to the :ref:`nlohmann_json CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``nlohmann_json_FOUND``
True if headers and requested libraries were found.
``nlohmann_json_INCLUDE_DIRS``
nlohmann_json include directories.
``nlohmann_json_LIBRARY_DIRS``
Link directories for nlohmann_json libraries.
``nlohmann_json_LIBRARIES``
nlohmann_json component libraries to be linked.
``nlohmann_json_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``nlohmann_json_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``nlohmann_json_VERSION``
nlohmann_json version number in ``X.Y`` format.
``nlohmann_json_VERSION_MAJOR``
nlohmann_json major version number (``X`` in ``X.Y``).
``nlohmann_json_VERSION_MINOR``
nlohmann_json minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``nlohmann_json_INCLUDE_DIR``
Directory containing nlohmann_json headers.
``nlohmann_json_LIBRARY_DIR_RELEASE``
Directory containing release nlohmann_json libraries.
``nlohmann_json_LIBRARY_DIR_DEBUG``
Directory containing debug nlohmann_json libraries.
``nlohmann_json_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``nlohmann_json_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``nlohmann_json_ROOT``, ``nlohmann_jsonROOT``
Preferred installation prefix.
``nlohmann_json_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``nlohmann_json_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``nlohmann_json_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``nlohmann_json``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the nlohmann_json header files using the above hint variables (excluding ``nlohmann_json_LIBRARYDIR``) and
saves the result in ``nlohmann_json_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``nlohmann_json_INCLUDEDIR``), "lib" directories near ``nlohmann_json_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``nlohmann_json_LIBRARY_DIR_DEBUG`` and ``nlohmann_json_LIBRARY_DIR_RELEASE`` and
individual library locations in ``nlohmann_json_<COMPONENT>_LIBRARY_DEBUG`` and ``nlohmann_json_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``nlohmann_json::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(nlohmann_json)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
nlohmann_json libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``nlohmann_json_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``nlohmann_json_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
nlohmann_json_FIND_RELEASE_ONLY is ``ON``).
``nlohmann_json_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``nlohmann_json_DEBUG``
Set to ``ON`` to enable debug output from ``Findnlohmann_json``. Please enable this before filing any bug report.
``nlohmann_json_LIBRARY_DIR``
Default value for ``nlohmann_json_LIBRARY_DIR_RELEASE`` and ``nlohmann_json_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find nlohmann_json headers only:
.. code-block:: cmake
find_package(nlohmann_json 2.0.0)
if(nlohmann_json_FOUND)
include_directories(${nlohmann_json_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC nlohmann_json::nlohmann_json)
endif()
Find nlohmann_json libraries and use imported targets:
.. code-block:: cmake
find_package(nlohmann_json 2.0.0 REQUIRED COMPONENTS nlohmann_json)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC nlohmann_json::nlohmann_json)
Find nlohmann_json headers and some *static* (release only) libraries:
.. code-block:: cmake
set(nlohmann_json_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(nlohmann_json_USE_RELEASE_LIBS ON) # only find release libs
find_package(nlohmann_json 2.0.0 COMPONENTS nlohmann_json)
if(nlohmann_json_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC nlohmann_json::nlohmann_json)
endif()
.. _`nlohmann_json CMake`:
nlohmann_json CMake
^^^^^^^^^^^^^^^^^^^
If nlohmann_json was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``nlohmann_jsonConfig.cmake`` and stores the result in ``CACHE``
entry ``nlohmann_json_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the nlohmann_json CMake package configuration for details on what it provides.
Set ``nlohmann_json_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`nlohmann_json pkg-config`:
nlohmann_json CMake
^^^^^^^^^^^^^^^^^^^
If nlohmann_json was installed with its pkg-config files, this module may attempt to look for nlohmann_json by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``nlohmann_json_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg nlohmann_json)
set(${_pkg}_INCLUDE_FILE json.hpp)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/nlohmann nlohmann)
set(${_pkg}_DEFAULT_COMPONENTS nlohmann_json)
set(${_pkg}_nlohmann_json_NAMES nlohmann_json)
set(${_pkg}_nlohmann_json_HEADER_ONLY TRUE)
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,288 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy of
# the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
# ==============================================================================
#
# Looking for pybind11 can be somewhat complicated now that there are two
# possible packages: - pybind11 - pybind11-global
#
# Here we try our best to look for pybind11 in all possible locations and in a
# meaningful way. In practice, this means that we look for a valid package in
# the following order: 1. First we look in a virtualenv (if one is active) for
# a) pybind11-global b) pybind11 >= 2.6.0 c) pybind11 < 2.6.0 && pybind11-cmake
# 2. pybind11-gobal in user site (if not in a virtualenv) 3. pybind11-gobal in
# global site package (also done if within a virtualenv) 4. pybind11 >= 2.6.0 in
# user and global sites NB: if the version of pybind11 is more recent than
# pybind11-global, we choose pybind11 5. pybind11 < 2.6.0 && pybind11-cmake in
# user and global sites
#
# ==============================================================================
# ~~~
# Make sure that pybind11 finds the correct python version
# - pybind11 < 2.6.0 uses find_package(PythonInterp ...)
# - pybind11 >= 2.6.0 looks for the `python` command or PYTHON_EXECUTABLE
# => specify PYTHON_EXECUTABLE manually to guarantee we find the same
# interpreter and libraries as for other python packages
# ~~~
set(PYTHON_EXECUTABLE ${Python_EXECUTABLE})
set(PYBIND11_PYTHON_VERSION ${Python_VERSION}) # maybe not strictly required
macro(_pybind11_message)
if(NOT pybind11_FIND_QUIETLY)
message(${ARGN})
endif()
endmacro()
_pybind11_message(CHECK_START "Looking for pybind11")
list(APPEND CMAKE_MESSAGE_INDENT " ")
# ==============================================================================
# First detect whether we are in a virtualenv or not
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import sys; print(int(sys.prefix != sys.base_prefix))"
OUTPUT_VARIABLE _is_virtualenv
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
if(_is_virtualenv)
# ~~~
# Try to find in order within the virtualenv:
# - pybind11-global
# - pybind11 >= 2.6.0
# - pybind11 < 2.6.0 with pybind11-cmake
# - if all of that fails, revert to user and global sites (as far as is possible)
# ~~~
_pybind11_message(CHECK_START "Looking for pybind11-global in virtualenv")
# Look for pybind11-global
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import sys, os; print(os.path.join(sys.prefix, 'share', 'cmake', 'pybind11'))"
OUTPUT_VARIABLE pybind11_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT EXISTS pybind11_DIR)
_pybind11_message(CHECK_FAIL "Not-found")
# Could not find pybind11-global, try pybind11 >= 2.6.0
_pybind11_message(CHECK_START "Looking for pybind11 >= 2.6.0 in virtualenv")
__find_python_module(pybind11 VERSION 2.6.0)
if(PYMOD_PYBIND11_FOUND)
_pybind11_message(CHECK_PASS "Found")
execute_process(
COMMAND ${Python_EXECUTABLE} -m pybind11 --cmakedir
OUTPUT_VARIABLE pybind11_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
_pybind11_message(CHECK_FAIL "Not-found")
# Now try pybind11 < 2.6.0 && pybind11-cmake
__find_python_module(pybind11-cmake)
if(PYMOD_PYBIND11_CMAKE_FOUND)
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import pybind11_cmake; print(pybind11_cmake.__path__[0])"
OUTPUT_VARIABLE pybind11_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
else()
_pybind11_message(CHECK_PASS "Found")
endif()
# Try to find some valid pybind11 config within the virtualenv
find_package(pybind11 2.6.0 CONFIG QUIET NO_DEFAULT_PATH)
endif()
# ------------------------------------------------------------------------------
if(NOT pybind11_FOUND)
_pybind11_message(CHECK_START "Looking for pybind11-global in global and user sites")
if(NOT _is_virtualenv)
# Try pybind11-global in user site
execute_process(
COMMAND ${Python_EXECUTABLE} -m site --user-base
RESULT_VARIABLE _status
OUTPUT_VARIABLE _user_base
OUTPUT_STRIP_TRAILING_WHITESPACE)
# NB: _status == 0 means user site enabled. Anything else and we really should not consider it
if(_status EQUAL 0 AND EXISTS "${_user_base}/share/cmake/pybind11/")
# cmake-lint: disable=C0103
set(pybind11_DIR "${_user_base}/share/cmake/pybind11/")
endif()
endif()
# Try to find pybind11-global either in user-site or global-site (even in the case of a virtualenv since we did not
# find anything useful in it previously)
find_package(pybind11 2.6.0 CONFIG QUIET)
if(pybind11_FOUND)
_pybind11_message(CHECK_PASS "Found")
else()
_pybind11_message(CHECK_PASS "Not-found")
endif()
if(NOT _is_virtualenv)
_pybind11_message(CHECK_START "Looking for pybind11 Python module")
# Try to find pybind11 either in user-site or global-site
if(pybind11_FIND_QUIETLY)
set(_args QUIET)
endif()
__find_python_module(pybind11 VERSION 2.6.0 ${_args})
unset(_args)
if(PYMOD_PYBIND11_FOUND)
_pybind11_message(CHECK_PASS "Found")
else()
_pybind11_message(CHECK_PASS "Not-found")
endif()
if(PYMOD_PYBIND11_FOUND AND PYMOD_PYBIND11_VERSION VERSION_GREATER pybind11_VERSION)
# We prefer pybind11 over pybind11 global if its version is more recent. This could typically be the case if a
# user installs a more recent version of pybind11 in its user site.
execute_process(
COMMAND ${Python_EXECUTABLE} -m pybind11 --cmakedir
OUTPUT_VARIABLE pybind11_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
_pybind11_message(CHECK_START "Looking for pybind11 (final)")
# Look for pybind11 again in case we have pybind11 more recent than pybind11-global
find_package(pybind11 2.6.0 CONFIG QUIET NO_DEFAULT_PATH)
# If we are not in a virtualenv, we should still try to look for pybind11 < 2.6.0 && pybind11-cmake
if(NOT pybind11_FOUND)
_pybind11_message(CHECK_PASS "Not-found")
_pybind11_message(CHECK_START "Looking for pybind11-cmake")
# If everything else fails, rely on the pybind11_cmake package
__find_python_module(pybind11-cmake)
if(PYMOD_PYBIND11_CMAKE_FOUND)
_pybind11_message(CHECK_PASS "Done")
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import pybind11_cmake; print(pybind11_cmake.__path__[0])"
OUTPUT_VARIABLE pybind11_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
_pybind11_message(CHECK_FAIL "Failed")
endif()
else()
_pybind11_message(CHECK_PASS "Found")
endif()
endif()
endif()
# ------------------------------------------------------------------------------
# Now look for pybind11 using the CONFIG method one last time. This would typically only be useful in the case of
# pybind11 < 2.6.0 located in either user or global sites.
list(POP_BACK CMAKE_MESSAGE_INDENT)
if(pybind11_DIR)
_pybind11_message(CHECK_PASS "Done")
else()
_pybind11_message(CHECK_FAIL "Failed")
endif()
find_package(pybind11 2.6.0 CONFIG NO_DEFAULT_PATH)
# ==============================================================================
# With pybind11-cmake 1.0.0 we might need to fix the include path
if(PYMOD_PYBIND11_CMAKE_FOUND)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <pybind11/pybind11.h>
int main() {return 0;}" pybind11_compiles)
if(NOT pybind11_compiles)
# This could happen with pybind11_cmake == 1.0.0 because there is a typo in the pybind11Config.cmake
execute_process(
COMMAND ${Python_EXECUTABLE} -c "import pybind11
print(pybind11.get_include(False) + ';' + pybind11.get_include(True))"
OUTPUT_VARIABLE _pybind11_inc_dir
OUTPUT_STRIP_TRAILING_WHITESPACE)
get_directory_property(_inc_dirs INCLUDE_DIRECTORIES)
list(FILTER _inc_dirs EXCLUDE REGEX .*pybind11_INCLUDE_DIR$)
list(APPEND _inc_dirs ${_pybind11_inc_dir})
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES "${_inc_dirs}")
endif()
endif()
# ==============================================================================
if(pybind11_FOUND)
if(NOT TARGET pybind11::headers)
_pybind11_message(SEND_ERROR
"Target pybind11::headers was not defined! Perhaps try updating pybind11 on your system?")
endif()
if(NOT TARGET pybind11::pybind11)
_pybind11_message(SEND_ERROR
"Target pybind11::pybind11 was not defined! Perhaps try updating pybind11 on your system?")
endif()
if(NOT TARGET pybind11::module)
_pybind11_message(SEND_ERROR
"Target pybind11::module was not defined! Perhaps try updating pybind11 on your system?")
endif()
# NB: workardound for NVHPC compiler that requires -isystem (e.g. for /usr/include)
get_target_property(_include_dir pybind11::pybind11_headers INTERFACE_INCLUDE_DIRECTORIES)
if(_include_dir)
target_include_directories(pybind11::pybind11_headers SYSTEM INTERFACE ${_include_dir})
endif()
else()
_pybind11_message(STATUS "pybind11 was not found on your system or it is an incompatible version")
_pybind11_message(STATUS " -> will be fetching pybind11 from an external Git repository")
set(PKG_NAME pybind11)
set(PKG_ROOT ${DEP_DIR}/${PKG_NAME}-src)
set(URL "https://gitee.com/mirrors/pybind11/repository/archive/v2.9.0.tar.gz")
FetchContent_Declare(${PKG_NAME} URL ${URL})
FetchContent_GetProperties(${PKG_NAME})
if(NOT ${PKG_NAME}_POPULATED)
FetchContent_Populate(${PKG_NAME})
endif()
include_directories(${PKG_ROOT}/include)
add_subdirectory(${PKG_ROOT} pybind11-build)
endif()
# ------------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
pybind11
REQUIRED_VARS pybind11_INCLUDE_DIR
VERSION_VAR pybind11_VERSION)
# ------------------------------------------------------------------------------
# For debugging
if(pybind11_FOUND)
_pybind11_message(STATUS "Found pybind11 using the CONFIG method in ${pybind11_DIR}")
_pybind11_message(STATUS "Found pybind11 and defined the pybind11::pybind11 imported target:")
_pybind11_message(STATUS " - include: ${pybind11_INCLUDE_DIR}")
_pybind11_message(STATUS " - version: ${pybind11_VERSION}")
endif()
# ==============================================================================
mark_as_advanced(pybind11_DIR)
# ==============================================================================

242
cmake/modules/Findre2.cmake Normal file
View File

@ -0,0 +1,242 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findre2
---------
Find re2 include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(re2
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if re2 is not found
[COMPONENTS <libs>...] # re2 libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "re2
CMake" build. For the latter case skip to the :ref:`re2 CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``re2_FOUND``
True if headers and requested libraries were found.
``re2_INCLUDE_DIRS``
re2 include directories.
``re2_LIBRARY_DIRS``
Link directories for re2 libraries.
``re2_LIBRARIES``
re2 component libraries to be linked.
``re2_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``re2_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``re2_VERSION``
re2 version number in ``X.Y`` format.
``re2_VERSION_MAJOR``
re2 major version number (``X`` in ``X.Y``).
``re2_VERSION_MINOR``
re2 minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``re2_INCLUDE_DIR``
Directory containing re2 headers.
``re2_LIBRARY_DIR_RELEASE``
Directory containing release re2 libraries.
``re2_LIBRARY_DIR_DEBUG``
Directory containing debug re2 libraries.
``re2_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``re2_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``re2_ROOT``, ``re2ROOT``
Preferred installation prefix.
``re2_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``re2_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``re2_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``re2``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the re2 header files using the above hint variables (excluding ``re2_LIBRARYDIR``) and
saves the result in ``re2_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``re2_INCLUDEDIR``), "lib" directories near ``re2_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``re2_LIBRARY_DIR_DEBUG`` and ``re2_LIBRARY_DIR_RELEASE`` and
individual library locations in ``re2_<COMPONENT>_LIBRARY_DEBUG`` and ``re2_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``re2::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(re2)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
re2 libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``re2_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``re2_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
re2_FIND_RELEASE_ONLY is ``ON``).
``re2_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``re2_DEBUG``
Set to ``ON`` to enable debug output from ``Findre2``. Please enable this before filing any bug report.
``re2_LIBRARY_DIR``
Default value for ``re2_LIBRARY_DIR_RELEASE`` and ``re2_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find re2 headers only:
.. code-block:: cmake
find_package(re2 2.0.0)
if(re2_FOUND)
include_directories(${re2_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC re2::re2)
endif()
Find re2 libraries and use imported targets:
.. code-block:: cmake
find_package(re2 2.0.0 REQUIRED COMPONENTS re2)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC re2::re2)
Find re2 headers and some *static* (release only) libraries:
.. code-block:: cmake
set(re2_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(re2_USE_RELEASE_LIBS ON) # only find release libs
find_package(re2 2.0.0 COMPONENTS re2)
if(re2_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC re2::re2)
endif()
.. _`re2 CMake`:
re2 CMake
^^^^^^^^^^^
If re2 was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``re2Config.cmake`` and stores the result in ``CACHE``
entry ``re2_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the re2 CMake package configuration for details on what it provides.
Set ``re2_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`re2 pkg-config`:
re2 CMake
^^^^^^^^^^^
If re2 was installed with its pkg-config files, this module may attempt to look for re2 by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``re2_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg re2)
set(${_pkg}_INCLUDE_FILE re2.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS re2)
set(${_pkg}_re2_NAMES re2) # names for the library
# Update RE2 library search directories with pre-built paths
function(re2_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,302 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findsentencepiece
---------
Find sentencepiece include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(sentencepiece
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if sentencepiece is not found
[COMPONENTS <libs>...] # sentencepiece libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "sentencepiece
CMake" build. For the latter case skip to the :ref:`sentencepiece CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``sentencepiece_FOUND``
True if headers and requested libraries were found.
``sentencepiece_INCLUDE_DIRS``
sentencepiece include directories.
``sentencepiece_LIBRARY_DIRS``
Link directories for sentencepiece libraries.
``sentencepiece_LIBRARIES``
sentencepiece component libraries to be linked.
``sentencepiece_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``sentencepiece_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``sentencepiece_VERSION``
sentencepiece version number in ``X.Y`` format.
``sentencepiece_VERSION_MAJOR``
sentencepiece major version number (``X`` in ``X.Y``).
``sentencepiece_VERSION_MINOR``
sentencepiece minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``sentencepiece_INCLUDE_DIR``
Directory containing sentencepiece headers.
``sentencepiece_LIBRARY_DIR_RELEASE``
Directory containing release sentencepiece libraries.
``sentencepiece_LIBRARY_DIR_DEBUG``
Directory containing debug sentencepiece libraries.
``sentencepiece_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``sentencepiece_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``sentencepiece_ROOT``, ``sentencepieceROOT``
Preferred installation prefix.
``sentencepiece_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``sentencepiece_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``sentencepiece_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``sentencepiece``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the sentencepiece header files using the above hint variables (excluding ``sentencepiece_LIBRARYDIR``) and
saves the result in ``sentencepiece_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``sentencepiece_INCLUDEDIR``), "lib" directories near ``sentencepiece_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``sentencepiece_LIBRARY_DIR_DEBUG`` and ``sentencepiece_LIBRARY_DIR_RELEASE`` and
individual library locations in ``sentencepiece_<COMPONENT>_LIBRARY_DEBUG`` and ``sentencepiece_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``sentencepiece::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(sentencepiece)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
sentencepiece libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``sentencepiece_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``sentencepiece_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
sentencepiece_FIND_RELEASE_ONLY is ``ON``).
``sentencepiece_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``sentencepiece_DEBUG``
Set to ``ON`` to enable debug output from ``Findsentencepiece``. Please enable this before filing any bug report.
``sentencepiece_LIBRARY_DIR``
Default value for ``sentencepiece_LIBRARY_DIR_RELEASE`` and ``sentencepiece_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find sentencepiece headers only:
.. code-block:: cmake
find_package(sentencepiece 2.0.0)
if(sentencepiece_FOUND)
include_directories(${sentencepiece_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC sentencepiece::sentencepiece)
endif()
Find sentencepiece libraries and use imported targets:
.. code-block:: cmake
find_package(sentencepiece 2.0.0 REQUIRED COMPONENTS sentencepiece)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC sentencepiece::sentencepiece)
Find sentencepiece headers and some *static* (release only) libraries:
.. code-block:: cmake
set(sentencepiece_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(sentencepiece_USE_RELEASE_LIBS ON) # only find release libs
find_package(sentencepiece 2.0.0 COMPONENTS sentencepiece)
if(sentencepiece_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC sentencepiece::sentencepiece)
endif()
.. _`sentencepiece CMake`:
sentencepiece CMake
^^^^^^^^^^^
If sentencepiece was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``sentencepieceConfig.cmake`` and stores the result in ``CACHE``
entry ``sentencepiece_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the sentencepiece CMake package configuration for details on what it provides.
Set ``sentencepiece_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`sentencepiece pkg-config`:
sentencepiece CMake
^^^^^^^^^^^
If sentencepiece was installed with its pkg-config files, this module may attempt to look for sentencepiece by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``sentencepiece_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
# cmake-lint: disable=C0103
include(_find_utils_begin)
set(_pkg sentencepiece)
set(${_pkg}_INCLUDE_FILE sentencepiece_processor.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS sentencepiece sentencepiece_train)
set(${_pkg}_sentencepiece_NAMES sentencepiece)
set(${_pkg}_sentencepiece_train_NAMES sentencepiece_train)
set(${_pkg}_sentencepiece_train_PKGCONFIG_NAMES sentencepiece)
set(_${_pkg}_exec_names spm_decode spm_encode spm_export_vocab spm_normalize spm_train)
foreach(_exec _${_pkg}_exec_names)
set(${_pkg}_${exec}_NAMES ${_exec})
set(${_pkg}_${exec}_TYPE "EXECUTABLE")
endforeach()
function(sentencepiece_version_function include_dir)
find_program(
_spm_exec
NAMES ${_${_pkg}_exec_names}
PATHS ${include_dir}/../bin
NO_DEFAULT_PATH)
if(_spm_exec)
# NB: workaround possible issue with library loading issues
if(APPLE)
set(ENV{DYLD_LIBRARY_PATH} "${include_dir}/../lib;$ENV{DYLD_LIBRARY_PATH}")
elseif(UNIX)
set(ENV{LD_LIBRARY_PATH} "${include_dir}/../lib;$ENV{LD_LIBRARY_PATH}")
endif()
execute_process(
COMMAND ${_spm_exec} --version
RESULT_VARIABLE _has_sentencepiece_version
OUTPUT_VARIABLE _sentencepiece_version)
if(_has_sentencepiece_version EQUAL 0 AND _sentencepiece_version MATCHES
"sentencepiece[ \t]+([0-9]+)\\.([0-9]+)\\.([0-9]+)")
set(${_pkg}_VERSION_MAJOR ${CMAKE_MATCH_1})
set(${_pkg}_VERSION_MINOR ${CMAKE_MATCH_2})
set(${_pkg}_VERSION_PATCH ${CMAKE_MATCH_3})
endif()
endif()
if("${${_pkg}_VERSION_MAJOR}" STREQUAL "" AND "${${_pkg}_VERSION_MINOR}" STREQUAL "")
message(
WARNING
"Unable to determine sentencepiece's version since google/sentencepiece/stubs/common.h file cannot be found!")
set(${_pkg}_VERSION_MAJOR 99)
set(${_pkg}_VERSION_MINOR 99)
set(${_pkg}_VERSION_PATCH 99)
endif()
set(${_pkg}_VERSION "${${_pkg}_VERSION_MAJOR}.${${_pkg}_VERSION_MINOR}.${${_pkg}_VERSION_PATCH}")
set(${_pkg}_VERSION_MAJOR
${${_pkg}_VERSION_MAJOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_MINOR
${${_pkg}_VERSION_MINOR}
PARENT_SCOPE)
set(${_pkg}_VERSION_PATCH
${${_pkg}_VERSION_PATCH}
PARENT_SCOPE)
set(${_pkg}_VERSION
${${_pkg}_VERSION}
PARENT_SCOPE)
endfunction()
# Update SENTENCEPIECE library search directories with pre-built paths
function(sentencepiece_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/lib)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,242 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#[=======================================================================[.rst:
Findtinyxml2
---------
Find tinyxml2 include dirs and libraries
Use this module by invoking :command:`find_package` with the form:
.. code-block:: cmake
find_package(tinyxml2
[version] [EXACT] # Minimum or EXACT version e.g. 2020.03
[REQUIRED] # Fail with error if tinyxml2 is not found
[COMPONENTS <libs>...] # tinyxml2 libraries by their canonical name
)
This module finds headers and requested component libraries OR a CMake package configuration file provided by a "tinyxml2
CMake" build. For the latter case skip to the :ref:`tinyxml2 CMake` section below.
Result Variables
^^^^^^^^^^^^^^^^
This module defines the following variables:
``tinyxml2_FOUND``
True if headers and requested libraries were found.
``tinyxml2_INCLUDE_DIRS``
tinyxml2 include directories.
``tinyxml2_LIBRARY_DIRS``
Link directories for tinyxml2 libraries.
``tinyxml2_LIBRARIES``
tinyxml2 component libraries to be linked.
``tinyxml2_<COMPONENT>_FOUND``
True if component ``<COMPONENT>`` was found (``<COMPONENT>`` name is upper-case).
``tinyxml2_<COMPONENT>_LIBRARY``
Libraries to link for component ``<COMPONENT>`` (may include :command:`target_link_libraries` debug/optimized
keywords).
``tinyxml2_VERSION``
tinyxml2 version number in ``X.Y`` format.
``tinyxml2_VERSION_MAJOR``
tinyxml2 major version number (``X`` in ``X.Y``).
``tinyxml2_VERSION_MINOR``
tinyxml2 minor version number (``Y`` in ``X.Y``).
Cache variables
^^^^^^^^^^^^^^^
Search results are saved persistently in CMake cache entries:
``tinyxml2_INCLUDE_DIR``
Directory containing tinyxml2 headers.
``tinyxml2_LIBRARY_DIR_RELEASE``
Directory containing release tinyxml2 libraries.
``tinyxml2_LIBRARY_DIR_DEBUG``
Directory containing debug tinyxml2 libraries.
``tinyxml2_<COMPONENT>_LIBRARY_DEBUG``
Component ``<COMPONENT>`` library debug variant.
``tinyxml2_<COMPONENT>_LIBRARY_RELEASE``
Component ``<COMPONENT>`` library release variant.
Hints
^^^^^
This module reads hints about search locations from variables:
``tinyxml2_ROOT``, ``tinyxml2ROOT``
Preferred installation prefix.
``tinyxml2_INCLUDEDIR``
Preferred include directory e.g. ``<prefix>/include``.
``tinyxml2_LIBRARYDIR``
Preferred library directory e.g. ``<prefix>/lib``.
``tinyxml2_NO_SYSTEM_PATHS``
Set to ``ON`` to disable searching in locations not specified by these hint variables. Default is ``OFF``.
Users may set these hints or results as ``CACHE`` entries. Projects should not read these entries directly but
instead use the above result variables. Note that some hint names start in upper-case ``tinyxml2``. One may specify these
as environment variables if they are not specified as CMake variables or cache entries.
This module first searches for the tinyxml2 header files using the above hint variables (excluding ``tinyxml2_LIBRARYDIR``) and
saves the result in ``tinyxml2_INCLUDE_DIR``. Then it searches for requested component libraries using the above hints
(excluding ``tinyxml2_INCLUDEDIR``), "lib" directories near ``tinyxml2_INCLUDE_DIR``, and the library name configuration
settings below. It saves the library directories in ``tinyxml2_LIBRARY_DIR_DEBUG`` and ``tinyxml2_LIBRARY_DIR_RELEASE`` and
individual library locations in ``tinyxml2_<COMPONENT>_LIBRARY_DEBUG`` and ``tinyxml2_<COMPONENT>_LIBRARY_RELEASE``. When one
changes settings used by previous searches in the same build tree (excluding environment variables) this module
discards previous search results affected by the changes and searches again.
Imported Targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` targets:
``tinyxml2::<component>``
Target for specific component dependency (shared or static library); ``<component>`` name is lower-case.
It is important to note that the imported targets behave differently than variables created by this module: multiple
calls to :command:`find_package(tinyxml2)` in the same directory or sub-directories with different options (e.g. static or
shared) will not override the values of the targets created by the first call.
Other Variables
^^^^^^^^^^^^^^^
tinyxml2 libraries come in many variants encoded in their file name. Users or projects may tell this module which variant
to find by setting variables:
``tinyxml2_FIND_RELEASE_ONLY``
Set to ``ON`` or ``OFF`` to specify whether to restrict the search to release libraries only. Default is ``OFF``.
``tinyxml2_USE_DEBUG_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the debug libraries. Default is ``ON`` (except when
tinyxml2_FIND_RELEASE_ONLY is ``ON``).
``tinyxml2_USE_RELEASE_LIBS``
Set to ``ON`` or ``OFF`` to specify whether to search and use the release libraries. Default is ``ON``.
Other variables one may set to control this module are:
``tinyxml2_DEBUG``
Set to ``ON`` to enable debug output from ``Findtinyxml2``. Please enable this before filing any bug report.
``tinyxml2_LIBRARY_DIR``
Default value for ``tinyxml2_LIBRARY_DIR_RELEASE`` and ``tinyxml2_LIBRARY_DIR_DEBUG``.
Examples
^^^^^^^^
Find tinyxml2 headers only:
.. code-block:: cmake
find_package(tinyxml2 0.5.0)
if(tinyxml2_FOUND)
include_directories(${tinyxml2_INCLUDE_DIRS})
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC tinyxml2::tinyxml2)
endif()
Find tinyxml2 libraries and use imported targets:
.. code-block:: cmake
find_package(tinyxml2 0.5.0 REQUIRED COMPONENTS tinyxml2)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC tinyxml2::tinyxml2)
Find tinyxml2 headers and some *static* (release only) libraries:
.. code-block:: cmake
set(tinyxml2_USE_DEBUG_LIBS OFF) # ignore debug libs and
set(tinyxml2_USE_RELEASE_LIBS ON) # only find release libs
find_package(tinyxml2 0.5.0 COMPONENTS tinyxml2)
if(tinyxml2_FOUND)
add_executable(foo foo.cc)
target_link_libraries(foo PUBLIC tinyxml2::tinyxml2)
endif()
.. _`tinyxml2 CMake`:
tinyxml2 CMake
^^^^^^^^^^^
If tinyxml2 was built using CMake, it provides a package configuration file for use with find_package's config mode.
This module looks for the package configuration file called ``tinyxml2Config.cmake`` and stores the result in ``CACHE``
entry ``tinyxml2_DIR``. If found, the package configuration file is loaded and this module returns with no further action.
See documentation of the tinyxml2 CMake package configuration for details on what it provides.
Set ``tinyxml2_NO_CMAKE`` to ``ON``, to disable the search for the package using the CONFIG method.
.. _`tinyxml2 pkg-config`:
tinyxml2 CMake
^^^^^^^^^^^
If tinyxml2 was installed with its pkg-config files, this module may attempt to look for tinyxml2 by relying on pkg-config.
If the components are found using this method, this module returns with no further action.
Set ``tinyxml2_NO_PKGCONFIG`` to ``ON``, to disable the search for the package using the pkg-config method.
#]=======================================================================]
include(_find_utils_begin)
set(_pkg tinyxml2)
set(${_pkg}_INCLUDE_FILE tinyxml2.h)
set(${_pkg}_INCLUDE_PATH_SUFFIXES include include/${_pkg} ${_pkg})
set(${_pkg}_DEFAULT_COMPONENTS tinyxml2)
set(${_pkg}_tinyxml2_NAMES tinyxml2)
function(tinyxml2_update_library_search_dirs_with_prebuilt_paths componentlibvar basedir)
if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
list(APPEND ${componentlibvar} ${basedir}/Relase)
list(APPEND ${componentlibvar} ${basedir}/MinSizeRel)
list(APPEND ${componentlibvar} ${basedir}/RelWithDebInfo)
list(APPEND ${componentlibvar} ${basedir}/Debug)
elseif(UNIX)
list(APPEND ${componentlibvar} ${basedir}/lib64)
list(APPEND ${componentlibvar} ${basedir}/lib)
list(APPEND ${componentlibvar} ${basedir}/lib/x86_64-linux-gnu)
endif()
set(${componentlibvar}
${${componentlibvar}}
PARENT_SCOPE)
endfunction()
include(_find_utils_end)
# ==============================================================================

View File

@ -0,0 +1,34 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
set(_find_utils_vars _pkg)
# ==============================================================================
# find_utils_push()
if(NOT DEFINED _find_utils_push_counter)
set(_find_utils_push_counter 0)
endif()
math(EXPR _find_utils_push_counter "${_find_utils_push_counter}+1")
foreach(_var ${_find_utils_vars})
set(_${_var}_${_find_utils_push_counter} ${${_var}})
endforeach()
# ==============================================================================

View File

@ -1,23 +1,29 @@
# Copyright 2022 Huawei Technologies Co., Ltd
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
"""
Introduction to dataset/engine/obs:
dataset/engine/obs provides the implement of OBSMindDataset.
"""
include(FindTemplate)
from .obs_mindrecord_dataset import MindRecordFromOBS, sync_wait_for_dataset
# ==============================================================================
# find_utils_pop()
__all__ = ["MindRecordFromOBS", "sync_wait_for_dataset"]
if("${_find_utils_push_counter}" GREATER "0")
foreach(_var ${_find_utils_vars})
set(${_var} ${_${_var}_${_find_utils_push_counter}})
endforeach()
math(EXPR _find_utils_push_counter "${_find_utils_push_counter}-1")
endif()

View File

@ -0,0 +1,514 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
# Set names of each component of abseil-cpp
foreach(
comp
algorithm
algorithm_container
any
atomic_hook
bad_any_cast
bad_any_cast_impl
bad_optional_access
bad_variant_access
base
base_internal
bind_front
bits
btree
city
civil_time
compare
compressed_tuple
config
container
container_common
container_memory
cord
core_headers
counting_allocator
debugging
debugging_internal
demangle_internal
dynamic_annotations
endian
errno_saver
examine_stack
exponential_biased
failure_signal_handler
fast_type_id
fixed_array
flags
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_internal
flags_marshalling
flags_parse
flags_path_util
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
flags_usage_internal
flat_hash_map
flat_hash_set
function_ref
graphcycles_internal
hash
hash_function_defaults
hash_policy_traits
hashtable_debug
hashtable_debug_hooks
hashtablez_sampler
have_sse
inlined_vector
inlined_vector_internal
int128
kernel_timeout_internal
layout
leak_check
leak_check_disable
log_severity
malloc_internal
memory
meta
node_hash_map
node_hash_policy
node_hash_set
numeric
optional
periodic_sampler
pretty_function
random_bit_gen_ref
random_distributions
random_internal_distribution_caller
random_internal_distribution_test_util
random_internal_fast_uniform_bits
random_internal_fastmath
random_internal_generate_real
random_internal_iostream_state_saver
random_internal_mock_helpers
random_internal_nonsecure_base
random_internal_pcg_engine
random_internal_platform
random_internal_pool_urbg
random_internal_randen
random_internal_randen_engine
random_internal_randen_hwaes
random_internal_randen_hwaes_impl
random_internal_randen_slow
random_internal_salted_seed_seq
random_internal_seed_material
random_internal_traits
random_internal_uniform_helper
random_internal_wide_multiply
random_random
random_seed_gen_exception
random_seed_sequences
raw_hash_map
raw_hash_set
raw_logging_internal
scoped_set_env
span
spinlock_wait
stacktrace
status
statusor
str_format
str_format_internal
strerror
strings
strings_internal
symbolize
synchronization
throw_delegate
time
time_zone
type_traits
utility
variant)
set(${_pkg}_${comp}_NAMES absl_${comp})
endforeach()
set(${_pkg}_algorithm_DEPENDENCIES config)
set(${_pkg}_algorithm_container_DEPENDENCIES algorithm core_headers meta)
set(${_pkg}_any_DEPENDENCIES bad_any_cast config core_headers fast_type_id type_traits utility)
set(${_pkg}_atomic_hook_DEPENDENCIES config core_headers)
set(${_pkg}_bad_any_cast_DEPENDENCIES bad_any_cast_impl config)
set(${_pkg}_bad_any_cast_impl_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_bad_optional_access_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_bad_variant_access_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_base_DEPENDENCIES
atomic_hook
base_internal
config
core_headers
dynamic_annotations
log_severity
raw_logging_internal
spinlock_wait
type_traits)
set(${_pkg}_base_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_base_internal_DEPENDENCIES config type_traits)
set(${_pkg}_bind_front_DEPENDENCIES base_internal compressed_tuple)
set(${_pkg}_bits_DEPENDENCIES config core_headers)
set(${_pkg}_btree_DEPENDENCIES
container_common
compare
compressed_tuple
container_memory
cord
core_headers
layout
memory
strings
throw_delegate
type_traits
utility)
set(${_pkg}_city_DEPENDENCIES config core_headers endian)
set(${_pkg}_compare_DEPENDENCIES core_headers type_traits)
set(${_pkg}_compressed_tuple_DEPENDENCIES utility)
set(${_pkg}_container_common_DEPENDENCIES type_traits)
set(${_pkg}_container_memory_DEPENDENCIES config memory type_traits utility)
set(${_pkg}_cord_DEPENDENCIES
base
base_internal
compressed_tuple
core_headers
endian
fixed_array
function_ref
inlined_vector
optional
raw_logging_internal
strings
strings_internal
type_traits)
set(${_pkg}_core_headers_DEPENDENCIES config)
set(${_pkg}_counting_allocator_DEPENDENCIES config)
set(${_pkg}_debugging_DEPENDENCIES stacktrace leak_check)
set(${_pkg}_debugging_internal_DEPENDENCIES core_headers config dynamic_annotations errno_saver raw_logging_internal)
set(${_pkg}_demangle_internal_DEPENDENCIES base core_headers)
set(${_pkg}_dynamic_annotations_DEPENDENCIES config)
set(${_pkg}_endian_DEPENDENCIES config core_headers)
set(${_pkg}_errno_saver_DEPENDENCIES config)
set(${_pkg}_examine_stack_DEPENDENCIES stacktrace symbolize config core_headers raw_logging_internal)
set(${_pkg}_exponential_biased_DEPENDENCIES config core_headers)
set(${_pkg}_failure_signal_handler_DEPENDENCIES
examine_stack
stacktrace
base
config
core_headers
errno_saver
raw_logging_internal)
set(${_pkg}_fast_type_id_DEPENDENCIES config)
set(${_pkg}_fixed_array_DEPENDENCIES
compressed_tuple
algorithm
config
core_headers
dynamic_annotations
throw_delegate
memory)
set(${_pkg}_flags_DEPENDENCIES
config
flags_commandlineflag
flags_config
flags_internal
flags_reflection
base
core_headers
strings)
set(${_pkg}_flags_commandlineflag_DEPENDENCIES config fast_type_id flags_commandlineflag_internal optional strings)
set(${_pkg}_flags_commandlineflag_internal_DEPENDENCIES config fast_type_id)
set(${_pkg}_flags_config_DEPENDENCIES config flags_path_util flags_program_name core_headers strings synchronization)
set(${_pkg}_flags_internal_DEPENDENCIES
base
config
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_marshalling
synchronization
meta
utility)
set(${_pkg}_flags_marshalling_DEPENDENCIES config core_headers log_severity strings str_format)
set(${_pkg}_flags_parse_DEPENDENCIES
config
core_headers
flags_config
flags
flags_commandlineflag
flags_commandlineflag_internal
flags_internal
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
strings
synchronization)
set(${_pkg}_flags_path_util_DEPENDENCIES config strings)
set(${_pkg}_flags_private_handle_accessor_DEPENDENCIES config flags_commandlineflag flags_commandlineflag_internal
strings)
set(${_pkg}_flags_program_name_DEPENDENCIES config core_headers flags_path_util strings synchronization)
set(${_pkg}_flags_reflection_DEPENDENCIES
config
flags_commandlineflag
flags_private_handle_accessor
flags_config
strings
synchronization
flat_hash_map)
set(${_pkg}_flags_usage_DEPENDENCIES config core_headers flags_usage_internal strings synchronization)
set(${_pkg}_flags_usage_internal_DEPENDENCIES
config
flags_config
flags
flags_commandlineflag
flags_internal
flags_path_util
flags_private_handle_accessor
flags_program_name
flags_reflection
strings
synchronization)
set(${_pkg}_flat_hash_map_DEPENDENCIES container_memory hash_function_defaults raw_hash_map algorithm_container memory)
set(${_pkg}_flat_hash_set_DEPENDENCIES container_memory hash_function_defaults raw_hash_set algorithm_container
core_headers memory)
set(${_pkg}_function_ref_DEPENDENCIES base_internal meta)
set(${_pkg}_graphcycles_internal_DEPENDENCIES base base_internal config core_headers malloc_internal
raw_logging_internal)
set(${_pkg}_hash_DEPENDENCIES
core_headers
endian
fixed_array
meta
int128
strings
optional
variant
utility
city)
set(${_pkg}_hash_function_defaults_DEPENDENCIES config cord hash strings)
set(${_pkg}_hash_policy_traits_DEPENDENCIES meta)
set(${_pkg}_hashtable_debug_DEPENDENCIES hashtable_debug_hooks)
set(${_pkg}_hashtable_debug_hooks_DEPENDENCIES config)
set(${_pkg}_hashtablez_sampler_DEPENDENCIES base exponential_biased have_sse synchronization)
set(${_pkg}_inlined_vector_DEPENDENCIES algorithm core_headers inlined_vector_internal throw_delegate memory)
set(${_pkg}_inlined_vector_internal_DEPENDENCIES compressed_tuple core_headers memory span type_traits)
set(${_pkg}_int128_DEPENDENCIES bits config core_headers)
set(${_pkg}_kernel_timeout_internal_DEPENDENCIES core_headers raw_logging_internal time)
set(${_pkg}_layout_DEPENDENCIES config core_headers meta strings span utility)
set(${_pkg}_leak_check_DEPENDENCIES config core_headers)
set(${_pkg}_log_severity_DEPENDENCIES core_headers)
set(${_pkg}_malloc_internal_DEPENDENCIES base base_internal config core_headers dynamic_annotations
raw_logging_internal)
set(${_pkg}_malloc_internal_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_memory_DEPENDENCIES core_headers meta)
set(${_pkg}_meta_DEPENDENCIES type_traits)
set(${_pkg}_node_hash_map_DEPENDENCIES container_memory hash_function_defaults node_hash_policy raw_hash_map
algorithm_container memory)
set(${_pkg}_node_hash_policy_DEPENDENCIES config)
set(${_pkg}_node_hash_set_DEPENDENCIES hash_function_defaults node_hash_policy raw_hash_set algorithm_container memory)
set(${_pkg}_numeric_DEPENDENCIES int128)
set(${_pkg}_optional_DEPENDENCIES
bad_optional_access
base_internal
config
core_headers
memory
type_traits
utility)
set(${_pkg}_periodic_sampler_DEPENDENCIES core_headers exponential_biased)
set(${_pkg}_random_bit_gen_ref_DEPENDENCIES core_headers random_internal_distribution_caller
random_internal_fast_uniform_bits type_traits)
set(${_pkg}_random_distributions_DEPENDENCIES
base_internal
config
core_headers
random_internal_generate_real
random_internal_distribution_caller
random_internal_fast_uniform_bits
random_internal_fastmath
random_internal_iostream_state_saver
random_internal_traits
random_internal_uniform_helper
random_internal_wide_multiply
strings
type_traits)
set(${_pkg}_random_internal_distribution_caller_DEPENDENCIES config utility fast_type_id)
set(${_pkg}_random_internal_distribution_test_util_DEPENDENCIES config core_headers raw_logging_internal strings
str_format span)
set(${_pkg}_random_internal_fast_uniform_bits_DEPENDENCIES config)
set(${_pkg}_random_internal_fastmath_DEPENDENCIES bits)
set(${_pkg}_random_internal_generate_real_DEPENDENCIES bits random_internal_fastmath random_internal_traits type_traits)
set(${_pkg}_random_internal_iostream_state_saver_DEPENDENCIES int128 type_traits)
set(${_pkg}_random_internal_mock_helpers_DEPENDENCIES fast_type_id optional)
set(${_pkg}_random_internal_nonsecure_base_DEPENDENCIES
core_headers
optional
random_internal_pool_urbg
random_internal_salted_seed_seq
random_internal_seed_material
span
type_traits)
set(${_pkg}_random_internal_pcg_engine_DEPENDENCIES config int128 random_internal_fastmath
random_internal_iostream_state_saver type_traits)
set(${_pkg}_random_internal_platform_DEPENDENCIES config)
set(${_pkg}_random_internal_pool_urbg_DEPENDENCIES
base
config
core_headers
endian
random_internal_randen
random_internal_seed_material
random_internal_traits
random_seed_gen_exception
raw_logging_internal
span)
set(${_pkg}_random_internal_randen_DEPENDENCIES random_internal_platform random_internal_randen_hwaes
random_internal_randen_slow)
set(${_pkg}_random_internal_randen_engine_DEPENDENCIES random_internal_iostream_state_saver random_internal_randen
raw_logging_internal type_traits)
set(${_pkg}_random_internal_randen_hwaes_DEPENDENCIES random_internal_platform random_internal_randen_hwaes_impl config)
set(${_pkg}_random_internal_randen_hwaes_impl_DEPENDENCIES random_internal_platform config)
set(${_pkg}_random_internal_randen_slow_DEPENDENCIES random_internal_platform config)
set(${_pkg}_random_internal_salted_seed_seq_DEPENDENCIES inlined_vector optional span random_internal_seed_material
type_traits)
set(${_pkg}_random_internal_seed_material_DEPENDENCIES core_headers optional random_internal_fast_uniform_bits
raw_logging_internal span strings)
set(${_pkg}_random_internal_traits_DEPENDENCIES config)
set(${_pkg}_random_internal_uniform_helper_DEPENDENCIES config random_internal_traits type_traits)
set(${_pkg}_random_internal_wide_multiply_DEPENDENCIES bits config int128)
set(${_pkg}_random_random_DEPENDENCIES random_distributions random_internal_nonsecure_base random_internal_pcg_engine
random_internal_pool_urbg random_internal_randen_engine random_seed_sequences)
set(${_pkg}_random_seed_gen_exception_DEPENDENCIES config)
set(${_pkg}_random_seed_sequences_DEPENDENCIES
inlined_vector
random_internal_nonsecure_base
random_internal_pool_urbg
random_internal_salted_seed_seq
random_internal_seed_material
random_seed_gen_exception
span)
set(${_pkg}_raw_hash_map_DEPENDENCIES container_memory raw_hash_set throw_delegate)
set(${_pkg}_raw_hash_set_DEPENDENCIES
bits
compressed_tuple
config
container_common
container_memory
core_headers
endian
hash_policy_traits
hashtable_debug_hooks
have_sse
layout
memory
meta
optional
utility
hashtablez_sampler)
set(${_pkg}_raw_logging_internal_DEPENDENCIES atomic_hook config core_headers log_severity)
set(${_pkg}_scoped_set_env_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_span_DEPENDENCIES algorithm core_headers throw_delegate type_traits)
set(${_pkg}_spinlock_wait_DEPENDENCIES base_internal core_headers errno_saver)
set(${_pkg}_stacktrace_DEPENDENCIES debugging_internal config core_headers)
set(${_pkg}_status_DEPENDENCIES
atomic_hook
config
core_headers
raw_logging_internal
inlined_vector
stacktrace
symbolize
strings
cord
str_format
optional)
set(${_pkg}_statusor_DEPENDENCIES
status
core_headers
raw_logging_internal
type_traits
strings
utility
variant)
set(${_pkg}_str_format_DEPENDENCIES str_format_internal)
set(${_pkg}_str_format_internal_DEPENDENCIES
bits
strings
config
core_headers
type_traits
int128
span)
set(${_pkg}_strerror_DEPENDENCIES config core_headers errno_saver)
set(${_pkg}_strings_DEPENDENCIES
strings_internal
base
bits
config
core_headers
endian
int128
memory
raw_logging_internal
throw_delegate
type_traits)
set(${_pkg}_strings_internal_DEPENDENCIES config core_headers endian raw_logging_internal type_traits)
set(${_pkg}_symbolize_DEPENDENCIES
debugging_internal
demangle_internal
base
config
core_headers
dynamic_annotations
malloc_internal
raw_logging_internal
strings)
set(${_pkg}_synchronization_DEPENDENCIES
graphcycles_internal
kernel_timeout_internal
atomic_hook
base
base_internal
config
core_headers
dynamic_annotations
malloc_internal
raw_logging_internal
stacktrace
symbolize
time)
set(${_pkg}_synchronization_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_throw_delegate_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_time_DEPENDENCIES
base
civil_time
core_headers
int128
raw_logging_internal
strings
time_zone)
set(${_pkg}_type_traits_DEPENDENCIES config)
set(${_pkg}_utility_DEPENDENCIES base_internal config type_traits)
set(${_pkg}_variant_DEPENDENCIES bad_variant_access base_internal config core_headers type_traits utility)

View File

@ -0,0 +1,527 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
# Set names of each component of abseil-cpp
foreach(
comp
algorithm
algorithm_container
any
atomic_hook
bad_any_cast
bad_any_cast_impl
bad_optional_access
bad_variant_access
base
base_internal
bind_front
bits
btree
city
civil_time
cleanup
cleanup_internal
compare
compressed_tuple
config
container_common
container_memory
cord
core_headers
counting_allocator
debugging
debugging_internal
demangle_internal
dynamic_annotations
endian
errno_saver
examine_stack
exponential_biased
failure_signal_handler
fast_type_id
fixed_array
flags
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_internal
flags_marshalling
flags_parse
flags_path_util
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
flags_usage_internal
flat_hash_map
flat_hash_set
function_ref
graphcycles_internal
hash
hash_function_defaults
hash_policy_traits
hashtable_debug
hashtable_debug_hooks
hashtablez_sampler
have_sse
inlined_vector
inlined_vector_internal
int128
kernel_timeout_internal
layout
leak_check
leak_check_disable
log_severity
malloc_internal
memory
meta
node_hash_map
node_hash_policy
node_hash_set
numeric
numeric_representation
optional
periodic_sampler
pretty_function
random_bit_gen_ref
random_distributions
random_internal_distribution_caller
random_internal_distribution_test_util
random_internal_fast_uniform_bits
random_internal_fastmath
random_internal_generate_real
random_internal_iostream_state_saver
random_internal_mock_helpers
random_internal_nonsecure_base
random_internal_pcg_engine
random_internal_platform
random_internal_pool_urbg
random_internal_randen
random_internal_randen_engine
random_internal_randen_hwaes
random_internal_randen_hwaes_impl
random_internal_randen_slow
random_internal_salted_seed_seq
random_internal_seed_material
random_internal_traits
random_internal_uniform_helper
random_internal_wide_multiply
random_random
random_seed_gen_exception
random_seed_sequences
raw_hash_map
raw_hash_set
raw_logging_internal
scoped_set_env
span
spinlock_wait
stacktrace
status
statusor
str_format
str_format_internal
strerror
strings
strings_internal
symbolize
synchronization
throw_delegate
time
time_zone
type_traits
utility
variant
wyhash)
set(${_pkg}_${comp}_NAMES absl_${comp})
endforeach()
set(${_pkg}_algorithm_DEPENDENCIES config)
set(${_pkg}_algorithm_container_DEPENDENCIES algorithm core_headers meta)
set(${_pkg}_any_DEPENDENCIES bad_any_cast config core_headers fast_type_id type_traits utility)
set(${_pkg}_atomic_hook_DEPENDENCIES config core_headers)
set(${_pkg}_bad_any_cast_DEPENDENCIES bad_any_cast_impl config)
set(${_pkg}_bad_any_cast_impl_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_bad_optional_access_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_bad_variant_access_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_base_DEPENDENCIES
atomic_hook
base_internal
config
core_headers
dynamic_annotations
log_severity
raw_logging_internal
spinlock_wait
type_traits)
set(${_pkg}_base_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_base_internal_DEPENDENCIES config type_traits)
set(${_pkg}_bind_front_DEPENDENCIES base_internal compressed_tuple)
set(${_pkg}_bits_DEPENDENCIES core_headers)
set(${_pkg}_btree_DEPENDENCIES
container_common
compare
compressed_tuple
container_memory
cord
core_headers
layout
memory
strings
throw_delegate
type_traits
utility)
set(${_pkg}_city_DEPENDENCIES config core_headers endian)
set(${_pkg}_cleanup_DEPENDENCIES cleanup_internal config core_headers)
set(${_pkg}_cleanup_internal_DEPENDENCIES base_internal core_headers utility)
set(${_pkg}_compare_DEPENDENCIES core_headers type_traits)
set(${_pkg}_compressed_tuple_DEPENDENCIES utility)
set(${_pkg}_container_common_DEPENDENCIES type_traits)
set(${_pkg}_container_memory_DEPENDENCIES config memory type_traits utility)
set(${_pkg}_cord_DEPENDENCIES
base
base_internal
compressed_tuple
config
core_headers
endian
fixed_array
function_ref
inlined_vector
optional
raw_logging_internal
strings
strings_internal
throw_delegate
type_traits)
set(${_pkg}_core_headers_DEPENDENCIES config)
set(${_pkg}_counting_allocator_DEPENDENCIES config)
set(${_pkg}_debugging_DEPENDENCIES stacktrace leak_check)
set(${_pkg}_debugging_internal_DEPENDENCIES core_headers config dynamic_annotations errno_saver raw_logging_internal)
set(${_pkg}_demangle_internal_DEPENDENCIES base core_headers)
set(${_pkg}_dynamic_annotations_DEPENDENCIES config)
set(${_pkg}_endian_DEPENDENCIES base config core_headers)
set(${_pkg}_errno_saver_DEPENDENCIES config)
set(${_pkg}_examine_stack_DEPENDENCIES stacktrace symbolize config core_headers raw_logging_internal)
set(${_pkg}_exponential_biased_DEPENDENCIES config core_headers)
set(${_pkg}_failure_signal_handler_DEPENDENCIES
examine_stack
stacktrace
base
config
core_headers
errno_saver
raw_logging_internal)
set(${_pkg}_fast_type_id_DEPENDENCIES config)
set(${_pkg}_fixed_array_DEPENDENCIES
compressed_tuple
algorithm
config
core_headers
dynamic_annotations
throw_delegate
memory)
set(${_pkg}_flags_DEPENDENCIES
config
flags_commandlineflag
flags_config
flags_internal
flags_reflection
base
core_headers
strings)
set(${_pkg}_flags_commandlineflag_DEPENDENCIES config fast_type_id flags_commandlineflag_internal optional strings)
set(${_pkg}_flags_commandlineflag_internal_DEPENDENCIES config fast_type_id)
set(${_pkg}_flags_config_DEPENDENCIES config flags_path_util flags_program_name core_headers strings synchronization)
set(${_pkg}_flags_internal_DEPENDENCIES
base
config
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_marshalling
synchronization
meta
utility)
set(${_pkg}_flags_marshalling_DEPENDENCIES config core_headers log_severity strings str_format)
set(${_pkg}_flags_parse_DEPENDENCIES
config
core_headers
flags_config
flags
flags_commandlineflag
flags_commandlineflag_internal
flags_internal
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
strings
synchronization)
set(${_pkg}_flags_path_util_DEPENDENCIES config strings)
set(${_pkg}_flags_private_handle_accessor_DEPENDENCIES config flags_commandlineflag flags_commandlineflag_internal
strings)
set(${_pkg}_flags_program_name_DEPENDENCIES config core_headers flags_path_util strings synchronization)
set(${_pkg}_flags_reflection_DEPENDENCIES
config
flags_commandlineflag
flags_private_handle_accessor
flags_config
strings
synchronization
flat_hash_map)
set(${_pkg}_flags_usage_DEPENDENCIES config core_headers flags_usage_internal strings synchronization)
set(${_pkg}_flags_usage_internal_DEPENDENCIES
config
flags_config
flags
flags_commandlineflag
flags_internal
flags_path_util
flags_private_handle_accessor
flags_program_name
flags_reflection
strings
synchronization)
set(${_pkg}_flat_hash_map_DEPENDENCIES container_memory hash_function_defaults raw_hash_map algorithm_container memory)
set(${_pkg}_flat_hash_set_DEPENDENCIES container_memory hash_function_defaults raw_hash_set algorithm_container
core_headers memory)
set(${_pkg}_function_ref_DEPENDENCIES base_internal meta)
set(${_pkg}_graphcycles_internal_DEPENDENCIES base base_internal config core_headers malloc_internal
raw_logging_internal)
set(${_pkg}_hash_DEPENDENCIES
city
config
core_headers
endian
fixed_array
meta
int128
strings
optional
variant
utility
wyhash)
set(${_pkg}_hash_function_defaults_DEPENDENCIES config cord hash strings)
set(${_pkg}_hash_policy_traits_DEPENDENCIES meta)
set(${_pkg}_hashtable_debug_DEPENDENCIES hashtable_debug_hooks)
set(${_pkg}_hashtable_debug_hooks_DEPENDENCIES config)
set(${_pkg}_hashtablez_sampler_DEPENDENCIES base exponential_biased have_sse synchronization)
set(${_pkg}_inlined_vector_DEPENDENCIES algorithm core_headers inlined_vector_internal throw_delegate memory)
set(${_pkg}_inlined_vector_internal_DEPENDENCIES compressed_tuple core_headers memory span type_traits)
set(${_pkg}_int128_DEPENDENCIES config core_headers bits)
set(${_pkg}_kernel_timeout_internal_DEPENDENCIES core_headers raw_logging_internal time)
set(${_pkg}_layout_DEPENDENCIES config core_headers meta strings span utility)
set(${_pkg}_leak_check_DEPENDENCIES config core_headers)
set(${_pkg}_log_severity_DEPENDENCIES core_headers)
set(${_pkg}_malloc_internal_DEPENDENCIES base base_internal config core_headers dynamic_annotations
raw_logging_internal)
set(${_pkg}_malloc_internal_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_memory_DEPENDENCIES core_headers meta)
set(${_pkg}_meta_DEPENDENCIES type_traits)
set(${_pkg}_node_hash_map_DEPENDENCIES container_memory hash_function_defaults node_hash_policy raw_hash_map
algorithm_container memory)
set(${_pkg}_node_hash_policy_DEPENDENCIES config)
set(${_pkg}_node_hash_set_DEPENDENCIES hash_function_defaults node_hash_policy raw_hash_set algorithm_container memory)
set(${_pkg}_numeric_DEPENDENCIES int128)
set(${_pkg}_numeric_representation_DEPENDENCIES config)
set(${_pkg}_optional_DEPENDENCIES
bad_optional_access
base_internal
config
core_headers
memory
type_traits
utility)
set(${_pkg}_periodic_sampler_DEPENDENCIES core_headers exponential_biased)
set(${_pkg}_random_bit_gen_ref_DEPENDENCIES core_headers random_internal_distribution_caller
random_internal_fast_uniform_bits type_traits)
set(${_pkg}_random_distributions_DEPENDENCIES
base_internal
config
core_headers
random_internal_generate_real
random_internal_distribution_caller
random_internal_fast_uniform_bits
random_internal_fastmath
random_internal_iostream_state_saver
random_internal_traits
random_internal_uniform_helper
random_internal_wide_multiply
strings
type_traits)
set(${_pkg}_random_internal_distribution_caller_DEPENDENCIES config utility fast_type_id)
set(${_pkg}_random_internal_distribution_test_util_DEPENDENCIES config core_headers raw_logging_internal strings
str_format span)
set(${_pkg}_random_internal_fast_uniform_bits_DEPENDENCIES config)
set(${_pkg}_random_internal_fastmath_DEPENDENCIES bits)
set(${_pkg}_random_internal_generate_real_DEPENDENCIES bits random_internal_fastmath random_internal_traits type_traits)
set(${_pkg}_random_internal_iostream_state_saver_DEPENDENCIES int128 type_traits)
set(${_pkg}_random_internal_mock_helpers_DEPENDENCIES fast_type_id optional)
set(${_pkg}_random_internal_nonsecure_base_DEPENDENCIES
core_headers
optional
random_internal_pool_urbg
random_internal_salted_seed_seq
random_internal_seed_material
span
type_traits)
set(${_pkg}_random_internal_pcg_engine_DEPENDENCIES config int128 random_internal_fastmath
random_internal_iostream_state_saver type_traits)
set(${_pkg}_random_internal_platform_DEPENDENCIES config)
set(${_pkg}_random_internal_pool_urbg_DEPENDENCIES
base
config
core_headers
endian
random_internal_randen
random_internal_seed_material
random_internal_traits
random_seed_gen_exception
raw_logging_internal
span)
set(${_pkg}_random_internal_randen_DEPENDENCIES random_internal_platform random_internal_randen_hwaes
random_internal_randen_slow)
set(${_pkg}_random_internal_randen_engine_DEPENDENCIES endian random_internal_iostream_state_saver
random_internal_randen raw_logging_internal type_traits)
set(${_pkg}_random_internal_randen_hwaes_DEPENDENCIES random_internal_platform random_internal_randen_hwaes_impl config)
set(${_pkg}_random_internal_randen_hwaes_impl_DEPENDENCIES random_internal_platform config)
set(${_pkg}_random_internal_randen_slow_DEPENDENCIES random_internal_platform config)
set(${_pkg}_random_internal_salted_seed_seq_DEPENDENCIES inlined_vector optional span random_internal_seed_material
type_traits)
set(${_pkg}_random_internal_seed_material_DEPENDENCIES core_headers optional random_internal_fast_uniform_bits
raw_logging_internal span strings)
set(${_pkg}_random_internal_traits_DEPENDENCIES config)
set(${_pkg}_random_internal_uniform_helper_DEPENDENCIES config random_internal_traits type_traits)
set(${_pkg}_random_internal_wide_multiply_DEPENDENCIES bits config int128)
set(${_pkg}_random_random_DEPENDENCIES random_distributions random_internal_nonsecure_base random_internal_pcg_engine
random_internal_pool_urbg random_internal_randen_engine random_seed_sequences)
set(${_pkg}_random_seed_gen_exception_DEPENDENCIES config)
set(${_pkg}_random_seed_sequences_DEPENDENCIES
inlined_vector
random_internal_nonsecure_base
random_internal_pool_urbg
random_internal_salted_seed_seq
random_internal_seed_material
random_seed_gen_exception
span)
set(${_pkg}_raw_hash_map_DEPENDENCIES container_memory raw_hash_set throw_delegate)
set(${_pkg}_raw_hash_set_DEPENDENCIES
bits
compressed_tuple
config
container_common
container_memory
core_headers
endian
hash_policy_traits
hashtable_debug_hooks
have_sse
layout
memory
meta
optional
utility
hashtablez_sampler)
set(${_pkg}_raw_logging_internal_DEPENDENCIES atomic_hook config core_headers log_severity)
set(${_pkg}_scoped_set_env_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_span_DEPENDENCIES algorithm core_headers throw_delegate type_traits)
set(${_pkg}_spinlock_wait_DEPENDENCIES base_internal core_headers errno_saver)
set(${_pkg}_stacktrace_DEPENDENCIES debugging_internal config core_headers)
set(${_pkg}_status_DEPENDENCIES
atomic_hook
config
core_headers
raw_logging_internal
inlined_vector
stacktrace
symbolize
strings
cord
str_format
optional)
set(${_pkg}_statusor_DEPENDENCIES
status
core_headers
raw_logging_internal
type_traits
strings
utility
variant)
set(${_pkg}_str_format_DEPENDENCIES str_format_internal)
set(${_pkg}_str_format_internal_DEPENDENCIES
bits
strings
config
core_headers
numeric_representation
type_traits
int128
span)
set(${_pkg}_strerror_DEPENDENCIES config core_headers errno_saver)
set(${_pkg}_strings_DEPENDENCIES
strings_internal
base
bits
config
core_headers
endian
int128
memory
raw_logging_internal
throw_delegate
type_traits)
set(${_pkg}_strings_internal_DEPENDENCIES config core_headers endian raw_logging_internal type_traits)
set(${_pkg}_symbolize_DEPENDENCIES
debugging_internal
demangle_internal
base
config
core_headers
dynamic_annotations
malloc_internal
raw_logging_internal
strings)
set(${_pkg}_synchronization_DEPENDENCIES
graphcycles_internal
kernel_timeout_internal
atomic_hook
base
base_internal
config
core_headers
dynamic_annotations
malloc_internal
raw_logging_internal
stacktrace
symbolize
time)
set(${_pkg}_synchronization_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_throw_delegate_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_time_DEPENDENCIES
base
civil_time
core_headers
int128
raw_logging_internal
strings
time_zone)
set(${_pkg}_time_zone_DEPENDENCIES $<$<PLATFORM_ID:Darwin>:>)
set(${_pkg}_type_traits_DEPENDENCIES config)
set(${_pkg}_utility_DEPENDENCIES base_internal config type_traits)
set(${_pkg}_variant_DEPENDENCIES bad_variant_access base_internal config core_headers type_traits utility)
set(${_pkg}_wyhash_DEPENDENCIES config endian int128)

View File

@ -0,0 +1,571 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
# Set names of each component of abseil-cpp
foreach(
comp
algorithm
algorithm_container
any
atomic_hook
bad_any_cast
bad_any_cast_impl
bad_optional_access
bad_variant_access
base
base_internal
bind_front
bits
btree
city
civil_time
cleanup
cleanup_internal
compare
compressed_tuple
config
container_common
container_memory
cord
cord_internal
cordz_functions
cordz_handle
cordz_info
cordz_sample_token
cordz_statistics
cordz_update_scope
cordz_update_tracker
core_headers
counting_allocator
debugging
debugging_internal
demangle_internal
dynamic_annotations
endian
errno_saver
examine_stack
exponential_biased
failure_signal_handler
fast_type_id
fixed_array
flags
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_internal
flags_marshalling
flags_parse
flags_path_util
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
flags_usage_internal
flat_hash_map
flat_hash_set
function_ref
graphcycles_internal
hash
hash_function_defaults
hash_policy_traits
hashtable_debug
hashtable_debug_hooks
hashtablez_sampler
have_sse
inlined_vector
inlined_vector_internal
int128
kernel_timeout_internal
layout
leak_check
leak_check_disable
log_severity
low_level_hash
malloc_internal
memory
meta
node_hash_map
node_hash_policy
node_hash_set
numeric
numeric_representation
optional
periodic_sampler
pretty_function
random_bit_gen_ref
random_distributions
random_internal_distribution_caller
random_internal_distribution_test_util
random_internal_fast_uniform_bits
random_internal_fastmath
random_internal_generate_real
random_internal_iostream_state_saver
random_internal_mock_helpers
random_internal_nonsecure_base
random_internal_pcg_engine
random_internal_platform
random_internal_pool_urbg
random_internal_randen
random_internal_randen_engine
random_internal_randen_hwaes
random_internal_randen_hwaes_impl
random_internal_randen_slow
random_internal_salted_seed_seq
random_internal_seed_material
random_internal_traits
random_internal_uniform_helper
random_internal_wide_multiply
random_random
random_seed_gen_exception
random_seed_sequences
raw_hash_map
raw_hash_set
raw_logging_internal
sample_recorder
scoped_set_env
span
spinlock_wait
stacktrace
status
statusor
str_format
str_format_internal
strerror
strings
strings_internal
symbolize
synchronization
throw_delegate
time
time_zone
type_traits
utility
variant)
set(${_pkg}_${comp}_NAMES absl_${comp})
endforeach()
set(${_pkg}_algorithm_DEPENDENCIES config)
set(${_pkg}_algorithm_container_DEPENDENCIES algorithm core_headers meta)
set(${_pkg}_any_DEPENDENCIES bad_any_cast config core_headers fast_type_id type_traits utility)
set(${_pkg}_atomic_hook_DEPENDENCIES config core_headers)
set(${_pkg}_bad_any_cast_DEPENDENCIES bad_any_cast_impl config)
set(${_pkg}_bad_any_cast_impl_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_bad_optional_access_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_bad_variant_access_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_base_DEPENDENCIES
atomic_hook
base_internal
config
core_headers
dynamic_annotations
log_severity
raw_logging_internal
spinlock_wait
type_traits)
set(${_pkg}_base_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_base_internal_DEPENDENCIES config type_traits)
set(${_pkg}_bind_front_DEPENDENCIES base_internal compressed_tuple)
set(${_pkg}_bits_DEPENDENCIES core_headers)
set(${_pkg}_btree_DEPENDENCIES
container_common
compare
compressed_tuple
container_memory
cord
core_headers
layout
memory
strings
throw_delegate
type_traits
utility)
set(${_pkg}_city_DEPENDENCIES config core_headers endian)
set(${_pkg}_cleanup_DEPENDENCIES cleanup_internal config core_headers)
set(${_pkg}_cleanup_internal_DEPENDENCIES base_internal core_headers utility)
set(${_pkg}_compare_DEPENDENCIES core_headers type_traits)
set(${_pkg}_compressed_tuple_DEPENDENCIES utility)
set(${_pkg}_container_common_DEPENDENCIES type_traits)
set(${_pkg}_container_memory_DEPENDENCIES config memory type_traits utility)
set(${_pkg}_cord_DEPENDENCIES
base
config
cord_internal
cordz_functions
cordz_info
cordz_update_scope
cordz_update_tracker
core_headers
endian
fixed_array
function_ref
inlined_vector
optional
raw_logging_internal
strings
type_traits)
set(${_pkg}_cord_internal_DEPENDENCIES
base_internal
compressed_tuple
config
core_headers
endian
inlined_vector
layout
raw_logging_internal
strings
throw_delegate
type_traits)
set(${_pkg}_cordz_functions_DEPENDENCIES config core_headers exponential_biased raw_logging_internal)
set(${_pkg}_cordz_handle_DEPENDENCIES base config raw_logging_internal synchronization)
set(${_pkg}_cordz_info_DEPENDENCIES
base
config
cord_internal
cordz_functions
cordz_handle
cordz_statistics
cordz_update_tracker
core_headers
inlined_vector
span
raw_logging_internal
stacktrace
synchronization)
set(${_pkg}_cordz_sample_token_DEPENDENCIES config cordz_handle cordz_info)
set(${_pkg}_cordz_statistics_DEPENDENCIES config core_headers cordz_update_tracker synchronization)
set(${_pkg}_cordz_update_scope_DEPENDENCIES config cord_internal cordz_info cordz_update_tracker core_headers)
set(${_pkg}_cordz_update_tracker_DEPENDENCIES config)
set(${_pkg}_core_headers_DEPENDENCIES config)
set(${_pkg}_counting_allocator_DEPENDENCIES config)
set(${_pkg}_debugging_DEPENDENCIES stacktrace leak_check)
set(${_pkg}_debugging_internal_DEPENDENCIES core_headers config dynamic_annotations errno_saver raw_logging_internal)
set(${_pkg}_demangle_internal_DEPENDENCIES base core_headers)
set(${_pkg}_dynamic_annotations_DEPENDENCIES config)
set(${_pkg}_endian_DEPENDENCIES base config core_headers)
set(${_pkg}_errno_saver_DEPENDENCIES config)
set(${_pkg}_examine_stack_DEPENDENCIES stacktrace symbolize config core_headers raw_logging_internal)
set(${_pkg}_exponential_biased_DEPENDENCIES config core_headers)
set(${_pkg}_failure_signal_handler_DEPENDENCIES
examine_stack
stacktrace
base
config
core_headers
errno_saver
raw_logging_internal)
set(${_pkg}_fast_type_id_DEPENDENCIES config)
set(${_pkg}_fixed_array_DEPENDENCIES
compressed_tuple
algorithm
config
core_headers
dynamic_annotations
throw_delegate
memory)
set(${_pkg}_flags_DEPENDENCIES
config
flags_commandlineflag
flags_config
flags_internal
flags_reflection
base
core_headers
strings)
set(${_pkg}_flags_commandlineflag_DEPENDENCIES config fast_type_id flags_commandlineflag_internal optional strings)
set(${_pkg}_flags_commandlineflag_internal_DEPENDENCIES config fast_type_id)
set(${_pkg}_flags_config_DEPENDENCIES config flags_path_util flags_program_name core_headers strings synchronization)
set(${_pkg}_flags_internal_DEPENDENCIES
base
config
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_marshalling
synchronization
meta
utility)
set(${_pkg}_flags_marshalling_DEPENDENCIES config core_headers log_severity strings str_format)
set(${_pkg}_flags_parse_DEPENDENCIES
config
core_headers
flags_config
flags
flags_commandlineflag
flags_commandlineflag_internal
flags_internal
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
strings
synchronization)
set(${_pkg}_flags_path_util_DEPENDENCIES config strings)
set(${_pkg}_flags_private_handle_accessor_DEPENDENCIES config flags_commandlineflag flags_commandlineflag_internal
strings)
set(${_pkg}_flags_program_name_DEPENDENCIES config core_headers flags_path_util strings synchronization)
set(${_pkg}_flags_reflection_DEPENDENCIES
config
flags_commandlineflag
flags_private_handle_accessor
flags_config
strings
synchronization
flat_hash_map)
set(${_pkg}_flags_usage_DEPENDENCIES config core_headers flags_usage_internal strings synchronization)
set(${_pkg}_flags_usage_internal_DEPENDENCIES
config
flags_config
flags
flags_commandlineflag
flags_internal
flags_path_util
flags_private_handle_accessor
flags_program_name
flags_reflection
flat_hash_map
strings
synchronization)
set(${_pkg}_flat_hash_map_DEPENDENCIES container_memory hash_function_defaults raw_hash_map algorithm_container memory)
set(${_pkg}_flat_hash_set_DEPENDENCIES container_memory hash_function_defaults raw_hash_set algorithm_container
core_headers memory)
set(${_pkg}_function_ref_DEPENDENCIES base_internal core_headers meta)
set(${_pkg}_graphcycles_internal_DEPENDENCIES base base_internal config core_headers malloc_internal
raw_logging_internal)
set(${_pkg}_hash_DEPENDENCIES
city
config
core_headers
endian
fixed_array
meta
int128
strings
optional
variant
utility
low_level_hash)
set(${_pkg}_hash_function_defaults_DEPENDENCIES config cord hash strings)
set(${_pkg}_hash_policy_traits_DEPENDENCIES meta)
set(${_pkg}_hashtable_debug_DEPENDENCIES hashtable_debug_hooks)
set(${_pkg}_hashtable_debug_hooks_DEPENDENCIES config)
set(${_pkg}_hashtablez_sampler_DEPENDENCIES base exponential_biased have_sse sample_recorder synchronization)
set(${_pkg}_inlined_vector_DEPENDENCIES algorithm core_headers inlined_vector_internal throw_delegate memory)
set(${_pkg}_inlined_vector_internal_DEPENDENCIES compressed_tuple core_headers memory span type_traits)
set(${_pkg}_int128_DEPENDENCIES config core_headers bits)
set(${_pkg}_kernel_timeout_internal_DEPENDENCIES core_headers raw_logging_internal time)
set(${_pkg}_layout_DEPENDENCIES config core_headers meta strings span utility)
set(${_pkg}_leak_check_DEPENDENCIES config core_headers)
set(${_pkg}_log_severity_DEPENDENCIES core_headers)
set(${_pkg}_low_level_hash_DEPENDENCIES bits config endian int128)
set(${_pkg}_malloc_internal_DEPENDENCIES base base_internal config core_headers dynamic_annotations
raw_logging_internal)
set(${_pkg}_malloc_internal_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_memory_DEPENDENCIES core_headers meta)
set(${_pkg}_meta_DEPENDENCIES type_traits)
set(${_pkg}_node_hash_map_DEPENDENCIES container_memory hash_function_defaults node_hash_policy raw_hash_map
algorithm_container memory)
set(${_pkg}_node_hash_policy_DEPENDENCIES config)
set(${_pkg}_node_hash_set_DEPENDENCIES hash_function_defaults node_hash_policy raw_hash_set algorithm_container memory)
set(${_pkg}_numeric_DEPENDENCIES int128)
set(${_pkg}_numeric_representation_DEPENDENCIES config)
set(${_pkg}_optional_DEPENDENCIES
bad_optional_access
base_internal
config
core_headers
memory
type_traits
utility)
set(${_pkg}_periodic_sampler_DEPENDENCIES core_headers exponential_biased)
set(${_pkg}_random_bit_gen_ref_DEPENDENCIES core_headers random_internal_distribution_caller
random_internal_fast_uniform_bits type_traits)
set(${_pkg}_random_distributions_DEPENDENCIES
base_internal
config
core_headers
random_internal_generate_real
random_internal_distribution_caller
random_internal_fast_uniform_bits
random_internal_fastmath
random_internal_iostream_state_saver
random_internal_traits
random_internal_uniform_helper
random_internal_wide_multiply
strings
type_traits)
set(${_pkg}_random_internal_distribution_caller_DEPENDENCIES config utility fast_type_id)
set(${_pkg}_random_internal_distribution_test_util_DEPENDENCIES config core_headers raw_logging_internal strings
str_format span)
set(${_pkg}_random_internal_fast_uniform_bits_DEPENDENCIES config)
set(${_pkg}_random_internal_fastmath_DEPENDENCIES bits)
set(${_pkg}_random_internal_generate_real_DEPENDENCIES bits random_internal_fastmath random_internal_traits type_traits)
set(${_pkg}_random_internal_iostream_state_saver_DEPENDENCIES int128 type_traits)
set(${_pkg}_random_internal_mock_helpers_DEPENDENCIES fast_type_id optional)
set(${_pkg}_random_internal_nonsecure_base_DEPENDENCIES
core_headers
optional
random_internal_pool_urbg
random_internal_salted_seed_seq
random_internal_seed_material
span
type_traits)
set(${_pkg}_random_internal_pcg_engine_DEPENDENCIES config int128 random_internal_fastmath
random_internal_iostream_state_saver type_traits)
set(${_pkg}_random_internal_platform_DEPENDENCIES config)
set(${_pkg}_random_internal_pool_urbg_DEPENDENCIES
base
config
core_headers
endian
random_internal_randen
random_internal_seed_material
random_internal_traits
random_seed_gen_exception
raw_logging_internal
span)
set(${_pkg}_random_internal_randen_DEPENDENCIES random_internal_platform random_internal_randen_hwaes
random_internal_randen_slow)
set(${_pkg}_random_internal_randen_engine_DEPENDENCIES endian random_internal_iostream_state_saver
random_internal_randen raw_logging_internal type_traits)
set(${_pkg}_random_internal_randen_hwaes_DEPENDENCIES random_internal_platform random_internal_randen_hwaes_impl config)
set(${_pkg}_random_internal_randen_hwaes_impl_DEPENDENCIES random_internal_platform config)
set(${_pkg}_random_internal_randen_slow_DEPENDENCIES random_internal_platform config)
set(${_pkg}_random_internal_salted_seed_seq_DEPENDENCIES inlined_vector optional span random_internal_seed_material
type_traits)
set(${_pkg}_random_internal_seed_material_DEPENDENCIES core_headers optional random_internal_fast_uniform_bits
raw_logging_internal span strings)
set(${_pkg}_random_internal_traits_DEPENDENCIES config)
set(${_pkg}_random_internal_uniform_helper_DEPENDENCIES config random_internal_traits type_traits)
set(${_pkg}_random_internal_wide_multiply_DEPENDENCIES bits config int128)
set(${_pkg}_random_random_DEPENDENCIES random_distributions random_internal_nonsecure_base random_internal_pcg_engine
random_internal_pool_urbg random_internal_randen_engine random_seed_sequences)
set(${_pkg}_random_seed_gen_exception_DEPENDENCIES config)
set(${_pkg}_random_seed_sequences_DEPENDENCIES
inlined_vector
random_internal_nonsecure_base
random_internal_pool_urbg
random_internal_salted_seed_seq
random_internal_seed_material
random_seed_gen_exception
span)
set(${_pkg}_raw_hash_map_DEPENDENCIES container_memory raw_hash_set throw_delegate)
set(${_pkg}_raw_hash_set_DEPENDENCIES
bits
compressed_tuple
config
container_common
container_memory
core_headers
endian
hash_policy_traits
hashtable_debug_hooks
have_sse
memory
meta
optional
utility
hashtablez_sampler)
set(${_pkg}_raw_logging_internal_DEPENDENCIES atomic_hook config core_headers log_severity)
set(${_pkg}_sample_recorder_DEPENDENCIES base synchronization)
set(${_pkg}_scoped_set_env_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_span_DEPENDENCIES algorithm core_headers throw_delegate type_traits)
set(${_pkg}_spinlock_wait_DEPENDENCIES base_internal core_headers errno_saver)
set(${_pkg}_stacktrace_DEPENDENCIES debugging_internal config core_headers)
set(${_pkg}_status_DEPENDENCIES
atomic_hook
config
core_headers
function_ref
raw_logging_internal
inlined_vector
stacktrace
symbolize
strings
cord
str_format
optional)
set(${_pkg}_statusor_DEPENDENCIES
base
status
core_headers
raw_logging_internal
type_traits
strings
utility
variant)
set(${_pkg}_str_format_DEPENDENCIES str_format_internal)
set(${_pkg}_str_format_internal_DEPENDENCIES
bits
strings
config
core_headers
numeric_representation
type_traits
int128
span)
set(${_pkg}_strerror_DEPENDENCIES config core_headers errno_saver)
set(${_pkg}_strings_DEPENDENCIES
strings_internal
base
bits
config
core_headers
endian
int128
memory
raw_logging_internal
throw_delegate
type_traits)
set(${_pkg}_strings_internal_DEPENDENCIES config core_headers endian raw_logging_internal type_traits)
set(${_pkg}_symbolize_DEPENDENCIES
debugging_internal
demangle_internal
base
config
core_headers
dynamic_annotations
malloc_internal
raw_logging_internal
strings)
set(${_pkg}_synchronization_DEPENDENCIES
graphcycles_internal
kernel_timeout_internal
atomic_hook
base
base_internal
config
core_headers
dynamic_annotations
malloc_internal
raw_logging_internal
stacktrace
symbolize
time)
set(${_pkg}_synchronization_EXTERNAL_DEPENDENCIES Threads::Threads)
set(${_pkg}_throw_delegate_DEPENDENCIES config raw_logging_internal)
set(${_pkg}_time_DEPENDENCIES
base
civil_time
core_headers
int128
raw_logging_internal
strings
time_zone)
set(${_pkg}_type_traits_DEPENDENCIES config)
set(${_pkg}_utility_DEPENDENCIES base_internal config type_traits)
set(${_pkg}_variant_DEPENDENCIES bad_variant_access base_internal config core_headers type_traits utility)

View File

@ -0,0 +1,599 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
if(NOT "${CMAKE_CUDA_COMPILER}" STREQUAL "")
set(_with_cuda TRUE)
else()
set(_with_cuda FALSE)
endif()
set(_comps
alphamat
aruco
barcode
bgsegm
bioinspired
calib3d
ccalib
core
correspondence
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
line_descriptor
mcc
ml
multiview
numeric
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
simple_pipeline
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto)
# Set names of each component of OpenCV 4.0
foreach(comp ${_comps})
set(${_pkg}_${comp}_NAMES opencv_${comp} opencv_${comp}401 opencv_${comp}400)
endforeach()
set(${_pkg}_alphamat_DEPENDENCIES core cudev imgproc)
set(${_pkg}_aruco_DEPENDENCIES
calib3d
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_barcode_DEPENDENCIES core cudev dnn imgproc)
set(${_pkg}_bgsegm_DEPENDENCIES
calib3d
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
video
videoio)
set(${_pkg}_bioinspired_DEPENDENCIES core cudev highgui imgcodecs imgproc videoio)
set(${_pkg}_calib3d_DEPENDENCIES
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_ccalib_DEPENDENCIES
calib3d
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_core_DEPENDENCIES cudev)
set(${_pkg}_cudaarithm_DEPENDENCIES core cudev)
set(${_pkg}_cudabgsegm_DEPENDENCIES
calib3d
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
video
videoio)
set(${_pkg}_cudacodec_DEPENDENCIES core cudev imgcodecs imgproc videoio)
set(${_pkg}_cudafeatures2d_DEPENDENCIES
core
cudaarithm
cudafilters
cudawarping
cudev
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_cudafilters_DEPENDENCIES core cudaarithm cudev imgproc)
set(${_pkg}_cudaimgproc_DEPENDENCIES core cudaarithm cudafilters cudev imgproc)
set(${_pkg}_cudalegacy_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudev
features2d
flann
highgui
imgcodecs
imgproc
objdetect
video
videoio)
set(${_pkg}_cudaobjdetect_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
cudev
features2d
flann
highgui
imgcodecs
imgproc
objdetect
video
videoio)
set(${_pkg}_cudaoptflow_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
cudev
features2d
flann
highgui
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
set(${_pkg}_cudastereo_DEPENDENCIES
calib3d
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_cudawarping_DEPENDENCIES core cudev imgproc)
set(${_pkg}_cvv_DEPENDENCIES
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_datasets_DEPENDENCIES
core
cudev
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
text
videoio)
set(${_pkg}_dnn_DEPENDENCIES core cudev imgproc)
set(${_pkg}_dnn_objdetect_DEPENDENCIES
core
cudev
dnn
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_dnn_superres_DEPENDENCIES core cudev dnn imgproc ml quality)
set(${_pkg}_dpm_DEPENDENCIES
calib3d
core
cudev
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_face_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
photo
videoio)
if(_with_cuda)
list(APPEND ${_pkg}_face_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_features2d_DEPENDENCIES core flann highgui imgcodecs imgproc videoio)
set(${_pkg}_flann_DEPENDENCIES core)
set(${_pkg}_freetype_DEPENDENCIES core imgproc)
set(${_pkg}_fuzzy_DEPENDENCIES core imgproc)
set(${_pkg}_gapi_DEPENDENCIES core imgproc)
set(${_pkg}_hdf_DEPENDENCIES core)
set(${_pkg}_hfs_DEPENDENCIES core imgproc)
set(${_pkg}_highgui_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_img_hash_DEPENDENCIES core imgproc)
set(${_pkg}_imgcodecs_DEPENDENCIES core imgproc)
set(${_pkg}_imgproc_DEPENDENCIES core)
set(${_pkg}_intensity_transform_DEPENDENCIES core imgproc)
set(${_pkg}_line_descriptor_DEPENDENCIES
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_mcc_DEPENDENCIES
calib3d
core
dnn
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_ml_DEPENDENCIES core)
set(${_pkg}_objdetect_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_optflow_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
video
videoio
ximgproc)
set(${_pkg}_ovis_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_phase_unwrapping_DEPENDENCIES core imgproc)
set(${_pkg}_photo_DEPENDENCIES core imgproc)
if(_with_cuda)
list(APPEND ${_pkg}_photo_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_plot_DEPENDENCIES core imgproc)
set(${_pkg}_quality_DEPENDENCIES core imgproc ml)
set(${_pkg}_rapid_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_reg_DEPENDENCIES core imgproc)
set(${_pkg}_rgbd_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio
viz)
set(${_pkg}_saliency_DEPENDENCIES
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_sfm_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
ml
shape
videoio
xfeatures2d)
if(_with_cuda)
list(APPEND ${_pkg}_sfm_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_shape_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_stereo_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
tracking
video
videoio)
set(${_pkg}_stitching_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
ml
objdetect
shape
video
videoio
xfeatures2d)
if(_with_cuda)
list(
APPEND
${_pkg}_stitching_DEPENDENCIES
cudaarithm
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudawarping)
endif()
set(${_pkg}_structured_light_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
phase_unwrapping
videoio
viz)
set(${_pkg}_superres_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_superres_DEPENDENCIES
cudaarithm
cudacodec
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_surface_matching_DEPENDENCIES core flann)
set(${_pkg}_text_DEPENDENCIES
core
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
videoio)
set(${_pkg}_tracking_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
video
videoio)
set(${_pkg}_video_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_videoio_DEPENDENCIES core imgcodecs imgproc)
set(${_pkg}_videostab_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
optflow
photo
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_videostab_DEPENDENCIES
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_viz_DEPENDENCIES core)
set(${_pkg}_wechat_qrcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_xfeatures2d_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
ml
shape
videoio)
if(_with_cuda)
list(APPEND ${_pkg}_xfeatures2d_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_ximgproc_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
video
videoio)
set(${_pkg}_xobjdetect_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_xphoto_DEPENDENCIES core imgproc photo)
if(_with_cuda)
list(APPEND ${_pkg}_xphoto_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
if(_with_cuda)
foreach(comp ${_comps})
list(PREPEND ${_pkg}_${comp}_NAMES cudev)
endforeach()
endif()

View File

@ -0,0 +1,414 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
if(NOT "${CMAKE_CUDA_COMPILER}" STREQUAL "")
set(_with_cuda TRUE)
else()
set(_with_cuda FALSE)
endif()
set(_comps
alphamat
aruco
barcode
bgsegm
bioinspired
calib3d
ccalib
core
correspondence
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
line_descriptor
mcc
ml
multiview
numeric
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
simple_pipeline
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto)
# Set names of each component of OpenCV 4.1
foreach(comp ${_comps})
set(${_pkg}_${comp}_NAMES opencv_${comp} opencv_${comp}412 opencv_${comp}411 opencv_${comp}410)
endforeach()
set(${_pkg}_alphamat_DEPENDENCIES core imgproc)
set(${_pkg}_aruco_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_barcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_bgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_bioinspired_DEPENDENCIES core highgui imgcodecs imgproc videoio)
set(${_pkg}_calib3d_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_ccalib_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_core_DEPENDENCIES)
set(${_pkg}_cudaarithm_DEPENDENCIES core)
set(${_pkg}_cudabgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_cudacodec_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_cudafeatures2d_DEPENDENCIES
core
cudaarithm
cudafilters
cudawarping
features2d
flann
imgproc)
set(${_pkg}_cudafilters_DEPENDENCIES core cudaarithm imgproc)
set(${_pkg}_cudaimgproc_DEPENDENCIES core cudaarithm cudafilters imgproc)
set(${_pkg}_cudalegacy_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaobjdetect_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaoptflow_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
ximgproc)
set(${_pkg}_cudastereo_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_cudawarping_DEPENDENCIES core imgproc)
set(${_pkg}_cvv_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_datasets_DEPENDENCIES
core
dnn
features2d
flann
imgcodecs
imgproc
ml
text)
set(${_pkg}_dnn_DEPENDENCIES core imgproc)
set(${_pkg}_dnn_objdetect_DEPENDENCIES core dnn highgui imgcodecs imgproc videoio)
set(${_pkg}_dnn_superres_DEPENDENCIES core dnn imgproc ml quality)
set(${_pkg}_dpm_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_face_DEPENDENCIES
core
flann
imgproc
features2d
photo
calib3d
objdetect)
if(_with_cuda)
list(APPEND ${_pkg}_face_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_features2d_DEPENDENCIES core flann imgproc)
set(${_pkg}_flann_DEPENDENCIES core)
set(${_pkg}_freetype_DEPENDENCIES core imgproc)
set(${_pkg}_fuzzy_DEPENDENCIES core imgproc)
set(${_pkg}_gapi_DEPENDENCIES core imgproc)
set(${_pkg}_hdf_DEPENDENCIES core)
set(${_pkg}_hfs_DEPENDENCIES core imgproc)
set(${_pkg}_highgui_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_img_hash_DEPENDENCIES core imgproc)
set(${_pkg}_imgcodecs_DEPENDENCIES core imgproc)
set(${_pkg}_imgproc_DEPENDENCIES core)
set(${_pkg}_intensity_transform_DEPENDENCIES core imgproc)
set(${_pkg}_line_descriptor_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_mcc_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_ml_DEPENDENCIES core)
set(${_pkg}_objdetect_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_optflow_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video
ximgproc)
set(${_pkg}_ovis_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_phase_unwrapping_DEPENDENCIES core imgproc)
set(${_pkg}_photo_DEPENDENCIES core imgproc)
if(_with_cuda)
list(APPEND ${_pkg}_photo_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_plot_DEPENDENCIES core imgproc)
set(${_pkg}_quality_DEPENDENCIES core imgproc ml)
set(${_pkg}_rapid_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_reg_DEPENDENCIES core imgproc)
set(${_pkg}_rgbd_DEPENDENCIES calib3d core features2d flann imgproc viz)
set(${_pkg}_saliency_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_sfm_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
ml
shape
xfeatures2d)
if(_with_cuda)
list(APPEND ${_pkg}_sfm_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_shape_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_stereo_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
tracking
video
videoio)
set(${_pkg}_stitching_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
objdetect
shape
video
xfeatures2d)
if(_with_cuda)
list(
APPEND
${_pkg}_stitching_DEPENDENCIES
cudaarithm
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudawarping)
endif()
set(${_pkg}_structured_light_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
phase_unwrapping
viz)
set(${_pkg}_superres_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_superres_DEPENDENCIES
cudaarithm
cudacodec
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_surface_matching_DEPENDENCIES core flann)
set(${_pkg}_text_DEPENDENCIES core dnn features2d flann imgproc ml)
set(${_pkg}_tracking_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
video
videoio)
set(${_pkg}_video_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_videoio_DEPENDENCIES core imgcodecs imgproc)
set(${_pkg}_videostab_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
photo
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_videostab_DEPENDENCIES
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_viz_DEPENDENCIES core)
set(${_pkg}_wechat_qrcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_xfeatures2d_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
shape)
if(_with_cuda)
list(APPEND ${_pkg}_xfeatures2d_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_ximgproc_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video)
set(${_pkg}_xobjdetect_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect)
set(${_pkg}_xphoto_DEPENDENCIES core imgproc photo)
if(_with_cuda)
list(APPEND ${_pkg}_xphoto_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
if(_with_cuda)
foreach(comp ${_comps})
list(PREPEND ${_pkg}_${comp}_NAMES cudev)
endforeach()
endif()

View File

@ -0,0 +1,414 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
if(NOT "${CMAKE_CUDA_COMPILER}" STREQUAL "")
set(_with_cuda TRUE)
else()
set(_with_cuda FALSE)
endif()
set(_comps
alphamat
aruco
barcode
bgsegm
bioinspired
calib3d
ccalib
core
correspondence
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
line_descriptor
mcc
ml
multiview
numeric
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
simple_pipeline
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto)
# Set names of each component of OpenCV 4.2
foreach(comp ${_comps})
set(${_pkg}_${comp}_NAMES opencv_${comp} opencv_${comp}420)
endforeach()
set(${_pkg}_alphamat_DEPENDENCIES core imgproc)
set(${_pkg}_aruco_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_barcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_bgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_bioinspired_DEPENDENCIES core highgui imgcodecs imgproc videoio)
set(${_pkg}_calib3d_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_ccalib_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_core_DEPENDENCIES)
set(${_pkg}_cudaarithm_DEPENDENCIES core)
set(${_pkg}_cudabgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_cudacodec_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_cudafeatures2d_DEPENDENCIES
core
cudaarithm
cudafilters
cudawarping
features2d
flann
imgproc)
set(${_pkg}_cudafilters_DEPENDENCIES core cudaarithm imgproc)
set(${_pkg}_cudaimgproc_DEPENDENCIES core cudaarithm cudafilters imgproc)
set(${_pkg}_cudalegacy_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaobjdetect_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaoptflow_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
ximgproc)
set(${_pkg}_cudastereo_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_cudawarping_DEPENDENCIES core imgproc)
set(${_pkg}_cvv_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_datasets_DEPENDENCIES
core
dnn
features2d
flann
imgcodecs
imgproc
ml
text)
set(${_pkg}_dnn_DEPENDENCIES core imgproc)
set(${_pkg}_dnn_objdetect_DEPENDENCIES core dnn highgui imgcodecs imgproc videoio)
set(${_pkg}_dnn_superres_DEPENDENCIES core dnn imgproc ml quality)
set(${_pkg}_dpm_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_face_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
objdetect
photo)
if(_with_cuda)
list(APPEND ${_pkg}_face_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_features2d_DEPENDENCIES core flann imgproc)
set(${_pkg}_flann_DEPENDENCIES core)
set(${_pkg}_freetype_DEPENDENCIES core imgproc)
set(${_pkg}_fuzzy_DEPENDENCIES core imgproc)
set(${_pkg}_gapi_DEPENDENCIES core imgproc)
set(${_pkg}_hdf_DEPENDENCIES core)
set(${_pkg}_hfs_DEPENDENCIES core imgproc)
set(${_pkg}_highgui_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_img_hash_DEPENDENCIES core imgproc)
set(${_pkg}_imgcodecs_DEPENDENCIES core imgproc)
set(${_pkg}_imgproc_DEPENDENCIES core)
set(${_pkg}_intensity_transform_DEPENDENCIES core imgproc)
set(${_pkg}_line_descriptor_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_mcc_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_ml_DEPENDENCIES core)
set(${_pkg}_objdetect_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_optflow_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video
ximgproc)
set(${_pkg}_ovis_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_phase_unwrapping_DEPENDENCIES core imgproc)
set(${_pkg}_photo_DEPENDENCIES core imgproc)
if(_with_cuda)
list(APPEND ${_pkg}_photo_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_plot_DEPENDENCIES core imgproc)
set(${_pkg}_quality_DEPENDENCIES core imgproc ml)
set(${_pkg}_rapid_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_reg_DEPENDENCIES core imgproc)
set(${_pkg}_rgbd_DEPENDENCIES calib3d core features2d flann imgproc viz)
set(${_pkg}_saliency_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_sfm_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
ml
shape
xfeatures2d)
if(_with_cuda)
list(APPEND ${_pkg}_sfm_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_shape_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_stereo_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
tracking
video
videoio)
set(${_pkg}_stitching_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
objdetect
shape
video
xfeatures2d)
if(_with_cuda)
list(
APPEND
${_pkg}_stitching_DEPENDENCIES
cudaarithm
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudawarping)
endif()
set(${_pkg}_structured_light_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
phase_unwrapping
viz)
set(${_pkg}_superres_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_superres_DEPENDENCIES
cudaarithm
cudacodec
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_surface_matching_DEPENDENCIES core flann)
set(${_pkg}_text_DEPENDENCIES core dnn features2d flann imgproc ml)
set(${_pkg}_tracking_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
video
videoio)
set(${_pkg}_video_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_videoio_DEPENDENCIES core imgcodecs imgproc)
set(${_pkg}_videostab_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
photo
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_videostab_DEPENDENCIES
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_viz_DEPENDENCIES core)
set(${_pkg}_wechat_qrcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_xfeatures2d_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
shape)
if(_with_cuda)
list(APPEND ${_pkg}_xfeatures2d_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_ximgproc_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video)
set(${_pkg}_xobjdetect_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect)
set(${_pkg}_xphoto_DEPENDENCIES core imgproc photo)
if(_with_cuda)
list(APPEND ${_pkg}_xphoto_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
if(_with_cuda)
foreach(comp ${_comps})
list(PREPEND ${_pkg}_${comp}_NAMES cudev)
endforeach()
endif()

View File

@ -0,0 +1,414 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
if(NOT "${CMAKE_CUDA_COMPILER}" STREQUAL "")
set(_with_cuda TRUE)
else()
set(_with_cuda FALSE)
endif()
set(_comps
alphamat
aruco
barcode
bgsegm
bioinspired
calib3d
ccalib
core
correspondence
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
line_descriptor
mcc
ml
multiview
numeric
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
simple_pipeline
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto)
# Set names of each component of OpenCV 4.3
foreach(comp ${_comps})
set(${_pkg}_${comp}_NAMES opencv_${comp} opencv_${comp}430)
endforeach()
set(${_pkg}_alphamat_DEPENDENCIES core imgproc)
set(${_pkg}_aruco_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_barcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_bgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_bioinspired_DEPENDENCIES core highgui imgcodecs imgproc videoio)
set(${_pkg}_calib3d_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_ccalib_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_core_DEPENDENCIES)
set(${_pkg}_cudaarithm_DEPENDENCIES core)
set(${_pkg}_cudabgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_cudacodec_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_cudafeatures2d_DEPENDENCIES
core
cudaarithm
cudafilters
cudawarping
features2d
flann
imgproc)
set(${_pkg}_cudafilters_DEPENDENCIES core cudaarithm imgproc)
set(${_pkg}_cudaimgproc_DEPENDENCIES core cudaarithm cudafilters imgproc)
set(${_pkg}_cudalegacy_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaobjdetect_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaoptflow_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
ximgproc)
set(${_pkg}_cudastereo_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_cudawarping_DEPENDENCIES core imgproc)
set(${_pkg}_cvv_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_datasets_DEPENDENCIES
core
dnn
features2d
flann
imgcodecs
imgproc
ml
text)
set(${_pkg}_dnn_DEPENDENCIES core imgproc)
set(${_pkg}_dnn_objdetect_DEPENDENCIES core dnn highgui imgcodecs imgproc videoio)
set(${_pkg}_dnn_superres_DEPENDENCIES core dnn imgproc ml quality)
set(${_pkg}_dpm_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_face_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
objdetect
photo)
if(_with_cuda)
list(APPEND ${_pkg}_face_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_features2d_DEPENDENCIES core flann imgproc)
set(${_pkg}_flann_DEPENDENCIES core)
set(${_pkg}_freetype_DEPENDENCIES core imgproc)
set(${_pkg}_fuzzy_DEPENDENCIES core imgproc)
set(${_pkg}_gapi_DEPENDENCIES core imgproc)
set(${_pkg}_hdf_DEPENDENCIES core)
set(${_pkg}_hfs_DEPENDENCIES core imgproc)
set(${_pkg}_highgui_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_img_hash_DEPENDENCIES core imgproc)
set(${_pkg}_imgcodecs_DEPENDENCIES core imgproc)
set(${_pkg}_imgproc_DEPENDENCIES core)
set(${_pkg}_intensity_transform_DEPENDENCIES core imgproc)
set(${_pkg}_line_descriptor_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_mcc_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_ml_DEPENDENCIES core)
set(${_pkg}_objdetect_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_optflow_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video
ximgproc)
set(${_pkg}_ovis_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_phase_unwrapping_DEPENDENCIES core imgproc)
set(${_pkg}_photo_DEPENDENCIES core imgproc)
if(_with_cuda)
list(APPEND ${_pkg}_photo_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_plot_DEPENDENCIES core imgproc)
set(${_pkg}_quality_DEPENDENCIES core imgproc ml)
set(${_pkg}_rapid_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_reg_DEPENDENCIES core imgproc)
set(${_pkg}_rgbd_DEPENDENCIES calib3d core features2d flann imgproc viz)
set(${_pkg}_saliency_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_sfm_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
ml
shape
xfeatures2d)
if(_with_cuda)
list(APPEND ${_pkg}_sfm_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_shape_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_stereo_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
tracking
video
videoio)
set(${_pkg}_stitching_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
objdetect
shape
video
xfeatures2d)
if(_with_cuda)
list(
APPEND
${_pkg}_stitching_DEPENDENCIES
cudaarithm
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudawarping)
endif()
set(${_pkg}_structured_light_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
phase_unwrapping
viz)
set(${_pkg}_superres_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_superres_DEPENDENCIES
cudaarithm
cudacodec
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_surface_matching_DEPENDENCIES core flann)
set(${_pkg}_text_DEPENDENCIES core dnn features2d flann imgproc ml)
set(${_pkg}_tracking_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
video
videoio)
set(${_pkg}_video_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_videoio_DEPENDENCIES core imgcodecs imgproc)
set(${_pkg}_videostab_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
photo
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_videostab_DEPENDENCIES
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_viz_DEPENDENCIES core)
set(${_pkg}_wechat_qrcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_xfeatures2d_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
shape)
if(_with_cuda)
list(APPEND ${_pkg}_xfeatures2d_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_ximgproc_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video)
set(${_pkg}_xobjdetect_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect)
set(${_pkg}_xphoto_DEPENDENCIES core imgproc photo)
if(_with_cuda)
list(APPEND ${_pkg}_xphoto_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
if(_with_cuda)
foreach(comp ${_comps})
list(PREPEND ${_pkg}_${comp}_NAMES cudev)
endforeach()
endif()

View File

@ -0,0 +1,414 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
if(NOT "${CMAKE_CUDA_COMPILER}" STREQUAL "")
set(_with_cuda TRUE)
else()
set(_with_cuda FALSE)
endif()
set(_comps
alphamat
aruco
barcode
bgsegm
bioinspired
calib3d
ccalib
core
correspondence
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
line_descriptor
mcc
ml
multiview
numeric
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
simple_pipeline
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto)
# Set names of each component of OpenCV 4.4
foreach(comp ${_comps})
set(${_pkg}_${comp}_NAMES opencv_${comp} opencv_${comp}440)
endforeach()
set(${_pkg}_alphamat_DEPENDENCIES core imgproc)
set(${_pkg}_aruco_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_barcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_bgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_bioinspired_DEPENDENCIES core highgui imgcodecs imgproc videoio)
set(${_pkg}_calib3d_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_ccalib_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_core_DEPENDENCIES)
set(${_pkg}_cudaarithm_DEPENDENCIES core)
set(${_pkg}_cudabgsegm_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_cudacodec_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_cudafeatures2d_DEPENDENCIES
core
cudaarithm
cudafilters
cudawarping
features2d
flann
imgproc)
set(${_pkg}_cudafilters_DEPENDENCIES core cudaarithm imgproc)
set(${_pkg}_cudaimgproc_DEPENDENCIES core cudaarithm cudafilters imgproc)
set(${_pkg}_cudalegacy_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaobjdetect_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaoptflow_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
ximgproc)
set(${_pkg}_cudastereo_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_cudawarping_DEPENDENCIES core imgproc)
set(${_pkg}_cvv_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_datasets_DEPENDENCIES
core
dnn
features2d
flann
imgcodecs
imgproc
ml
text)
set(${_pkg}_dnn_DEPENDENCIES core imgproc)
set(${_pkg}_dnn_objdetect_DEPENDENCIES core dnn highgui imgcodecs imgproc videoio)
set(${_pkg}_dnn_superres_DEPENDENCIES core dnn imgproc ml quality)
set(${_pkg}_dpm_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_face_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
objdetect
photo)
if(_with_cuda)
list(APPEND ${_pkg}_face_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_features2d_DEPENDENCIES core flann imgproc)
set(${_pkg}_flann_DEPENDENCIES core)
set(${_pkg}_freetype_DEPENDENCIES core imgproc)
set(${_pkg}_fuzzy_DEPENDENCIES core imgproc)
set(${_pkg}_gapi_DEPENDENCIES calib3d core features2d flann imgproc video)
set(${_pkg}_hdf_DEPENDENCIES core)
set(${_pkg}_hfs_DEPENDENCIES core imgproc)
set(${_pkg}_highgui_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_img_hash_DEPENDENCIES core imgproc)
set(${_pkg}_imgcodecs_DEPENDENCIES core imgproc)
set(${_pkg}_imgproc_DEPENDENCIES core)
set(${_pkg}_intensity_transform_DEPENDENCIES core imgproc)
set(${_pkg}_line_descriptor_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_mcc_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_ml_DEPENDENCIES core)
set(${_pkg}_objdetect_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_optflow_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video
ximgproc)
set(${_pkg}_ovis_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_phase_unwrapping_DEPENDENCIES core imgproc)
set(${_pkg}_photo_DEPENDENCIES core imgproc)
if(_with_cuda)
list(APPEND ${_pkg}_photo_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_plot_DEPENDENCIES core imgproc)
set(${_pkg}_quality_DEPENDENCIES core imgproc ml)
set(${_pkg}_rapid_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_reg_DEPENDENCIES core imgproc)
set(${_pkg}_rgbd_DEPENDENCIES calib3d core features2d flann imgproc viz)
set(${_pkg}_saliency_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_sfm_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
ml
shape
xfeatures2d)
if(_with_cuda)
list(APPEND ${_pkg}_sfm_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_shape_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_stereo_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
tracking
video
videoio)
set(${_pkg}_stitching_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
objdetect
shape
video
xfeatures2d)
if(_with_cuda)
list(
APPEND
${_pkg}_stitching_DEPENDENCIES
cudaarithm
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudawarping)
endif()
set(${_pkg}_structured_light_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
phase_unwrapping
viz)
set(${_pkg}_superres_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_superres_DEPENDENCIES
cudaarithm
cudacodec
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_surface_matching_DEPENDENCIES core flann)
set(${_pkg}_text_DEPENDENCIES core dnn features2d flann imgproc ml)
set(${_pkg}_tracking_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
video
videoio)
set(${_pkg}_video_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_videoio_DEPENDENCIES core imgcodecs imgproc)
set(${_pkg}_videostab_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect
optflow
photo
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_videostab_DEPENDENCIES
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_viz_DEPENDENCIES core)
set(${_pkg}_wechat_qrcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_xfeatures2d_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
shape)
if(_with_cuda)
list(APPEND ${_pkg}_xfeatures2d_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_ximgproc_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
video)
set(${_pkg}_xobjdetect_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
objdetect)
set(${_pkg}_xphoto_DEPENDENCIES core imgproc photo)
if(_with_cuda)
list(APPEND ${_pkg}_xphoto_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
if(_with_cuda)
foreach(comp ${_comps})
list(PREPEND ${_pkg}_${comp}_NAMES cudev)
endforeach()
endif()

View File

@ -0,0 +1,457 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
if(NOT "${CMAKE_CUDA_COMPILER}" STREQUAL "")
set(_with_cuda TRUE)
else()
set(_with_cuda FALSE)
endif()
set(_comps
alphamat
aruco
barcode
bgsegm
bioinspired
calib3d
ccalib
core
correspondence
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
line_descriptor
mcc
ml
multiview
numeric
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
simple_pipeline
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto)
# Set names of each component of OpenCV 4.5
foreach(comp ${_comps})
set(${_pkg}_${comp}_NAMES
opencv_${comp}
opencv_${comp}459
opencv_${comp}458
opencv_${comp}457
opencv_${comp}456
opencv_${comp}455
opencv_${comp}454
opencv_${comp}453
opencv_${comp}452
opencv_${comp}451
opencv_${comp}450)
endforeach()
set(${_pkg}_alphamat_DEPENDENCIES core imgproc)
set(${_pkg}_aruco_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_barcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_bgsegm_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgproc
video)
set(${_pkg}_bioinspired_DEPENDENCIES core highgui imgcodecs imgproc videoio)
set(${_pkg}_calib3d_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_ccalib_DEPENDENCIES
calib3d
core
features2d
flann
highgui
imgcodecs
imgproc
videoio)
set(${_pkg}_core_DEPENDENCIES)
set(${_pkg}_cudaarithm_DEPENDENCIES core)
set(${_pkg}_cudabgsegm_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgproc
video)
set(${_pkg}_cudacodec_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_cudafeatures2d_DEPENDENCIES
core
cudaarithm
cudafilters
cudawarping
features2d
flann
imgproc)
set(${_pkg}_cudafilters_DEPENDENCIES core cudaarithm imgproc)
set(${_pkg}_cudaimgproc_DEPENDENCIES core cudaarithm cudafilters imgproc)
set(${_pkg}_cudalegacy_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
dnn
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaobjdetect_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
dnn
features2d
flann
imgproc
objdetect
video)
set(${_pkg}_cudaoptflow_DEPENDENCIES
calib3d
core
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudawarping
dnn
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
ximgproc)
set(${_pkg}_cudastereo_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_cudawarping_DEPENDENCIES core imgproc)
set(${_pkg}_cvv_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_datasets_DEPENDENCIES
core
dnn
features2d
flann
imgcodecs
imgproc
ml
text)
set(${_pkg}_dnn_DEPENDENCIES core imgproc)
set(${_pkg}_dnn_objdetect_DEPENDENCIES core dnn highgui imgcodecs imgproc videoio)
set(${_pkg}_dnn_superres_DEPENDENCIES core dnn imgproc ml quality)
set(${_pkg}_dpm_DEPENDENCIES
calib3d
core
dnn
features2d
flann
highgui
imgcodecs
imgproc
objdetect
videoio)
set(${_pkg}_face_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgproc
objdetect
photo)
if(_with_cuda)
list(APPEND ${_pkg}_face_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_features2d_DEPENDENCIES core flann imgproc)
set(${_pkg}_flann_DEPENDENCIES core)
set(${_pkg}_freetype_DEPENDENCIES core imgproc)
set(${_pkg}_fuzzy_DEPENDENCIES core imgproc)
set(${_pkg}_gapi_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgproc
video)
set(${_pkg}_hdf_DEPENDENCIES core)
set(${_pkg}_hfs_DEPENDENCIES core imgproc)
set(${_pkg}_highgui_DEPENDENCIES core imgcodecs imgproc videoio)
set(${_pkg}_img_hash_DEPENDENCIES core imgproc)
set(${_pkg}_imgcodecs_DEPENDENCIES core imgproc)
set(${_pkg}_imgproc_DEPENDENCIES core)
set(${_pkg}_intensity_transform_DEPENDENCIES core imgproc)
set(${_pkg}_line_descriptor_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_mcc_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_ml_DEPENDENCIES core)
set(${_pkg}_objdetect_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_optflow_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgcodecs
imgproc
video
ximgproc)
set(${_pkg}_ovis_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_phase_unwrapping_DEPENDENCIES core imgproc)
set(${_pkg}_photo_DEPENDENCIES core imgproc)
if(_with_cuda)
list(APPEND ${_pkg}_photo_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
set(${_pkg}_plot_DEPENDENCIES core imgproc)
set(${_pkg}_quality_DEPENDENCIES core imgproc ml)
set(${_pkg}_rapid_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_reg_DEPENDENCIES core imgproc)
set(${_pkg}_rgbd_DEPENDENCIES calib3d core features2d flann imgproc viz)
set(${_pkg}_saliency_DEPENDENCIES core features2d flann imgproc)
set(${_pkg}_sfm_DEPENDENCIES
calib3d
core
features2d
flann
imgcodecs
imgproc
ml
shape
xfeatures2d)
if(_with_cuda)
list(APPEND ${_pkg}_sfm_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_shape_DEPENDENCIES calib3d core features2d flann imgproc)
set(${_pkg}_stereo_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
tracking
video
videoio)
set(${_pkg}_stitching_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgproc
ml
objdetect
shape
video
xfeatures2d)
if(_with_cuda)
list(
APPEND
${_pkg}_stitching_DEPENDENCIES
cudaarithm
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudawarping)
endif()
set(${_pkg}_structured_light_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
phase_unwrapping
viz)
set(${_pkg}_superres_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgcodecs
imgproc
objdetect
optflow
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_superres_DEPENDENCIES
cudaarithm
cudacodec
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_surface_matching_DEPENDENCIES core flann)
set(${_pkg}_text_DEPENDENCIES core dnn features2d flann imgproc ml)
set(${_pkg}_tracking_DEPENDENCIES
calib3d
core
datasets
dnn
features2d
flann
highgui
imgcodecs
imgproc
ml
plot
text
video
videoio)
set(${_pkg}_video_DEPENDENCIES calib3d core dnn features2d flann imgproc)
set(${_pkg}_videoio_DEPENDENCIES core imgcodecs imgproc)
set(${_pkg}_videostab_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgcodecs
imgproc
objdetect
optflow
photo
video
videoio
ximgproc)
if(_with_cuda)
list(
APPEND
${_pkg}_videostab_DEPENDENCIES
cudaarithm
cudafilters
cudaimgproc
cudalegacy
cudaoptflow
cudawarping)
endif()
set(${_pkg}_viz_DEPENDENCIES core)
set(${_pkg}_wechat_qrcode_DEPENDENCIES core dnn imgproc)
set(${_pkg}_xfeatures2d_DEPENDENCIES
calib3d
core
features2d
flann
imgproc
ml
shape)
if(_with_cuda)
list(APPEND ${_pkg}_xfeatures2d_DEPENDENCIES cudaarithm)
endif()
set(${_pkg}_ximgproc_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgcodecs
imgproc
video)
set(${_pkg}_xobjdetect_DEPENDENCIES
calib3d
core
dnn
features2d
flann
imgcodecs
imgproc
objdetect)
set(${_pkg}_xphoto_DEPENDENCIES core imgproc photo)
if(_with_cuda)
list(APPEND ${_pkg}_xphoto_DEPENDENCIES cudaarithm cudafilters cudaimgproc)
endif()
if(_with_cuda)
foreach(comp ${_comps})
list(PREPEND ${_pkg}_${comp}_NAMES cudev)
endforeach()
endif()

View File

@ -0,0 +1,108 @@
# ==============================================================================
#
# Copyright 2022 <Huawei Technologies Co., Ltd>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
# Set names of each component of OpenCV 5.0-pre
foreach(
comp
3d
alphamat
aruco
barcode
bgsegm
bioinspired
calib
ccalib
core
cudaarithm
cudabgsegm
cudacodec
cudafeatures2d
cudafilters
cudaimgproc
cudalegacy
cudaobjdetect
cudaoptflow
cudastereo
cudawarping
cudev
cvv
datasets
dnn
dnn_objdetect
dnn_superres
dpm
face
features2d
flann
freetype
fuzzy
gapi
hdf
hfs
highgui
img_hash
imgcodecs
imgproc
intensity_transform
julia
line_descriptor
mcc
ml
objdetect
optflow
ovis
phase_unwrapping
photo
plot
quality
rapid
reg
rgbd
saliency
sfm
shape
stereo
stitching
structured_light
superres
surface_matching
text
tracking
video
videoio
videostab
viz
wechat_qrcode
xfeatures2d
ximgproc
xobjdetect
xphoto
xstereo)
set(${_pkg}_${comp}_NAMES
opencv_${comp}
opencv_${comp}509
opencv_${comp}508
opencv_${comp}507
opencv_${comp}506
opencv_${comp}505
opencv_${comp}504
opencv_${comp}503
opencv_${comp}502
opencv_${comp}501
opencv_${comp}500)
endforeach()

View File

@ -21,6 +21,7 @@ option(ENABLE_IBVERBS "enable IBVERBS for parameter server" OFF)
option(ENABLE_PYTHON "Enable python" ON)
option(ENABLE_ACL "enable acl" OFF)
option(ENABLE_GLIBCXX "enable_glibcxx" OFF)
option(ENABLE_WERROR "Enable -Werror while compiling" ON)
option(MODE_ASCEND_ALL "supports all ascend platform" OFF)
option(MODE_ASCEND_ACL "supports ascend acl mode only" OFF)
option(ENABLE_SYM_FILE "enable sym file" OFF)
@ -61,6 +62,10 @@ if(ENABLE_ASAN)
endif()
endif()
if(ENABLE_WERROR)
set(OPTION_CXX_FLAGS "${OPTION_CXX_FLAGS} -Werror")
endif()
if(DEBUG_MODE)
set(CMAKE_BUILD_TYPE "Debug")
add_compile_definitions(MEM_REUSE_DEBUG)

View File

@ -90,7 +90,7 @@ install(
)
install(
TARGETS mindspore_core mindspore_common mindspore_backend
TARGETS mindspore_core mindspore_common
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
@ -134,12 +134,12 @@ if(ENABLE_MINDDATA)
install(FILES ${tinyxml2_LIBPATH}/libtinyxml2.so.8.0.0
DESTINATION ${INSTALL_LIB_DIR} RENAME libtinyxml2.so.8 COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicuuc.so.69.1
DESTINATION ${INSTALL_LIB_DIR} RENAME libicuuc.so.69 COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicudata.so.69.1
DESTINATION ${INSTALL_LIB_DIR} RENAME libicudata.so.69 COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicui18n.so.69.1
DESTINATION ${INSTALL_LIB_DIR} RENAME libicui18n.so.69 COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicuuc.so.67.1
DESTINATION ${INSTALL_LIB_DIR} RENAME libicuuc.so.67 COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicudata.so.67.1
DESTINATION ${INSTALL_LIB_DIR} RENAME libicudata.so.67 COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicui18n.so.67.1
DESTINATION ${INSTALL_LIB_DIR} RENAME libicui18n.so.67 COMPONENT mindspore)
endif()
if(ENABLE_CPU)
@ -283,14 +283,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
)
endif()
if(ENABLE_CLOUD_AND_LITE)
install(
TARGETS mindspore-lite mslite_converter_plugin
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif()
# set python files
file(GLOB MS_PY_LIST ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/*.py)
install(
@ -314,7 +306,6 @@ install(
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/communication
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/profiler
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/compression
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/rewrite
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/run_check
DESTINATION ${INSTALL_PY_DIR}
COMPONENT mindspore

View File

@ -31,217 +31,6 @@ set(BENCHMARK_TRAIN_NAME benchmark_train)
set(BENCHMARK_TRAIN_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark_train)
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
function(__install_white_list_ops)
install(FILES
${TOP_DIR}/mindspore/core/ops/abs.h
${TOP_DIR}/mindspore/core/ops/adam.h
${TOP_DIR}/mindspore/core/ops/addn.h
${TOP_DIR}/mindspore/core/ops/all.h
${TOP_DIR}/mindspore/core/ops/apply_momentum.h
${TOP_DIR}/mindspore/core/ops/assert.h
${TOP_DIR}/mindspore/core/ops/assign.h
${TOP_DIR}/mindspore/core/ops/assign_add.h
${TOP_DIR}/mindspore/core/ops/audio_spectrogram.h
${TOP_DIR}/mindspore/core/ops/batch_norm.h
${TOP_DIR}/mindspore/core/ops/batch_to_space.h
${TOP_DIR}/mindspore/core/ops/batch_to_space_nd.h
${TOP_DIR}/mindspore/core/ops/bias_add.h
${TOP_DIR}/mindspore/core/ops/binary_cross_entropy.h
${TOP_DIR}/mindspore/core/ops/broadcast.h
${TOP_DIR}/mindspore/core/ops/cast.h
${TOP_DIR}/mindspore/core/ops/ceil.h
${TOP_DIR}/mindspore/core/ops/clip.h
${TOP_DIR}/mindspore/core/ops/concat.h
${TOP_DIR}/mindspore/core/ops/attention.h
${TOP_DIR}/mindspore/core/ops/cos.h
${TOP_DIR}/mindspore/core/ops/constant_of_shape.h
${TOP_DIR}/mindspore/core/ops/crop.h
${TOP_DIR}/mindspore/core/ops/custom_extract_features.h
${TOP_DIR}/mindspore/core/ops/custom_normalize.h
${TOP_DIR}/mindspore/core/ops/custom_predict.h
${TOP_DIR}/mindspore/core/ops/depend.h
${TOP_DIR}/mindspore/core/ops/depth_to_space.h
${TOP_DIR}/mindspore/core/ops/detection_post_process.h
${TOP_DIR}/mindspore/core/ops/dropout.h
${TOP_DIR}/mindspore/core/ops/elu.h
${TOP_DIR}/mindspore/core/ops/eltwise.h
${TOP_DIR}/mindspore/core/ops/equal.h
${TOP_DIR}/mindspore/core/ops/expand_dims.h
${TOP_DIR}/mindspore/core/ops/fake_quant_with_min_max_vars.h
${TOP_DIR}/mindspore/core/ops/fake_quant_with_min_max_vars_per_channel.h
${TOP_DIR}/mindspore/core/ops/fake_quant_with_min_max_vars.h
${TOP_DIR}/mindspore/core/ops/fft_real.h
${TOP_DIR}/mindspore/core/ops/fft_imag.h
${TOP_DIR}/mindspore/core/ops/flatten.h
${TOP_DIR}/mindspore/core/ops/floor.h
${TOP_DIR}/mindspore/core/ops/floor_div.h
${TOP_DIR}/mindspore/core/ops/floor_mod.h
${TOP_DIR}/mindspore/core/ops/fill.h
${TOP_DIR}/mindspore/core/ops/fused_batch_norm.h
${TOP_DIR}/mindspore/core/ops/gather.h
${TOP_DIR}/mindspore/core/ops/gather_nd.h
${TOP_DIR}/mindspore/core/ops/greater.h
${TOP_DIR}/mindspore/core/ops/greater_equal.h
${TOP_DIR}/mindspore/core/ops/hashtable_lookup.h
${TOP_DIR}/mindspore/core/ops/instance_norm.h
${TOP_DIR}/mindspore/core/ops/leaky_relu.h
${TOP_DIR}/mindspore/core/ops/less.h
${TOP_DIR}/mindspore/core/ops/less_equal.h
${TOP_DIR}/mindspore/core/ops/log.h
${TOP_DIR}/mindspore/core/ops/logical_and.h
${TOP_DIR}/mindspore/core/ops/logical_not.h
${TOP_DIR}/mindspore/core/ops/logical_or.h
${TOP_DIR}/mindspore/core/ops/lp_normalization.h
${TOP_DIR}/mindspore/core/ops/lrn.h
${TOP_DIR}/mindspore/core/ops/lsh_projection.h
${TOP_DIR}/mindspore/core/ops/lstm.h
${TOP_DIR}/mindspore/core/ops/maximum.h
${TOP_DIR}/mindspore/core/ops/switch_layer.h
${TOP_DIR}/mindspore/core/ops/mfcc.h
${TOP_DIR}/mindspore/core/ops/minimum.h
${TOP_DIR}/mindspore/core/ops/mod.h
${TOP_DIR}/mindspore/core/ops/neg.h
${TOP_DIR}/mindspore/core/ops/not_equal.h
${TOP_DIR}/mindspore/core/ops/non_max_suppression.h
${TOP_DIR}/mindspore/core/ops/one_hot.h
${TOP_DIR}/mindspore/core/ops/ones_like.h
${TOP_DIR}/mindspore/core/ops/prior_box.h
${TOP_DIR}/mindspore/core/ops/quant_dtype_cast.h
${TOP_DIR}/mindspore/core/ops/rank.h
${TOP_DIR}/mindspore/core/ops/range.h
${TOP_DIR}/mindspore/core/ops/reciprocal.h
${TOP_DIR}/mindspore/core/ops/real_div.h
${TOP_DIR}/mindspore/core/ops/reshape.h
${TOP_DIR}/mindspore/core/ops/resize.h
${TOP_DIR}/mindspore/core/ops/reverse_sequence.h
${TOP_DIR}/mindspore/core/ops/reverse_v2.h
${TOP_DIR}/mindspore/core/ops/rfft.h
${TOP_DIR}/mindspore/core/ops/roi_pooling.h
${TOP_DIR}/mindspore/core/ops/round.h
${TOP_DIR}/mindspore/core/ops/rsqrt.h
${TOP_DIR}/mindspore/core/ops/scatter_nd.h
${TOP_DIR}/mindspore/core/ops/sgd.h
${TOP_DIR}/mindspore/core/ops/shape.h
${TOP_DIR}/mindspore/core/ops/sigmoid_cross_entropy_with_logits.h
${TOP_DIR}/mindspore/core/ops/sin.h
${TOP_DIR}/mindspore/core/ops/skip_gram.h
${TOP_DIR}/mindspore/core/ops/smooth_l1_loss.h
${TOP_DIR}/mindspore/core/ops/softmax.h
${TOP_DIR}/mindspore/core/ops/softmax_cross_entropy_with_logits.h
${TOP_DIR}/mindspore/core/ops/space_to_batch.h
${TOP_DIR}/mindspore/core/ops/space_to_batch_nd.h
${TOP_DIR}/mindspore/core/ops/space_to_depth.h
${TOP_DIR}/mindspore/core/ops/sparse_softmax_cross_entropy_with_logits.h
${TOP_DIR}/mindspore/core/ops/sparse_to_dense.h
${TOP_DIR}/mindspore/core/ops/split.h
${TOP_DIR}/mindspore/core/ops/sqrt.h
${TOP_DIR}/mindspore/core/ops/squeeze.h
${TOP_DIR}/mindspore/core/ops/square.h
${TOP_DIR}/mindspore/core/ops/squared_difference.h
${TOP_DIR}/mindspore/core/ops/stack.h
${TOP_DIR}/mindspore/core/ops/strided_slice.h
${TOP_DIR}/mindspore/core/ops/switch.h
${TOP_DIR}/mindspore/core/ops/tensor_list_from_tensor.h
${TOP_DIR}/mindspore/core/ops/tensor_list_get_item.h
${TOP_DIR}/mindspore/core/ops/tensor_list_reserve.h
${TOP_DIR}/mindspore/core/ops/tensor_list_set_item.h
${TOP_DIR}/mindspore/core/ops/tensor_list_stack.h
${TOP_DIR}/mindspore/core/ops/transpose.h
${TOP_DIR}/mindspore/core/ops/unique.h
${TOP_DIR}/mindspore/core/ops/unsorted_segment_sum.h
${TOP_DIR}/mindspore/core/ops/unsqueeze.h
${TOP_DIR}/mindspore/core/ops/unstack.h
${TOP_DIR}/mindspore/core/ops/where.h
${TOP_DIR}/mindspore/core/ops/zeros_like.h
${TOP_DIR}/mindspore/core/ops/select.h
${TOP_DIR}/mindspore/core/ops/scatter_nd_update.h
${TOP_DIR}/mindspore/core/ops/gru.h
${TOP_DIR}/mindspore/core/ops/non_zero.h
${TOP_DIR}/mindspore/core/ops/invert_permutation.h
${TOP_DIR}/mindspore/core/ops/size.h
${TOP_DIR}/mindspore/core/ops/random_standard_normal.h
${TOP_DIR}/mindspore/core/ops/crop_and_resize.h
${TOP_DIR}/mindspore/core/ops/erf.h
${TOP_DIR}/mindspore/core/ops/is_finite.h
${TOP_DIR}/mindspore/core/ops/lin_space.h
${TOP_DIR}/mindspore/core/ops/uniform_real.h
${TOP_DIR}/mindspore/core/ops/splice.h
${TOP_DIR}/mindspore/core/ops/log_softmax.h
${TOP_DIR}/mindspore/core/ops/call.h
${TOP_DIR}/mindspore/core/ops/custom.h
${TOP_DIR}/mindspore/core/ops/cumsum.h
${TOP_DIR}/mindspore/core/ops/split_with_overlap.h
${TOP_DIR}/mindspore/core/ops/ragged_range.h
${TOP_DIR}/mindspore/core/ops/glu.h
${TOP_DIR}/mindspore/core/ops/tensor_array.h
${TOP_DIR}/mindspore/core/ops/tensor_array_read.h
${TOP_DIR}/mindspore/core/ops/tensor_array_write.h
${TOP_DIR}/mindspore/core/ops/affine.h
${TOP_DIR}/mindspore/core/ops/all_gather.h
${TOP_DIR}/mindspore/core/ops/reduce_scatter.h
${TOP_DIR}/mindspore/core/ops/dynamic_quant.h
${TOP_DIR}/mindspore/core/ops/random_normal.h
${TOP_DIR}/mindspore/core/ops/nllloss.h
${TOP_DIR}/mindspore/core/ops/op_name.h
${TOP_DIR}/mindspore/core/ops/tuple_get_item.h
${TOP_DIR}/mindspore/core/ops/add.h
${TOP_DIR}/mindspore/core/ops/div.h
${TOP_DIR}/mindspore/core/ops/mul.h
${TOP_DIR}/mindspore/core/ops/tuple_get_item.h
${TOP_DIR}/mindspore/core/ops/scale.h
${TOP_DIR}/mindspore/core/ops/sub.h
${TOP_DIR}/mindspore/core/ops/avg_pool.h
${TOP_DIR}/mindspore/core/ops/exp.h
${TOP_DIR}/mindspore/core/ops/conv2d_transpose.h
${TOP_DIR}/mindspore/core/ops/conv2d.h
${TOP_DIR}/mindspore/core/ops/pow.h
${TOP_DIR}/mindspore/core/ops/topk.h
${TOP_DIR}/mindspore/core/ops/reduce.h
${TOP_DIR}/mindspore/core/ops/arg_max.h
${TOP_DIR}/mindspore/core/ops/max_pool.h
${TOP_DIR}/mindspore/core/ops/prelu.h
${TOP_DIR}/mindspore/core/ops/tile.h
${TOP_DIR}/mindspore/core/ops/make_tuple.h
${TOP_DIR}/mindspore/core/ops/base_operator.h
${TOP_DIR}/mindspore/core/ops/return.h
${TOP_DIR}/mindspore/core/ops/pad.h
DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ops
COMPONENT ${RUNTIME_COMPONENT_NAME}
)
install(FILES
${TOP_DIR}/mindspore/core/ops/fusion/activation.h
${TOP_DIR}/mindspore/core/ops/fusion/add_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/adder_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/arg_max_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/arg_min_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/avg_pool_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/conv2d_backprop_filter_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/conv2d_backprop_input_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/conv2d_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/conv2d_transpose_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/div_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/embedding_lookup_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/exp_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/full_connection.h
${TOP_DIR}/mindspore/core/ops/fusion/layer_norm_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/l2_normalize_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/mat_mul_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/max_pool_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/mul_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/pad_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/partial_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/pow_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/prelu_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/reduce_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/scale_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/slice_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/sub_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/tile_fusion.h
${TOP_DIR}/mindspore/core/ops/fusion/topk_fusion.h
DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ops/fusion
COMPONENT ${RUNTIME_COMPONENT_NAME}
)
endfunction()
# full mode will also package the files of lite_cv mode.
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "full")
# full header files
@ -450,10 +239,6 @@ if(PLATFORM_ARM64)
if(ANDROID_NDK_TOOLCHAIN_INCLUDED OR MSLITE_ENABLE_CONVERTER)
__install_micro_wrapper()
endif()
if(MSLITE_ENABLE_RUNTIME_GLOG)
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 DESTINATION ${GLOG_DIR} RENAME libglog.so.0
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(MSLITE_ENABLE_TOOLS)
if(NOT MSLITE_COMPILE_TWICE)
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR}
@ -492,13 +277,16 @@ if(PLATFORM_ARM64)
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${ABSTRACT_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/abstract
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${API_IR_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/api/ir
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${BASE_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/base
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${IR_DTYPE_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ir/dtype
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${IR_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ir
COMPONENT ${RUNTIME_COMPONENT_NAME})
__install_white_list_ops()
install(DIRECTORY ${TOP_DIR}/mindspore/core/ops/ DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ops
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
install(FILES ${UTILS_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/utils
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/schema/
@ -555,12 +343,12 @@ if(PLATFORM_ARM64)
DESTINATION ${RUNTIME_LIB_DIR} RENAME libturbojpeg.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${tinyxml2_LIBPATH}/libtinyxml2.so.8.0.0
DESTINATION ${RUNTIME_LIB_DIR} RENAME libtinyxml2.so.8 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicuuc.so.69.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicuuc.so.69 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicudata.so.69.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicudata.so.69 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicui18n.so.69.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicui18n.so.69 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicuuc.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicuuc.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicudata.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicudata.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicui18n.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicui18n.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_grpc++.so.1.36.1 DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_grpc++.so.1 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_grpc.so.15.0.0 DESTINATION
@ -848,10 +636,6 @@ else()
install(FILES ${TOP_DIR}/mindspore/lite/tools/obfuscator/lib/linux-x64/libmsdeobfuscator-lite.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(MSLITE_ENABLE_RUNTIME_GLOG)
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 DESTINATION ${GLOG_DIR} RENAME libglog.so.0
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(MSLITE_ENABLE_CONVERTER)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${CONVERTER_ROOT_DIR}/include
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h"
@ -864,13 +648,16 @@ else()
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${ABSTRACT_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/abstract
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${API_IR_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/api/ir
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${BASE_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/base
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${IR_DTYPE_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ir/dtype
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${IR_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ir
COMPONENT ${RUNTIME_COMPONENT_NAME})
__install_white_list_ops()
install(DIRECTORY ${TOP_DIR}/mindspore/core/ops/ DESTINATION ${CONVERTER_ROOT_DIR}/include/core/ops
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
install(FILES ${UTILS_HEADER} DESTINATION ${CONVERTER_ROOT_DIR}/include/core/utils
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/schema/ DESTINATION ${CONVERTER_ROOT_DIR}/include/schema
@ -923,12 +710,12 @@ else()
DESTINATION ${RUNTIME_LIB_DIR} RENAME libturbojpeg.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${tinyxml2_LIBPATH}/libtinyxml2.so.8.0.0
DESTINATION ${RUNTIME_LIB_DIR} RENAME libtinyxml2.so.8 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicuuc.so.69.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicuuc.so.69 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicudata.so.69.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicudata.so.69 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicui18n.so.69.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicui18n.so.69 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicuuc.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicuuc.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicudata.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicudata.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicui18n.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicui18n.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_grpc++.so.1.36.1 DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_grpc++.so.1 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_grpc.so.15.0.0 DESTINATION

View File

@ -67,7 +67,7 @@ install(
)
install(
TARGETS mindspore_core mindspore_common mindspore_backend
TARGETS mindspore_core mindspore_common
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
@ -125,12 +125,12 @@ if(ENABLE_MINDDATA)
install(FILES ${tinyxml2_LIBPATH}/libtinyxml2.8.0.0.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libtinyxml2.8.dylib COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicuuc.69.1.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libicuuc.69.dylib COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicudata.69.1.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libicudata.69.dylib COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicui18n.69.1.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libicui18n.69.dylib COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicuuc.67.1.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libicuuc.67.dylib COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicudata.67.1.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libicudata.67.dylib COMPONENT mindspore)
install(FILES ${icu4c_LIBPATH}/libicui18n.67.1.dylib
DESTINATION ${INSTALL_LIB_DIR} RENAME libicui18n.67.dylib COMPONENT mindspore)
endif()
if(ENABLE_CPU)
@ -198,7 +198,6 @@ install(
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/communication
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/profiler
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/compression
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/rewrite
${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/run_check
DESTINATION ${INSTALL_PY_DIR}
COMPONENT mindspore

View File

@ -27,7 +27,7 @@ install(
)
install(
TARGETS mindspore_core mindspore_common mindspore_backend
TARGETS mindspore_core mindspore_common
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)

View File

@ -74,7 +74,7 @@ install(
)
install(
TARGETS mindspore_core mindspore_common mindspore_backend
TARGETS mindspore_core mindspore_common
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)

File diff suppressed because it is too large Load Diff

View File

@ -253,7 +253,7 @@
{"op_name": "AssignAdd", "inputs": [{"index": 0, "name": "ref", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "value", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "ref", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [], "fusion_type": "OPAQUE", "dtype_format": [[["int8", "DefaultFormat"], ["int8", "DefaultFormat"], ["int8", "DefaultFormat"]], [["int8", "NC1HWC0"], ["int8", "NC1HWC0"], ["int8", "NC1HWC0"]], [["int8", "C1HWNCoC0"], ["int8", "C1HWNCoC0"], ["int8", "C1HWNCoC0"]], [["int8", "FracZ"], ["int8", "FracZ"], ["int8", "FracZ"]], [["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"]], [["uint8", "NC1HWC0"], ["uint8", "NC1HWC0"], ["uint8", "NC1HWC0"]], [["uint8", "C1HWNCoC0"], ["uint8", "C1HWNCoC0"], ["uint8", "C1HWNCoC0"]], [["uint8", "FracZ"], ["uint8", "FracZ"], ["uint8", "FracZ"]], [["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]], [["int32", "NC1HWC0"], ["int32", "NC1HWC0"], ["int32", "NC1HWC0"]], [["int32", "C1HWNCoC0"], ["int32", "C1HWNCoC0"], ["int32", "C1HWNCoC0"]], [["int32", "FracZ"], ["int32", "FracZ"], ["int32", "FracZ"]], [["int64", "DefaultFormat"], ["int64", "DefaultFormat"], ["int64", "DefaultFormat"]], [["int64", "NC1HWC0"], ["int64", "NC1HWC0"], ["int64", "NC1HWC0"]], [["int64", "C1HWNCoC0"], ["int64", "C1HWNCoC0"], ["int64", "C1HWNCoC0"]], [["int64", "FracZ"], ["int64", "FracZ"], ["int64", "FracZ"]], [["float16", "DefaultFormat"], ["float16", "DefaultFormat"], ["float16", "DefaultFormat"]], [["float16", "NC1HWC0"], ["float16", "NC1HWC0"], ["float16", "NC1HWC0"]], [["float16", "C1HWNCoC0"], ["float16", "C1HWNCoC0"], ["float16", "C1HWNCoC0"]], [["float16", "FracZ"], ["float16", "FracZ"], ["float16", "FracZ"]], [["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"]], [["float32", "C1HWNCoC0"], ["float32", "C1HWNCoC0"], ["float32", "C1HWNCoC0"]], [["float32", "FracZ"], ["float32", "FracZ"], ["float32", "FracZ"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "assign_add.so", "compute_cost": 10, "kernel_name": "assign_add", "partial_flag": true, "reshape_type": "", "dynamic_shape": true, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "AssignSub", "inputs": [{"index": 0, "name": "var", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "value", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "var", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [], "fusion_type": "OPAQUE", "dtype_format": [[["int8", "DefaultFormat"], ["int8", "DefaultFormat"], ["int8", "DefaultFormat"]], [["int8", "NC1HWC0"], ["int8", "NC1HWC0"], ["int8", "NC1HWC0"]], [["int8", "C1HWNCoC0"], ["int8", "C1HWNCoC0"], ["int8", "C1HWNCoC0"]], [["int8", "FracZ"], ["int8", "FracZ"], ["int8", "FracZ"]], [["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"]], [["uint8", "NC1HWC0"], ["uint8", "NC1HWC0"], ["uint8", "NC1HWC0"]], [["uint8", "C1HWNCoC0"], ["uint8", "C1HWNCoC0"], ["uint8", "C1HWNCoC0"]], [["uint8", "FracZ"], ["uint8", "FracZ"], ["uint8", "FracZ"]], [["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]], [["int32", "NC1HWC0"], ["int32", "NC1HWC0"], ["int32", "NC1HWC0"]], [["int32", "C1HWNCoC0"], ["int32", "C1HWNCoC0"], ["int32", "C1HWNCoC0"]], [["int32", "FracZ"], ["int32", "FracZ"], ["int32", "FracZ"]], [["float16", "DefaultFormat"], ["float16", "DefaultFormat"], ["float16", "DefaultFormat"]], [["float16", "NC1HWC0"], ["float16", "NC1HWC0"], ["float16", "NC1HWC0"]], [["float16", "C1HWNCoC0"], ["float16", "C1HWNCoC0"], ["float16", "C1HWNCoC0"]], [["float16", "FracZ"], ["float16", "FracZ"], ["float16", "FracZ"]], [["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"]], [["float32", "C1HWNCoC0"], ["float32", "C1HWNCoC0"], ["float32", "C1HWNCoC0"]], [["float32", "FracZ"], ["float32", "FracZ"], ["float32", "FracZ"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "assign_sub.so", "compute_cost": 10, "kernel_name": "assign_sub", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "AssignSub", "inputs": [{"index": 0, "name": "val", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "value", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "val", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [], "fusion_type": "OPAQUE", "dtype_format": [[["int8", "DefaultFormat"], ["int8", "DefaultFormat"], ["int8", "DefaultFormat"]], [["int8", "NC1HWC0"], ["int8", "NC1HWC0"], ["int8", "NC1HWC0"]], [["int8", "C1HWNCoC0"], ["int8", "C1HWNCoC0"], ["int8", "C1HWNCoC0"]], [["int8", "FracZ"], ["int8", "FracZ"], ["int8", "FracZ"]], [["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"]], [["uint8", "NC1HWC0"], ["uint8", "NC1HWC0"], ["uint8", "NC1HWC0"]], [["uint8", "C1HWNCoC0"], ["uint8", "C1HWNCoC0"], ["uint8", "C1HWNCoC0"]], [["uint8", "FracZ"], ["uint8", "FracZ"], ["uint8", "FracZ"]], [["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]], [["int32", "NC1HWC0"], ["int32", "NC1HWC0"], ["int32", "NC1HWC0"]], [["int32", "C1HWNCoC0"], ["int32", "C1HWNCoC0"], ["int32", "C1HWNCoC0"]], [["int32", "FracZ"], ["int32", "FracZ"], ["int32", "FracZ"]], [["float16", "DefaultFormat"], ["float16", "DefaultFormat"], ["float16", "DefaultFormat"]], [["float16", "NC1HWC0"], ["float16", "NC1HWC0"], ["float16", "NC1HWC0"]], [["float16", "C1HWNCoC0"], ["float16", "C1HWNCoC0"], ["float16", "C1HWNCoC0"]], [["float16", "FracZ"], ["float16", "FracZ"], ["float16", "FracZ"]], [["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"]], [["float32", "C1HWNCoC0"], ["float32", "C1HWNCoC0"], ["float32", "C1HWNCoC0"]], [["float32", "FracZ"], ["float32", "FracZ"], ["float32", "FracZ"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "assign_sub.so", "compute_cost": 10, "kernel_name": "assign_sub", "partial_flag": true, "reshape_type": "", "dynamic_shape": true, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "BatchMatMul", "inputs": [{"index": 0, "name": "x1", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "x2", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "bias", "need_compile": false, "param_type": "optional", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "transpose_x1", "param_type": "required", "type": "bool", "value": "all"}, {"name": "transpose_x2", "param_type": "required", "type": "bool", "value": "all"}], "fusion_type": "OPAQUE", "dtype_format": [[["int32", ""], ["int32", ""], ["int32", ""], ["int32", ""]], [["float16", ""], ["float16", ""], ["float16", ""], ["float16", ""]], [["float32", ""], ["float32", ""], ["float32", ""], ["float32", ""]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "batch_matmul.so", "compute_cost": 10, "kernel_name": "batch_matmul", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": true, "op_pattern": ""}
{"op_name": "BatchMatMul", "inputs": [{"index": 0, "name": "x1", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "x2", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "bias", "need_compile": false, "param_type": "optional", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "transpose_x1", "param_type": "required", "type": "bool", "value": "all"}, {"name": "transpose_x2", "param_type": "required", "type": "bool", "value": "all"}], "fusion_type": "OPAQUE", "dtype_format": [[["int32", ""], ["int32", ""], ["int32", ""], ["int32", ""]], [["float16", ""], ["float16", ""], ["float16", ""], ["float16", ""]], [["float32", ""], ["float32", ""], ["float32", ""], ["float32", ""]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "batch_matmul.so", "compute_cost": 10, "kernel_name": "batch_matmul", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": true, "is_dynamic_format": true, "op_pattern": ""}
{"op_name": "BatchMatMul", "inputs": [{"index": 0, "name": "x1", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "x2", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "bias", "need_compile": false, "param_type": "optional", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "transpose_x1", "param_type": "required", "type": "bool", "value": "all"}, {"name": "transpose_x2", "param_type": "required", "type": "bool", "value": "all"}], "fusion_type": "OPAQUE", "dtype_format": [[["float16", "FRACTAL_NZ"], ["float16", "FRACTAL_NZ"], ["float16", "DefaultFormat"], ["float16", "FRACTAL_NZ"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "batch_matmul.so", "compute_cost": 10, "kernel_name": "batch_matmul", "partial_flag": true, "reshape_type": "", "dynamic_shape": true, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "BatchMatMulV2", "inputs": [{"index": 0, "name": "x1", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "x2", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "bias", "need_compile": false, "param_type": "optional", "shape": "all"}, {"index": 3, "name": "offset_w", "need_compile": false, "param_type": "optional", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "transpose_x1", "param_type": "required", "type": "bool", "value": "all"}, {"name": "transpose_x2", "param_type": "required", "type": "bool", "value": "all"}, {"name": "offset_x", "param_type": "optional", "type": "int", "value": "all", "default_value": "0"}], "fusion_type": "OPAQUE", "dtype_format": [[["int32", ""], ["int32", ""], ["int32", ""], ["int32", ""], ["int32", ""]], [["float16", ""], ["float16", ""], ["float16", ""], ["float16", ""], ["float16", ""]], [["float32", ""], ["float32", ""], ["float32", ""], ["float32", ""], ["float32", ""]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "batch_matmul_v2.so", "compute_cost": 10, "kernel_name": "batch_matmul_v2", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": true, "is_dynamic_format": true, "op_pattern": ""}
{"op_name": "BatchNorm", "inputs": [{"index": 0, "name": "x", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "scale", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "offset", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 3, "name": "mean", "need_compile": false, "param_type": "optional", "shape": "all"}, {"index": 4, "name": "variance", "need_compile": false, "param_type": "optional", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "batch_mean", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "batch_variance", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 3, "name": "reserve_space_1", "need_compile": false, "param_type": "optional", "shape": "all"}, {"index": 4, "name": "reserve_space_2", "need_compile": false, "param_type": "optional", "shape": "all"}], "attr": [{"name": "epsilon", "param_type": "optional", "type": "float", "value": "all"}, {"name": "format", "param_type": "optional", "type": "str", "value": "all"}, {"name": "is_training", "param_type": "optional", "type": "bool", "value": "all"}], "fusion_type": "OPAQUE", "dtype_format": [[["float16", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float16", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float16", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float16", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"]], [["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"], ["float32", "NC1HWC0"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "batch_norm.so", "compute_cost": 10, "kernel_name": "batch_norm", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
@ -333,7 +333,7 @@
{"op_name": "ScatterNdSub", "inputs": [{"index": 0, "name": "var", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "indices", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "updates", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "var", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "use_locking", "param_type": "optional", "type": "bool", "value": "all", "default_value": "false"}], "fusion_type": "ELEMWISE", "dtype_format": [[["float16", "DefaultFormat"], ["int32", "DefaultFormat"], ["float16", "DefaultFormat"], ["float16", "DefaultFormat"]], [["float32", "DefaultFormat"], ["int32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["int8", "DefaultFormat"], ["int32", "DefaultFormat"], ["int8", "DefaultFormat"], ["int8", "DefaultFormat"]], [["uint8", "DefaultFormat"], ["int32", "DefaultFormat"], ["uint8", "DefaultFormat"], ["uint8", "DefaultFormat"]], [["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "scatter_nd_sub.so", "compute_cost": 10, "kernel_name": "scatter_nd_sub", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "ScatterNonAliasingAdd", "inputs": [{"index": 0, "name": "x", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "indices", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "updates", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [], "fusion_type": "ELEMWISE", "dtype_format": [[["float16", "DefaultFormat"], ["int32", "DefaultFormat"], ["float16", "DefaultFormat"], ["float16", "DefaultFormat"]], [["float32", "DefaultFormat"], ["int32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "scatter_non_aliasing_add.so", "compute_cost": 10, "kernel_name": "scatter_non_aliasing_add", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "ScatterNonAliasingAdd", "inputs": [{"index": 0, "name": "input_x", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "indices", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 2, "name": "updates", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [], "fusion_type": "ELEMWISE", "dtype_format": [[["float16", "DefaultFormat"], ["int32", "DefaultFormat"], ["float16", "DefaultFormat"], ["float16", "DefaultFormat"]], [["float32", "DefaultFormat"], ["int32", "DefaultFormat"], ["float32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "scatter_non_aliasing_add.so", "compute_cost": 10, "kernel_name": "scatter_non_aliasing_add", "partial_flag": true, "reshape_type": "", "dynamic_shape": true, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "ReduceMean", "inputs": [{"index": 0, "name": "x", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "axis", "param_type": "required", "type": "listInt", "value": "all"}, {"name": "keep_dims", "param_type": "optional", "type": "bool", "value": "all", "default_value": "false"}, {"name": "noop_with_empty_axes", "param_type": "optional", "type": "bool", "value": "all", "default_value": "false"}], "fusion_type": "OPAQUE", "dtype_format": [[["int8", ""], ["int8", ""]], [["uint8", ""], ["uint8", ""]], [["float16", ""], ["float16", ""]], [["float32", ""], ["float32", ""]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "reduce_mean.so", "compute_cost": 10, "kernel_name": "reduce_mean_d", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": "reduce"}
{"op_name": "ReduceMean", "inputs": [{"index": 0, "name": "x", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "axis", "param_type": "required", "type": "listInt", "value": "all"}, {"name": "keep_dims", "param_type": "optional", "type": "bool", "value": "all", "default_value": "false"}], "fusion_type": "OPAQUE", "dtype_format": [[["int8", ""], ["int8", ""]], [["uint8", ""], ["uint8", ""]], [["float16", ""], ["float16", ""]], [["float32", ""], ["float32", ""]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "reduce_mean.so", "compute_cost": 10, "kernel_name": "reduce_mean_d", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": "reduce"}
{"op_name": "Tile", "inputs": [{"index": 0, "name": "x1", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [{"name": "multiples", "param_type": "optional", "type": "listInt", "value": "all"}], "fusion_type": "ELEMWISE", "dtype_format": [[["", ""], ["", ""]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "tile_d.so", "compute_cost": 10, "kernel_name": "tile_d", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": true, "op_pattern": ""}
{"op_name": "Tile", "inputs": [{"index": 0, "name": "x1", "need_compile": false, "param_type": "required", "shape": "all"}, {"index": 1, "name": "multiples", "need_compile": false, "param_type": "required", "shape": "all"}], "outputs": [{"index": 0, "name": "y", "need_compile": false, "param_type": "required", "shape": "all"}], "attr": [], "fusion_type": "ELEMWISE", "dtype_format": [[["int32", "DefaultFormat"], ["int32", "DefaultFormat"], ["int32", "DefaultFormat"]], [["float32", "DefaultFormat"], ["int32", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float16", "DefaultFormat"], ["int32", "DefaultFormat"], ["float16", "DefaultFormat"]], [["int32", "DefaultFormat"], ["int64", "DefaultFormat"], ["int32", "DefaultFormat"]], [["float32", "DefaultFormat"], ["int64", "DefaultFormat"], ["float32", "DefaultFormat"]], [["float16", "DefaultFormat"], ["int64", "DefaultFormat"], ["float16", "DefaultFormat"]]], "imply_type": "TBE", "async_flag": false, "binfile_name": "tile.so", "compute_cost": 10, "kernel_name": "tile", "partial_flag": true, "reshape_type": "", "dynamic_shape": true, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}
{"op_name": "AtomicAddrClean", "inputs": [], "outputs": [], "attr": [{"name": "automic_add_mem_size", "param_type": "required", "type": "listUInt64", "value": "all"}], "fusion_type": "ELEMWISE", "dtype_format": [], "imply_type": "TBE", "async_flag": false, "binfile_name": "atomic_addr_clean.so", "compute_cost": 10, "kernel_name": "atomic_addr_clean", "partial_flag": true, "reshape_type": "", "dynamic_shape": false, "dynamic_compile_static": false, "need_check_supported": false, "is_dynamic_format": false, "op_pattern": ""}

View File

@ -3,8 +3,8 @@ mindspore.dataset.BatchInfo
.. py:class:: mindspore.dataset.BatchInfo
此类提供了两种方法获取数据集的批处理数量batch size和迭代数epoch属性。
这些属性可以用于 `batch` 操作中的输入参数 `batch_size``per_batch_map`
此类提供了两种方法获取数据集的批处理数量batch size和迭代数epoch
用于 `batch` 操作中的输入参数 `batch_size``per_batch_map`
.. py:method:: get_batch_num()

View File

@ -19,7 +19,7 @@ mindspore.dataset.Caltech101Dataset
目录Annotations用于存储图像的标注。
- **target_type** (str, 可选) - 指定数据集的子集,可取值为'category'、'annotation' 或 'all'。
取值为'category'时将读取图像的类别标注作为label取值为'annotation'时将读取图像的轮廓标注作为label
取值为'all'时将同时输出图像的类别标注和轮廓标注。默认值:None表示'category'。
取值为'all'时将同时输出图像的类别标注和轮廓标注。默认值:'category'。
- **num_samples** (int, 可选) - 指定从数据集中读取的样本数可以小于数据集总数。默认值None读取全部样本图片。
- **num_parallel_workers** (int, 可选) - 指定读取数据的工作线程数。默认值None使用mindspore.dataset.config中配置的线程数。
- **shuffle** (bool, 可选) - 是否混洗数据集。默认值None下表中会展示不同参数配置的预期行为。
@ -116,10 +116,6 @@ mindspore.dataset.Caltech101Dataset
.. include:: mindspore.dataset.Dataset.rst
.. include:: mindspore.dataset.Dataset.b.rst
.. include:: mindspore.dataset.Dataset.c.rst
.. include:: mindspore.dataset.Dataset.d.rst
.. include:: mindspore.dataset.Dataset.use_sampler.rst

View File

@ -103,8 +103,6 @@ mindspore.dataset.Caltech256Dataset
.. include:: mindspore.dataset.Dataset.rst
.. include:: mindspore.dataset.Dataset.b.rst
.. include:: mindspore.dataset.Dataset.d.rst
.. include:: mindspore.dataset.Dataset.use_sampler.rst

View File

@ -12,7 +12,7 @@ mindspore.dataset.CityscapesDataset
- **dataset_dir** (str) - 包含数据集文件的根目录路径。
- **usage** (str, 可选) - 指定数据集的子集。当参数 `quality_mode` 取值为'fine'时,此参数可取值为'train'、'test'、'val'或'all'。
当参数 `quality_mode` 取值为'coarse'时,此参数可取值为'train'、'train_extra'、'val'或'all'。默认值:'train',全部样本图片。
在参数 `quality_mode` 的其他取值下,此参数可取值为'train'、'train_extra'、'val'或'all'。默认值:'train',全部样本图片。
- **quality_mode** (str, 可选) - 指定数据集的质量模式,可取值为'fine'或'coarse'。默认值:'fine'。
- **task** (str, 可选) - 指定数据集的任务类型,可取值为'instance'、'semantic'、'polygon'或'color'。默认值:'instance'。
- **num_samples** (int, 可选) - 指定从数据集中读取的样本数可以小于数据集总数。默认值None读取全部样本图片。
@ -128,8 +128,6 @@ mindspore.dataset.CityscapesDataset
.. include:: mindspore.dataset.Dataset.rst
.. include:: mindspore.dataset.Dataset.b.rst
.. include:: mindspore.dataset.Dataset.d.rst
.. include:: mindspore.dataset.Dataset.use_sampler.rst

View File

@ -10,7 +10,7 @@ mindspore.dataset.DIV2KDataset
**参数:**
- **dataset_dir** (str) - 包含数据集文件的根目录路径。
- **usage** (str, 可选) - 指定数据集的子集。可取值为'train'、'valid'或'all'。默认值:'train'。
- **usage** (str, 可选) - 指定数据集的子集。可取值为'train'、'valid'或'all'。默认值:'train',全部样本图片
- **downgrade** (str, 可选) - 指定数据集的下采样的模式,可取值为'bicubic'、'unknown'、'mild'、'difficult'或'wild'。默认值:'bicubic'。
- **scale** (str, 可选) - 指定数据集的缩放尺度。当参数 `downgrade` 取值为'bicubic'时此参数可以取值为2、3、4、8。
当参数 `downgrade` 取值为'unknown'时此参数可以取值为2、3、4。当参数 `downgrade` 取值为'mild'、'difficult'、'wild'时此参数仅可以取值为4。默认值2。
@ -143,8 +143,6 @@ mindspore.dataset.DIV2KDataset
.. include:: mindspore.dataset.Dataset.rst
.. include:: mindspore.dataset.Dataset.b.rst
.. include:: mindspore.dataset.Dataset.d.rst
.. include:: mindspore.dataset.Dataset.use_sampler.rst

View File

@ -1,7 +1,7 @@
.. py:method:: add_sampler(new_sampler)
为当前数据集添加采样器。
为当前数据集对象添加采样器。
**参数:**
- **new_sampler** (Sampler):待添加的子采样器。
- **new_sampler** (Sampler) :作用于当前数据集对象的采样器。

View File

@ -16,7 +16,7 @@
- **pad_info** (dict, 可选) - 对指定数据列进行填充。通过传入dict来指定列信息与填充信息要求dict的键是要填充的数据列名dict的值是包含2个元素的元组。
元组中第1个元素表示要扩展至的目标shape第2个元素表示要填充的值。
如果某一个数据列未指定将要填充后的shape和填充值则该列中的每条数据都将填充至该批次中最长数据的长度且填充值为0。
注意,`pad_info` 中任何填充shape为None的列其每条数据长度都将被填充为当前批处理中最数据的长度,除非指定 `pad_to_bucket_boundary` 为True。默认值None不填充。
注意,`pad_info` 中任何填充shape为None的列其每条数据长度都将被填充为当前批处理中最数据的长度除非指定 `pad_to_bucket_boundary` 为True。默认值None不填充。
- **pad_to_bucket_boundary** (bool, 可选) - 如果为True`pad_info` 中填充shape为None的列会被填充至由参数 `bucket_batch_sizes` 指定的对应分桶长度-1的长度。
如果有任何数据落入最后一个分桶中则将报错。默认值False。
- **drop_remainder** (bool, 可选) - 当每个分桶中的最后一个批处理数据数据条目小于 `bucket_batch_sizes`是否丢弃该批处理数据。默认值False不丢弃。

View File

@ -32,7 +32,7 @@
.. py:method:: create_tuple_iterator(columns=None, num_epochs=-1, output_numpy=False, do_copy=True)
基于数据集对象创建迭代器,输出数据为 `numpy.ndarray` 组成的列表。
基于数据集对象创建迭代器输出数据为ndarray组成的列表。
可以通过参数 `columns` 指定输出的所有列名及列的顺序。如果columns未指定列的顺序将保持不变。
@ -95,7 +95,7 @@
**参数:**
- **func** (function) - 数据处理函数,要求输入必须为一个 `numpy.ndarray` ,返回值是一个 `Dataset` 对象。
- **func** (function) - 数据处理函数,要求输入必须为一个'ndarray',返回值是一个'Dataset'对象。
**返回:**
@ -104,7 +104,7 @@
**异常:**
- **TypeError** - `func` 不是函数。
- **TypeError** - `func` 的返回值不是 `Dataset` 对象。
- **TypeError** - `func` 的返回值不是数据集对象。
.. py:method:: get_batch_size()
@ -120,7 +120,7 @@
**返回:**
dict描述类别名称到索引的键值对映射关系通常为str-to-int格式。针对COCO数据集类别名称到索引映射关系描述形式为str-to-list<int>格式,列表中的第二个数字表示超类别。
dict描述类别名称到索引的键值对映射关系通常为str-to-int格式。针对COCO数据集类别名称到索引映射关系描述形式为str-to-list<int>格式,列表中的第二个数字表示超类别。
.. py:method:: get_col_names()
@ -150,11 +150,11 @@
.. py:method:: input_indexs
:property:
数据集的input index信息。
获取input index信息。
**返回:**
int数据集的input index信息。
input index信息的元组
.. py:method:: map(operations, input_columns=None, output_columns=None, column_order=None, num_parallel_workers=None, python_multiprocessing=False, cache=None, callbacks=None, max_rowsize=16, offload=None)
@ -187,10 +187,6 @@
MapDatasetmap操作后的数据集。
.. py:method:: notify_watchdog()
关闭数据集对象中的watchdog线程。当前GeneratorDataset/map/batch开启多进程时会各自拉起一个watchdog线程来监控多进程的状态对于get_dataset_size/output_shapes/output_types/get_col_names/num_classes这些接口其内部默认调用了notify_watchdog。
.. py:method:: num_classes()
获取数据集对象中所有样本的类别数目。
@ -243,7 +239,7 @@
.. py:method:: repeat(count=None)
重复此数据集 `count` 次。如果 `count` 为None或-1则无限重复迭代
重复此数据集 `count` 次。如果 `count` 为None或-1则无限重复。
.. note::
repeat和batch的顺序反映了batch的数量。建议repeat操作在batch操作之后使用。
@ -395,10 +391,10 @@
**异常:**
- **RuntimeError** - 数据集对象不支持 `get_dataset_size` 或者 `get_dataset_size` 返回None。
- **RuntimeError** - `sizes` 是list[int],并且 `sizes` 中所有元素的总和不等于数据集大小。
- **RuntimeError** - `sizes` 是list[float]并且计算后存在大小为0的拆分子数据集。
- **RuntimeError** - sizes是整数列表并且size中所有元素的总和不等于数据集大小。
- **RuntimeError** - sizes是float列表并且计算后存在大小为0的拆分子数据集。
- **RuntimeError** - 数据集对象在调用拆分之前已进行分片。
- **ValueError** - `sizes` 是list[float]且并非所有float数值都在0和1之间或者float数值的总和不等于1。
- **ValueError** - sizes是float列表且并非所有float数都在0和1之间或者float数的总和不等于1。
**返回:**

View File

@ -13,7 +13,7 @@
**异常:**
- **TypeError** - `apply_func` 的类型不是函数。
- **TypeError** - `apply_func` 未返回 `Dataset` 对象。
- **TypeError** - `apply_func` 未返回Dataset对象。
.. py:method:: batch(batch_size, drop_remainder=False, num_parallel_workers=None, per_batch_map=None, input_columns=None, output_columns=None, column_order=None, pad_info=None, python_multiprocessing=False, max_rowsize=16)
@ -44,7 +44,7 @@
如果 `input_column` 长度不等于 `output_column` 长度,则此参数必须指定。
注意:列名不限定在 `input_columns``output_columns` 中指定的列也可以是上一个操作输出的未被处理的数据列详细可参阅使用样例4。默认值None按照原输入顺序排列。
- **pad_info** (dict, 可选) - 对给定数据列进行填充。通过传入dict来指定列信息与填充信息例如 `pad_info={"col1":([224,224],0)}`
则将列名为"col1"的数据列扩充到shape为(224, 224)的Tensor缺失的值使用0填充。默认值None不填充。
则将列名为"col1"的数据列扩充到shape为[224,224]的Tensor缺失的值使用0填充。默认值None不填充。
- **python_multiprocessing** (bool, 可选) - 启动Python多进程模式并行执行 `per_batch_map` 。如果 `per_batch_map` 的计算量很大此选项可能会很有用。默认值False不启用多进程。
- **max_rowsize** (int, 可选) - 指定在多进程之间复制数据时,共享内存分配的最大空间,仅当 `python_multiprocessing` 为True时该选项有效。默认值16单位为MB。

View File

@ -1,7 +1,7 @@
.. py:method:: use_sampler(new_sampler)
替换当前数据集的最末子采样器,保持父采样器不变
为当前数据集对象更换一个新的采样器
**参数:**
- **new_sampler** (Sampler) 用于替换的新采样器。
- **new_sampler** (Sampler) :替换的新采样器。

View File

@ -15,11 +15,11 @@ mindspore.dataset.DistributedSampler
**异常:**
- **TypeError** - `num_shards` 的类型不是int
- **TypeError** - `shard_id` 的类型不是int
- **TypeError** - `shuffle` 的类型不是bool
- **TypeError** - `num_samples` 的类型不是int
- **TypeError** - `offset` 的类型不是int
- **TypeError** - `num_shards` 不是整数值
- **TypeError** - `shard_id` 不是整数值
- **TypeError** - `shuffle` 不是Boolean值
- **TypeError** - `num_samples` 不是整数值
- **TypeError** - `offset` 不是整数值
- **ValueError** - `num_samples` 为负值。
- **RuntimeError** - `num_shards` 不是正值。
- **RuntimeError** - `shard_id` 小于0或大于等于 `num_shards`

View File

@ -164,6 +164,22 @@ mindspore.dataset.GraphData
**TypeError**:参数 `node_type` 的类型不为整型。
.. py:method:: get_edges_from_nodes(node_list)
从节点获取边。
**参数:**
- **node_list** (Union[list[tuple], numpy.ndarray]) - 含一个或多个图节点ID对的列表。
**返回:**
numpy.ndarray含一个或多个边ID的数组。
**异常:**
**TypeError**:参数 `edge_list` 的类型不为列表或numpy.ndarray。
.. py:method:: get_edge_feature(edge_list, feature_types)
获取 `edge_list` 列表中边的特征,以 `feature_types` 类型返回。
@ -182,21 +198,6 @@ mindspore.dataset.GraphData
- **TypeError** - 参数 `edge_list` 的类型不为列表或numpy.ndarray。
- **TypeError** - 参数 `feature_types` 的类型不为列表或numpy.ndarray。
.. py:method:: get_edges_from_nodes(node_list)
从节点获取边。
**参数:**
- **node_list** (Union[list[tuple], numpy.ndarray]) - 含一个或多个图节点ID对的列表。
**返回:**
numpy.ndarray含一个或多个边ID的数组。
**异常:**
**TypeError**:参数 `edge_list` 的类型不为列表或numpy.ndarray。
.. py:method:: get_neg_sampled_neighbors(node_list, neg_neighbor_num, neg_neighbor_type)
@ -218,6 +219,22 @@ mindspore.dataset.GraphData
- **TypeError** - 参数 `neg_neighbor_num` 的类型不为整型。
- **TypeError** - 参数 `neg_neighbor_type` 的类型不为整型。
.. py:method:: get_nodes_from_edges(edge_list)
从图中的边获取节点。
**参数:**
- **edge_list** (Union[list, numpy.ndarray]) - 包含边的列表。
**返回:**
numpy.ndarray包含节点的数组。
**异常:**
**TypeError** 参数 `edge_list` 不为列表或ndarray。
.. py:method:: get_node_feature(node_list, feature_types)
获取 `node_list` 中节点的特征,以 `feature_types` 类型返回。
@ -236,23 +253,6 @@ mindspore.dataset.GraphData
- **TypeError** - 参数 `node_list` 的类型不为列表或numpy.ndarray。
- **TypeError** - 参数 `feature_types` 的类型不为列表或numpy.ndarray。
.. py:method:: get_nodes_from_edges(edge_list)
从图中的边获取节点。
**参数:**
- **edge_list** (Union[list, numpy.ndarray]) - 包含边的列表。
**返回:**
numpy.ndarray包含节点的数组。
**异常:**
**TypeError** 参数 `edge_list` 不为列表或ndarray。
.. py:method:: get_sampled_neighbors(node_list, neighbor_nums, neighbor_types, strategy=SamplingStrategy.RANDOM)
获取已采样相邻节点信息。此API支持多跳相邻节点采样。即将上一次采样结果作为下一跳采样的输入最多允许6跳。采样结果平铺成列表格式为[input node, 1-hop sampling result, 2-hop samling result ...]

View File

@ -1,51 +0,0 @@
mindspore.dataset.OBSMindDataset
================================
.. py:class:: mindspore.dataset.OBSMindDataset(dataset_files, server, ak, sk, sync_obs_path, columns_list=None, shuffle=Shuffle.GLOBAL, num_shards=None, shard_id=None, shard_equal_rows=True)
读取和解析存放在OBS上的MindRecord格式数据集。生成的数据集的列名和列类型取决于MindRecord文件中的保存的列名与类型。
**参数:**
- **dataset_files** (list[str]) - OBS上MindRecord格式数据集文件的路径列表每个文件的路径前缀为s3://。
- **server** (str) - 连接OBS的服务地址。可包含协议类型、域名、端口号。示例<https://your-endpoint:9000>。
- **ak** (str) - 访问密钥中的AK。
- **sk** (str) - 访问密钥中的SK。
- **sync_obs_path** (str) - 用于同步操作的OBS路径用户需要提前创建目录路径的前缀为s3://。
- **columns_list** (list[str],可选) - 指定从MindRecord文件中读取的数据列。默认值None读取所有列。
- **shuffle** (Union[bool, Shuffle], 可选) - 每个epoch中数据混洗的模式支持传入bool类型与枚举类型进行指定默认值mindspore.dataset.Shuffle.GLOBAL。
如果 `shuffle` 为False则不混洗如果 `shuffle` 为True等同于将 `shuffle` 设置为mindspore.dataset.Shuffle.GLOBAL。
通过传入枚举变量设置数据混洗的模式:
- **Shuffle.GLOBAL**:混洗文件和文件中的数据。
- **Shuffle.FILES**:仅混洗文件。
- **Shuffle.INFILE**:保持读入文件的序列,仅混洗每个文件中的数据。
- **num_shards** (int, 可选) - 指定分布式训练时将数据集进行划分的分片数默认值None。
- **shard_id** (int, 可选) - 指定分布式训练时使用的分片ID号默认值None。只有当指定了 `num_shards` 时才能指定此参数。
- **shard_equal_rows** (bool, 可选) - 分布式训练时为所有分片获取等量的数据行数。默认值True。
如果 `shard_equal_rows` 为False则可能会使得每个分片的数据条目不相等从而导致分布式训练失败。
因此当每个TFRecord文件的数据数量不相等时建议将此参数设置为True。注意只有当指定了 `num_shards` 时才能指定此参数。
**异常:**
- **RuntimeError** - `sync_obs_path` 参数指定的目录不存在。
- **ValueError** - `columns_list` 参数无效。
- **RuntimeError** - 指定了 `num_shards` 参数,但是未指定 `shard_id` 参数。
- **RuntimeError** - 指定了 `shard_id` 参数,但是未指定 `num_shards` 参数。
- **ValueError** - `shard_id` 参数值错误小于0或者大于等于 `num_shards` )。
.. note::
- 需要用户提前在OBS上创建同步用的目录然后通过 `sync_obs_path` 指定。
- 如果线下训练,建议为每次训练设置 `BATCH_JOB_ID` 环境变量。
- 分布式训练中假如使用多个节点服务器则必须使用每个节点全部的8张卡。如果只有一个节点服务器则没有这样的限制。
.. include:: mindspore.dataset.Dataset.rst
.. include:: mindspore.dataset.Dataset.b.rst
.. include:: mindspore.dataset.Dataset.c.rst
.. include:: mindspore.dataset.Dataset.d.rst
.. include:: mindspore.dataset.Dataset.zip.rst

View File

@ -15,9 +15,9 @@ mindspore.dataset.PKSampler
**异常:**
- **TypeError** `shuffle` 的类型不是bool。
- **TypeError** `class_column` 的类型不是str。
- **TypeError** `num_samples` 的类型不是int
- **TypeError** `shuffle` 不是bool
- **TypeError** `class_column` 不是str
- **TypeError** `num_samples` 不是整数值
- **NotImplementedError** `num_class` 不为None。
- **RuntimeError** `num_val` 不是正值。
- **ValueError** `num_samples` 为负值。

View File

@ -13,7 +13,7 @@ mindspore.dataset.PaddedDataset
- **TypeError** - `padded_samples` 的类型不为list。
- **TypeError** - `padded_samples` 的元素类型不为dict。
- **ValueError** - `padded_samples` 为空的list
- **ValueError** - `padded_samples` 为空列表
.. include:: mindspore.dataset.Dataset.add_sampler.rst

View File

@ -7,7 +7,7 @@ mindspore.dataset.RandomSampler
**参数:**
- **replacement** (bool, 可选): 是否将样本ID放回下一次采样默认值False放回采样。
- **replacement** (bool, 可选): 是否将样本ID放回下一次采样默认值True放回采样。
- **num_samples** (int, 可选): 获取的样本数可用于部分获取采样得到的样本。默认值None获取采样到的所有样本。
**异常:**

Some files were not shown because too many files have changed in this diff Show More