Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
MIGraphX
Commits
42bdd4e3
Commit
42bdd4e3
authored
Oct 05, 2023
by
Artur Wojcik
Browse files
cmake_onnx
parent
da93af43
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
7 deletions
+46
-7
src/onnx/CMakeLists.txt
src/onnx/CMakeLists.txt
+46
-7
No files found.
src/onnx/CMakeLists.txt
View file @
42bdd4e3
...
@@ -21,13 +21,33 @@
...
@@ -21,13 +21,33 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
# THE SOFTWARE.
#####################################################################################
#####################################################################################
find_package
(
Protobuf REQUIRED
)
protobuf_generate_cpp
(
PROTO_SRCS PROTO_HDRS onnx.proto
)
add_library
(
onnx-proto STATIC onnx.proto
)
add_library
(
onnx-proto STATIC
${
PROTO_SRCS
}
)
if
(
WIN32
)
target_include_directories
(
onnx-proto SYSTEM PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
${
PROTOBUF_INCLUDE_DIR
}
)
include
(
${
protobuf_DIR
}
/protobuf-generate.cmake
)
target_compile_options
(
onnx-proto PRIVATE -w
)
add_dependencies
(
onnx-proto protobuf::protoc
)
target_link_libraries
(
onnx-proto PRIVATE
${
PROTOBUF_LIBRARY
}
)
target_compile_options
(
onnx-proto
PRIVATE
-Wno-used-but-marked-unused
-Wno-switch-enum
-Wno-reserved-identifier
-Wno-inconsistent-missing-destructor-override
-Wno-suggest-destructor-override
-Wno-zero-as-null-pointer-constant
-Wno-undef
-Wno-unused-parameter
-Wno-shadow-field-in-constructor
-Wno-covered-switch-default
)
protobuf_generate
(
TARGET onnx-proto
)
else
()
find_package
(
Protobuf REQUIRED
)
protobuf_generate_cpp
(
PROTO_SRCS PROTO_HDRS onnx.proto
)
target_sources
(
onnx-proto PRIVATE
${
PROTO_SRCS
}
${
PROTO_HDRS
}
)
target_include_directories
(
onnx-proto SYSTEM PUBLIC
${
CMAKE_CURRENT_BINARY_DIR
}
${
PROTOBUF_INCLUDE_DIR
}
)
target_compile_options
(
onnx-proto PRIVATE -w
)
endif
()
target_link_libraries
(
onnx-proto PRIVATE protobuf::libprotobuf
)
set_target_properties
(
onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On
)
set_target_properties
(
onnx-proto PROPERTIES POSITION_INDEPENDENT_CODE On
)
file
(
GLOB ONNX_SRCS CONFIGURE_DEPENDS *.cpp
)
file
(
GLOB ONNX_SRCS CONFIGURE_DEPENDS *.cpp
)
...
@@ -37,7 +57,26 @@ set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx)
...
@@ -37,7 +57,26 @@ set_target_properties(migraphx_onnx PROPERTIES EXPORT_NAME onnx)
migraphx_generate_export_header
(
migraphx_onnx
)
migraphx_generate_export_header
(
migraphx_onnx
)
rocm_set_soversion
(
migraphx_onnx
${
MIGRAPHX_SO_VERSION
}
)
rocm_set_soversion
(
migraphx_onnx
${
MIGRAPHX_SO_VERSION
}
)
rocm_clang_tidy_check
(
migraphx_onnx
)
rocm_clang_tidy_check
(
migraphx_onnx
)
target_link_libraries
(
migraphx_onnx PRIVATE onnx-proto
"-Wl,--exclude-libs,ALL"
)
if
(
WIN32
)
# (!!!) Link protobuf statically on Windows (!!!)
# Refer to protobuf/cmake/README.md for details.
target_link_libraries
(
migraphx_onnx PRIVATE onnx-proto protobuf::libprotobuf
)
target_include_directories
(
migraphx_onnx SYSTEM PRIVATE
${
CMAKE_CURRENT_BINARY_DIR
}
)
target_compile_options
(
migraphx_onnx
PRIVATE
-Wno-used-but-marked-unused
-Wno-switch-enum
-Wno-reserved-identifier
-Wno-inconsistent-missing-destructor-override
-Wno-suggest-destructor-override
-Wno-zero-as-null-pointer-constant
-Wno-undef
-Wno-unused-parameter
-Wno-shadow-field-in-constructor
-Wno-covered-switch-default
)
else
()
target_link_libraries
(
migraphx_onnx PRIVATE onnx-proto
"-Wl,--exclude-libs,ALL"
)
endif
()
target_link_libraries
(
migraphx_onnx PUBLIC migraphx
)
target_link_libraries
(
migraphx_onnx PUBLIC migraphx
)
rocm_install_targets
(
rocm_install_targets
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment