diff --git a/3rdparty/dll/x86/pthreadGC2.dll b/3rdparty/dll/x86/pthreadGC2.dll deleted file mode 100644 index 67b9289d..00000000 Binary files a/3rdparty/dll/x86/pthreadGC2.dll and /dev/null differ diff --git a/3rdparty/dll/x86/pthreadGCE2.dll b/3rdparty/dll/x86/pthreadGCE2.dll deleted file mode 100644 index 9e18ea24..00000000 Binary files a/3rdparty/dll/x86/pthreadGCE2.dll and /dev/null differ diff --git a/3rdparty/dll/x86/pthreadVC2.dll b/3rdparty/dll/x86/pthreadVC2.dll deleted file mode 100644 index fcb5d9dc..00000000 Binary files a/3rdparty/dll/x86/pthreadVC2.dll and /dev/null differ diff --git a/3rdparty/dll/x86/pthreadVCE2.dll b/3rdparty/dll/x86/pthreadVCE2.dll deleted file mode 100644 index 9d148cc0..00000000 Binary files a/3rdparty/dll/x86/pthreadVCE2.dll and /dev/null differ diff --git a/3rdparty/dll/x86/pthreadVSE2.dll b/3rdparty/dll/x86/pthreadVSE2.dll deleted file mode 100644 index 8129116f..00000000 Binary files a/3rdparty/dll/x86/pthreadVSE2.dll and /dev/null differ diff --git a/3rdparty/lib/x86/libpthreadGC2.a b/3rdparty/lib/x86/libpthreadGC2.a deleted file mode 100644 index df211759..00000000 Binary files a/3rdparty/lib/x86/libpthreadGC2.a and /dev/null differ diff --git a/3rdparty/lib/x86/libpthreadGCE2.a b/3rdparty/lib/x86/libpthreadGCE2.a deleted file mode 100644 index 9c56202c..00000000 Binary files a/3rdparty/lib/x86/libpthreadGCE2.a and /dev/null differ diff --git a/3rdparty/lib/x86/pthreadVC2.lib b/3rdparty/lib/x86/pthreadVC2.lib deleted file mode 100644 index c20ee200..00000000 Binary files a/3rdparty/lib/x86/pthreadVC2.lib and /dev/null differ diff --git a/3rdparty/lib/x86/pthreadVCE2.lib b/3rdparty/lib/x86/pthreadVCE2.lib deleted file mode 100644 index 7f05317b..00000000 Binary files a/3rdparty/lib/x86/pthreadVCE2.lib and /dev/null differ diff --git a/3rdparty/lib/x86/pthreadVSE2.lib b/3rdparty/lib/x86/pthreadVSE2.lib deleted file mode 100644 index 3f3335d4..00000000 Binary files a/3rdparty/lib/x86/pthreadVSE2.lib and /dev/null differ diff --git a/3rdparty/dll/x64/pthreadGC2.dll b/3rdparty/pthreads/bin/pthreadGC2.dll similarity index 100% rename from 3rdparty/dll/x64/pthreadGC2.dll rename to 3rdparty/pthreads/bin/pthreadGC2.dll diff --git a/3rdparty/dll/x64/pthreadVC2.dll b/3rdparty/pthreads/bin/pthreadVC2.dll similarity index 100% rename from 3rdparty/dll/x64/pthreadVC2.dll rename to 3rdparty/pthreads/bin/pthreadVC2.dll diff --git a/3rdparty/include/pthread.h b/3rdparty/pthreads/include/pthread.h similarity index 100% rename from 3rdparty/include/pthread.h rename to 3rdparty/pthreads/include/pthread.h diff --git a/3rdparty/include/sched.h b/3rdparty/pthreads/include/sched.h similarity index 100% rename from 3rdparty/include/sched.h rename to 3rdparty/pthreads/include/sched.h diff --git a/3rdparty/include/semaphore.h b/3rdparty/pthreads/include/semaphore.h similarity index 100% rename from 3rdparty/include/semaphore.h rename to 3rdparty/pthreads/include/semaphore.h diff --git a/3rdparty/lib/x64/libpthreadGC2.a b/3rdparty/pthreads/lib/libpthreadGC2.a similarity index 100% rename from 3rdparty/lib/x64/libpthreadGC2.a rename to 3rdparty/pthreads/lib/libpthreadGC2.a diff --git a/3rdparty/lib/x64/pthreadVC2.lib b/3rdparty/pthreads/lib/pthreadVC2.lib similarity index 100% rename from 3rdparty/lib/x64/pthreadVC2.lib rename to 3rdparty/pthreads/lib/pthreadVC2.lib diff --git a/src/stb_image.h b/3rdparty/stb/include/stb_image.h similarity index 100% rename from src/stb_image.h rename to 3rdparty/stb/include/stb_image.h diff --git a/src/stb_image_write.h b/3rdparty/stb/include/stb_image_write.h similarity index 100% rename from src/stb_image_write.h rename to 3rdparty/stb/include/stb_image_write.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 16febf08..6a5076ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -73,14 +73,12 @@ if(ENABLE_CUDA AND NOT CUDA_COMPUTE_MODEL) endif() if(USE_INTEGRATED_LIBS) - include_directories(${CMAKE_CURRENT_LIST_DIR}/3rdparty/include) - set(PThreads_windows_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty/include) - set(PThreads_windows_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/3rdparty/lib/x64/pthreadVC2.lib) + set(PThreads_windows_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty/pthreads CACHE PATH "Path where pthreads for windows can be located") add_definitions(-D_TIMESPEC_DEFINED) endif() +set(Stb_DIR ${CMAKE_CURRENT_LIST_DIR}/3rdparty/stb CACHE PATH "Path where Stb image library can be located") set(CMAKE_DEBUG_POSTFIX d) - add_definitions(-DUSE_CMAKE_LIBS) if(MSVC) @@ -108,6 +106,7 @@ set(ENABLE_OPENCV "TRUE" CACHE BOOL "Enable OpenCV integration") if(ENABLE_OPENCV) find_package(OpenCV) endif() +find_package(Stb REQUIRED) set(SKIP_USELIB_TRACK "FALSE" CACHE BOOL "Skip building uselib_track" FORCE) if(OpenCV_FOUND) @@ -260,7 +259,7 @@ if(OpenCV_VERSION VERSION_GREATER "3.0" AND NOT SKIP_USELIB_TRACK) add_executable(uselib_track ${CMAKE_CURRENT_LIST_DIR}/src/yolo_console_dll.cpp) target_compile_definitions(uselib_track PRIVATE TRACK_OPTFLOW=1) set_target_properties(uselib_track PROPERTIES LINKER_LANGUAGE CXX) - target_include_directories(uselib_track PUBLIC $ $ $) + target_include_directories(uselib_track PUBLIC $ $ $ $) target_link_libraries(uselib_track PRIVATE ${OpenCV_LIBS}) endif() @@ -271,9 +270,9 @@ add_executable(darknet ${CMAKE_CURRENT_LIST_DIR}/src/darknet.c ${sources} ${head set_source_files_properties(${CMAKE_CURRENT_LIST_DIR}/src/darknet.c PROPERTIES LANGUAGE CXX) set_target_properties(darknet PROPERTIES LINKER_LANGUAGE CXX) -target_include_directories(darknet PUBLIC $ $ $) -target_include_directories(darklib PUBLIC $ $ $) -target_include_directories(uselib PUBLIC $ $ $) +target_include_directories(darknet PUBLIC $ $ $ $) +target_include_directories(darklib PUBLIC $ $ $ $) +target_include_directories(uselib PUBLIC $ $ $ $) if(CUDNN_FOUND) target_link_libraries(darknet PRIVATE CuDNN::CuDNN) diff --git a/CMakeSettings.json b/CMakeSettings.json index 968e68ba..4df04b61 100644 --- a/CMakeSettings.json +++ b/CMakeSettings.json @@ -20,9 +20,8 @@ "cmakeCommandArgs": "", "configurationType": "Debug", "generator": "Visual Studio 15 2017 Win64", - "name": "x64-Debug", - "variables": [ - { + "name": "x64-Debug static", + "variables": [{ "name": "CMAKE_TOOLCHAIN_FILE", "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" }, @@ -35,16 +34,14 @@ "value": "${env.VCPKG_DEFAULT_TRIPLET}" } ] - }, - { + }, { "buildCommandArgs": "-m -v:minimal", "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", "cmakeCommandArgs": "", "configurationType": "Release", "generator": "Visual Studio 15 2017 Win64", - "name": "x64-Release", - "variables": [ - { + "name": "x64-Release static", + "variables": [{ "name": "CMAKE_TOOLCHAIN_FILE", "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" }, @@ -57,6 +54,159 @@ "value": "${env.VCPKG_DEFAULT_TRIPLET}" } ] + }, { + "buildCommandArgs": "-m -v:minimal", + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "configurationType": "Debug", + "generator": "Visual Studio 15 2017 Win64", + "name": "x64-Debug static w/ CUDA", + "variables": [{ + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + }, + { + "name": "USE_INTEGRATED_LIBS", + "value": "FALSE" + }, + { + "name": "CUDA_COMPUTE_MODEL", + "value": "30" + }, + { + "name": "VCPKG_TARGET_TRIPLET", + "value": "${env.VCPKG_DEFAULT_TRIPLET}" + } + ] + }, { + "buildCommandArgs": "-m -v:minimal", + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "configurationType": "Release", + "generator": "Visual Studio 15 2017 Win64", + "name": "x64-Release static w/ CUDA", + "variables": [{ + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + }, + { + "name": "USE_INTEGRATED_LIBS", + "value": "FALSE" + }, + { + "name": "CUDA_COMPUTE_MODEL", + "value": "30" + }, + { + "name": "VCPKG_TARGET_TRIPLET", + "value": "${env.VCPKG_DEFAULT_TRIPLET}" + } + ] + } + { + "buildCommandArgs": "-m -v:minimal", + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "configurationType": "Debug", + "generator": "Visual Studio 15 2017 Win64", + "name": "x64-Debug dynamic", + "variables": [{ + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + }, + { + "name": "USE_INTEGRATED_LIBS", + "value": "FALSE" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "TRUE" + }, + { + "name": "VCPKG_TARGET_TRIPLET", + "value": "${env.VCPKG_DEFAULT_TRIPLET}" + } + ] + }, { + "buildCommandArgs": "-m -v:minimal", + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "configurationType": "Release", + "generator": "Visual Studio 15 2017 Win64", + "name": "x64-Release dynamic", + "variables": [{ + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + }, + { + "name": "USE_INTEGRATED_LIBS", + "value": "FALSE" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "TRUE" + }, + { + "name": "VCPKG_TARGET_TRIPLET", + "value": "${env.VCPKG_DEFAULT_TRIPLET}" + } + ] + }, { + "buildCommandArgs": "-m -v:minimal", + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "configurationType": "Debug", + "generator": "Visual Studio 15 2017 Win64", + "name": "x64-Debug dynamic w/ CUDA", + "variables": [{ + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + }, + { + "name": "USE_INTEGRATED_LIBS", + "value": "FALSE" + }, + { + "name": "CUDA_COMPUTE_MODEL", + "value": "30" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "TRUE" + }, + { + "name": "VCPKG_TARGET_TRIPLET", + "value": "${env.VCPKG_DEFAULT_TRIPLET}" + } + ] + }, { + "buildCommandArgs": "-m -v:minimal", + "buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}", + "cmakeCommandArgs": "", + "configurationType": "Release", + "generator": "Visual Studio 15 2017 Win64", + "name": "x64-Release dynamic w/ CUDA", + "variables": [{ + "name": "CMAKE_TOOLCHAIN_FILE", + "value": "${env.VCPKG_ROOT}\\scripts\\buildsystems\\vcpkg.cmake" + }, + { + "name": "USE_INTEGRATED_LIBS", + "value": "FALSE" + }, + { + "name": "CUDA_COMPUTE_MODEL", + "value": "30" + }, + { + "name": "BUILD_SHARED_LIBS", + "value": "TRUE" + }, + { + "name": "VCPKG_TARGET_TRIPLET", + "value": "${env.VCPKG_DEFAULT_TRIPLET}" + } + ] } ] } diff --git a/DarknetConfig.cmake.in b/DarknetConfig.cmake.in index 0e8956f9..606503f2 100644 --- a/DarknetConfig.cmake.in +++ b/DarknetConfig.cmake.in @@ -6,10 +6,15 @@ # Compute paths get_filename_component(Darknet_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) set(Darknet_INCLUDE_DIRS "@CONF_INCLUDE_DIRS@") +list(APPEND CMAKE_MODULE_PATH "${Darknet_CMAKE_DIR}") include(CMakeFindDependencyMacro) -find_dependency(OpenCV REQUIRED) +if(@ENABLE_OPENCV@) + find_dependency(OpenCV REQUIRED) +endif() + +find_dependency(Stb REQUIRED HINTS "@Stb_DIR@") if(@ENABLE_CUDA@) find_dependency(CUDNN) @@ -18,11 +23,11 @@ endif() set(CMAKE_THREAD_PREFER_PTHREAD ON) find_dependency(Threads) -if(@MSVC@) +if(MSVC) find_dependency(PThreads_windows) endif() -if("@CMAKE_VERSION@" VERSION_GREATER "3.9.0") +if("${CMAKE_VERSION}" VERSION_GREATER "3.9.0") find_dependency(OpenMP) endif() diff --git a/Makefile b/Makefile index b9bed33b..d184ca17 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ OS := $(shell uname) # GTX 1080, GTX 1070, GTX 1060, GTX 1050, GTX 1030, Titan Xp, Tesla P40, Tesla P4 # ARCH= -gencode arch=compute_61,code=sm_61 -gencode arch=compute_61,code=compute_61 -# GP100/Tesla P100 DGX-1 +# GP100/Tesla P100 - DGX-1 # ARCH= -gencode arch=compute_60,code=sm_60 # For Jetson TX1, Tegra X1, DRIVE CX, DRIVE PX - uncomment: @@ -54,30 +54,30 @@ endif CC=gcc CPP=g++ -NVCC=nvcc +NVCC=nvcc OPTS=-Ofast -LDFLAGS= -lm -pthread -COMMON= -Iinclude/ +LDFLAGS= -lm -pthread +COMMON= -Iinclude/ -I3rdparty/stb/include CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -ifeq ($(DEBUG), 1) +ifeq ($(DEBUG), 1) #OPTS= -O0 -g #OPTS= -Og -g COMMON+= -DDEBUG CFLAGS+= -DDEBUG else -ifeq ($(AVX), 1) +ifeq ($(AVX), 1) CFLAGS+= -ffp-contract=fast -mavx -mavx2 -msse3 -msse4.1 -msse4.2 -msse4a endif endif CFLAGS+=$(OPTS) -ifeq ($(OPENCV), 1) +ifeq ($(OPENCV), 1) COMMON+= -DOPENCV CFLAGS+= -DOPENCV -LDFLAGS+= `pkg-config --libs opencv` -COMMON+= `pkg-config --cflags opencv` +LDFLAGS+= `pkg-config --libs opencv` +COMMON+= `pkg-config --cflags opencv` endif ifeq ($(OPENMP), 1) @@ -129,12 +129,12 @@ DEPS = $(wildcard src/*.h) Makefile include/darknet.h all: obj backup results setchmod $(EXEC) $(LIBNAMESO) $(APPNAMESO) -ifeq ($(LIBSO), 1) +ifeq ($(LIBSO), 1) CFLAGS+= -fPIC $(LIBNAMESO): $(OBJS) include/yolo_v2_class.hpp src/yolo_v2_class.cpp $(CPP) -shared -std=c++11 -fvisibility=hidden -DLIB_EXPORTS $(COMMON) $(CFLAGS) $(OBJS) src/yolo_v2_class.cpp -o $@ $(LDFLAGS) - + $(APPNAMESO): $(LIBNAMESO) include/yolo_v2_class.hpp src/yolo_console_dll.cpp $(CPP) -std=c++11 $(COMMON) $(CFLAGS) -o $@ src/yolo_console_dll.cpp $(LDFLAGS) -L ./ -l:$(LIBNAMESO) endif @@ -164,4 +164,3 @@ setchmod: clean: rm -rf $(OBJS) $(EXEC) $(LIBNAMESO) $(APPNAMESO) - diff --git a/README.md b/README.md index 9b740ae2..e04ffe97 100644 --- a/README.md +++ b/README.md @@ -183,9 +183,9 @@ PS \> cd $env:VCPKG_ROOT PS Code\vcpkg> .\vcpkg install pthreads opencv #replace with opencv[cuda] in case you want to use cuda-accelerated openCV ``` -8. [necessary only with CUDA] Customize the CMakeLists.txt with the preferred compute capability +8. [necessary only with CUDA] Customize the `build.ps1` script enabling the appropriate `my_cuda_compute_model` line. If not manually defined, CMake toolchain will automatically use the very low 3.0 CUDA compute model -9. Build with the Powershell script `build.ps1` or use the "Open Folder" functionality of Visual Studio 2017. In the first option, if you want to use Visual Studio, you will find a custom solution created for you by CMake after the build containing all the appropriate config flags for your system. +9. Build with the Powershell script `build.ps1`. If you want to use Visual Studio, you will find a custom solution created for you by CMake after the build containing all the appropriate config flags for your system. ### How to compile on Windows (legacy way) diff --git a/build.ps1 b/build.ps1 index d937b427..7063098c 100755 --- a/build.ps1 +++ b/build.ps1 @@ -2,12 +2,25 @@ $number_of_build_workers=8 #$shared_lib="-DBUILD_SHARED_LIBS:BOOL=ON" +$force_using_include_libs=$false -if (Test-Path env:VCPKG_ROOT) { +#$my_cuda_compute_model=75 #Compute capability for Tesla T4, RTX 2080 +#$my_cuda_compute_model=72 #Compute capability for Jetson Xavier +#$my_cuda_compute_model=70 #Compute capability for Tesla V100 +#$my_cuda_compute_model=62 #Compute capability for Jetson TX2 +#$my_cuda_compute_model=61 #Compute capability for Tesla P40 +#$my_cuda_compute_model=60 #Compute capability for Tesla P100 +#$my_cuda_compute_model=53 #Compute capability for Jetson TX1 +#$my_cuda_compute_model=52 #Compute capability for Tesla M40/M60 +#$my_cuda_compute_model=37 #Compute capability for Tesla K80 +#$my_cuda_compute_model=35 #Compute capability for Tesla K20/K40 +#$my_cuda_compute_model=30 #Compute capability for Tesla K10, Quadro K4000 + +if ((Test-Path env:VCPKG_ROOT) -and -not $force_using_include_libs) { $vcpkg_path = "$env:VCPKG_ROOT" Write-Host "Found vcpkg in VCPKG_ROOT: $vcpkg_path" } -elseif (Test-Path "${env:WORKSPACE}\vcpkg") { +elseif ((Test-Path "${env:WORKSPACE}\vcpkg") -and -not $force_using_include_libs) { $vcpkg_path = "${env:WORKSPACE}\vcpkg" Write-Host "Found vcpkg in WORKSPACE\vcpkg: $vcpkg_path" } @@ -67,39 +80,39 @@ if (Test-Path env:CUDA_PATH) { } } -if (Test-Path $vcpkg_path) { - # RELEASE - New-Item -Path .\build_win_release -ItemType directory -Force - Set-Location build_win_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} --target install - Remove-Item DarknetConfig.cmake - Remove-Item DarknetConfigVersion.cmake - Set-Location .. -# Remove-Item -Force DarknetConfig.cmake -# Remove-Item -Force DarknetConfigVersion.cmake +if($my_cuda_compute_model) { + $additional_build_setup = "-DCUDA_COMPUTE_MODEL=${my_cuda_compute_model}" +} +if ($vcpkg_path) { # 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 -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 $additional_build_setup .. cmake --build . --config Debug --parallel ${number_of_build_workers} --target install Remove-Item DarknetConfig.cmake Remove-Item DarknetConfigVersion.cmake Set-Location .. -# Remove-Item -Force DarknetConfig.cmake -# Remove-Item -Force DarknetConfigVersion.cmake -} -else { - # 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 .. + + # RELEASE + New-Item -Path .\build_win_release -ItemType directory -Force + Set-Location build_win_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 $additional_build_setup .. cmake --build . --config Release --parallel ${number_of_build_workers} --target install Remove-Item DarknetConfig.cmake Remove-Item DarknetConfigVersion.cmake + Copy-Item *.dll .. + Set-Location .. +} +else { + # USE LOCAL PTHREAD LIB AND LOCAL STB HEADER, NO VCPKG, ONLY RELEASE MODE SUPPORTED + # 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 $additional_build_setup .. + cmake --build . --config Release --parallel ${number_of_build_workers} --target install + Remove-Item DarknetConfig.cmake + Remove-Item DarknetConfigVersion.cmake + Copy-Item ..\3rdparty\pthreads\bin\pthreadVC2.dll .. Set-Location .. -# Remove-Item -Force DarknetConfig.cmake -# Remove-Item -Force DarknetConfigVersion.cmake } diff --git a/build.sh b/build.sh index b41eddfe..7ff54d91 100755 --- a/build.sh +++ b/build.sh @@ -18,11 +18,10 @@ cd build_release cmake .. -DCMAKE_BUILD_TYPE=Release ${additional_defines} cmake --build . --target install -- -j${number_of_build_workers} #cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+ -rm DarknetConfig.cmake -rm DarknetConfigVersion.cmake +rm -f DarknetConfig.cmake +rm -f DarknetConfigVersion.cmake cd .. -rm DarknetConfig.cmake -rm DarknetConfigVersion.cmake +cp cmake/Modules/*.cmake share/darknet # DEBUG mkdir -p build_debug @@ -30,8 +29,7 @@ cd build_debug cmake .. -DCMAKE_BUILD_TYPE=Debug ${additional_defines} cmake --build . --target install -- -j${number_of_build_workers} #cmake --build . --target install --parallel ${number_of_build_workers} #valid only for CMake 3.12+ -rm DarknetConfig.cmake -rm DarknetConfigVersion.cmake +rm -f DarknetConfig.cmake +rm -f DarknetConfigVersion.cmake cd .. -rm DarknetConfig.cmake -rm DarknetConfigVersion.cmake +cp cmake/Modules/*.cmake share/darknet diff --git a/cmake/Modules/FindDarknet.cmake b/cmake/Modules/FindDarknet.cmake deleted file mode 100644 index 8861e1a7..00000000 --- a/cmake/Modules/FindDarknet.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. -# Copyright Stefano Sinigardi - -#.rst: -# FindDarknet -# ------------ -# -# Find the Darknet includes and library. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module defines the following variables: -# -# ``Darknet_FOUND`` -# True if Darknet library found -# -# ``Darknet_INCLUDE_DIR`` -# Location of Darknet headers -# -# ``Darknet_LIBRARY`` -# List of libraries to link with when using Darknet -# - -include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) -include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) - -if(NOT Darknet_INCLUDE_DIR) - find_path(Darknet_INCLUDE_DIR NAMES darknet.h PATHS darknet darknet/include) -endif() - -# Allow libraries to be set manually -if(NOT Darknet_LIBRARY) - find_library(Darknet_LIBRARY_RELEASE NAMES darklib PATHS darknet darknet/lib) - find_library(Darknet_LIBRARY_DEBUG NAMES darklibd PATHS darknet darknet/lib) - select_library_configurations(Darknet) -endif() - -set(Darknet_INCLUDE_DIRS "${Darknet_INCLUDE_DIR}") -set(Darknet_LIBRARIES "${Darknet_LIBRARY}") - -find_package_handle_standard_args(Darknet DEFAULT_MSG Darknet_LIBRARY Darknet_INCLUDE_DIR) -mark_as_advanced(Darknet_INCLUDE_DIR Darknet_INCLUDE_DIRS Darknet_LIBRARY Darknet_LIBRARIES) diff --git a/cmake/Modules/FindPThreads_windows.cmake b/cmake/Modules/FindPThreads_windows.cmake index 2012cd1d..e1c4cfd2 100644 --- a/cmake/Modules/FindPThreads_windows.cmake +++ b/cmake/Modules/FindPThreads_windows.cmake @@ -26,13 +26,13 @@ include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) if(NOT PThreads_windows_INCLUDE_DIR) - find_path(PThreads_windows_INCLUDE_DIR NAMES pthread.h) + find_path(PThreads_windows_INCLUDE_DIR NAMES pthread.h PATHS ${PThreads_windows_DIR} PATH_SUFFIXES include) endif() # Allow libraries to be set manually if(NOT PThreads_windows_LIBRARY) - find_library(PThreads_windows_LIBRARY_RELEASE NAMES pthreadsVC2 pthreadVC2) - find_library(PThreads_windows_LIBRARY_DEBUG NAMES pthreadsVC2d pthreadVC2d) + find_library(PThreads_windows_LIBRARY_RELEASE NAMES pthreadsVC2 pthreadVC2 PATHS ${PThreads_windows_DIR} PATH_SUFFIXES lib) + find_library(PThreads_windows_LIBRARY_DEBUG NAMES pthreadsVC2d pthreadVC2d PATHS ${PThreads_windows_DIR} PATH_SUFFIXES lib) select_library_configurations(PThreads_windows) endif() @@ -70,7 +70,7 @@ if( PThreads_windows_FOUND AND NOT TARGET PThreads_windows::PThreads_windows ) else() add_library( PThreads_windows::PThreads_windows UNKNOWN IMPORTED ) set_target_properties( PThreads_windows::PThreads_windows PROPERTIES - IMPORTED_LOCATION_RELEASE "${PThreads_windows_LIBRARY}" + IMPORTED_LOCATION_RELEASE "${PThreads_windows_LIBRARY_RELEASE}" INTERFACE_INCLUDE_DIRECTORIES "${PThreads_windows_INCLUDE_DIR}" IMPORTED_CONFIGURATIONS Release IMPORTED_LINK_INTERFACE_LANGUAGES "C" ) diff --git a/cmake/Modules/FindStb.cmake b/cmake/Modules/FindStb.cmake new file mode 100755 index 00000000..1db213a6 --- /dev/null +++ b/cmake/Modules/FindStb.cmake @@ -0,0 +1,30 @@ +# Distributed under the OSI-approved BSD 3-Clause License. +# Copyright Stefano Sinigardi + +#.rst: +# FindStb +# ------------ +# +# Find the Stb include headers. +# +# Result Variables +# ^^^^^^^^^^^^^^^^ +# +# This module defines the following variables: +# +# ``Stb_FOUND`` +# True if Stb library found +# +# ``Stb_INCLUDE_DIR`` +# Location of Stb headers +# + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +include(${CMAKE_ROOT}/Modules/SelectLibraryConfigurations.cmake) + +if(NOT Stb_INCLUDE_DIR) + find_path(Stb_INCLUDE_DIR NAMES stb_image.h PATHS ${Stb_DIR} PATH_SUFFIXES include) +endif() + +find_package_handle_standard_args(Stb DEFAULT_MSG Stb_INCLUDE_DIR) +mark_as_advanced(Stb_INCLUDE_DIR) diff --git a/image_yolov2.sh b/image_yolov2.sh old mode 100644 new mode 100755 diff --git a/image_yolov3.sh b/image_yolov3.sh old mode 100644 new mode 100755 diff --git a/json_mjpeg_streams.sh b/json_mjpeg_streams.sh old mode 100644 new mode 100755 diff --git a/net_cam_v3.sh b/net_cam_v3.sh old mode 100644 new mode 100755 diff --git a/video_v2.sh b/video_v2.sh old mode 100644 new mode 100755 diff --git a/video_yolov3.sh b/video_yolov3.sh old mode 100644 new mode 100755