2018-11-20 00:48:22 +00:00
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
2019-04-29 19:58:20 +00:00
file ( GLOB_RECURSE onnxruntime_graph_src CONFIGURE_DEPENDS
2019-03-26 19:31:36 +00:00
" $ { O N N X R U N T I M E _ I N C L U D E _ D I R } / c o r e / g r a p h / * . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / * . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / * . c c "
)
2024-03-12 18:33:30 +00:00
# start with empty training srcs list
set ( orttraining_graph_src )
if ( onnxruntime_ENABLE_TRAINING_OPS AND NOT onnxruntime_ENABLE_TRAINING )
set ( orttraining_graph_src
" $ { O R T T R A I N I N G _ S O U R C E _ D I R } / c o r e / g r a p h / t r a i n i n g _ o p _ d e f s . c c "
" $ { O R T T R A I N I N G _ S O U R C E _ D I R } / c o r e / g r a p h / t r a i n i n g _ o p _ d e f s . h "
)
endif ( )
if ( onnxruntime_ENABLE_TRAINING )
file ( GLOB_RECURSE orttraining_graph_src CONFIGURE_DEPENDS
" $ { O R T T R A I N I N G _ S O U R C E _ D I R } / c o r e / g r a p h / * . h "
" $ { O R T T R A I N I N G _ S O U R C E _ D I R } / c o r e / g r a p h / * . c c "
)
endif ( )
# create empty lists for any excludes
2020-08-21 21:14:53 +00:00
set ( onnxruntime_graph_src_exclude_patterns )
2024-03-12 18:33:30 +00:00
set ( orttraining_graph_src_exclude_patterns )
2020-08-21 21:14:53 +00:00
if ( onnxruntime_MINIMAL_BUILD )
2020-08-22 21:02:13 +00:00
# remove schema registration support
2020-08-21 21:14:53 +00:00
list ( APPEND onnxruntime_graph_src_exclude_patterns
2020-08-22 21:02:13 +00:00
" $ { O N N X R U N T I M E _ I N C L U D E _ D I R } / c o r e / g r a p h / s c h e m a _ r e g i s t r y . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / s c h e m a _ r e g i s t r y . c c "
2020-08-21 21:14:53 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / * d e f s . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / * d e f s . c c "
2022-02-09 17:31:58 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / o n n x _ d e p r e c a t e d _ o p e r a t o r s . c c "
2021-03-25 18:34:06 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / o n n x _ f u n c t i o n _ u t i l . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / o n n x _ f u n c t i o n _ u t i l . c c "
2023-11-03 13:38:29 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / s h a p e _ i n f e r e n c e _ f u n c t i o n s . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / s h a p e _ i n f e r e n c e _ f u n c t i o n s . c c "
2024-03-12 18:33:30 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / d m l _ o p s / d m l _ d e f s . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / d m l _ o p s / d m l _ d e f s . c c "
2022-04-29 17:15:58 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / f u n c t i o n _ t e m p l a t e . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / f u n c t i o n _ u t i l s . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / f u n c t i o n _ u t i l s . c c "
2020-08-21 21:14:53 +00:00
)
2024-03-12 18:33:30 +00:00
list ( APPEND orttraining_graph_src_exclude_patterns
" $ { O R T T R A I N I N G _ S O U R C E _ D I R } / c o r e / g r a p h / t r a i n i n g _ o p _ d e f s . h "
" $ { O R T T R A I N I N G _ S O U R C E _ D I R } / c o r e / g r a p h / t r a i n i n g _ o p _ d e f s . c c "
)
2020-08-21 21:14:53 +00:00
# no Function support initially
list ( APPEND onnxruntime_graph_src_exclude_patterns
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / f u n c t i o n * "
)
2022-05-05 15:30:07 +00:00
# remove graph proto serializer
list ( APPEND onnxruntime_graph_src_exclude_patterns
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / g r a p h _ p r o t o _ s e r i a l i z e r . c c "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / g r a p h _ p r o t o _ s e r i a l i z e r . h "
)
2021-08-27 07:16:05 +00:00
# no optimizer support in base minimal build
# some optimizer support in extended minimal build
if ( NOT onnxruntime_EXTENDED_MINIMAL_BUILD )
list ( APPEND onnxruntime_graph_src_exclude_patterns
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / g r a p h _ u t i l s . * "
)
endif ( )
2020-08-21 21:14:53 +00:00
endif ( )
2019-03-26 19:31:36 +00:00
if ( onnxruntime_DISABLE_CONTRIB_OPS )
2020-08-21 21:14:53 +00:00
list ( APPEND onnxruntime_graph_src_exclude_patterns
2019-03-26 19:31:36 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / * . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / c o n t r i b _ o p s / * . c c "
)
endif ( )
2018-11-20 00:48:22 +00:00
2019-10-15 13:13:07 +00:00
if ( NOT onnxruntime_USE_DML )
2020-08-21 21:14:53 +00:00
list ( APPEND onnxruntime_graph_src_exclude_patterns
2019-10-15 13:13:07 +00:00
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / d m l _ o p s / * . h "
" $ { O N N X R U N T I M E _ R O O T } / c o r e / g r a p h / d m l _ o p s / * . c c "
)
endif ( )
2020-08-21 21:14:53 +00:00
file ( GLOB onnxruntime_graph_src_exclude ${ onnxruntime_graph_src_exclude_patterns } )
list ( REMOVE_ITEM onnxruntime_graph_src ${ onnxruntime_graph_src_exclude } )
2022-12-14 16:32:46 +00:00
if ( onnxruntime_ENABLE_TRAINING_OPS )
2024-03-12 18:33:30 +00:00
file ( GLOB orttraining_graph_src_exclude ${ orttraining_graph_src_exclude_patterns } )
list ( REMOVE_ITEM orttraining_graph_src ${ orttraining_graph_src_exclude } )
2020-03-11 21:25:37 +00:00
endif ( )
2024-03-12 18:33:30 +00:00
onnxruntime_add_static_library ( onnxruntime_graph ${ onnxruntime_graph_src } ${ orttraining_graph_src } )
2022-12-20 19:44:02 +00:00
add_dependencies ( onnxruntime_graph onnx_proto flatbuffers::flatbuffers )
2023-08-15 16:11:46 +00:00
onnxruntime_add_include_to_target ( onnxruntime_graph onnxruntime_common ${ WIL_TARGET } onnx onnx_proto ${ PROTOBUF_LIB } flatbuffers::flatbuffers safeint_interface Boost::mp11 )
2022-08-15 16:59:07 +00:00
if ( MSVC )
set ( ONNX_PROTOBUF_NATVIS_FILE "onnx_protobuf.natvis" )
target_sources (
o n n x r u n t i m e _ g r a p h
I N T E R F A C E $ < B U I L D _ I N T E R F A C E : $ { P R O J E C T _ S O U R C E _ D I R } / e x t e r n a l / $ { O N N X _ P R O T O B U F _ N A T V I S _ F I L E } >
)
endif ( )
2021-07-31 00:16:37 +00:00
if ( NOT MSVC )
Update C/C++ dependencies: abseil, date, nsync, googletest, wil, mp11, cpuinfo and safeint (#15470)
### Description
Update C/C++ dependencies abseil, date, nsync, googletest, wil, mp11,
cpuinfo and safeint to newer versions per request of @
mayeut. He created the following PRs to update the deps:
https://github.com/microsoft/onnxruntime/pull/15432
https://github.com/microsoft/onnxruntime/pull/15434
https://github.com/microsoft/onnxruntime/pull/15435
https://github.com/microsoft/onnxruntime/pull/15436
https://github.com/microsoft/onnxruntime/pull/15437
However, our build system needs to fetch the dependencies from an
internal mirror that only Microsoft employees have write access to. So I
closed his PRs and created this one.
This PR also updates abseil to a newer version. This is to prepare for
upgrading re2.
2023-09-08 20:35:04 +00:00
target_compile_options ( onnxruntime_graph PRIVATE "-Wno-parentheses" "-Wno-deprecated-declarations" )
2021-07-31 00:16:37 +00:00
endif ( )
2020-06-24 03:18:16 +00:00
if ( onnxruntime_ENABLE_TRAINING )
#TODO: the graph library should focus on ONNX IR, it shouldn't depend on math libraries like MKLML/OpenBlas
target_include_directories ( onnxruntime_graph PRIVATE ${ MKLML_INCLUDE_DIR } )
2021-07-23 08:53:26 +00:00
target_link_libraries ( onnxruntime_graph PRIVATE nlohmann_json::nlohmann_json )
2020-06-24 03:18:16 +00:00
endif ( )
2018-11-20 00:48:22 +00:00
target_include_directories ( onnxruntime_graph PRIVATE ${ ONNXRUNTIME_ROOT } )
2020-03-11 21:25:37 +00:00
2022-12-14 16:32:46 +00:00
if ( onnxruntime_ENABLE_TRAINING_OPS )
2020-03-11 21:25:37 +00:00
target_include_directories ( onnxruntime_graph PRIVATE ${ ORTTRAINING_ROOT } )
2020-06-15 15:47:03 +00:00
2020-09-09 16:39:56 +00:00
if ( onnxruntime_USE_NCCL )
target_include_directories ( onnxruntime_graph PRIVATE ${ NCCL_INCLUDE_DIRS } )
endif ( )
2020-03-11 21:25:37 +00:00
endif ( )
2018-11-20 00:48:22 +00:00
set_target_properties ( onnxruntime_graph PROPERTIES FOLDER "ONNXRuntime" )
set_target_properties ( onnxruntime_graph PROPERTIES LINKER_LANGUAGE CXX )
2024-03-12 18:33:30 +00:00
source_group ( TREE ${ REPO_ROOT } FILES ${ onnxruntime_graph_src } )
2022-12-14 16:32:46 +00:00
if ( onnxruntime_ENABLE_TRAINING_OPS )
2020-03-11 21:25:37 +00:00
source_group ( TREE ${ ORTTRAINING_ROOT } FILES ${ orttraining_graph_src } )
endif ( )
2018-11-20 00:48:22 +00:00
2021-02-12 22:17:10 +00:00
if ( onnxruntime_BUILD_MS_EXPERIMENTAL_OPS )
target_compile_definitions ( onnxruntime_graph PRIVATE BUILD_MS_EXPERIMENTAL_OPS=1 )
endif ( )
2018-11-20 00:48:22 +00:00
if ( WIN32 )
2020-09-04 21:59:01 +00:00
set ( onnxruntime_graph_static_library_flags
- I G N O R E : 4 2 2 1 # LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library
)
2019-03-21 21:06:38 +00:00
2020-09-04 21:59:01 +00:00
set_target_properties ( onnxruntime_graph PROPERTIES
S T A T I C _ L I B R A R Y _ F L A G S " $ { o n n x r u n t i m e _ g r a p h _ s t a t i c _ l i b r a r y _ f l a g s } " )
2019-03-21 21:06:38 +00:00
2022-06-09 08:07:30 +00:00
if ( NOT onnxruntime_DISABLE_EXCEPTIONS )
2018-11-20 00:48:22 +00:00
target_compile_options ( onnxruntime_graph PRIVATE
/ E H s c # exception handling - C++ may throw, extern "C" will not
)
2022-06-09 08:07:30 +00:00
endif ( )
endif ( )
if ( onnxruntime_ENABLE_ATEN )
target_compile_definitions ( onnxruntime_graph PRIVATE ENABLE_ATEN )
2018-11-20 00:48:22 +00:00
endif ( )
2022-04-04 05:37:18 +00:00
if ( NOT onnxruntime_BUILD_SHARED_LIB )
2023-06-20 05:20:31 +00:00
install ( DIRECTORY ${ PROJECT_SOURCE_DIR } /../include/onnxruntime/core/graph DESTINATION ${ CMAKE_INSTALL_INCLUDEDIR } /onnxruntime/core )
install ( TARGETS onnxruntime_graph
2022-04-04 05:37:18 +00:00
A R C H I V E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
L I B R A R Y D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ L I B D I R }
R U N T I M E D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R }
F R A M E W O R K D E S T I N A T I O N $ { C M A K E _ I N S T A L L _ B I N D I R } )
endif ( )