Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ jobs:
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
- name: Setup Python 3.9.13
uses: actions/setup-python@v5
with:
python-version: '3.9.13'
architecture: 'x64'

- name: build_test
shell: pwsh
run: |
Expand All @@ -93,6 +99,8 @@ jobs:
export PATH=/usr/bin:/usr/lib:/usr/local/bin:/usr/local/lib:$PATH
python -V
python3 -V
python -m pip install --upgrade pip
python -m pip install timeout_decorator numpy onnxruntime pytest opencv-python setuptools
echo $PATH
echo "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" | sed 's/[^0-9A-Za-z]/^&/g'
eval "$(./win_env/vcvarsall.sh x64)"
Expand All @@ -113,8 +121,6 @@ jobs:
cmake --build build_win_lite/x64-Release --config Release --target ALL_BUILD
cp -r build_win_lite/x64-Release/output .
set -e
python -m pip install --upgrade pip
python -m pip install timeout_decorator numpy onnxruntime pytest opencv-python
export PYTHONHOME="$(dirname "$(which python)")"
export C_INCLUDE_PATH=${C_INCLUDE_PATH}:$(pwd)/output/bmf/include
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:$(pwd)/output/bmf/include
Expand All @@ -123,6 +129,7 @@ jobs:
export PATH=$(pwd)/3rd_party/win_rootfs/x64/usr/bin:$(pwd)/3rd_party/win_rootfs/x64/usr/lib:$(pwd)/output/bmf/bin:$(pwd)/output/bmf/lib:${PATH}
echo $PATH
echo $(pwd)
ls output/bmf
export HMP_TEST_DATA_ROOT=$(pwd)/bmf/hmp/tests/data
ffmpeg -version
module_manager help
Expand Down
54 changes: 19 additions & 35 deletions bmf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ add_subdirectory(sdk)
#add_subdirectory(go_module_sdk) #FIXME: compile failed
add_subdirectory(engine)
add_subdirectory(c_modules)

if (NOT EMSCRIPTEN)
add_subdirectory(python_modules)
# XXX: no go modules now
Expand Down Expand Up @@ -45,21 +46,12 @@ else()
)
endif()

if(NOT WIN32)
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/__always_update
${CMAKE_CURRENT_BINARY_DIR}/always_update
COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/always_update
)
else()
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/__always_update
${CMAKE_CURRENT_BINARY_DIR}/always_update
COMMAND copy /Y NUL \"${CMAKE_CURRENT_BINARY_DIR}/always_update\"
)
endif()
add_custom_command(
OUTPUT
${CMAKE_CURRENT_BINARY_DIR}/__always_update
${CMAKE_CURRENT_BINARY_DIR}/always_update
COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/always_update
)

function(copy_dir_to_bmf_module)
if(ARGV1)
Expand All @@ -81,17 +73,17 @@ if(NOT IOS)
copy_dir_to_bmf_module(modules)
copy_dir_to_bmf_module(python_sdk)
copy_dir_to_bmf_module(server)
copy_dir_to_bmf_module(sdk/cpp_sdk/include include)
copy_dir_to_bmf_module(engine/connector/include include)
if(BMF_ENABLE_TEST)
copy_dir_to_bmf_module(demo ../demo)
copy_dir_to_bmf_module(test ../test)
copy_dir_to_bmf_module(engine/c_engine/files files)
endif()
else()
copy_dir_to_bmf_module(sdk/cpp_sdk/include include)
endif()

copy_dir_to_bmf_module(sdk/cpp_sdk/include include)
copy_dir_to_bmf_module(cmd)

####
if(ANDROID)
add_custom_command(TARGET bmf_assem
Expand Down Expand Up @@ -149,7 +141,6 @@ endif()

# COPY hmp related resources
set(HMP_ROOT ${PROJECT_SOURCE_DIR}/bmf/hmp)

add_custom_command(TARGET bmf_assem
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:hmp> ${BMF_ASSEMBLE_ROOT}/bmf/lib
Expand All @@ -164,25 +155,19 @@ endif()

## copy symbol link of hmp and _jhmp
if(NOT APPLE AND NOT ANDROID AND NOT EMSCRIPTEN)
if(WIN32)
add_custom_command(TARGET bmf_assem
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE_DIR:hmp>/${CMAKE_SHARED_LIBRARY_PREFIX}hmp${CMAKE_SHARED_LIBRARY_SUFFIX} ${BMF_ASSEMBLE_ROOT}/bmf/lib
)
else()
add_custom_command(TARGET bmf_assem
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE_DIR:hmp>/${CMAKE_SHARED_LIBRARY_PREFIX}hmp${CMAKE_SHARED_LIBRARY_SUFFIX}* ${BMF_ASSEMBLE_ROOT}/bmf/lib
)
endif()
add_custom_command(TARGET bmf_assem
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
$<TARGET_FILE_DIR:hmp>/
${BMF_ASSEMBLE_ROOT}/bmf/lib/
)

if(BMF_ENABLE_JNI)
add_custom_command(TARGET bmf_assem
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
$<TARGET_FILE_DIR:_jhmp>/${CMAKE_SHARED_LIBRARY_PREFIX}_jhmp${CMAKE_SHARED_LIBRARY_SUFFIX}* ${BMF_ASSEMBLE_ROOT}/bmf/lib
COMMAND ${CMAKE_COMMAND} -E copy_directory
$<TARGET_FILE_DIR:_jhmp>/
${BMF_ASSEMBLE_ROOT}/bmf/lib/
)
endif()
endif()
Expand Down Expand Up @@ -226,7 +211,6 @@ if(TARGET _hmp)
${BMF_ASSEMBLE_ROOT}/bmf/hmp/)
endif()


if(IOS)
if(BUILD_SHARED_LIBS OR NOT BMF_LOCAL_DEPENDENCIES)
message(FATAL_ERROR "Only support static build for IOS platform")
Expand Down
2 changes: 2 additions & 0 deletions bmf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,7 @@
GraphConfig, get_module_file_dependencies, ff_filter
from .server import ServerGateway, ServerGatewayNew

from .cmd import find_in_python_root, exec_cmd, run_bmf_graph, trace_format_log, module_manager, bmf_env

if platform.system().lower() != 'windows':
sys.setdlopenflags(flags)
6 changes: 3 additions & 3 deletions bmf/cmd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ target_link_libraries(module_manager
)

# Build targets

install(TARGETS run_bmf_graph trace_format_log module_manager
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
RUNTIME DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
LIBRARY DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
ARCHIVE DESTINATION ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
)

Expand Down
1 change: 1 addition & 0 deletions bmf/cmd/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .python_wrapper.wrapper import find_in_python_root, exec_cmd, run_bmf_graph, trace_format_log, module_manager, bmf_env
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def build_extension(self, ext: CMakeExtension) -> None:
# Can be set with Conda-Build, for example.
cmake_generator = os.environ.get("CMAKE_GENERATOR", "")

sha = os.environ.get("GIT_SHA")
sha = os.environ.get("GIT_SHA", "")
short_sha = sha[:7]

# Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON
Expand Down
Loading