diff options
Diffstat (limited to '0000-Build-shared-libraries-and-fix-install-location.patch')
-rw-r--r-- | 0000-Build-shared-libraries-and-fix-install-location.patch | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/0000-Build-shared-libraries-and-fix-install-location.patch b/0000-Build-shared-libraries-and-fix-install-location.patch new file mode 100644 index 0000000..5ebf4d3 --- /dev/null +++ b/0000-Build-shared-libraries-and-fix-install-location.patch @@ -0,0 +1,80 @@ +From 8a2a2327e89fb62bb74ced121cbdf8c3a59ad04f Mon Sep 17 00:00:00 2001 +From: Alejandro Alvarez Ayllon <a.alvarezayllon@gmail.com> +Date: Sat, 24 Feb 2024 14:48:45 +0100 +Subject: [PATCH 0/6] Build shared libraries and fix install location + +--- + CMakeLists.txt | 22 ++++++++++++++++++++-- + 1 file changed, 20 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4dd56b6e..7f79cc9a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -470,7 +470,7 @@ + list(REMOVE_ITEM __tmp_srcs ${onnx_gtests_src}) + list(APPEND ONNX_SRCS ${__tmp_srcs}) + +-add_library(onnx_proto ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS}) ++add_library(onnx_proto SHARED ${ONNX_PROTO_SRCS} ${ONNX_PROTO_HDRS}) + add_dependencies(onnx_proto gen_onnx_operators_proto gen_onnx_data_proto) + target_include_directories(onnx_proto PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> +@@ -495,6 +495,8 @@ + set(ONNX_API_DEFINE "-DONNX_API=__attribute__\(\(__visibility__\(\"default\"\)\)\)") + set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden) + set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1) ++ set_target_properties(onnx_proto PROPERTIES VERSION ${ONNX_VERSION} ++ SOVERSION ${ONNX_VERSION}) + endif() + target_compile_definitions(onnx_proto PRIVATE ${ONNX_API_DEFINE}) + target_compile_features(onnx_proto PUBLIC cxx_std_${CMAKE_CXX_STANDARD}) +@@ -519,10 +521,12 @@ + # So, create a object library + add_library(onnx OBJECT ${ONNX_SRCS}) + else() +- add_library(onnx ${ONNX_SRCS}) ++ add_library(onnx SHARED ${ONNX_SRCS}) ++ set_target_properties(onnx PROPERTIES VERSION ${ONNX_VERSION} ++ SOVERSION ${ONNX_VERSION}) + endif() +-set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET hidden) +-set_target_properties(onnx PROPERTIES VISIBILITY_INLINES_HIDDEN ON) ++set_target_properties(onnx PROPERTIES CXX_VISIBILITY_PRESET default) ++set_target_properties(onnx PROPERTIES VISIBILITY_INLINES_HIDDEN OFF) + + target_include_directories(onnx PUBLIC + $<BUILD_INTERFACE:${ONNX_ROOT}> +@@ -669,6 +673,17 @@ + FILES_MATCHING + PATTERN "*.h") + ++install(DIRECTORY ${ONNX_ROOT}/onnx ++ DESTINATION "${PY_SITEARCH}" ++ FILES_MATCHING ++ PATTERN "*.py" ++ PATTERN "test/*" EXCLUDE ) ++install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/onnx ++ DESTINATION "${PY_SITEARCH}" ++ FILES_MATCHING ++ PATTERN "*.py" ++ PATTERN "test/*" EXCLUDE ) ++ + configure_file( + ${PROJECT_SOURCE_DIR}/cmake/ONNXConfigVersion.cmake.in + ${PROJECT_BINARY_DIR}/ONNXConfigVersion.cmake +@@ -727,7 +742,9 @@ + install(TARGETS + onnx onnx_proto + EXPORT ONNXTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) +- ++install(TARGETS ++ onnx_cpp2py_export ++ DESTINATION "${PY_SITEARCH}/onnx") + if(ONNX_BUILD_TESTS) + include(${ONNX_ROOT}/cmake/unittest.cmake) + endif() +-- +2.43.0 + + |