mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Move caffe_option to proper cmake_dependent_option (#2049)
This commit is contained in:
parent
9d94a529fa
commit
1f9df59de9
|
|
@ -14,9 +14,14 @@
|
|||
|
||||
|
||||
# ---[ Options
|
||||
caffe_option(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use single dynamic library interface" ON)
|
||||
caffe_option(MKL_USE_STATIC_LIBS "Use static libraries" OFF IF NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY)
|
||||
caffe_option(MKL_MULTI_THREADED "Use multi-threading" ON IF NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY)
|
||||
include(CMakeDependentOption)
|
||||
option(MKL_USE_SINGLE_DYNAMIC_LIBRARY "Use single dynamic library interface" ON)
|
||||
cmake_dependent_option(
|
||||
MKL_USE_STATIC_LIBS "Use static libraries" OFF
|
||||
"NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY" OFF)
|
||||
cmake_dependent_option(
|
||||
MKL_MULTI_THREADED "Use multi-threading" ON
|
||||
"NOT MKL_USE_SINGLE_DYNAMIC_LIBRARY" OFF)
|
||||
|
||||
# ---[ Root folders
|
||||
if(MSVC)
|
||||
|
|
|
|||
|
|
@ -113,47 +113,6 @@ function(caffe_parse_header_single_define LIBNAME HDR_PATH VARNAME)
|
|||
endif()
|
||||
endfunction()
|
||||
|
||||
########################################################################################################
|
||||
# An option that the user can select. Can accept condition to control when option is available for user.
|
||||
# Usage:
|
||||
# caffe_option(<option_variable> "doc string" <initial value or boolean expression> [IF <condition>])
|
||||
function(caffe_option variable description value)
|
||||
set(__value ${value})
|
||||
set(__condition "")
|
||||
set(__varname "__value")
|
||||
foreach(arg ${ARGN})
|
||||
if(arg STREQUAL "IF" OR arg STREQUAL "if")
|
||||
set(__varname "__condition")
|
||||
else()
|
||||
list(APPEND ${__varname} ${arg})
|
||||
endif()
|
||||
endforeach()
|
||||
unset(__varname)
|
||||
if("${__condition}" STREQUAL "")
|
||||
set(__condition 2 GREATER 1)
|
||||
endif()
|
||||
|
||||
if(${__condition})
|
||||
if("${__value}" MATCHES ";")
|
||||
if(${__value})
|
||||
option(${variable} "${description}" ON)
|
||||
else()
|
||||
option(${variable} "${description}" OFF)
|
||||
endif()
|
||||
elseif(DEFINED ${__value})
|
||||
if(${__value})
|
||||
option(${variable} "${description}" ON)
|
||||
else()
|
||||
option(${variable} "${description}" OFF)
|
||||
endif()
|
||||
else()
|
||||
option(${variable} "${description}" ${__value})
|
||||
endif()
|
||||
else()
|
||||
unset(${variable} CACHE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
##############################################################################
|
||||
# Helper function to add as-needed flag around a library.
|
||||
function(caffe_add_as_needed_flag lib output_var)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user