From ac7436dccd19d6caf93bb82d75b3df4b17c72883 Mon Sep 17 00:00:00 2001 From: Stefano Sinigardi Date: Fri, 1 May 2020 01:14:24 +0200 Subject: [PATCH] ported build configs from circleCI --- .github/workflows/ccpp.yml | 80 +++++++++++++++++++++++++++++++------- CMakeLists.txt | 9 ++++- appveyor.yml | 62 ++++++++++++++--------------- src/http_stream.cpp | 8 ++++ 4 files changed, 113 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 6d430e2a..bdae8321 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -3,7 +3,61 @@ name: Darknet Continuous Integration on: [push, pull_request] jobs: - linux-build-vcpkg: + linux-make: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Update apt + run: sudo apt update + - name: Install dependencies + run: sudo apt install libopencv-dev + + - name: 'Install CUDA' + run: | + wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.2.89-1_amd64.deb + sudo apt-key adv --fetch-keys http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub + sudo dpkg -i cuda-repo-ubuntu1804_10.2.89-1_amd64.deb + wget http://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb + sudo dpkg -i nvidia-machine-learning-repo-ubuntu1804_1.0.0-1_amd64.deb + sudo apt update + sudo apt-get install -y --no-install-recommends cuda-compiler-10-2 cuda-libraries-dev-10-2 cuda-driver-dev-10-2 cuda-cudart-dev-10-2 cuda-curand-dev-10-2 + sudo apt-get install -y --no-install-recommends libcudnn7-dev + sudo ln -s /usr/local/cuda-10.2/lib64/stubs/libcuda.so /usr/local/cuda-10.2/lib64/stubs/libcuda.so.1 + nvcc --version + gcc --version + + - name: 'LIBSO=1 GPU=0 CUDNN=0 OPENCV=0' + run: | + make LIBSO=1 GPU=0 CUDNN=0 OPENCV=0 -j 8 + make clean + - name: 'LIBSO=1 GPU=0 CUDNN=0 OPENCV=0 DEBUG=1' + run: | + make LIBSO=1 GPU=0 CUDNN=0 OPENCV=0 DEBUG=1 -j 8 + make clean + - name: 'LIBSO=1 GPU=0 CUDNN=0 OPENCV=0 AVX=1' + run: | + make LIBSO=1 GPU=0 CUDNN=0 OPENCV=0 AVX=1 -j 8 + make clean + - name: 'LIBSO=1 GPU=0 CUDNN=0 OPENCV=1' + run: | + make LIBSO=1 GPU=0 CUDNN=0 OPENCV=1 -j 8 + make clean + - name: 'LIBSO=1 GPU=1 CUDNN=1 OPENCV=1' + run: | + make LIBSO=1 GPU=1 CUDNN=1 OPENCV=1 -j 8 + make clean + - name: 'LIBSO=1 GPU=1 CUDNN=1 OPENCV=1 CUDNN_HALF=1' + run: | + make LIBSO=1 GPU=1 CUDNN=1 OPENCV=1 CUDNN_HALF=1 -j 8 + make clean + - name: 'LIBSO=1 GPU=1 CUDNN=1 OPENCV=1 CUDNN_HALF=1 USE_CPP=1' + run: | + make LIBSO=1 GPU=1 CUDNN=1 OPENCV=1 CUDNN_HALF=1 USE_CPP=1 -j 8 + make clean + + + linux-cmake-vcpkg: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -54,7 +108,7 @@ jobs: path: ${{ github.workspace }}/uselib* - linux-build: + linux-cmake: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -95,7 +149,7 @@ jobs: path: ${{ github.workspace }}/uselib* - linux-build-with-cuda: + linux-cmake-with-cuda: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -160,7 +214,7 @@ jobs: path: ${{ github.workspace }}/uselib* - linux-build-no-opencv-cpp-mode: + linux-cmake-no-opencv-cpp-mode: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -179,7 +233,7 @@ jobs: buildWithCMakeArgs: '--target install' - macos-build-vcpkg: + macos-cmake-vcpkg: runs-on: macOS-latest steps: - uses: actions/checkout@v2 @@ -228,7 +282,7 @@ jobs: path: ${{ github.workspace }}/uselib* - macos-build: + macos-cmake: runs-on: macOS-latest steps: - uses: actions/checkout@v2 @@ -267,7 +321,7 @@ jobs: path: ${{ github.workspace }}/uselib* - macos-build-no-opencv-no-omp-cpp-mode: + macos-cmake-no-opencv-no-omp-cpp-mode: runs-on: macOS-latest steps: - uses: actions/checkout@v2 @@ -286,7 +340,7 @@ jobs: buildWithCMakeArgs: '--target install' - windows-build-vcpkg: + windows-cmake-vcpkg: runs-on: windows-latest steps: - uses: actions/checkout@v2 @@ -336,7 +390,7 @@ jobs: path: ${{ github.workspace }}/uselib* - windows-build-vcpkg-with-cuda: + windows-cmake-vcpkg-with-cuda: runs-on: windows-latest steps: - uses: actions/checkout@v2 @@ -404,7 +458,7 @@ jobs: path: ${{ github.workspace }}/uselib* - windows-build-integrated-libs: + windows-cmake-integrated-libs: runs-on: windows-latest steps: - uses: actions/checkout@v2 @@ -444,7 +498,7 @@ jobs: path: ${{ github.workspace }}/uselib* - windows-build-integrated-libs-cpp-mode: + windows-cmake-integrated-libs-cpp-mode: runs-on: windows-latest steps: - uses: actions/checkout@v2 @@ -463,7 +517,7 @@ jobs: buildWithCMakeArgs: '--config Release --target install' - windows-build-integrated-libs-with-cuda: + windows-cmake-integrated-libs-with-cuda: runs-on: windows-latest steps: - uses: actions/checkout@v2 @@ -494,7 +548,7 @@ jobs: buildWithCMakeArgs: '--config Release --target install' - windows-mingw: + windows-cmake-mingw: runs-on: windows-latest steps: - uses: actions/checkout@v2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5400cbbb..dc37cb0a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,9 +364,9 @@ endif() if(MSVC) target_link_libraries(darknet PRIVATE PThreads_windows::PThreads_windows) - target_link_libraries(darknet PRIVATE wsock32 ws2_32) + target_link_libraries(darknet PRIVATE wsock32) target_link_libraries(dark PUBLIC PThreads_windows::PThreads_windows) - target_link_libraries(dark PUBLIC wsock32 ws2_32) + target_link_libraries(dark PUBLIC wsock32) target_link_libraries(uselib PRIVATE PThreads_windows::PThreads_windows) target_compile_definitions(darknet PRIVATE -D_CRT_RAND_S -DNOMINMAX -D_USE_MATH_DEFINES) target_compile_definitions(dark PRIVATE -D_CRT_RAND_S -DNOMINMAX -D_USE_MATH_DEFINES) @@ -374,6 +374,11 @@ if(MSVC) target_compile_definitions(uselib PRIVATE -D_CRT_RAND_S -DNOMINMAX -D_USE_MATH_DEFINES) endif() +if(MSVC OR MINGW) + target_link_libraries(darknet PRIVATE ws2_32) + target_link_libraries(dark PUBLIC ws2_32) +endif() + target_link_libraries(darknet PRIVATE Threads::Threads) target_link_libraries(dark PUBLIC Threads::Threads) target_link_libraries(uselib PRIVATE Threads::Threads) diff --git a/appveyor.yml b/appveyor.yml index d2153460..841ecc50 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,20 +10,20 @@ environment: COMPILER: cygwin CYGWIN_NOWINPATH: yes CYGSH: C:\cygwin64\bin\bash -c - #- platform: Win64 - # USE_CUDA: yes - # INSTALL_CUDA_VERSION: 10.0 - # COMPILER: vs - # configuration: Release - # VCPKG_ROOT: C:\Tools\vcpkg - # VCPKG_DEFAULT_TRIPLET: x64-windows - #- platform: Win64 - # USE_CUDA: yes - # INSTALL_CUDA_VERSION: 10.1 - # COMPILER: vs - # configuration: Release - # VCPKG_ROOT: C:\Tools\vcpkg - # VCPKG_DEFAULT_TRIPLET: x64-windows + - platform: Win64 + USE_CUDA: yes + INSTALL_CUDA_VERSION: 10.0 + COMPILER: vs + configuration: Release + VCPKG_ROOT: C:\Tools\vcpkg + VCPKG_DEFAULT_TRIPLET: x64-windows + - platform: Win64 + USE_CUDA: yes + INSTALL_CUDA_VERSION: 10.1 + COMPILER: vs + configuration: Release + VCPKG_ROOT: C:\Tools\vcpkg + VCPKG_DEFAULT_TRIPLET: x64-windows - platform: Win64 USE_CUDA: yes INSTALL_CUDA_VERSION: 10.2 @@ -31,23 +31,23 @@ environment: configuration: Release VCPKG_ROOT: C:\Tools\vcpkg VCPKG_DEFAULT_TRIPLET: x64-windows - #- platform: Win64 - # USE_CUDA: no - # COMPILER: vs - # configuration: Release - # VCPKG_ROOT: C:\Tools\vcpkg - # VCPKG_DEFAULT_TRIPLET: x64-windows - #- platform: Win64 - # USE_CUDA: no - # COMPILER: vs - # configuration: Release - # USE_INTEGRATED_LIBS: yes - #- platform: Win64 - # USE_CUDA: no - # COMPILER: vs - # configuration: Release - # USE_INTEGRATED_LIBS: yes - # FORCE_CPP: yes + - platform: Win64 + USE_CUDA: no + COMPILER: vs + configuration: Release + VCPKG_ROOT: C:\Tools\vcpkg + VCPKG_DEFAULT_TRIPLET: x64-windows + - platform: Win64 + USE_CUDA: no + COMPILER: vs + configuration: Release + USE_INTEGRATED_LIBS: yes + - platform: Win64 + USE_CUDA: no + COMPILER: vs + configuration: Release + USE_INTEGRATED_LIBS: yes + FORCE_CPP: yes install: - if [%COMPILER%]==[vs] cinst cmake ninja diff --git a/src/http_stream.cpp b/src/http_stream.cpp index 480f56e2..2cf03aac 100644 --- a/src/http_stream.cpp +++ b/src/http_stream.cpp @@ -718,11 +718,19 @@ void custom_atomic_store_int(volatile int* obj, int desr) std::atomic_store(ptr_a, desr); } +#if !defined(__MINGW64__) void this_thread_sleep_for(int ms_time) { std::chrono::milliseconds dura(ms_time); std::this_thread::sleep_for(dura); } +#else +void this_thread_sleep_for(int ms_time) +{ + std::cerr << " this_thread_sleep_for() isn't implemented \n"; + return; +} +#endif void this_thread_yield() {