Commit fe401e0f authored by Brad King's avatar Brad King 💬
Browse files

Remove old CMakeBackwardCompatibilityC thread options

We may use only one thread library at a time.  Instead of presenting a
separate option for each one just choose the preferred library for the
current platform automatically.

Change-Id: I279057b968990b71163eeb90ce080fec83254cb3
parent b4074556
......@@ -28,46 +28,10 @@ IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
SET (CMAKE_X_LIBS "${X11_LIBRARIES}" CACHE STRING
"Libraries and options used in X11 programs.")
SET (CMAKE_HAS_X "${X11_FOUND}" CACHE INTERNAL "Is X11 around.")
INCLUDE (FindThreads)
SET (CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING
"Thread library used.")
SET (CMAKE_USE_PTHREADS "${CMAKE_USE_PTHREADS_INIT}" CACHE BOOL
"Use the pthreads library.")
SET (CMAKE_USE_WIN32_THREADS "${CMAKE_USE_WIN32_THREADS_INIT}" CACHE BOOL
"Use the win32 thread library.")
SET (CMAKE_HP_PTHREADS ${CMAKE_HP_PTHREADS_INIT} CACHE BOOL
"Use HP pthreads.")
SET (CMAKE_USE_SPROC ${CMAKE_USE_SPROC_INIT} CACHE BOOL
"Use sproc libs.")
IF(MINGW AND CMAKE_USE_PTHREADS AND CMAKE_USE_WIN32_THREADS)
MESSAGE(STATUS
"Forcing CMAKE_USE_PTHREADS OFF as only one threading library should be used.")
SET(CMAKE_USE_PTHREADS OFF CACHE BOOL
"Force pthreads off if WIN32 threads are enabled" FORCE)
SET(CMAKE_THREAD_LIBS "" CACHE STRING "Thread library used." FORCE)
ELSE()
SET(CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.")
ENDIF()
ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
SET (VTK_MAX_THREADS "64" CACHE STRING
"Max number of threads vktMultiThreader will allocate.")
MARK_AS_ADVANCED(
CMAKE_HP_PTHREADS
CMAKE_THREAD_LIBS
CMAKE_USE_PTHREADS
CMAKE_USE_SPROC
CMAKE_USE_WIN32_THREADS
CMAKE_X_CFLAGS
CMAKE_X_LIBS
VTK_MAX_THREADS
)
......@@ -500,6 +500,29 @@ ADD_DEFINITIONS(-DVTK_IN_VTK)
#-----------------------------------------------------------------------------
# Platform configuration tests.
INCLUDE(CMakeBackwardCompatibilityC)
include(FindThreads)
set(VTK_USE_WIN32_THREADS 0)
set(VTK_USE_PTHREADS 0)
set(VTK_HP_PTHREADS 0)
set(VTK_USE_SPROC 0)
if(CMAKE_USE_WIN32_THREADS_INIT)
set(VTK_USE_WIN32_THREADS 1)
set(CMAKE_THREAD_LIBS_INIT "")
elseif(CMAKE_USE_PTHREADS_INIT)
set(VTK_USE_PTHREADS 1)
if(CMAKE_HP_PTHREADS_INIT)
set(VTK_HP_PTHREADS 1)
endif()
elseif(CMAKE_USE_SPROC_INIT)
set(VTK_USE_SPROC 1)
endif()
set(CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.")
mark_as_advanced(CMAKE_THREAD_LIBS)
set(VTK_MAX_THREADS "64" CACHE STRING
"Max number of threads vktMultiThreader will allocate.")
mark_as_advanced(VTK_MAX_THREADS)
INCLUDE(TestForANSIStreamHeaders)
# Simulate old CMakeBackwardCompatibilityCXX test.
......@@ -530,10 +553,6 @@ MACRO(VTK_PREPARE_CMAKEDEFINE not invar outvar)
ENDMACRO(VTK_PREPARE_CMAKEDEFINE)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_WORDS_BIGENDIAN VTK_WORDS_BIGENDIAN)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_PTHREADS VTK_USE_PTHREADS)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_SPROC VTK_USE_SPROC)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_HP_PTHREADS VTK_HP_PTHREADS)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_USE_WIN32_THREADS VTK_USE_WIN32_THREADS)
VTK_PREPARE_CMAKEDEFINE("" CMAKE_NO_ANSI_STRING_STREAM VTK_NO_ANSI_STRING_STREAM)
VTK_PREPARE_CMAKEDEFINE(NOT VTK_EXPLICIT_TEMPLATES
VTK_NO_EXPLICIT_TEMPLATE_INSTANTIATION)
......
......@@ -32,10 +32,9 @@ endif ( PROJ_LIST_EXTERNAL AND BUILD_SHARED_LIBS )
option( PROJ_USE_PTHREADS "Should libproj4 be built as a thread-friendly library?" OFF )
mark_as_advanced( PROJ_USE_PTHREADS )
if ( PROJ_USE_PTHREADS )
include( ${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityC.cmake )
if ( NOT CMAKE_USE_PTHREADS )
if ( NOT VTK_USE_PTHREADS )
message( FATAL "Your platform does not appear to support pthreads. Please turn PROJ_USE_PTHREADS off and retry." )
endif ( NOT CMAKE_USE_PTHREADS )
endif ( NOT VTK_USE_PTHREADS )
endif ( PROJ_USE_PTHREADS )
# Include code that requires GSL
......
......@@ -25,15 +25,6 @@ SET(LIBXML2_PLATFORM_TEST_FILE_C platformTestsC.c)
set(CMAKE_THREAD_PREFER_PTHREAD OFF)
FIND_PACKAGE(Threads)
IF(MINGW AND CMAKE_USE_PTHREADS AND CMAKE_USE_WIN32_THREADS)
MESSAGE(STATUS
"Forcing CMAKE_USE_PTHREADS OFF as only one threading library should be used.")
SET(CMAKE_USE_PTHREADS OFF CACHE BOOL
"Force pthreads off if WIN32 threads are enabled" FORCE)
SET(CMAKE_THREAD_LIBS "" CACHE STRING "Force pthreads off if WIN32 threads are enabled" FORCE)
ELSE()
SET(CMAKE_THREAD_LIBS "${CMAKE_THREAD_LIBS_INIT}" CACHE STRING "Thread library used.")
ENDIF()
# This macro checks if the symbol exists in the library and if it
# does, it appends library to the list.
......@@ -215,9 +206,9 @@ ELSE(HAVE_ZLIB_H AND HAVE_LIBZ)
ENDIF(HAVE_ZLIB_H AND HAVE_LIBZ)
# not building VTK with pthreads
IF(NOT CMAKE_USE_PTHREADS AND HAVE_PTHREAD_H)
IF(NOT VTK_USE_PTHREADS AND HAVE_PTHREAD_H)
SET(HAVE_PTHREAD_H 0)
ENDIF(NOT CMAKE_USE_PTHREADS AND HAVE_PTHREAD_H)
ENDIF()
# Create the platform configuration header.
CONFIGURE_FILE(${vtklibxml2_SOURCE_DIR}/config_cmake.h.in
......
......@@ -32,13 +32,13 @@ IF (WIN32)
ELSE (WIN32)
INCLUDE(CheckIncludeFiles)
CHECK_INCLUDE_FILES("pthread.h" HAVE_PTHREAD_H)
IF(HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
IF(HAVE_PTHREAD_H AND VTK_USE_PTHREADS)
ADD_DEFINITIONS(-DHAVE_PTHREAD_H)
ENDIF(HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
ENDIF()
VTK_ADD_LIBRARY( vtksqlite ${SQLite_SRCS} )
IF (UNIX AND HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
IF (UNIX AND HAVE_PTHREAD_H AND VTK_USE_PTHREADS)
TARGET_LINK_LIBRARIES(vtksqlite ${CMAKE_THREAD_LIBS})
ENDIF (UNIX AND HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
ENDIF()
ENDIF (WIN32)
IF(VTK_LIBRARY_PROPERTIES)
......
......@@ -272,8 +272,8 @@ IF(VTK_WRAP_TCL)
TARGET_LINK_LIBRARIES(vtkpython ${VTK_TK_LIBRARIES})
ENDIF(VTK_WRAP_TCL)
IF(HAVE_PTHREAD_H AND CMAKE_USE_PTHREADS)
TARGET_LINK_LIBRARIES(vtkpython ${CMAKE_THREAD_LIBS_INIT})
IF(HAVE_PTHREAD_H AND VTK_USE_PTHREADS)
TARGET_LINK_LIBRARIES(vtkpython ${CMAKE_THREAD_LIBS})
ENDIF()
IF(VTK_USE_FFMPEG_ENCODER)
......
Supports Markdown
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