Merge pull request #2514 from cenit/dev/cenit/appveyor

fix cuda build on appveyor, remove old unsupported config on macOS
pull/2542/head
Alexey 6 years ago committed by GitHub
commit ef803e05df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      .travis.yml
  2. 33
      appveyor.yml
  3. 92
      build.ps1
  4. 21
      build.sh

@ -3,18 +3,6 @@ language: cpp
matrix: matrix:
include: include:
- os: osx
compiler: gcc
name: macOS - gcc@5 - opencv@2
env:
- MATRIX_EVAL="brew install gcc@5 opencv@2 && CC=gcc-5 && CXX=g++-5 && OpenCV_DIR=/usr/local/opt/opencv@2"
- os: osx
compiler: gcc
name: macOS - gcc@5 - opencv@3
env:
- MATRIX_EVAL="brew install gcc@5 opencv@3 && CC=gcc-5 && CXX=g++-5 && OpenCV_DIR=/usr/local/opt/opencv@3"
- os: osx - os: osx
compiler: gcc compiler: gcc
name: macOS - native gcc (llvm backend) - opencv@2 name: macOS - native gcc (llvm backend) - opencv@2

@ -13,9 +13,6 @@ environment:
VCPKG_ROOT: C:\projects\vcpkg VCPKG_ROOT: C:\projects\vcpkg
VCPKG_DEFAULT_TRIPLET: x64-windows VCPKG_DEFAULT_TRIPLET: x64-windows
USE_CUDA: yes USE_CUDA: yes
CUDACXX: C:\CUDA\bin\nvcc.exe
CUDA_PATH: C:\CUDA\
CUDA_PATH_V10_0: C:\CUDA\
- platform: Win64 - platform: Win64
COMPILER: vs COMPILER: vs
VCPKG_ROOT: C:\projects\vcpkg VCPKG_ROOT: C:\projects\vcpkg
@ -33,12 +30,12 @@ install:
- if [%COMPILER%]==[cygwin] SET PATH=%PATH:C:\Program Files\Git\usr\bin;=% - if [%COMPILER%]==[cygwin] SET PATH=%PATH:C:\Program Files\Git\usr\bin;=%
- git submodule -q update --init --recursive - git submodule -q update --init --recursive
- cd %WORKSPACE%\ - cd %WORKSPACE%\
- if [%USE_CUDA%]==[yes] curl -L https://developer.nvidia.com/compute/cuda/10.0/Prod/local_installers/cuda_10.0.130_411.31_windows -o cuda_10.0.130_411.31_windows.exe - if [%USE_CUDA%]==[yes] curl -L https://developer.nvidia.com/compute/cuda/10.1/Prod/local_installers/cuda_10.1.105_418.96_win10.exe -o setup.exe
- if [%USE_CUDA%]==[yes] mkdir C:\CUDATEMP - if [%USE_CUDA%]==[yes] .\setup.exe -s nvcc_10.1 cuobjdump_10.1 nvprune_10.1 cupti_10.1 gpu_library_advisor_10.1 memcheck_10.1 nvdisasm_10.1 nvprof_10.1 visual_profiler_10.1 visual_studio_integration_10.1 cublas_10.1 cublas_dev_10.1 cudart_10.1 cufft_10.1 cufft_dev_10.1 curand_10.1 curand_dev_10.1 cusolver_10.1 cusolver_dev_10.1 cusparse_10.1 cusparse_dev_10.1 nvgraph_10.1 nvgraph_dev_10.1 npp_10.1 npp_dev_10.1 nvrtc_10.1 nvrtc_dev_10.1 nvml_dev_10.1 occupancy_calculator_10.1 fortran_examples_10.1
- if [%USE_CUDA%]==[yes] mkdir C:\CUDA - if [%USE_CUDA%]==[yes] set CUDA_PATH=%ProgramFiles%\NVIDIA GPU Computing Toolkit\CUDA\v10.1
- if [%USE_CUDA%]==[yes] 7z x cuda_10.0.130_411.31_windows.exe -oC:\CUDATEMP - if [%USE_CUDA%]==[yes] set CUDA_PATH_V10_1=%CUDA_PATH%
- if [%USE_CUDA%]==[yes] cd C:\CUDATEMP - if [%USE_CUDA%]==[yes] set CUDA_TOOLKIT_ROOT_DIR=%CUDA_PATH%
- if [%USE_CUDA%]==[yes] FOR /D %%G in ("*") DO xcopy C:\CUDATEMP\%%G\* C:\CUDA\ /s /y - if [%USE_CUDA%]==[yes] set PATH=%CUDA_PATH%\bin;%PATH%
- cd %WORKSPACE%\ - cd %WORKSPACE%\
- mkdir cygwin-downloads - mkdir cygwin-downloads
- ps: if($env:COMPILER -eq "cygwin") { Invoke-WebRequest https://cygwin.com/setup-x86_64.exe -OutFile $env:WORKSPACE\cygwin-setup.exe } - ps: if($env:COMPILER -eq "cygwin") { Invoke-WebRequest https://cygwin.com/setup-x86_64.exe -OutFile $env:WORKSPACE\cygwin-setup.exe }
@ -61,7 +58,17 @@ install:
- cd .. - cd ..
build_script: build_script:
- if [%COMPILER%]==[cygwin] cd build_debug && %CYGSH% 'cmake --build .' && cd .. - if [%COMPILER%]==[cygwin] cd build_debug && %CYGSH% 'cmake --build . --target install' && cd ..
- if [%COMPILER%]==[cygwin] cd build_release && %CYGSH% 'cmake --build .' && cd .. - if [%COMPILER%]==[cygwin] cd build_release && %CYGSH% 'cmake --build . --target install' && cd ..
- if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] cd build_debug && cmake --build . --config Debug && cd .. - if [%COMPILER%]==[vs] if NOT [%USE_INTEGRATED_LIBS%]==[yes] cd build_debug && cmake --build . --config Debug --target install && cd ..
- if [%COMPILER%]==[vs] cd build_release && cmake --build . --config Release && cd .. - if [%COMPILER%]==[vs] cd build_release && cmake --build . --config Release --target install && cd ..
artifacts:
- path: './darklib.lib'
name: darklib.lib
- path: './darklib.dll'
name: darklib.dll
- path: './uselib.exe'
name: uselib.exe
- path: './darknet.exe'
name: darknet.exe

@ -1,43 +1,89 @@
#!/usr/bin/env pwsh #!/usr/bin/env pwsh
$number_of_build_workers=8 $number_of_build_workers=8
$vstype="Community" #$shared_lib="-DBUILD_SHARED_LIBS:BOOL=ON"
if ((Get-Command "cl.exe" -ErrorAction SilentlyContinue) -eq $null) if (Test-Path env:VCPKG_ROOT) {
{ $vcpkg_path = "$env:VCPKG_ROOT"
pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\${vstype}\Common7\Tools" Write-Host "Found vcpkg in VCPKG_ROOT: $vcpkg_path"
}
elseif (Test-Path "${env:WORKSPACE}\vcpkg") {
$vcpkg_path = "${env:WORKSPACE}\vcpkg"
Write-Host "Found vcpkg in WORKSPACE\vcpkg: $vcpkg_path"
}
else {
Write-Host "Skipping vcpkg-enabled builds because the VCPKG_ROOT environment variable is not defined, using self-distributed libs`n" -ForegroundColor Yellow
}
if ($null -eq $env:VCPKG_DEFAULT_TRIPLET) {
Write-Host "No default triplet has been set-up for vcpkg. Defaulting to x64-windows`n" -ForegroundColor Yellow
$vcpkg_triplet = "x64-windows"
}
else {
$vcpkg_triplet = $env:VCPKG_DEFAULT_TRIPLET
}
if ($vcpkg_triplet -Match "x86") {
Throw "darknet is supported only in x64 builds!"
}
if ($null -eq (Get-Command "cl.exe" -ErrorAction SilentlyContinue)) {
$vstype = "Professional"
if (Test-Path "C:\Program Files (x86)\Microsoft Visual Studio\2017\${vstype}\Common7\Tools") {
Write-Host "Found VS 2017 Professional"
}
else {
$vstype = "Community"
Write-Host "Found VS 2017 Community"
}
Push-Location "C:\Program Files (x86)\Microsoft Visual Studio\2017\${vstype}\Common7\Tools"
cmd /c "VsDevCmd.bat -arch=x64 & set" | cmd /c "VsDevCmd.bat -arch=x64 & set" |
foreach { ForEach-Object {
if ($_ -match "=") { if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
} }
} }
popd Pop-Location
Write-Host "Visual Studio 2017 ${vstype} Command Prompt variables set.`n" -ForegroundColor Yellow Write-Host "Visual Studio 2017 ${vstype} Command Prompt variables set.`n" -ForegroundColor Yellow
} }
if (Test-Path env:VCPKG_ROOT) { if ($null -eq (Get-Command "nvcc.exe" -ErrorAction SilentlyContinue)) {
# DEBUG if (Test-Path env:CUDA_PATH) {
New-Item -Path .\build_win_debug -ItemType directory -Force $env:PATH += ";${env:CUDA_PATH}\bin"
Set-Location build_win_debug }
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$env:VCPKG_DEFAULT_TRIPLET" "-DCMAKE_BUILD_TYPE=Debug" .. else {
cmake --build . --config Debug --parallel ${number_of_build_workers} Write-Host "Unable to find CUDA, if necessary please install it or define a CUDA_PATH env variable pointing to the install folder`n" -ForegroundColor Yellow
Set-Location .. }
}
if (Test-Path env:CUDA_PATH) {
if (-Not(Test-Path env:CUDA_TOOLKIT_ROOT_DIR)) {
$env:CUDA_TOOLKIT_ROOT_DIR = "${env:CUDA_PATH}"
Write-Host "Added missing env variable CUDA_TOOLKIT_ROOT_DIR`n" -ForegroundColor Yellow
}
}
if (Test-Path $vcpkg_path) {
# RELEASE # RELEASE
New-Item -Path .\build_win_release -ItemType directory -Force New-Item -Path .\build_win_release -ItemType directory -Force
Set-Location build_win_release Set-Location build_win_release
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$env:VCPKG_DEFAULT_TRIPLET" "-DCMAKE_BUILD_TYPE=Release" .. cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Release" $shared_lib ..
cmake --build . --config Release --parallel ${number_of_build_workers} cmake --build . --config Release --parallel ${number_of_build_workers} --target install
Set-Location ..
# DEBUG
New-Item -Path .\build_win_debug -ItemType directory -Force
Set-Location build_win_debug
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" "-DCMAKE_TOOLCHAIN_FILE=$vcpkg_path\scripts\buildsystems\vcpkg.cmake" "-DVCPKG_TARGET_TRIPLET=$vcpkg_triplet" "-DCMAKE_BUILD_TYPE=Debug" $shared_lib ..
cmake --build . --config Debug --parallel ${number_of_build_workers} --target install
Set-Location .. Set-Location ..
} }
else { else {
Write-Host "Skipping vcpkg-enabled builds because the VCPKG_ROOT environment variable is not defined`n" -ForegroundColor Yellow # USE LOCAL PTHREAD LIB, NO VCPKG, ONLY RELEASE
# if you want to manually force this case, remove VCPKG_ROOT env variable and remember to use "vcpkg integrate remove" in case you had enabled user-wide vcpkg integration
New-Item -Path .\build_win_release_novcpkg -ItemType directory -Force
Set-Location build_win_release_novcpkg
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" $shared_lib ..
cmake --build . --config Release --parallel ${number_of_build_workers} --target install
Set-Location ..
} }
# USE LOCAL PTHREAD LIB, NO VCPKG: remember to use "vcpkg.exe integrate remove" in case you had enable user-wide vcpkg integration
New-Item -Path .\build_win_release_cuda_int_libs -ItemType directory -Force
Set-Location build_win_release_cuda_int_libs
cmake -G "Visual Studio 15 2017" -T "host=x64" -A "x64" ..
cmake --build . --config Release --parallel ${number_of_build_workers}
Set-Location ..

@ -2,12 +2,13 @@
number_of_build_workers=8 number_of_build_workers=8
if [[ "$OSTYPE" == "darwin"* && "$1" == "gcc" ]]; then # RELEASE
export CC="/usr/local/bin/gcc-8" mkdir -p build_release
export CXX="/usr/local/bin/g++-8" cd build_release
fi cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install -- -j${number_of_build_workers}
rm -f uselib darknet #cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+
cd ..
# DEBUG # DEBUG
mkdir -p build_debug mkdir -p build_debug
@ -16,11 +17,3 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake --build . --target install -- -j${number_of_build_workers} cmake --build . --target install -- -j${number_of_build_workers}
#cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+ #cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+
cd .. cd ..
# RELEASE
mkdir -p build_release
cd build_release
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --target install -- -j${number_of_build_workers}
#cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+
cd ..

Loading…
Cancel
Save