From 59bf6f869d0d591ffea4c40ac2ccc7c10802426f Mon Sep 17 00:00:00 2001 From: nekosu Date: Tue, 10 Oct 2023 16:56:34 +0800 Subject: [PATCH] feat: support import debug onr on windows --- .github/workflows/ci.yml | 43 ----------------------------- cmake/modules/FindFastDeploy.cmake | 22 --------------- cmake/modules/FindONNXRuntime.cmake | 13 +++++++-- 3 files changed, 11 insertions(+), 67 deletions(-) delete mode 100644 cmake/modules/FindFastDeploy.cmake diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 325f1900a..e6d723229 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -199,49 +199,6 @@ jobs: name: MAA-linux-${{ matrix.arch }} path: "install" - windows-debug: - needs: meta - runs-on: windows-latest - strategy: - matrix: - arch: [x86_64] - fail-fast: false - - steps: - - name: Windows runner hack - shell: cmd - run: | - dir d:\a - cd .. - mkdir C:\MaaFramework - rmdir MaaFramework - mklink /j MaaFramework C:\MaaFramework - dism /Online /Disable-Feature /FeatureName:Windows-Defender /Remove /NoRestart /Quiet - cd . - - - name: Windows runner hack (2) - uses: al-cheb/configure-pagefile-action@v1.3 - with: - minimum-size: 16GB - maximum-size: 16GB - disk-root: "D:" - - - uses: actions/checkout@v3 - with: - submodules: true - - - name: Bootstrap MaaDeps - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - python3 maadeps-download.py x64-windows - - - name: Build MAA - run: | - cmake --preset "MSVC 2022" -DMAADEPS_TRIPLET="maa-x64-windows" -DMAA_HASH_VERSION='${{ needs.meta.outputs.tag }}' - - cmake --build build --preset "MSVC 2022 - Debug" -j 16 - macos: needs: meta runs-on: macos-latest diff --git a/cmake/modules/FindFastDeploy.cmake b/cmake/modules/FindFastDeploy.cmake deleted file mode 100644 index 89dbc012e..000000000 --- a/cmake/modules/FindFastDeploy.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# TODO: replace with cmake-generated interface file - -find_path(FastDeploy_INCLUDE_DIR NAMES fastdeploy/fastdeploy_model.h) - -find_library(FastDeploy_LIBRARY NAMES fastdeploy) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - FastDeploy - REQUIRED_VARS FastDeploy_LIBRARY FastDeploy_INCLUDE_DIR -) - -if(FastDeploy_FOUND) - set(FastDeploy_INCLUDE_DIRS ${FastDeploy_INCLUDE_DIR}) - if(NOT TARGET FastDeploy::FastDeploy) - add_library(FastDeploy::FastDeploy UNKNOWN IMPORTED) - set_target_properties(FastDeploy::FastDeploy PROPERTIES - IMPORTED_LOCATION "${FastDeploy_LIBRARY}" - INTERFACE_INCLUDE_DIRECTORIES "${FastDeploy_INCLUDE_DIR}" - ) - endif() -endif() diff --git a/cmake/modules/FindONNXRuntime.cmake b/cmake/modules/FindONNXRuntime.cmake index c25c8378f..fd68f2b49 100644 --- a/cmake/modules/FindONNXRuntime.cmake +++ b/cmake/modules/FindONNXRuntime.cmake @@ -5,6 +5,9 @@ find_library(ONNXRuntime_LIBRARY_IMP NAMES onnxruntime) if (WIN32) get_filename_component(ONNXRuntime_PATH_LIB ${ONNXRuntime_LIBRARY_IMP} DIRECTORY) find_file(ONNXRuntime_LIBRARY NAMES onnxruntime_maa.dll PATHS "${ONNXRuntime_PATH_LIB}/../bin") + + find_file(ONNXRuntime_LIBRARY_IMP_DEBUG NAMES onnxruntime.lib PATHS "${ONNXRuntime_PATH_LIB}/../debug/lib") + find_file(ONNXRuntime_LIBRARY_DEBUG NAMES onnxruntime_maa.dll PATHS "${ONNXRuntime_PATH_LIB}/../debug/bin") else () set(ONNXRuntime_LIBRARY ${ONNXRuntime_LIBRARY_IMP}) endif (WIN32) @@ -19,13 +22,19 @@ if(ONNXRuntime_FOUND) set(ONNXRuntime_INCLUDE_DIRS ${ONNXRuntime_INCLUDE_DIR}) if(NOT TARGET ONNXRuntime::ONNXRuntime) add_library(ONNXRuntime::ONNXRuntime SHARED IMPORTED) + set_property(TARGET ONNXRuntime::ONNXRuntime APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE) if (WIN32) + set_property(TARGET ONNXRuntime::ONNXRuntime APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG) + set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES + IMPORTED_IMPLIB_RELEASE "${ONNXRuntime_LIBRARY_IMP}" + ) set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES - IMPORTED_IMPLIB "${ONNXRuntime_LIBRARY_IMP}" + IMPORTED_IMPLIB_DEBUG "${ONNXRuntime_LIBRARY_IMP_DEBUG}" + IMPORTED_LOCATION_DEBUG "${ONNXRuntime_LIBRARY_DEBUG}" ) endif (WIN32) set_target_properties(ONNXRuntime::ONNXRuntime PROPERTIES - IMPORTED_LOCATION "${ONNXRuntime_LIBRARY}" + IMPORTED_LOCATION_RELEASE "${ONNXRuntime_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${ONNXRuntime_INCLUDE_DIR}" ) endif()