mirror of https://github.com/davisking/dlib.git
Moved the auxiliary cmake into a common folder.
--HG-- rename : dlib/add_global_compiler_switch.cmake => dlib/cmake_utils/add_global_compiler_switch.cmake rename : dlib/add_python_module => dlib/cmake_utils/add_python_module rename : dlib/cmake_find_blas.txt => dlib/cmake_utils/cmake_find_blas.txt rename : dlib/dlib.pc.in => dlib/cmake_utils/dlib.pc.in rename : dlib/dlibConfig.cmake.in => dlib/cmake_utils/dlibConfig.cmake.in rename : dlib/release_build_by_default => dlib/cmake_utils/release_build_by_default rename : dlib/tell_visual_studio_to_use_static_runtime.cmake => dlib/cmake_utils/tell_visual_studio_to_use_static_runtime.cmake rename : dlib/dnn/test_for_cpp11/CMakeLists.txt => dlib/cmake_utils/test_for_cpp11/CMakeLists.txt rename : dlib/dnn/test_for_cpp11/cpp11_test.cpp => dlib/cmake_utils/test_for_cpp11/cpp11_test.cpp rename : dlib/dnn/test_for_cuda/CMakeLists.txt => dlib/cmake_utils/test_for_cuda/CMakeLists.txt rename : dlib/dnn/test_for_cuda/cuda_test.cu => dlib/cmake_utils/test_for_cuda/cuda_test.cu rename : dlib/dnn/test_for_cudnn/CMakeLists.txt => dlib/cmake_utils/test_for_cudnn/CMakeLists.txt rename : dlib/dnn/test_for_cudnn/find_cudnn.txt => dlib/cmake_utils/test_for_cudnn/find_cudnn.txt rename : dlib/use_cpp_11.cmake => dlib/cmake_utils/use_cpp_11.cmake
This commit is contained in:
parent
dcc32f4ec4
commit
4de8678b57
|
@ -8,8 +8,8 @@ cmake_minimum_required(VERSION 2.8.4)
|
|||
project(dlib)
|
||||
|
||||
# default to a Release build (except if CMAKE_BUILD_TYPE is set)
|
||||
include(release_build_by_default)
|
||||
include(use_cpp_11.cmake)
|
||||
include(cmake_utils/release_build_by_default)
|
||||
include(cmake_utils/use_cpp_11.cmake)
|
||||
|
||||
|
||||
set(CPACK_PACKAGE_VERSION_MAJOR "19")
|
||||
|
@ -31,7 +31,7 @@ if(COMMAND cmake_policy)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
include(add_global_compiler_switch.cmake)
|
||||
include(cmake_utils/add_global_compiler_switch.cmake)
|
||||
|
||||
|
||||
# Make sure ENABLE_ASSERTS is defined for debug builds
|
||||
|
@ -424,7 +424,7 @@ if (NOT TARGET dlib)
|
|||
|
||||
if (DLIB_USE_BLAS OR DLIB_USE_LAPACK)
|
||||
# Try to find BLAS and LAPACK
|
||||
include(cmake_find_blas.txt)
|
||||
include(cmake_utils/cmake_find_blas.txt)
|
||||
|
||||
if (DLIB_USE_BLAS)
|
||||
if (blas_found)
|
||||
|
@ -458,13 +458,13 @@ if (NOT TARGET dlib)
|
|||
# linux).
|
||||
list(APPEND CUDA_NVCC_FLAGS "-arch=sm_30;-std=c++11;-D__STRICT_ANSI__")
|
||||
|
||||
include(dnn/test_for_cudnn/find_cudnn.txt)
|
||||
include(cmake_utils/test_for_cudnn/find_cudnn.txt)
|
||||
|
||||
if (cudnn AND NOT DEFINED cuda_test_compile_worked AND NOT DEFINED cudnn_test_compile_worked)
|
||||
# make sure cuda is really working by doing a test compile
|
||||
message(STATUS "Building a CUDA test project to see if your compiler is compatible with CUDA...")
|
||||
try_compile(cuda_test_compile_worked ${PROJECT_BINARY_DIR}/cuda_test_build
|
||||
${PROJECT_SOURCE_DIR}/dnn/test_for_cuda cuda_test
|
||||
${PROJECT_SOURCE_DIR}/cmake_utils/test_for_cuda cuda_test
|
||||
CMAKE_FLAGS "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
|
||||
"-DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}"
|
||||
"-DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}"
|
||||
|
@ -474,7 +474,7 @@ if (NOT TARGET dlib)
|
|||
else()
|
||||
message(STATUS "Checking if you have the right version of cuDNN installed.")
|
||||
try_compile(cudnn_test_compile_worked ${PROJECT_BINARY_DIR}/cudnn_test_build
|
||||
${PROJECT_SOURCE_DIR}/dnn/test_for_cudnn cudnn_test
|
||||
${PROJECT_SOURCE_DIR}/cmake_utils/test_for_cudnn cudnn_test
|
||||
CMAKE_FLAGS "-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}"
|
||||
"-DCMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}"
|
||||
"-DCMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}"
|
||||
|
@ -610,7 +610,7 @@ if (NOT TARGET dlib)
|
|||
DESTINATION ${ConfigPackageLocation})
|
||||
|
||||
set(CONF_INSTALL_PATH "\${dlib_CMAKE_DIR}/../../../")
|
||||
configure_file(dlibConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/config/dlibConfig.cmake" @ONLY)
|
||||
configure_file(cmake_utils/dlibConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/config/dlibConfig.cmake" @ONLY)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
|
@ -626,7 +626,7 @@ if (NOT TARGET dlib)
|
|||
|
||||
## dlib-1.pc generation and installation
|
||||
|
||||
configure_file("dlib.pc.in" "dlib-1.pc" @ONLY)
|
||||
configure_file("cmake_utils/dlib.pc.in" "dlib-1.pc" @ONLY)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/dlib-1.pc"
|
||||
DESTINATION "${LIB_INSTALL_DIR}/pkgconfig")
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ endif()
|
|||
|
||||
|
||||
# Determine the path to dlib.
|
||||
string(REGEX REPLACE "cmake$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE})
|
||||
include(${dlib_path}/add_global_compiler_switch.cmake)
|
||||
include(${dlib_path}/use_cpp_11.cmake)
|
||||
set(dlib_path ${CMAKE_CURRENT_LIST_DIR})
|
||||
include(${dlib_path}/cmake_utils/add_global_compiler_switch.cmake)
|
||||
include(${dlib_path}/cmake_utils/use_cpp_11.cmake)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
# By default, g++ won't warn or error if you forget to return a value in a
|
||||
|
@ -92,7 +92,7 @@ INCLUDE_DIRECTORIES(${dlib_path}/..)
|
|||
|
||||
# This is really optional, but nice. It will make sure the build mode
|
||||
# created by cmake is always release by default.
|
||||
include(${dlib_path}/release_build_by_default)
|
||||
include(${dlib_path}/cmake_utils/release_build_by_default)
|
||||
|
||||
|
||||
# Don't add dlib if it's already been added to the cmake project
|
||||
|
|
|
@ -40,8 +40,7 @@ set(CMAKE_PREFIX_PATH ${PYTHON_PATH})
|
|||
# of other dll files and can be safely copied to someone elese's computer
|
||||
# and expected to run.
|
||||
if (MSVC)
|
||||
string(REGEX REPLACE "add_python_module$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE})
|
||||
include(${dlib_path}/tell_visual_studio_to_use_static_runtime.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/tell_visual_studio_to_use_static_runtime.cmake)
|
||||
add_definitions(-DBOOST_PYTHON_STATIC_LIB)
|
||||
SET(Boost_USE_STATIC_LIBS ON)
|
||||
SET(Boost_USE_MULTITHREADED ON)
|
||||
|
@ -130,8 +129,7 @@ else()
|
|||
endif()
|
||||
|
||||
# include dlib so we can link against it
|
||||
string(REGEX REPLACE "add_python_module$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE})
|
||||
include(${dlib_path}/cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../cmake)
|
||||
|
||||
|
||||
# We put the extra _ on the end of the name just so it's possible to
|
|
@ -37,3 +37,4 @@ endif()
|
|||
|
||||
find_library(dlib_LIBRARIES dlib HINTS ${dlib_INSTALL_PATH}/lib)
|
||||
set(dlib_LIBRARIES ${dlib_LIBRARIES} "@dlib_needed_libraries@")
|
||||
set(dlib_LIBS ${dlib_LIBRARIES} "@dlib_needed_libraries@")
|
|
@ -2,7 +2,7 @@
|
|||
cmake_minimum_required(VERSION 2.8.4)
|
||||
project(cuda_test)
|
||||
|
||||
include_directories(..)
|
||||
include_directories(../../dnn)
|
||||
add_definitions(-DDLIB_USE_CUDA)
|
||||
|
||||
find_package(CUDA 7.5 REQUIRED)
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.8.4)
|
||||
project(cudnn_test)
|
||||
include(../../use_cpp_11.cmake)
|
||||
include(../use_cpp_11.cmake)
|
||||
|
||||
find_package(CUDA 7.5 REQUIRED)
|
||||
set(CUDA_HOST_COMPILATION_CPP ON)
|
||||
|
@ -12,4 +12,4 @@ include(find_cudnn.txt)
|
|||
|
||||
include_directories(${cudnn_include})
|
||||
|
||||
cuda_add_library(cudnn_test STATIC ../cudnn_dlibapi.cpp ${cudnn} )
|
||||
cuda_add_library(cudnn_test STATIC ../../dnn/cudnn_dlibapi.cpp ${cudnn} )
|
|
@ -16,9 +16,7 @@ endif()
|
|||
# Set to false unless we find out otherwise in the code below.
|
||||
set(COMPILER_CAN_DO_CPP_11 0)
|
||||
|
||||
# Determine the path to dlib.
|
||||
string(REGEX REPLACE "use_cpp_11.cmake$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE})
|
||||
include(${dlib_path}/add_global_compiler_switch.cmake)
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/add_global_compiler_switch.cmake)
|
||||
|
||||
|
||||
# Now turn on the appropriate compiler switch to enable C++11 if you have a
|
||||
|
@ -44,7 +42,7 @@ if (CMAKE_VERSION VERSION_LESS "3.1.2")
|
|||
# Since we don't know what compiler this is ust try to build a c++11 project and see if it compiles.
|
||||
message(STATUS "Building a C++11 test project to see if your compiler supports C++11")
|
||||
try_compile(test_for_cpp11_worked ${PROJECT_BINARY_DIR}/cpp11_test_build
|
||||
${dlib_path}/dnn/test_for_cpp11 cpp11_test)
|
||||
${CMAKE_CURRENT_LIST_DIR}/test_for_cpp11 cpp11_test)
|
||||
if (test_for_cpp11_worked)
|
||||
message(STATUS "C++11 activated.")
|
||||
set(COMPILER_CAN_DO_CPP_11 1)
|
|
@ -3,7 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.4)
|
|||
|
||||
|
||||
set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
|
||||
include(../../dlib/add_python_module)
|
||||
include(../../dlib/cmake_utils/add_python_module)
|
||||
|
||||
add_definitions(-DDLIB_VERSION=${DLIB_VERSION})
|
||||
|
||||
|
|
Loading…
Reference in New Issue