Skip to content

Commit

Permalink
build: HAVE_LIBPTHREAD, HAVE_PTHREAD(S) => HAVE_PTHREAD
Browse files Browse the repository at this point in the history
  • Loading branch information
alalek committed Aug 14, 2017
1 parent ef2b730 commit 6ff9fc6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 18 deletions.
7 changes: 2 additions & 5 deletions 3rdparty/protobuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,8 @@ project(libprotobuf)

include(CheckIncludeFiles)

if(NOT MSVC)
check_include_files("pthread.h" HAVE_PTHREAD)
if(HAVE_PTHREAD)
add_definitions(-DHAVE_PTHREAD=1)
endif()
if(HAVE_PTHREAD)
add_definitions(-DHAVE_PTHREAD=1)
endif()

if(MSVC)
Expand Down
2 changes: 1 addition & 1 deletion 3rdparty/tbb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ else()
)
endif()

if (HAVE_LIBPTHREAD)
if(HAVE_PTHREAD)
add_definitions(-DUSE_PTHREAD) #required for Unix
endif()

Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ if(UNIX)
include(CheckSymbolExists)

if(NOT APPLE)
CHECK_INCLUDE_FILE(pthread.h HAVE_LIBPTHREAD)
CHECK_INCLUDE_FILE(pthread.h HAVE_PTHREAD)
if(ANDROID)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly|OpenBSD")
Expand All @@ -565,7 +565,7 @@ if(UNIX)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
endif()
else()
set(HAVE_LIBPTHREAD YES)
set(HAVE_PTHREAD 1)
endif()

CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
Expand Down
11 changes: 2 additions & 9 deletions cmake/OpenCVFindLibsPerf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,9 @@ if(WITH_OPENMP)
set(HAVE_OPENMP "${OPENMP_FOUND}")
endif()

if(NOT MSVC AND NOT DEFINED HAVE_PTHREADS)
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/pthread_test.cpp")
file(WRITE "${_fname}" "#include <pthread.h>\nint main() { (void)pthread_self(); return 0; }\n")
try_compile(HAVE_PTHREADS "${CMAKE_BINARY_DIR}" "${_fname}")
file(REMOVE "${_fname}")
endif()

ocv_clear_vars(HAVE_PTHREADS_PF)
if(WITH_PTHREADS_PF)
set(HAVE_PTHREADS_PF ${HAVE_PTHREADS})
if(WITH_PTHREADS_PF AND HAVE_PTHREAD)
set(HAVE_PTHREADS_PF 1)
else()
set(HAVE_PTHREADS_PF 0)
endif()
2 changes: 1 addition & 1 deletion cmake/templates/cvconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
#cmakedefine HAVE_PNG

/* Posix threads (pthreads) */
#cmakedefine HAVE_PTHREADS
#cmakedefine HAVE_PTHREAD

/* parallel_for with pthreads */
#cmakedefine HAVE_PTHREADS_PF
Expand Down

0 comments on commit 6ff9fc6

Please sign in to comment.