mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-31 23:27:43 +00:00
Convert ExternalProject Featurizers into git submodule (#2834)
Add git submodule for Featurizer library. Update cmake to build for git submodule.
This commit is contained in:
parent
98cb41aa03
commit
aa37dea598
3 changed files with 9 additions and 35 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -46,3 +46,6 @@
|
|||
[submodule "server/external/spdlog"]
|
||||
path = server/external/spdlog
|
||||
url = https://github.com/gabime/spdlog.git
|
||||
[submodule "cmake/external/FeaturizersLibrary"]
|
||||
path = cmake/external/FeaturizersLibrary
|
||||
url = https://github.com/microsoft/FeaturizersLibrary.git
|
||||
|
|
|
|||
1
cmake/external/FeaturizersLibrary
vendored
Submodule
1
cmake/external/FeaturizersLibrary
vendored
Submodule
|
|
@ -0,0 +1 @@
|
|||
Subproject commit ebec32ef06859b6399bf8854f18b91158c87760b
|
||||
40
cmake/external/featurizers.cmake
vendored
40
cmake/external/featurizers.cmake
vendored
|
|
@ -2,48 +2,17 @@
|
|||
# Licensed under the MIT License.
|
||||
# This source code should not depend on the onnxruntime and may be built independently
|
||||
|
||||
set(featurizers_URL "https://github.com/microsoft/FeaturizersLibrary.git")
|
||||
set(featurizers_TAG "ebec32ef06859b6399bf8854f18b91158c87760b")
|
||||
|
||||
set(featurizers_pref FeaturizersLibrary)
|
||||
set(featurizers_ROOT ${PROJECT_SOURCE_DIR}/external/${featurizers_pref})
|
||||
set(featurizers_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/external/${featurizers_pref})
|
||||
|
||||
# Windows required git config setting
|
||||
# and an a switch whether we link to MSVCRT statically or dynamically
|
||||
if (WIN32)
|
||||
ExternalProject_Add(featurizers_lib
|
||||
PREFIX ${featurizers_pref}
|
||||
GIT_REPOSITORY ${featurizers_URL}
|
||||
GIT_TAG ${featurizers_TAG}
|
||||
# Need this to properly checkout crlf
|
||||
GIT_CONFIG core.autocrlf=input
|
||||
SOURCE_DIR ${featurizers_ROOT}
|
||||
# Location of CMakeLists.txt
|
||||
SOURCE_SUBDIR src/Featurizers
|
||||
BINARY_DIR ${featurizers_BINARY_DIR}
|
||||
CMAKE_ARGS -Dfeaturizers_MSVC_STATIC_RUNTIME=${onnxruntime_MSVC_STATIC_RUNTIME}
|
||||
INSTALL_COMMAND ""
|
||||
|
||||
)
|
||||
else()
|
||||
ExternalProject_Add(featurizers_lib
|
||||
PREFIX ${featurizers_pref}
|
||||
GIT_REPOSITORY ${featurizers_URL}
|
||||
GIT_TAG ${featurizers_TAG}
|
||||
SOURCE_DIR ${featurizers_ROOT}
|
||||
# Location of CMakeLists.txt
|
||||
SOURCE_SUBDIR src/Featurizers
|
||||
BINARY_DIR ${featurizers_BINARY_DIR}
|
||||
CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
endif()
|
||||
add_subdirectory(external/FeaturizersLibrary/src/Featurizers ${featurizers_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
set_target_properties(FeaturizersCode PROPERTIES FOLDER "External/FeaturizersLibrary")
|
||||
|
||||
add_library(onnxruntime_featurizers STATIC IMPORTED)
|
||||
add_dependencies(onnxruntime_featurizers featurizers_lib)
|
||||
target_include_directories(onnxruntime_featurizers INTERFACE ${featurizers_ROOT}/src)
|
||||
add_dependencies(onnxruntime_featurizers FeaturizersCode)
|
||||
|
||||
target_include_directories(onnxruntime_featurizers INTERFACE ${featurizers_ROOT}/src)
|
||||
if(MSVC)
|
||||
set_property(TARGET onnxruntime_featurizers PROPERTY IMPORTED_LOCATION
|
||||
${CMAKE_CURRENT_BINARY_DIR}/external/${featurizers_pref}/${CMAKE_BUILD_TYPE}/FeaturizersCode.lib)
|
||||
|
|
@ -52,6 +21,7 @@ else()
|
|||
${CMAKE_CURRENT_BINARY_DIR}/external/${featurizers_pref}/libFeaturizersCode.a)
|
||||
endif()
|
||||
|
||||
|
||||
if (WIN32)
|
||||
# Add Code Analysis properties to enable C++ Core checks. Have to do it via a props file include.
|
||||
set_target_properties(onnxruntime_featurizers PROPERTIES VS_USER_PROPS ${PROJECT_SOURCE_DIR}/ConfigureVisualStudioCodeAnalysis.props)
|
||||
|
|
|
|||
Loading…
Reference in a new issue