Commit b373ac39 authored by Rashad Kanavath's avatar Rashad Kanavath

COMP: enable openmp flags (default) #jira 1340,1319

parent 55483543
......@@ -235,37 +235,11 @@ macro(check_compiler_platform_flags)
("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.8" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9") ))
set(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -Wno-array-bounds")
endif()
endif()
# RK: copy past from ITK?
if(APPLE)
option(OTB_USE_64BITS_APPLE_TRUNCATION_WARNING "Turn on warnings on 64bits to 32bits truncations." OFF)
mark_as_advanced(OTB_USE_64BITS_APPLE_TRUNCATION_WARNING)
execute_process(COMMAND "${CMAKE_C_COMPILER}" --version
OUTPUT_VARIABLE _version ERROR_VARIABLE _version)
# -fopenmp breaks compiling the HDF5 library in shared library mode
# on the OS X platform -- at least with gcc 4.2 from Xcode.
set(compile_flag_lists CMAKE_C_FLAGS CMAKE_CXX_FLAGS
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO)
foreach(listname ${compile_flag_lists})
if("${${listname}}" MATCHES ".*-fopenmp.*")
string(REPLACE "-fopenmp" "" tmpFlags "${${listname}}")
set(${listname} "${tmpFlags}")
message("-fopenmp causes incorrect compliation of HDF, removing from ${listname}")
endif()
endforeach()
endif()
#RK: copy past from ITK?
# gcc must have -msse2 option to enable sse2 support
# if(VNL_CONFIG_ENABLE_SSE2 OR VNL_CONFIG_ENABLE_SSE2_ROUNDING)
# set(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} -msse2")
# endif()
if(APPLE)
option(OTB_USE_64BITS_APPLE_TRUNCATION_WARNING "Turn on warnings on 64bits to 32bits truncations." OFF)
mark_as_advanced(OTB_USE_64BITS_APPLE_TRUNCATION_WARNING)
endif()
#-----------------------------------------------------------------------------
......@@ -298,6 +272,18 @@ macro(check_compiler_platform_flags)
set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} -mthreads")
endif()
# check for OpenMP
if(OTB_USE_OPENMP)
find_package(OpenMP QUIET)
endif()
if(OPENMP_FOUND)
message(STATUS "Enabling OpenMP support")
set(OTB_REQUIRED_C_FLAGS "${OTB_REQUIRED_C_FLAGS} ${OpenMP_C_FLAGS}")
set(OTB_REQUIRED_CXX_FLAGS "${OTB_REQUIRED_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(OTB_REQUIRED_LINK_FLAGS "${OTB_REQUIRED_LINK_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else()
message(STATUS "Disabling OpenMP support")
endif()
#-----------------------------------------------------------------------------
# The frename-registers option does not work due to a bug in the gnu compiler.
......
......@@ -213,6 +213,8 @@ endif()
option(OTB_USE_DEPRECATED "Turn on the use and test of deprecated classes" OFF)
mark_as_advanced(OTB_USE_DEPRECATED)
option(OTB_USE_OPENMP "Add openmp compiler and linker flags" ON)
#-----------------------------------------------------------------------------
# SHOW_ALL_MSG_DEBUG option
option(OTB_SHOW_ALL_MSG_DEBUG "Show all debug messages (very verbose)" OFF)
......
......@@ -195,17 +195,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
#set_target_properties(siftfast PROPERTIES COMPILE_FLAGS "-DDVPROFILE")
#target_link_libraries(siftfast libsiftfast)
# check for OpenMP
find_package(OpenMP)
if(OPENMP_FOUND)
message(STATUS "Enabling OpenMP support")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
else()
message(STATUS "Disabling OpenMP support")
endif()
#Install TARGET & FILES for otb-lib
if(OTB_LIBRARY_PROPERTIES)
set_target_properties(otbsiftfast PROPERTIES ${OTB_LIBRARY_PROPERTIES})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment