move Stb lib to 3rdparty folder

This commit is contained in:
Stefano Sinigardi 2019-03-13 22:56:44 +01:00
parent dd27d67f58
commit 5be12ce058
31 changed files with 65 additions and 40 deletions

View File

@ -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/include 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)
@ -241,7 +240,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 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include>)
target_include_directories(uselib_track PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
target_link_libraries(uselib_track PRIVATE ${OpenCV_LIBS})
endif()
@ -252,9 +251,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 $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include>)
target_include_directories(darklib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include>)
target_include_directories(uselib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include>)
target_include_directories(darknet PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
target_include_directories(darklib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
target_include_directories(uselib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/src> $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${Stb_INCLUDE_DIR}>)
if(CUDNN_FOUND)
target_link_libraries(darknet PRIVATE CuDNN::CuDNN)

View File

@ -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)
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()

View File

@ -32,7 +32,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:
@ -56,7 +56,7 @@ CPP=g++
NVCC=nvcc
OPTS=-Ofast
LDFLAGS= -lm -pthread
COMMON= -Iinclude/
COMMON= -Iinclude/ -I3rdparty/stb/include
CFLAGS=-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC
ifeq ($(DEBUG), 1)
@ -157,4 +157,3 @@ setchmod:
clean:
rm -rf $(OBJS) $(EXEC) $(LIBNAMESO) $(APPNAMESO)

View File

@ -63,7 +63,7 @@ if (Test-Path env:CUDA_PATH) {
}
}
if (Test-Path $vcpkg_path) {
if ($vcpkg_path) {
# RELEASE
New-Item -Path .\build_win_release -ItemType directory -Force
Set-Location build_win_release
@ -72,8 +72,6 @@ if (Test-Path $vcpkg_path) {
Remove-Item DarknetConfig.cmake
Remove-Item DarknetConfigVersion.cmake
Set-Location ..
# Remove-Item -Force DarknetConfig.cmake
# Remove-Item -Force DarknetConfigVersion.cmake
# DEBUG
New-Item -Path .\build_win_debug -ItemType directory -Force
@ -83,8 +81,6 @@ if (Test-Path $vcpkg_path) {
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
@ -96,6 +92,4 @@ else {
Remove-Item DarknetConfig.cmake
Remove-Item DarknetConfigVersion.cmake
Set-Location ..
# Remove-Item -Force DarknetConfig.cmake
# Remove-Item -Force DarknetConfigVersion.cmake
}

View File

@ -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

30
cmake/Modules/FindStb.cmake Executable file
View File

@ -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})
endif()
find_package_handle_standard_args(Stb DEFAULT_MSG Stb_INCLUDE_DIR)
mark_as_advanced(Stb_INCLUDE_DIR)

0
image_yolov2.sh Normal file → Executable file
View File

0
image_yolov3.sh Normal file → Executable file
View File

0
json_mjpeg_streams.sh Normal file → Executable file
View File

0
net_cam_v3.sh Normal file → Executable file
View File

0
video_v2.sh Normal file → Executable file
View File

0
video_yolov3.sh Normal file → Executable file
View File