Skip to content

Commit 6fc1a6b

Browse files
committed
more refinement
1 parent 87222b0 commit 6fc1a6b

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

.pipelines/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,7 @@ stages:
748748
- script: |
749749
bash ./build.sh \
750750
-DCMAKE_TOOLCHAIN_FILE=$(Build.BinariesDirectory)/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
751+
-DOCOS_ENABLE_STATIC_LIB=OFF \
751752
-DOCOS_ENABLE_SPM_TOKENIZER=ON \
752753
-DOCOS_BUILD_PYTHON=OFF \
753754
-DOCOS_ENABLE_VISION=OFF \
@@ -758,12 +759,12 @@ stages:
758759
- script: |
759760
bash ./build.sh \
760761
-DCMAKE_TOOLCHAIN_FILE=$(Build.BinariesDirectory)/emsdk/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake \
762+
-DOCOS_ENABLE_STATIC_LIB=ON \
761763
-DOCOS_ENABLE_SPM_TOKENIZER=ON \
762764
-DOCOS_BUILD_PYTHON=OFF \
763765
-DOCOS_ENABLE_VISION=OFF \
764766
-DOCOS_ENABLE_CTEST=OFF \
765-
-DOCOS_ENABLE_C_API=ON \
766-
-DOCOS_ENABLE_STATIC_LIB=ON
767+
-DOCOS_ENABLE_C_API=ON
767768
displayName: build ort-extensions as a static library
768769
769770
- stage: AndroidBuilds

CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ include(CMakeDependentOption)
5454

5555
set(_ORTX_STANDALONE_PROJECT OFF)
5656
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
57-
set(_ORTX_STANDALONE_PROJECT ON)
57+
set(_ORTX_STANDALONE_PROJECT ON)
58+
endif()
59+
60+
set(_ORTX_SHARED_BUILD_SUPPORTED ON)
61+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
62+
set(_ORTX_SHARED_BUILD_SUPPORTED OFF)
5863
endif()
5964

6065
option(CC_OPTIMIZE "Allow compiler optimizations, Set to OFF to disable" ON)
@@ -82,7 +87,7 @@ option(OCOS_ENABLE_STATIC_LIB "Enable generating static library" OFF) # only for
8287
option(OCOS_ENABLE_SELECTED_OPLIST "Enable including the selected_ops tool file" OFF)
8388
option(OCOS_ENABLE_C_API "Enable building the C API" OFF)
8489

85-
option(OCOS_BUILD_SHARED_LIB "Enable building the dynamic library" ON)
90+
option(OCOS_BUILD_SHARED_LIB "Enable building the dynamic library" ${_ORTX_SHARED_BUILD_SUPPORTED})
8691
option(OCOS_BUILD_PYTHON "Enable building the Python package" OFF)
8792
option(OCOS_BUILD_JAVA "Enable building the Java package" OFF)
8893
option(OCOS_BUILD_ANDROID "Enable building the Android package" OFF)

cmake/ext_wasm.cmake

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ if(OCOS_ENABLE_STATIC_LIB)
99
add_library(onnxruntime_extensions ALIAS ortcustomops)
1010
standardize_output_folder(ortcustomops)
1111
else()
12-
# Emscripten does not support building a shared library with custom ops.
13-
# and backward compatible with the previous version, we silently turn off the shared library build.
14-
set(OCOS_BUILD_SHARED_LIB OFF CACHE INTERNAL "" FORCE)
1512
add_executable(ortcustomops ${_TARGET_LIB_SRC})
1613
set_target_properties(ortcustomops PROPERTIES LINK_FLAGS " \
1714
-s WASM=1 \

0 commit comments

Comments
 (0)