From 82a64c7f165ccfe24ebe5546205bd67d60373cab Mon Sep 17 00:00:00 2001 From: nihui Date: Tue, 1 Dec 2020 00:10:32 +0800 Subject: [PATCH] some ci tweaks (#2375) * some ci tweaks * workaround windows-2016 cache --- .github/workflows/windows-x64-cpu-vs2017.yml | 8 ++++---- .github/workflows/windows-x64-gpu-vs2017.yml | 10 +++++----- CMakeLists.txt | 5 ----- src/CMakeLists.txt | 5 +++++ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/windows-x64-cpu-vs2017.yml b/.github/workflows/windows-x64-cpu-vs2017.yml index 76a6c88fb..d5ba8922c 100644 --- a/.github/workflows/windows-x64-cpu-vs2017.yml +++ b/.github/workflows/windows-x64-cpu-vs2017.yml @@ -7,10 +7,10 @@ jobs: - uses: actions/checkout@v2 - name: cache-protobuf id: cache-protobuf - uses: actions/cache@v1 + uses: actions/cache@v1.0.3 with: path: "protobuf-install" - key: protobuf-vs2017-x64-install + key: protobuf-vs2017-x64-install3 - name: protobuf if: steps.cache-protobuf.outputs.cache-hit != 'true' run: | @@ -35,10 +35,10 @@ jobs: - uses: actions/checkout@v2 - name: cache-protobuf id: cache-protobuf - uses: actions/cache@v1 + uses: actions/cache@v1.0.3 with: path: "protobuf-install" - key: protobuf-vs2017-x64-install + key: protobuf-vs2017-x64-install3 - name: protobuf if: steps.cache-protobuf.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/windows-x64-gpu-vs2017.yml b/.github/workflows/windows-x64-gpu-vs2017.yml index cc6403eb9..da42e44f0 100644 --- a/.github/workflows/windows-x64-gpu-vs2017.yml +++ b/.github/workflows/windows-x64-gpu-vs2017.yml @@ -9,10 +9,10 @@ jobs: submodules: true - name: cache-protobuf id: cache-protobuf - uses: actions/cache@v1 + uses: actions/cache@v1.0.3 with: path: "protobuf-install" - key: protobuf-vs2017-x64-install + key: protobuf-vs2017-x64-install3 - name: protobuf if: steps.cache-protobuf.outputs.cache-hit != 'true' run: | @@ -24,7 +24,7 @@ jobs: cmake --build . --config Release --target install - name: cache-vulkansdk id: cache-vulkansdk - uses: actions/cache@v1 + uses: actions/cache@v1.0.3 with: path: "VulkanSDK" key: VulkanSDK-1.1.114.0-Installer @@ -36,10 +36,10 @@ jobs: Remove-Item .\VulkanSDK\Demos, .\VulkanSDK\glslang, .\VulkanSDK\Samples, .\VulkanSDK\shaderc, .\VulkanSDK\spirv-tools, .\VulkanSDK\Third-Party, .\VulkanSDK\Tools, .\VulkanSDK\Tools32 -Recurse - name: cache-swiftshader id: cache-swiftshader - uses: actions/cache@v1 + uses: actions/cache@v1.0.3 with: path: swiftshader-install - key: swiftshader-vs2017-x64-install-20200508 + key: swiftshader-vs2017-x64-install3-20200508 - name: checkout-swiftshader if: steps.cache-swiftshader.outputs.cache-hit != 'true' uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index c052acaeb..394abc324 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,11 +99,6 @@ message(STATUS "Target arch: ${NCNN_TARGET_ARCH}") set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "cmake") -if(NCNN_COVERAGE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -coverage -fprofile-arcs -ftest-coverage") - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage -lgcov") -endif() - if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s FORCE_FILESYSTEM=1 -s INITIAL_MEMORY=1024MB -s EXIT_RUNTIME=1") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FORCE_FILESYSTEM=1 -s INITIAL_MEMORY=1024MB -s EXIT_RUNTIME=1") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7a1977b9d..f966b5358 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -307,6 +307,11 @@ if(((IOS AND CMAKE_OSX_ARCHITECTURES MATCHES "arm64") OR (APPLE AND CMAKE_OSX_AR endif() endif() +if(NCNN_COVERAGE) + target_compile_options(ncnn PUBLIC -coverage -fprofile-arcs -ftest-coverage) + target_link_libraries(ncnn PUBLIC -coverage -lgcov) +endif() + if(ANDROID OR IOS) # disable shared library on android and xcode ios set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)