Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
86eaaf45
Commit
86eaaf45
authored
Mar 18, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
c5689ea2
e26e09d3
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
352 additions
and
349 deletions
+352
-349
CMakeLists.txt
dlib/CMakeLists.txt
+142
-139
check_if_neon_available.cmake
dlib/cmake_utils/check_if_neon_available.cmake
+3
-3
find_blas.cmake
dlib/cmake_utils/find_blas.cmake
+196
-196
set_compiler_specific_options.cmake
dlib/cmake_utils/set_compiler_specific_options.cmake
+1
-1
tell_visual_studio_to_use_static_runtime.cmake
...make_utils/tell_visual_studio_to_use_static_runtime.cmake
+1
-1
use_cpp_11.cmake
dlib/cmake_utils/use_cpp_11.cmake
+9
-9
No files found.
dlib/CMakeLists.txt
View file @
86eaaf45
...
...
@@ -89,10 +89,10 @@ endmacro()
# Suppress superfluous randlib warnings about libdlib.a having no symbols on MacOSX.
if
(
APPLE
)
set
(
CMAKE_C_ARCHIVE_CREATE
"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>"
)
set
(
CMAKE_CXX_ARCHIVE_CREATE
"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>"
)
set
(
CMAKE_C_ARCHIVE_FINISH
"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>"
)
set
(
CMAKE_CXX_ARCHIVE_FINISH
"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>"
)
set
(
CMAKE_C_ARCHIVE_CREATE
"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>"
)
set
(
CMAKE_CXX_ARCHIVE_CREATE
"<CMAKE_AR> Scr <TARGET> <LINK_FLAGS> <OBJECTS>"
)
set
(
CMAKE_C_ARCHIVE_FINISH
"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>"
)
set
(
CMAKE_CXX_ARCHIVE_FINISH
"<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>"
)
endif
()
# Don't try to call add_library(dlib) and setup dlib's stuff if it has already
...
...
@@ -104,30 +104,30 @@ endif()
if
(
NOT TARGET dlib
)
set
(
DLIB_ISO_CPP_ONLY_STR
"Enable this if you don't want to compile any non-ISO C++ code (i.e. you don't use any of the API Wrappers)"
)
"Enable this if you don't want to compile any non-ISO C++ code (i.e. you don't use any of the API Wrappers)"
)
set
(
DLIB_NO_GUI_SUPPORT_STR
"Enable this if you don't want to compile any of the dlib GUI code"
)
"Enable this if you don't want to compile any of the dlib GUI code"
)
set
(
DLIB_ENABLE_STACK_TRACE_STR
"Enable this if you want to turn on the DLIB_STACK_TRACE macros"
)
"Enable this if you want to turn on the DLIB_STACK_TRACE macros"
)
set
(
DLIB_USE_BLAS_STR
"Disable this if you don't want to use a BLAS library"
)
"Disable this if you don't want to use a BLAS library"
)
set
(
DLIB_USE_LAPACK_STR
"Disable this if you don't want to use a LAPACK library"
)
"Disable this if you don't want to use a LAPACK library"
)
set
(
DLIB_USE_CUDA_STR
"Disable this if you don't want to use NVIDIA CUDA"
)
"Disable this if you don't want to use NVIDIA CUDA"
)
set
(
DLIB_PNG_SUPPORT_STR
"Disable this if you don't want to link against libpng"
)
"Disable this if you don't want to link against libpng"
)
set
(
DLIB_GIF_SUPPORT_STR
"Disable this if you don't want to link against libgif"
)
"Disable this if you don't want to link against libgif"
)
set
(
DLIB_JPEG_SUPPORT_STR
"Disable this if you don't want to link against libjpeg"
)
"Disable this if you don't want to link against libjpeg"
)
set
(
DLIB_LINK_WITH_SQLITE3_STR
"Disable this if you don't want to link against sqlite3"
)
"Disable this if you don't want to link against sqlite3"
)
#set (DLIB_USE_FFTW_STR "Disable this if you don't want to link against fftw" )
set
(
DLIB_USE_MKL_FFT_STR
"Disable this is you don't want to use the MKL DFTI FFT implementation"
)
"Disable this is you don't want to use the MKL DFTI FFT implementation"
)
set
(
DLIB_ENABLE_ASSERTS_STR
"Enable this if you want to turn on the DLIB_ASSERT macro"
)
"Enable this if you want to turn on the DLIB_ASSERT macro"
)
option
(
DLIB_ENABLE_ASSERTS
${
DLIB_ENABLE_ASSERTS_STR
}
OFF
)
...
...
@@ -199,30 +199,30 @@ if (NOT TARGET dlib)
set
(
source_files
base64/base64_kernel_1.cpp
bigint/bigint_kernel_1.cpp
bigint/bigint_kernel_2.cpp
bit_stream/bit_stream_kernel_1.cpp
entropy_decoder/entropy_decoder_kernel_1.cpp
entropy_decoder/entropy_decoder_kernel_2.cpp
entropy_encoder/entropy_encoder_kernel_1.cpp
entropy_encoder/entropy_encoder_kernel_2.cpp
md5/md5_kernel_1.cpp
tokenizer/tokenizer_kernel_1.cpp
unicode/unicode.cpp
data_io/image_dataset_metadata.cpp
data_io/mnist.cpp
global_optimization/global_function_search.cpp
filtering/kalman_filter.cpp
test_for_odr_violations.cpp
)
base64/base64_kernel_1.cpp
bigint/bigint_kernel_1.cpp
bigint/bigint_kernel_2.cpp
bit_stream/bit_stream_kernel_1.cpp
entropy_decoder/entropy_decoder_kernel_1.cpp
entropy_decoder/entropy_decoder_kernel_2.cpp
entropy_encoder/entropy_encoder_kernel_1.cpp
entropy_encoder/entropy_encoder_kernel_2.cpp
md5/md5_kernel_1.cpp
tokenizer/tokenizer_kernel_1.cpp
unicode/unicode.cpp
data_io/image_dataset_metadata.cpp
data_io/mnist.cpp
global_optimization/global_function_search.cpp
filtering/kalman_filter.cpp
test_for_odr_violations.cpp
)
set
(
dlib_needed_libraries
)
set
(
dlib_needed_includes
)
if
(
DLIB_ISO_CPP_ONLY
)
add_library
(
dlib
${
source_files
}
)
add_library
(
dlib
${
source_files
}
)
else
()
set
(
source_files
${
source_files
}
...
...
@@ -457,51 +457,51 @@ if (NOT TARGET dlib)
# If we can't find libjpeg then statically compile it in.
add_definitions
(
-DDLIB_JPEG_STATIC
)
set
(
source_files
${
source_files
}
external/libjpeg/jcomapi.cpp
external/libjpeg/jdapimin.cpp
external/libjpeg/jdapistd.cpp
external/libjpeg/jdatasrc.cpp
external/libjpeg/jdcoefct.cpp
external/libjpeg/jdcolor.cpp
external/libjpeg/jddctmgr.cpp
external/libjpeg/jdhuff.cpp
external/libjpeg/jdinput.cpp
external/libjpeg/jdmainct.cpp
external/libjpeg/jdmarker.cpp
external/libjpeg/jdmaster.cpp
external/libjpeg/jdmerge.cpp
external/libjpeg/jdphuff.cpp
external/libjpeg/jdpostct.cpp
external/libjpeg/jdsample.cpp
external/libjpeg/jerror.cpp
external/libjpeg/jidctflt.cpp
external/libjpeg/jidctfst.cpp
external/libjpeg/jidctint.cpp
external/libjpeg/jidctred.cpp
external/libjpeg/jmemmgr.cpp
external/libjpeg/jmemnobs.cpp
external/libjpeg/jquant1.cpp
external/libjpeg/jquant2.cpp
external/libjpeg/jutils.cpp
external/libjpeg/jcapimin.cpp
external/libjpeg/jdatadst.cpp
external/libjpeg/jcparam.cpp
external/libjpeg/jcapistd.cpp
external/libjpeg/jcmarker.cpp
external/libjpeg/jcinit.cpp
external/libjpeg/jcmaster.cpp
external/libjpeg/jcdctmgr.cpp
external/libjpeg/jccoefct.cpp
external/libjpeg/jccolor.cpp
external/libjpeg/jchuff.cpp
external/libjpeg/jcmainct.cpp
external/libjpeg/jcphuff.cpp
external/libjpeg/jcprepct.cpp
external/libjpeg/jcsample.cpp
external/libjpeg/jfdctint.cpp
external/libjpeg/jfdctflt.cpp
external/libjpeg/jfdctfst.cpp
)
external/libjpeg/jcomapi.cpp
external/libjpeg/jdapimin.cpp
external/libjpeg/jdapistd.cpp
external/libjpeg/jdatasrc.cpp
external/libjpeg/jdcoefct.cpp
external/libjpeg/jdcolor.cpp
external/libjpeg/jddctmgr.cpp
external/libjpeg/jdhuff.cpp
external/libjpeg/jdinput.cpp
external/libjpeg/jdmainct.cpp
external/libjpeg/jdmarker.cpp
external/libjpeg/jdmaster.cpp
external/libjpeg/jdmerge.cpp
external/libjpeg/jdphuff.cpp
external/libjpeg/jdpostct.cpp
external/libjpeg/jdsample.cpp
external/libjpeg/jerror.cpp
external/libjpeg/jidctflt.cpp
external/libjpeg/jidctfst.cpp
external/libjpeg/jidctint.cpp
external/libjpeg/jidctred.cpp
external/libjpeg/jmemmgr.cpp
external/libjpeg/jmemnobs.cpp
external/libjpeg/jquant1.cpp
external/libjpeg/jquant2.cpp
external/libjpeg/jutils.cpp
external/libjpeg/jcapimin.cpp
external/libjpeg/jdatadst.cpp
external/libjpeg/jcparam.cpp
external/libjpeg/jcapistd.cpp
external/libjpeg/jcmarker.cpp
external/libjpeg/jcinit.cpp
external/libjpeg/jcmaster.cpp
external/libjpeg/jcdctmgr.cpp
external/libjpeg/jccoefct.cpp
external/libjpeg/jccolor.cpp
external/libjpeg/jchuff.cpp
external/libjpeg/jcmainct.cpp
external/libjpeg/jcphuff.cpp
external/libjpeg/jcprepct.cpp
external/libjpeg/jcsample.cpp
external/libjpeg/jfdctint.cpp
external/libjpeg/jfdctflt.cpp
external/libjpeg/jfdctfst.cpp
)
endif
()
set
(
source_files
${
source_files
}
image_loader/jpeg_loader.cpp
...
...
@@ -511,8 +511,8 @@ if (NOT TARGET dlib)
if
(
DLIB_USE_BLAS OR DLIB_USE_LAPACK OR DLIB_USE_MKL_FFT
)
# Try to find BLAS, LAPACK and MKL
include
(
cmake_utils/
cmake_find_blas.txt
)
# Try to find BLAS, LAPACK and MKL
include
(
cmake_utils/
find_blas.cmake
)
if
(
DLIB_USE_BLAS
)
if
(
blas_found
)
...
...
@@ -596,19 +596,21 @@ if (NOT TARGET dlib)
# 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..."
)
set
(
CUDA_TEST_CMAKE_FLAGS
"-DCMAKE_PREFIX_PATH=
${
CMAKE_PREFIX_PATH
}
"
"-DCMAKE_INCLUDE_PATH=
${
CMAKE_INCLUDE_PATH
}
"
"-DCMAKE_LIBRARY_PATH=
${
CMAKE_LIBRARY_PATH
}
"
)
set
(
CUDA_TEST_CMAKE_FLAGS
"-DCMAKE_PREFIX_PATH=
${
CMAKE_PREFIX_PATH
}
"
"-DCMAKE_INCLUDE_PATH=
${
CMAKE_INCLUDE_PATH
}
"
"-DCMAKE_LIBRARY_PATH=
${
CMAKE_LIBRARY_PATH
}
"
)
if
(
NOT MSVC
)
# see https://github.com/davisking/dlib/issues/363
list
(
APPEND CUDA_TEST_CMAKE_FLAGS
"-DCUDA_HOST_COMPILER=
${
CUDA_HOST_COMPILER
}
"
)
endif
()
try_compile
(
cuda_test_compile_worked
${
PROJECT_BINARY_DIR
}
/cuda_test_build
${
PROJECT_SOURCE_DIR
}
/cmake_utils/test_for_cuda cuda_test
CMAKE_FLAGS
${
CUDA_TEST_CMAKE_FLAGS
}
OUTPUT_VARIABLE try_compile_output_message
)
try_compile
(
cuda_test_compile_worked
${
PROJECT_BINARY_DIR
}
/cuda_test_build
${
PROJECT_SOURCE_DIR
}
/cmake_utils/test_for_cuda cuda_test
CMAKE_FLAGS
${
CUDA_TEST_CMAKE_FLAGS
}
OUTPUT_VARIABLE try_compile_output_message
)
if
(
NOT cuda_test_compile_worked
)
string
(
REPLACE
"
\n
"
"
\n
*** "
try_compile_output_message
"
${
try_compile_output_message
}
"
)
message
(
STATUS
"*****************************************************************************************************************"
)
...
...
@@ -618,10 +620,11 @@ if (NOT TARGET dlib)
message
(
STATUS
"*****************************************************************************************************************"
)
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
}
/cmake_utils/test_for_cudnn cudnn_test
CMAKE_FLAGS
${
CUDA_TEST_CMAKE_FLAGS
}
)
try_compile
(
cudnn_test_compile_worked
${
PROJECT_BINARY_DIR
}
/cudnn_test_build
${
PROJECT_SOURCE_DIR
}
/cmake_utils/test_for_cudnn cudnn_test
CMAKE_FLAGS
${
CUDA_TEST_CMAKE_FLAGS
}
)
if
(
NOT cudnn_test_compile_worked
)
message
(
STATUS
"*** Found cuDNN, but it looks like the wrong version so dlib will not use it. ***"
)
message
(
STATUS
"*** Dlib requires cuDNN V5.0 OR GREATER. Since cuDNN is not found DLIB WILL NOT USE CUDA. ***"
)
...
...
@@ -662,15 +665,15 @@ if (NOT TARGET dlib)
dnn/gpu_data.cpp
)
set
(
dlib_needed_libraries
${
dlib_needed_libraries
}
${
CUDA_CUBLAS_LIBRARIES
}
${
cudnn
}
${
CUDA_curand_LIBRARY
}
${
cusolver
}
)
${
CUDA_CUBLAS_LIBRARIES
}
${
cudnn
}
${
CUDA_curand_LIBRARY
}
${
cusolver
}
)
if
(
openmp_libraries
)
list
(
APPEND dlib_needed_libraries
${
openmp_libraries
}
)
endif
()
include_directories
(
${
cudnn_include
}
)
message
(
STATUS
"Enabling CUDA support for dlib. DLIB WILL USE CUDA"
)
else
()
...
...
@@ -682,7 +685,7 @@ if (NOT TARGET dlib)
message
(
STATUS
"Disabling CUDA support for dlib. DLIB WILL NOT USE CUDA"
)
endif
()
endif
()
if
(
DLIB_LINK_WITH_SQLITE3
)
find_library
(
sqlite sqlite3
)
...
...
@@ -729,10 +732,10 @@ if (NOT TARGET dlib)
target_include_directories
(
dlib
INTERFACE $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/..>
INTERFACE $<INSTALL_INTERFACE:include>
PUBLIC
${
dlib_needed_includes
}
)
INTERFACE $<BUILD_INTERFACE:
${
CMAKE_CURRENT_SOURCE_DIR
}
/..>
INTERFACE $<INSTALL_INTERFACE:include>
PUBLIC
${
dlib_needed_includes
}
)
target_link_libraries
(
dlib PUBLIC
${
dlib_needed_libraries
}
)
if
(
DLIB_IN_PROJECT_BUILD
)
target_compile_options
(
dlib PUBLIC
${
active_preprocessor_switches
}
)
...
...
@@ -770,52 +773,52 @@ if (NOT TARGET dlib)
# Install the library
if
(
NOT DLIB_IN_PROJECT_BUILD
)
set_target_properties
(
dlib PROPERTIES
VERSION
${
VERSION
}
)
install
(
TARGETS dlib
EXPORT dlib
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
# Windows considers .dll to be runtime artifacts
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
set_target_properties
(
dlib PROPERTIES
VERSION
${
VERSION
}
)
install
(
TARGETS dlib
EXPORT dlib
RUNTIME DESTINATION
${
CMAKE_INSTALL_BINDIR
}
# Windows considers .dll to be runtime artifacts
LIBRARY DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
ARCHIVE DESTINATION
${
CMAKE_INSTALL_LIBDIR
}
)
install
(
DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/ DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dlib
FILES_MATCHING PATTERN
"*.h"
PATTERN
"*.cmake"
REGEX
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
EXCLUDE
)
install
(
DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/ DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dlib
FILES_MATCHING PATTERN
"*.h"
PATTERN
"*.cmake"
REGEX
"
${
CMAKE_CURRENT_BINARY_DIR
}
"
EXCLUDE
)
configure_file
(
${
PROJECT_SOURCE_DIR
}
/config.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h
)
# overwrite config.h with the configured one
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dlib
)
configure_file
(
${
PROJECT_SOURCE_DIR
}
/config.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h
)
# overwrite config.h with the configured one
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/config.h DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dlib
)
configure_file
(
${
PROJECT_SOURCE_DIR
}
/revision.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/revision.h
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/revision.h DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dlib
)
configure_file
(
${
PROJECT_SOURCE_DIR
}
/revision.h.in
${
CMAKE_CURRENT_BINARY_DIR
}
/revision.h
)
install
(
FILES
${
CMAKE_CURRENT_BINARY_DIR
}
/revision.h DESTINATION
${
CMAKE_INSTALL_INCLUDEDIR
}
/dlib
)
## Config.cmake generation and installation
## Config.cmake generation and installation
set
(
ConfigPackageLocation
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/dlib"
)
install
(
EXPORT dlib
NAMESPACE dlib::
DESTINATION
${
ConfigPackageLocation
}
)
set
(
ConfigPackageLocation
"
${
CMAKE_INSTALL_LIBDIR
}
/cmake/dlib"
)
install
(
EXPORT dlib
NAMESPACE dlib::
DESTINATION
${
ConfigPackageLocation
}
)
configure_file
(
cmake_utils/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
(
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config/dlibConfigVersion.cmake"
VERSION
${
VERSION
}
COMPATIBILITY AnyNewerVersion
)
include
(
CMakePackageConfigHelpers
)
write_basic_package_version_file
(
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config/dlibConfigVersion.cmake"
VERSION
${
VERSION
}
COMPATIBILITY AnyNewerVersion
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config/dlibConfig.cmake"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config/dlibConfigVersion.cmake"
DESTINATION
${
ConfigPackageLocation
}
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config/dlibConfig.cmake"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/config/dlibConfigVersion.cmake"
DESTINATION
${
ConfigPackageLocation
}
)
## dlib-1.pc generation and installation
## dlib-1.pc generation and installation
configure_file
(
"cmake_utils/dlib.pc.in"
"dlib-1.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/dlib-1.pc"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/pkgconfig"
)
configure_file
(
"cmake_utils/dlib.pc.in"
"dlib-1.pc"
@ONLY
)
install
(
FILES
"
${
CMAKE_CURRENT_BINARY_DIR
}
/dlib-1.pc"
DESTINATION
"
${
CMAKE_INSTALL_LIBDIR
}
/pkgconfig"
)
endif
()
...
...
dlib/cmake_utils/check_if_neon_available.cmake
View file @
86eaaf45
...
...
@@ -12,9 +12,9 @@ set(ARM_NEON_IS_AVAILABLE 0)
# test if __ARM_NEON__ is defined
try_compile
(
test_for_neon_worked
${
PROJECT_BINARY_DIR
}
/neon_test_build
${
CMAKE_CURRENT_LIST_DIR
}
/test_for_neon
neon_test
)
neon_test
)
if
(
test_for_neon_worked
)
message
(
STATUS
"__ARM_NEON__ defined."
)
set
(
ARM_NEON_IS_AVAILABLE 1
)
message
(
STATUS
"__ARM_NEON__ defined."
)
set
(
ARM_NEON_IS_AVAILABLE 1
)
endif
()
dlib/cmake_utils/
cmake_find_blas.txt
→
dlib/cmake_utils/
find_blas.cmake
View file @
86eaaf45
...
...
@@ -32,139 +32,139 @@ SET(lapack_without_underscore 0)
message
(
STATUS
"Searching for BLAS and LAPACK"
)
if
(
UNIX OR MINGW
)
message(STATUS "Searching for BLAS and LAPACK")
if (BUILDING_MATLAB_MEX_FILE)
# # This commented out stuff would link directly to MATLAB's built in
# BLAS and LAPACK. But it's better to not link to anything and do a
#find_library(MATLAB_BLAS_LIBRARY mwblas PATHS ${MATLAB_LIB_FOLDERS} )
#find_library(MATLAB_LAPACK_LIBRARY mwlapack PATHS ${MATLAB_LIB_FOLDERS} )
#if (MATLAB_BLAS_LIBRARY AND MATLAB_LAPACK_LIBRARY)
# add_subdirectory(external/cblas)
# set(blas_libraries ${MATLAB_BLAS_LIBRARY} cblas )
# set(lapack_libraries ${MATLAB_LAPACK_LIBRARY} )
# set(blas_found 1)
# set(lapack_found 1)
# message(STATUS "Found MATLAB's BLAS and LAPACK libraries")
#endif()
# We need cblas since MATLAB doesn't provide cblas symbols.
add_subdirectory(external/cblas)
set(blas_libraries cblas )
set(blas_found 1)
set(lapack_found 1)
message(STATUS "Will link with MATLAB's BLAS and LAPACK at runtime (hopefully!)")
## Don't try to link to anything other than MATLAB's own internal blas
## and lapack libraries because doing so generally upsets MATLAB. So
## we just end here no matter what.
return()
endif()
# First, search for libraries via pkg-config, which is the cleanest path
find_package(PkgConfig)
pkg_check_modules(BLAS_REFERENCE cblas)
pkg_check_modules(LAPACK_REFERENCE lapack)
if (BLAS_REFERENCE_FOUND AND LAPACK_REFERENCE_FOUND)
set(blas_libraries "${BLAS_REFERENCE_LDFLAGS}")
set(lapack_libraries "${LAPACK_REFERENCE_LDFLAGS}")
set(blas_found 1)
set(lapack_found 1)
set(REQUIRES_LIBS "${REQUIRES_LIBS} cblas lapack")
message(STATUS "Found BLAS and LAPACK via pkg-config")
return()
endif()
include(CheckTypeSize)
check_type_size( "void*" SIZE_OF_VOID_PTR)
if (SIZE_OF_VOID_PTR EQUAL 8)
set( mkl_search_path
/opt/intel/mkl/*/lib/em64t
/opt/intel/mkl/lib/intel64
/opt/intel/lib/intel64
/opt/intel/mkl/lib
)
find_library(mkl_intel mkl_intel_lp64 ${mkl_search_path})
mark_as_advanced(mkl_intel)
else()
set( mkl_search_path
/opt/intel/mkl/*/lib/32
/opt/intel/mkl/lib/ia32
/opt/intel/lib/ia32
)
find_library(mkl_intel mkl_intel ${mkl_search_path})
mark_as_advanced(mkl_intel)
endif()
message
(
STATUS
"Searching for BLAS and LAPACK"
)
if
(
BUILDING_MATLAB_MEX_FILE
)
# # This commented out stuff would link directly to MATLAB's built in
# BLAS and LAPACK. But it's better to not link to anything and do a
#find_library(MATLAB_BLAS_LIBRARY mwblas PATHS ${MATLAB_LIB_FOLDERS} )
#find_library(MATLAB_LAPACK_LIBRARY mwlapack PATHS ${MATLAB_LIB_FOLDERS} )
#if (MATLAB_BLAS_LIBRARY AND MATLAB_LAPACK_LIBRARY)
# add_subdirectory(external/cblas)
# set(blas_libraries ${MATLAB_BLAS_LIBRARY} cblas )
# set(lapack_libraries ${MATLAB_LAPACK_LIBRARY} )
# set(blas_found 1)
# set(lapack_found 1)
# message(STATUS "Found MATLAB's BLAS and LAPACK libraries")
#endif()
# We need cblas since MATLAB doesn't provide cblas symbols.
add_subdirectory
(
external/cblas
)
set
(
blas_libraries cblas
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
message
(
STATUS
"Will link with MATLAB's BLAS and LAPACK at runtime (hopefully!)"
)
## Don't try to link to anything other than MATLAB's own internal blas
## and lapack libraries because doing so generally upsets MATLAB. So
## we just end here no matter what.
return
()
endif
()
# First, search for libraries via pkg-config, which is the cleanest path
find_package
(
PkgConfig
)
pkg_check_modules
(
BLAS_REFERENCE cblas
)
pkg_check_modules
(
LAPACK_REFERENCE lapack
)
if
(
BLAS_REFERENCE_FOUND AND LAPACK_REFERENCE_FOUND
)
set
(
blas_libraries
"
${
BLAS_REFERENCE_LDFLAGS
}
"
)
set
(
lapack_libraries
"
${
LAPACK_REFERENCE_LDFLAGS
}
"
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
set
(
REQUIRES_LIBS
"
${
REQUIRES_LIBS
}
cblas lapack"
)
message
(
STATUS
"Found BLAS and LAPACK via pkg-config"
)
return
()
endif
()
include
(
CheckTypeSize
)
check_type_size
(
"void*"
SIZE_OF_VOID_PTR
)
if
(
SIZE_OF_VOID_PTR EQUAL 8
)
set
(
mkl_search_path
/opt/intel/mkl/*/lib/em64t
/opt/intel/mkl/lib/intel64
/opt/intel/lib/intel64
/opt/intel/mkl/lib
)
find_library
(
mkl_intel mkl_intel_lp64
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_intel
)
else
()
set
(
mkl_search_path
/opt/intel/mkl/*/lib/32
/opt/intel/mkl/lib/ia32
/opt/intel/lib/ia32
)
find_library
(
mkl_intel mkl_intel
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_intel
)
endif
()
include
(
CheckLibraryExists
)
# Get mkl_include_dir
set(mkl_include_search_path
/opt/intel/mkl/include
/opt/intel/include
)
find_path(mkl_include_dir mkl_version.h ${mkl_include_search_path})
mark_as_advanced(mkl_include_dir)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path})
find_library(openmp_libraries iomp5 ${mkl_search_path})
mark_as_advanced( mkl_rt openmp_libraries )
# if we found the MKL
if ( mkl_rt)
set(mkl_libraries ${mkl_rt} )
set(blas_libraries ${mkl_rt} )
set(lapack_libraries ${mkl_rt} )
set(blas_found 1)
set(lapack_found 1)
set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
endif()
if (NOT found_intel_mkl)
# Search for the needed libraries from the MKL. This time try looking for a different
# set of MKL files and try to link against those.
find_library(mkl_core mkl_core ${mkl_search_path})
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
find_library(mkl_iomp iomp5 ${mkl_search_path})
find_library(mkl_pthread pthread ${mkl_search_path})
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread)
# If we found the MKL
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
set(mkl_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(blas_found 1)
set(lapack_found 1)
set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
endif()
endif()
# Get mkl_include_dir
set
(
mkl_include_search_path
/opt/intel/mkl/include
/opt/intel/include
)
find_path
(
mkl_include_dir mkl_version.h
${
mkl_include_search_path
}
)
mark_as_advanced
(
mkl_include_dir
)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
find_library
(
mkl_rt mkl_rt
${
mkl_search_path
}
)
find_library
(
openmp_libraries iomp5
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_rt openmp_libraries
)
# if we found the MKL
if
(
mkl_rt
)
set
(
mkl_libraries
${
mkl_rt
}
)
set
(
blas_libraries
${
mkl_rt
}
)
set
(
lapack_libraries
${
mkl_rt
}
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
set
(
found_intel_mkl 1
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
endif
()
if (found_intel_mkl AND mkl_include_dir)
set(found_intel_mkl_headers 1)
endif()
if
(
NOT found_intel_mkl
)
# Search for the needed libraries from the MKL. This time try looking for a different
# set of MKL files and try to link against those.
find_library
(
mkl_core mkl_core
${
mkl_search_path
}
)
find_library
(
mkl_thread mkl_intel_thread
${
mkl_search_path
}
)
find_library
(
mkl_iomp iomp5
${
mkl_search_path
}
)
find_library
(
mkl_pthread pthread
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread
)
# If we found the MKL
if
(
mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread
)
set
(
mkl_libraries
${
mkl_intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
${
mkl_pthread
}
)
set
(
blas_libraries
${
mkl_intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
${
mkl_pthread
}
)
set
(
lapack_libraries
${
mkl_intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
${
mkl_pthread
}
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
set
(
found_intel_mkl 1
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
endif
()
endif
()
if
(
found_intel_mkl AND mkl_include_dir
)
set
(
found_intel_mkl_headers 1
)
endif
()
# try to find some other LAPACK libraries if we didn't find the MKL
set
(
extra_paths
/usr/lib64
/usr/lib64/atlas-sse3
/usr/lib64/atlas-sse2
/usr/lib64/atlas
/usr/lib
/usr/lib/atlas-sse3
/usr/lib/atlas-sse2
/usr/lib/atlas
/usr/lib/openblas-base
/opt/OpenBLAS/lib
$ENV{OPENBLAS_HOME}/lib
)
/usr/lib64
/usr/lib64/atlas-sse3
/usr/lib64/atlas-sse2
/usr/lib64/atlas
/usr/lib
/usr/lib/atlas-sse3
/usr/lib/atlas-sse2
/usr/lib/atlas
/usr/lib/openblas-base
/opt/OpenBLAS/lib
$ENV{OPENBLAS_HOME}/lib
)
INCLUDE
(
CheckFunctionExists
)
...
...
@@ -199,9 +199,9 @@ if (UNIX OR MINGW)
mark_as_advanced
(
lapack_lib
)
endif
()
# try to find some other BLAS libraries if we didn't find the MKL
if
(
NOT blas_found
)
find_library
(
atlas_lib atlas PATHS
${
extra_paths
}
)
find_library
(
cblas_lib cblas PATHS
${
extra_paths
}
)
...
...
@@ -236,7 +236,7 @@ if (UNIX OR MINGW)
mark_as_advanced
(
cblas_lib
)
endif
()
if
(
NOT blas_found
)
find_library
(
generic_blas blas PATHS
${
extra_paths
}
)
if
(
generic_blas
)
...
...
@@ -268,64 +268,64 @@ if (UNIX OR MINGW)
elseif
(
WIN32 AND NOT MINGW
)
message(STATUS "Searching for BLAS and LAPACK")
include(CheckTypeSize)
check_type_size( "void*" SIZE_OF_VOID_PTR)
if (SIZE_OF_VOID_PTR EQUAL 8)
set( mkl_search_path
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/mkl/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/compiler/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/compiler/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64"
"C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64"
"C:/Program Files (x86)/Intel/Composer XE/compiler/lib/intel64"
"C:/Program Files/Intel/Composer XE/mkl/lib/intel64"
"C:/Program Files/Intel/Composer XE/compiler/lib/intel64"
)
find_library(mkl_intel mkl_intel_lp64 ${mkl_search_path})
else()
set( mkl_search_path
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/mkl/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/compiler/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/compiler/lib/ia32"
"C:/Program Files (x86)/Intel/Composer XE/mkl/lib/ia32"
"C:/Program Files (x86)/Intel/Composer XE/compiler/lib/ia32"
"C:/Program Files/Intel/Composer XE/mkl/lib/ia32"
"C:/Program Files/Intel/Composer XE/compiler/lib/ia32"
)
find_library(mkl_intel mkl_intel_c ${mkl_search_path})
endif()
message
(
STATUS
"Searching for BLAS and LAPACK"
)
include
(
CheckTypeSize
)
check_type_size
(
"void*"
SIZE_OF_VOID_PTR
)
if
(
SIZE_OF_VOID_PTR EQUAL 8
)
set
(
mkl_search_path
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/mkl/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/compiler/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/compiler/lib/intel64"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64"
"C:/Program Files (x86)/Intel/Composer XE/mkl/lib/intel64"
"C:/Program Files (x86)/Intel/Composer XE/compiler/lib/intel64"
"C:/Program Files/Intel/Composer XE/mkl/lib/intel64"
"C:/Program Files/Intel/Composer XE/compiler/lib/intel64"
)
find_library
(
mkl_intel mkl_intel_lp64
${
mkl_search_path
}
)
else
()
set
(
mkl_search_path
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/mkl/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries_*/windows/compiler/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/ia32"
"C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/compiler/lib/ia32"
"C:/Program Files (x86)/Intel/Composer XE/mkl/lib/ia32"
"C:/Program Files (x86)/Intel/Composer XE/compiler/lib/ia32"
"C:/Program Files/Intel/Composer XE/mkl/lib/ia32"
"C:/Program Files/Intel/Composer XE/compiler/lib/ia32"
)
find_library
(
mkl_intel mkl_intel_c
${
mkl_search_path
}
)
endif
()
INCLUDE
(
CheckFunctionExists
)
# Search for the needed libraries from the MKL.
find_library(mkl_core mkl_core ${mkl_search_path})
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
find_library(mkl_iomp libiomp5md ${mkl_search_path})
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp)
# If we found the MKL
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp )
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} )
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} )
set(blas_found 1)
set(lapack_found 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
# Make sure the version of the Intel MKL we found is compatible with
# the compiler we are using. One way to do this check is to see if we can
# link to it right now.
set(CMAKE_REQUIRED_LIBRARIES ${blas_libraries})
CHECK_FUNCTION_EXISTS(cblas_ddot HAVE_CBLAS)
if (NOT HAVE_CBLAS)
message("BLAS library does not have cblas symbols, so dlib will not use BLAS or LAPACK")
set(blas_found 0)
set(lapack_found 0)
endif()
endif()
# Search for the needed libraries from the MKL.
find_library
(
mkl_core mkl_core
${
mkl_search_path
}
)
find_library
(
mkl_thread mkl_intel_thread
${
mkl_search_path
}
)
find_library
(
mkl_iomp libiomp5md
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_intel mkl_core mkl_thread mkl_iomp
)
# If we found the MKL
if
(
mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp
)
set
(
blas_libraries
${
mkl_intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
)
set
(
lapack_libraries
${
mkl_intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
# Make sure the version of the Intel MKL we found is compatible with
# the compiler we are using. One way to do this check is to see if we can
# link to it right now.
set
(
CMAKE_REQUIRED_LIBRARIES
${
blas_libraries
}
)
CHECK_FUNCTION_EXISTS
(
cblas_ddot HAVE_CBLAS
)
if
(
NOT HAVE_CBLAS
)
message
(
"BLAS library does not have cblas symbols, so dlib will not use BLAS or LAPACK"
)
set
(
blas_found 0
)
set
(
lapack_found 0
)
endif
()
endif
()
endif
()
...
...
@@ -333,18 +333,18 @@ endif()
# When all else fails use CMake's built in functions to find BLAS and LAPACK
if
(
NOT blas_found
)
find_package(BLAS QUIET)
if (${BLAS_FOUND})
set(blas_libraries ${BLAS_LIBRARIES})
set(blas_found 1)
if (NOT lapack_found)
find_package(LAPACK QUIET)
if (${LAPACK_FOUND})
set(lapack_libraries ${LAPACK_LIBRARIES})
set(lapack_found 1)
endif()
endif()
endif()
find_package
(
BLAS QUIET
)
if
(
${
BLAS_FOUND
}
)
set
(
blas_libraries
${
BLAS_LIBRARIES
}
)
set
(
blas_found 1
)
if
(
NOT lapack_found
)
find_package
(
LAPACK QUIET
)
if
(
${
LAPACK_FOUND
}
)
set
(
lapack_libraries
${
LAPACK_LIBRARIES
}
)
set
(
lapack_found 1
)
endif
()
endif
()
endif
()
endif
()
...
...
dlib/cmake_utils/set_compiler_specific_options.cmake
View file @
86eaaf45
...
...
@@ -2,7 +2,7 @@
cmake_minimum_required
(
VERSION 2.8.12
)
if
(
POLICY CMP0054
)
cmake_policy
(
SET CMP0054 NEW
)
cmake_policy
(
SET CMP0054 NEW
)
endif
()
set
(
USING_OLD_VISUAL_STUDIO_COMPILER 0
)
...
...
dlib/cmake_utils/tell_visual_studio_to_use_static_runtime.cmake
View file @
86eaaf45
...
...
@@ -4,7 +4,7 @@
cmake_minimum_required
(
VERSION 2.8.12
)
if
(
POLICY CMP0054
)
cmake_policy
(
SET CMP0054 NEW
)
cmake_policy
(
SET CMP0054 NEW
)
endif
()
if
(
MSVC OR
"
${
CMAKE_CXX_COMPILER_ID
}
"
STREQUAL
"MSVC"
)
...
...
dlib/cmake_utils/use_cpp_11.cmake
View file @
86eaaf45
...
...
@@ -5,7 +5,7 @@
cmake_minimum_required
(
VERSION 2.8.12
)
if
(
POLICY CMP0054
)
cmake_policy
(
SET CMP0054 NEW
)
cmake_policy
(
SET CMP0054 NEW
)
endif
()
...
...
@@ -60,14 +60,14 @@ else()
# Set a flag if the compiler you are using is capable of providing C++11 features.
get_property
(
cxx_features GLOBAL PROPERTY CMAKE_CXX_KNOWN_FEATURES
)
if
(
";
${
cxx_features
}
;"
MATCHES
";cxx_rvalue_references;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_variadic_templates;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_lambdas;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_defaulted_move_initializers;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_delegating_constructors;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_thread_local;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_constexpr;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_decltype_incomplete_return_types;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_auto_type;"
)
";
${
cxx_features
}
;"
MATCHES
";cxx_variadic_templates;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_lambdas;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_defaulted_move_initializers;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_delegating_constructors;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_thread_local;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_constexpr;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_decltype_incomplete_return_types;"
AND
";
${
cxx_features
}
;"
MATCHES
";cxx_auto_type;"
)
set
(
COMPILER_CAN_DO_CPP_11 1
)
# Tell cmake that we need C++11 for dlib
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment