From 565d5a3a2e61c82f20ac297ae8047a45e21b789f Mon Sep 17 00:00:00 2001 From: Robert Maynard Date: Fri, 29 May 2020 16:39:55 -0400 Subject: [PATCH] Remove CMake workarounds for version < 3.12 --- CMake/FindMPI.cmake | 24 +- CMake/FindOpenGL.cmake | 527 ------------------------------ CMake/VTKmConfig.cmake.in | 4 +- CMake/VTKmDeviceAdapters.cmake | 9 +- CMake/VTKmRenderingContexts.cmake | 10 +- CMake/VTKmWrappers.cmake | 4 +- CMakeLists.txt | 3 +- 7 files changed, 13 insertions(+), 568 deletions(-) delete mode 100644 CMake/FindOpenGL.cmake diff --git a/CMake/FindMPI.cmake b/CMake/FindMPI.cmake index 3ecf1facd..df330ea85 100644 --- a/CMake/FindMPI.cmake +++ b/CMake/FindMPI.cmake @@ -306,18 +306,6 @@ set(_MPI_XL_Fortran_COMPILER_NAMES mpixlf95 mpixlf95_r mpxlf95 mpxlf95 mpixlf77 mpixlf77_r mpxlf77 mpxlf77_r mpixlf mpixlf_r mpxlf mpxlf_r) -# Allow CMake 3.8.0 to use OS specific `separate_arguments` signature. -# Otherwise use the 3.9 NATIVE_COMMAND feature that does this for us -# automatically -if (CMAKE_VERSION VERSION_LESS "3.9.0") - if (WIN32 AND NOT CYGWIN) - set(_MPI_parse_kind WINDOWS_COMMAND) - else () - set(_MPI_parse_kind UNIX_COMMAND) - endif () -else () - set(_MPI_parse_kind NATIVE_COMMAND) -endif () # Prepend vendor-specific compiler wrappers to the list. If we don't know the compiler, # attempt all of them. @@ -353,9 +341,9 @@ unset(_MPIEXEC_NAMES_BASE) function (_MPI_check_compiler LANG QUERY_FLAG OUTPUT_VARIABLE RESULT_VARIABLE) if(DEFINED MPI_${LANG}_COMPILER_FLAGS) - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS ${_MPI_parse_kind} "${MPI_${LANG}_COMPILER_FLAGS}") + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_${LANG}_COMPILER_FLAGS}") else() - separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS ${_MPI_parse_kind} "${MPI_COMPILER_FLAGS}") + separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}") endif() execute_process( COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG} @@ -643,7 +631,7 @@ function (_MPI_interrogate_compiler LANG) if (NOT MPI_ALL_INCLUDE_PATHS) _MPI_check_compiler(${LANG} "-showme:incdirs" MPI_INCDIRS_CMDLINE MPI_INCDIRS_COMPILER_RETURN) if(MPI_INCDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_INCLUDE_PATHS ${_MPI_parse_kind} "${MPI_INCDIRS_CMDLINE}") + separate_arguments(MPI_ALL_INCLUDE_PATHS NATIVE_COMMAND "${MPI_INCDIRS_CMDLINE}") endif() endif() @@ -711,7 +699,7 @@ function (_MPI_interrogate_compiler LANG) if (NOT MPI_ALL_LINK_PATHS) _MPI_check_compiler(${LANG} "-showme:libdirs" MPI_LIBDIRS_CMDLINE MPI_LIBDIRS_COMPILER_RETURN) if(MPI_LIBDIRS_COMPILER_RETURN) - separate_arguments(MPI_ALL_LINK_PATHS ${_MPI_parse_kind} "${MPI_LIBDIRS_CMDLINE}") + separate_arguments(MPI_ALL_LINK_PATHS NATIVE_COMMAND "${MPI_LIBDIRS_CMDLINE}") endif() endif() @@ -1170,7 +1158,7 @@ macro(_MPI_create_imported_target LANG) set_property(TARGET MPI::MPI_${LANG} PROPERTY INTERFACE_LINK_LIBRARIES "") if(MPI_${LANG}_LINK_FLAGS) - separate_arguments(_MPI_${LANG}_LINK_FLAGS ${_MPI_parse_kind} "${MPI_${LANG}_LINK_FLAGS}") + separate_arguments(_MPI_${LANG}_LINK_FLAGS NATIVE_COMMAND "${MPI_${LANG}_LINK_FLAGS}") if(CMAKE_VERSION VERSION_LESS 3.13) set_property(TARGET MPI::MPI_${LANG} APPEND PROPERTY INTERFACE_LINK_LIBRARIES "${_MPI_${LANG}_LINK_FLAGS}") else() @@ -1362,7 +1350,7 @@ if(NOT MPI_IGNORE_LEGACY_VARIABLES) unset(MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS) unset(MPI_${LANG}_EXTRA_COMPILE_OPTIONS) if(MPI_${LANG}_COMPILE_FLAGS) - separate_arguments(MPI_SEPARATE_FLAGS ${_MPI_parse_kind} "${MPI_${LANG}_COMPILE_FLAGS}") + separate_arguments(MPI_SEPARATE_FLAGS NATIVE_COMMAND "${MPI_${LANG}_COMPILE_FLAGS}") foreach(_MPI_FLAG IN LISTS MPI_SEPARATE_FLAGS) if("${_MPI_FLAG}" MATCHES "^ *-D([^ ]+)") list(APPEND MPI_${LANG}_EXTRA_COMPILE_DEFINITIONS "${CMAKE_MATCH_1}") diff --git a/CMake/FindOpenGL.cmake b/CMake/FindOpenGL.cmake deleted file mode 100644 index 3303256a4..000000000 --- a/CMake/FindOpenGL.cmake +++ /dev/null @@ -1,527 +0,0 @@ -##============================================================================ -## Copyright (c) Kitware, Inc. -## All rights reserved. -## See LICENSE.txt for details. -## -## This software is distributed WITHOUT ANY WARRANTY; without even -## the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -## PURPOSE. See the above copyright notice for more information. -##============================================================================ - -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindOpenGL -# ---------- -# -# FindModule for OpenGL and GLU. -# -# Optional COMPONENTS -# ^^^^^^^^^^^^^^^^^^^ -# -# This module respects several optional COMPONENTS: ``EGL``, ``GLX``, and -# ``OpenGL``. There are corresponding import targets for each of these flags. -# -# IMPORTED Targets -# ^^^^^^^^^^^^^^^^ -# -# This module defines the :prop_tgt:`IMPORTED` targets: -# -# ``OpenGL::GL`` -# Defined to the platform-specific OpenGL libraries if the system has OpenGL. -# ``OpenGL::OpenGL`` -# Defined to libOpenGL if the system is GLVND-based. -# ``OpenGL::GL`` -# ``OpenGL::GLU`` -# Defined if the system has GLU. -# ``OpenGL::GLX`` -# Defined if the system has GLX. -# ``OpenGL::EGL`` -# Defined if the system has EGL. -# -# Result Variables -# ^^^^^^^^^^^^^^^^ -# -# This module sets the following variables: -# -# ``OPENGL_FOUND`` -# True, if the system has OpenGL and all components are found. -# ``OPENGL_XMESA_FOUND`` -# True, if the system has XMESA. -# ``OPENGL_GLU_FOUND`` -# True, if the system has GLU. -# ``OpenGL_OpenGL_FOUND`` -# True, if the system has an OpenGL library. -# ``OpenGL_GLX_FOUND`` -# True, if the system has GLX. -# ``OpenGL_EGL_FOUND`` -# True, if the system has EGL. -# ``OPENGL_INCLUDE_DIR`` -# Path to the OpenGL include directory. -# ``OPENGL_EGL_INCLUDE_DIRS`` -# Path to the EGL include directory. -# ``OPENGL_LIBRARIES`` -# Paths to the OpenGL library, windowing system libraries, and GLU libraries. -# On Linux, this assumes GLX and is never correct for EGL-based targets. -# Clients are encouraged to use the ``OpenGL::*`` import targets instead. -# -# Cache variables -# ^^^^^^^^^^^^^^^ -# -# The following cache variables may also be set: -# -# ``OPENGL_egl_LIBRARY`` -# Path to the EGL library. -# ``OPENGL_glu_LIBRARY`` -# Path to the GLU library. -# ``OPENGL_glx_LIBRARY`` -# Path to the GLVND 'GLX' library. -# ``OPENGL_opengl_LIBRARY`` -# Path to the GLVND 'OpenGL' library -# ``OPENGL_gl_LIBRARY`` -# Path to the OpenGL library. New code should prefer the ``OpenGL::*`` import -# targets. -# -# Linux-specific -# ^^^^^^^^^^^^^^ -# -# Some Linux systems utilize GLVND as a new ABI for OpenGL. GLVND separates -# context libraries from OpenGL itself; OpenGL lives in "libOpenGL", and -# contexts are defined in "libGLX" or "libEGL". GLVND is currently the only way -# to get OpenGL 3+ functionality via EGL in a manner portable across vendors. -# Projects may use GLVND explicitly with target ``OpenGL::OpenGL`` and either -# ``OpenGL::GLX`` or ``OpenGL::EGL``. -# -# Projects may use the ``OpenGL::GL`` target (or ``OPENGL_LIBRARIES`` variable) -# to use legacy GL interfaces. These will use the legacy GL library located -# by ``OPENGL_gl_LIBRARY``, if available. If ``OPENGL_gl_LIBRARY`` is empty or -# not found and GLVND is available, the ``OpenGL::GL`` target will use GLVND -# ``OpenGL::OpenGL`` and ``OpenGL::GLX`` (and the ``OPENGL_LIBRARIES`` -# variable will use the corresponding libraries). Thus, for non-EGL-based -# Linux targets, the ``OpenGL::GL`` target is most portable. -# -# A ``OpenGL_GL_PREFERENCE`` variable may be set to specify the preferred way -# to provide legacy GL interfaces in case multiple choices are available. -# The value may be one of: -# -# ``GLVND`` -# If the GLVND OpenGL and GLX libraries are available, prefer them. -# This forces ``OPENGL_gl_LIBRARY`` to be empty. -# This is the default if components were requested (since components -# correspond to GLVND libraries). -# -# ``LEGACY`` -# Prefer to use the legacy libGL library, if available. -# This is the default if no components were requested. -# -# For EGL targets the client must rely on GLVND support on the user's system. -# Linking should use the ``OpenGL::OpenGL OpenGL::EGL`` targets. Using GLES* -# libraries is theoretically possible in place of ``OpenGL::OpenGL``, but this -# module does not currently support that; contributions welcome. -# -# ``OPENGL_egl_LIBRARY`` and ``OPENGL_EGL_INCLUDE_DIRS`` are defined in the case of -# GLVND. For non-GLVND Linux and other systems these are left undefined. -# -# macOS-Specific -# ^^^^^^^^^^^^^^ -# -# On OSX FindOpenGL defaults to using the framework version of OpenGL. People -# will have to change the cache values of OPENGL_glu_LIBRARY and -# OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX. - -set(_OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY) - -# Provide OPENGL_USE_ variables for each component. -foreach(component ${OpenGL_FIND_COMPONENTS}) - string(TOUPPER ${component} _COMPONENT) - set(OPENGL_USE_${_COMPONENT} 1) -endforeach() - -if (CYGWIN) - find_path(OPENGL_INCLUDE_DIR GL/gl.h ) - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) - - find_library(OPENGL_gl_LIBRARY opengl32 ) - find_library(OPENGL_glu_LIBRARY glu32 ) - -elseif (WIN32) - - if(BORLAND) - set (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32") - set (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32") - else() - set (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32") - set (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32") - endif() - -elseif (APPLE) - # The OpenGL.framework provides both gl and glu - find_library(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL library for OS X") - find_library(OPENGL_glu_LIBRARY OpenGL DOC - "GLU library for OS X (usually same as OpenGL library)") - find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OS X") - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) - -else() - if (CMAKE_SYSTEM_NAME MATCHES "HP-UX") - # Handle HP-UX cases where we only want to find OpenGL in either hpux64 - # or hpux32 depending on if we're doing a 64 bit build. - if(CMAKE_SIZEOF_VOID_P EQUAL 4) - set(_OPENGL_LIB_PATH - /opt/graphics/OpenGL/lib/hpux32/) - else() - set(_OPENGL_LIB_PATH - /opt/graphics/OpenGL/lib/hpux64/ - /opt/graphics/OpenGL/lib/pa20_64) - endif() - elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku) - set(_OPENGL_LIB_PATH - /boot/develop/lib/x86) - set(_OPENGL_INCLUDE_PATH - /boot/develop/headers/os/opengl) - endif() - - # The first line below is to make sure that the proper headers - # are used on a Linux machine with the NVidia drivers installed. - # They replace Mesa with NVidia's own library but normally do not - # install headers and that causes the linking to - # fail since the compiler finds the Mesa headers but NVidia's library. - # Make sure the NVIDIA directory comes BEFORE the others. - # - Atanas Georgiev - find_path(OPENGL_INCLUDE_DIR GL/gl.h - /usr/share/doc/NVIDIA_GLX-1.0/include - /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include - ${_OPENGL_INCLUDE_PATH} - ) - find_path(OPENGL_GLX_INCLUDE_DIR GL/glx.h ${_OPENGL_INCLUDE_PATH}) - find_path(OPENGL_EGL_INCLUDE_DIR EGL/egl.h ${_OPENGL_INCLUDE_PATH}) - find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h - /usr/share/doc/NVIDIA_GLX-1.0/include - /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include - ) - - # Search for the GLVND libraries. We do this regardless of COMPONENTS; we'll - # take into account the COMPONENTS logic later. - find_library(OPENGL_opengl_LIBRARY - NAMES OpenGL - PATHS /usr/X11R6/lib - ${_OPENGL_LIB_PATH} - ) - - find_library(OPENGL_glx_LIBRARY - NAMES GLX - PATHS /usr/X11R6/lib - ${_OPENGL_LIB_PATH} - ) - - find_library(OPENGL_egl_LIBRARY - NAMES EGL - PATHS ${_OPENGL_LIB_PATH} - ) - - find_library(OPENGL_glu_LIBRARY - NAMES GLU MesaGLU - PATHS ${OPENGL_gl_LIBRARY} - /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/shlib /usr/X11R6/lib - ) - - if(NOT DEFINED OpenGL_GL_PREFERENCE) - set(OpenGL_GL_PREFERENCE "") - endif() - if(NOT OpenGL_GL_PREFERENCE STREQUAL "") - # A preference has been explicitly specified. - if(NOT OpenGL_GL_PREFERENCE MATCHES "^(GLVND|LEGACY)$") - message(FATAL_ERROR - "OpenGL_GL_PREFERENCE value '${OpenGL_GL_PREFERENCE}' not recognized. " - "Allowed values are 'GLVND' and 'LEGACY'." - ) - endif() - elseif(OpenGL_FIND_COMPONENTS) - # No preference was explicitly specified, but the caller did request - # at least one GLVND component. Prefer GLVND for legacy GL. - set(OpenGL_GL_PREFERENCE "GLVND") - else() - # No preference was explicitly specified and no GLVND components were - # requested. Prefer libGL for legacy GL. - set(OpenGL_GL_PREFERENCE "LEGACY") - endif() - - if("x${OpenGL_GL_PREFERENCE}x" STREQUAL "xGLVNDx" AND OPENGL_opengl_LIBRARY AND OPENGL_glx_LIBRARY) - # We can provide legacy GL using GLVND libraries. - # Do not use any legacy GL library. - set(OPENGL_gl_LIBRARY "") - else() - # We cannot provide legacy GL using GLVND libraries. - # Search for the legacy GL library. - find_library(OPENGL_gl_LIBRARY - NAMES GL MesaGL - PATHS /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/shlib /usr/X11R6/lib - ${_OPENGL_LIB_PATH} - ) - endif() - - # FPHSA cannot handle "this OR that is required", so we conditionally set what - # it must look for. First clear any previous config we might have done: - set(_OpenGL_REQUIRED_VARS) - - # now we append the libraries as appropriate. The complicated logic - # basically comes down to "use libOpenGL when we can, and add in specific - # context mechanisms when requested, or we need them to preserve the previous - # default where glx is always available." - if((NOT OPENGL_USE_EGL AND - NOT OPENGL_opengl_LIBRARY AND - OPENGL_glx_LIBRARY AND - NOT OPENGL_gl_LIBRARY) OR - (NOT OPENGL_USE_EGL AND - NOT OPENGL_glx_LIBRARY AND - NOT OPENGL_gl_LIBRARY) OR - (NOT OPENGL_USE_EGL AND - OPENGL_opengl_LIBRARY AND - OPENGL_glx_LIBRARY) OR - ( OPENGL_USE_EGL)) - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_opengl_LIBRARY) - endif() - - # GLVND GLX library. Preferred when available. - if((NOT OPENGL_USE_OPENGL AND - NOT OPENGL_USE_GLX AND - NOT OPENGL_USE_EGL AND - NOT OPENGL_glx_LIBRARY AND - NOT OPENGL_gl_LIBRARY) OR - ( OPENGL_USE_GLX AND - NOT OPENGL_USE_EGL AND - NOT OPENGL_glx_LIBRARY AND - NOT OPENGL_gl_LIBRARY) OR - (NOT OPENGL_USE_EGL AND - OPENGL_opengl_LIBRARY AND - OPENGL_glx_LIBRARY) OR - (OPENGL_USE_GLX AND OPENGL_USE_EGL)) - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_glx_LIBRARY) - endif() - - # GLVND EGL library. - if(OPENGL_USE_EGL) - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_egl_LIBRARY) - endif() - - # Old-style "libGL" library: used as a fallback when GLVND isn't available. - if((NOT OPENGL_USE_EGL AND - NOT OPENGL_opengl_LIBRARY AND - OPENGL_glx_LIBRARY AND - OPENGL_gl_LIBRARY) OR - (NOT OPENGL_USE_EGL AND - NOT OPENGL_glx_LIBRARY AND - OPENGL_gl_LIBRARY)) - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_gl_LIBRARY) - endif() - - # We always need the 'gl.h' include dir. - list(APPEND _OpenGL_REQUIRED_VARS OPENGL_INCLUDE_DIR) - - unset(_OPENGL_INCLUDE_PATH) - unset(_OPENGL_LIB_PATH) - - find_library(OPENGL_glu_LIBRARY - NAMES GLU MesaGLU - PATHS ${OPENGL_gl_LIBRARY} - /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/shlib /usr/X11R6/lib - ) -endif () - -if(OPENGL_xmesa_INCLUDE_DIR) - set( OPENGL_XMESA_FOUND "YES" ) -else() - set( OPENGL_XMESA_FOUND "NO" ) -endif() - -if(OPENGL_glu_LIBRARY) - set( OPENGL_GLU_FOUND "YES" ) -else() - set( OPENGL_GLU_FOUND "NO" ) -endif() - -# OpenGL_OpenGL_FOUND is a bit unique in that it is okay if /either/ libOpenGL -# or libGL is found. -# Using libGL with libEGL is never okay, though; we handle that case later. -if(NOT OPENGL_opengl_LIBRARY AND NOT OPENGL_gl_LIBRARY) - set(OpenGL_OpenGL_FOUND FALSE) -else() - set(OpenGL_OpenGL_FOUND TRUE) -endif() - -if(OPENGL_glx_LIBRARY AND OPENGL_GLX_INCLUDE_DIR) - set(OpenGL_GLX_FOUND TRUE) -else() - set(OpenGL_GLX_FOUND FALSE) -endif() - -if(OPENGL_egl_LIBRARY AND OPENGL_EGL_INCLUDE_DIR) - set(OpenGL_EGL_FOUND TRUE) -else() - set(OpenGL_EGL_FOUND FALSE) -endif() - -# User-visible names should be plural. -if(OPENGL_EGL_INCLUDE_DIR) - set(OPENGL_EGL_INCLUDE_DIRS ${OPENGL_EGL_INCLUDE_DIR}) -endif() - -include(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenGL REQUIRED_VARS ${_OpenGL_REQUIRED_VARS} - HANDLE_COMPONENTS) -unset(_OpenGL_REQUIRED_VARS) - -# OpenGL:: targets -if(OPENGL_FOUND) - # ::OpenGL is a GLVND library, and thus Linux-only: we don't bother checking - # for a framework version of this library. - if(OPENGL_opengl_LIBRARY AND NOT TARGET OpenGL::OpenGL) - if(IS_ABSOLUTE "${OPENGL_opengl_LIBRARY}") - add_library(OpenGL::OpenGL UNKNOWN IMPORTED) - set_target_properties(OpenGL::OpenGL PROPERTIES IMPORTED_LOCATION - "${OPENGL_opengl_LIBRARY}") - else() - add_library(OpenGL::OpenGL INTERFACE IMPORTED) - set_target_properties(OpenGL::OpenGL PROPERTIES IMPORTED_LIBNAME - "${OPENGL_opengl_LIBRARY}") - endif() - set_target_properties(OpenGL::OpenGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${OPENGL_INCLUDE_DIR}") - endif() - - # ::GLX is a GLVND library, and thus Linux-only: we don't bother checking - # for a framework version of this library. - if(OpenGL_GLX_FOUND AND NOT TARGET OpenGL::GLX) - if(IS_ABSOLUTE "${OPENGL_glx_LIBRARY}") - add_library(OpenGL::GLX UNKNOWN IMPORTED) - set_target_properties(OpenGL::GLX PROPERTIES IMPORTED_LOCATION - "${OPENGL_glx_LIBRARY}") - else() - add_library(OpenGL::GLX INTERFACE IMPORTED) - set_target_properties(OpenGL::GLX PROPERTIES IMPORTED_LIBNAME - "${OPENGL_glx_LIBRARY}") - endif() - set_target_properties(OpenGL::GLX PROPERTIES INTERFACE_LINK_LIBRARIES - OpenGL::OpenGL) - set_target_properties(OpenGL::GLX PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${OPENGL_GLX_INCLUDE_DIR}") - endif() - - if(OPENGL_gl_LIBRARY AND NOT TARGET OpenGL::GL) - # A legacy GL library is available, so use it for the legacy GL target. - if(IS_ABSOLUTE "${OPENGL_gl_LIBRARY}") - add_library(OpenGL::GL UNKNOWN IMPORTED) - if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$") - set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}") - if(EXISTS "${_gl_fw}.tbd") - set(_gl_fw "${_gl_fw}.tbd") - endif() - set_target_properties(OpenGL::GL PROPERTIES - IMPORTED_LOCATION "${_gl_fw}") - else() - set_target_properties(OpenGL::GL PROPERTIES - IMPORTED_LOCATION "${OPENGL_gl_LIBRARY}") - endif() - else() - add_library(OpenGL::GL INTERFACE IMPORTED) - set_target_properties(OpenGL::GL PROPERTIES - IMPORTED_LIBNAME "${OPENGL_gl_LIBRARY}") - endif() - set_target_properties(OpenGL::GL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENGL_INCLUDE_DIR}") - elseif(NOT TARGET OpenGL::GL AND TARGET OpenGL::OpenGL AND TARGET OpenGL::GLX) - # A legacy GL library is not available, but we can provide the legacy GL - # target using GLVND OpenGL+GLX. - add_library(OpenGL::GL INTERFACE IMPORTED) - set_target_properties(OpenGL::GL PROPERTIES INTERFACE_LINK_LIBRARIES - OpenGL::OpenGL) - set_property(TARGET OpenGL::GL APPEND PROPERTY INTERFACE_LINK_LIBRARIES - OpenGL::GLX) - set_target_properties(OpenGL::GL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${OPENGL_INCLUDE_DIR}") - endif() - - # ::EGL is a GLVND library, and thus Linux-only: we don't bother checking - # for a framework version of this library. - # Note we test for OpenGL::OpenGL as a target. When this module is updated to - # support GLES, we would additionally want to check for the hypothetical GLES - # target and enable EGL if either ::GLES or ::OpenGL is created. - if(TARGET OpenGL::OpenGL AND OpenGL_EGL_FOUND AND NOT TARGET OpenGL::EGL) - if(IS_ABSOLUTE "${OPENGL_egl_LIBRARY}") - add_library(OpenGL::EGL UNKNOWN IMPORTED) - set_target_properties(OpenGL::EGL PROPERTIES IMPORTED_LOCATION - "${OPENGL_egl_LIBRARY}") - else() - add_library(OpenGL::EGL INTERFACE IMPORTED) - set_target_properties(OpenGL::EGL PROPERTIES IMPORTED_LIBNAME - "${OPENGL_egl_LIBRARY}") - endif() - set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_LINK_LIBRARIES - OpenGL::OpenGL) - # Note that EGL's include directory is different from OpenGL/GLX's! - set_target_properties(OpenGL::EGL PROPERTIES INTERFACE_INCLUDE_DIRECTORIES - "${OPENGL_EGL_INCLUDE_DIR}") - endif() - - if(OPENGL_GLU_FOUND AND NOT TARGET OpenGL::GLU) - if(IS_ABSOLUTE "${OPENGL_glu_LIBRARY}") - add_library(OpenGL::GLU UNKNOWN IMPORTED) - if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$") - set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}") - if(EXISTS "${_glu_fw}.tbd") - set(_glu_fw "${_glu_fw}.tbd") - endif() - set_target_properties(OpenGL::GLU PROPERTIES - IMPORTED_LOCATION "${_glu_fw}") - else() - set_target_properties(OpenGL::GLU PROPERTIES - IMPORTED_LOCATION "${OPENGL_glu_LIBRARY}") - endif() - else() - add_library(OpenGL::GLU INTERFACE IMPORTED) - set_target_properties(OpenGL::GLU PROPERTIES - IMPORTED_LIBNAME "${OPENGL_glu_LIBRARY}") - endif() - set_target_properties(OpenGL::GLU PROPERTIES - INTERFACE_LINK_LIBRARIES OpenGL::GL) - endif() - - # OPENGL_LIBRARIES mirrors OpenGL::GL's logic ... - if(OPENGL_gl_LIBRARY) - set(OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY}) - elseif(TARGET OpenGL::OpenGL AND TARGET OpenGL::GLX) - set(OPENGL_LIBRARIES ${OPENGL_opengl_LIBRARY} ${OPENGL_glx_LIBRARY}) - else() - set(OPENGL_LIBRARIES "") - endif() - # ... and also includes GLU, if available. - if(TARGET OpenGL::GLU) - list(APPEND OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY}) - endif() -endif() - -# This deprecated setting is for backward compatibility with CMake1.4 -set(OPENGL_LIBRARY ${OPENGL_LIBRARIES}) -# This deprecated setting is for backward compatibility with CMake1.4 -set(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR}) - -mark_as_advanced( - OPENGL_INCLUDE_DIR - OPENGL_xmesa_INCLUDE_DIR - OPENGL_egl_LIBRARY - OPENGL_glu_LIBRARY - OPENGL_glx_LIBRARY - OPENGL_gl_LIBRARY - OPENGL_opengl_LIBRARY - OPENGL_EGL_INCLUDE_DIR - OPENGL_GLX_INCLUDE_DIR -) diff --git a/CMake/VTKmConfig.cmake.in b/CMake/VTKmConfig.cmake.in index cc92e3ccb..d2d251a43 100644 --- a/CMake/VTKmConfig.cmake.in +++ b/CMake/VTKmConfig.cmake.in @@ -48,8 +48,8 @@ # # -if (CMAKE_VERSION VERSION_LESS "3.8") - message(FATAL_ERROR "VTK-m requires CMake 3.8+") +if (CMAKE_VERSION VERSION_LESS "3.12") + message(FATAL_ERROR "VTK-m requires CMake 3.12+") endif() if("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND CMAKE_VERSION VERSION_LESS "3.11") diff --git a/CMake/VTKmDeviceAdapters.cmake b/CMake/VTKmDeviceAdapters.cmake index ea1425cf9..d3876761f 100644 --- a/CMake/VTKmDeviceAdapters.cmake +++ b/CMake/VTKmDeviceAdapters.cmake @@ -43,14 +43,7 @@ endfunction() if(VTKm_ENABLE_TBB AND NOT TARGET vtkm::tbb) find_package(TBB REQUIRED) - - # Workaround a bug in older versions of cmake prevents linking with UNKNOWN IMPORTED libraries - # refer to CMake issue #17245 - if (CMAKE_VERSION VERSION_LESS 3.10) - add_library(vtkm::tbb SHARED IMPORTED GLOBAL) - else() - add_library(vtkm::tbb UNKNOWN IMPORTED GLOBAL) - endif() + add_library(vtkm::tbb UNKNOWN IMPORTED GLOBAL) set_target_properties(vtkm::tbb PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${TBB_INCLUDE_DIRS}") diff --git a/CMake/VTKmRenderingContexts.cmake b/CMake/VTKmRenderingContexts.cmake index d438b4f24..635e650c8 100644 --- a/CMake/VTKmRenderingContexts.cmake +++ b/CMake/VTKmRenderingContexts.cmake @@ -51,15 +51,7 @@ function(vtkm_find_gl) #Find GL if(DO_GL_FIND AND NOT TARGET OpenGL::GL) - if(CMAKE_VERSION VERSION_LESS 3.10) - find_package(OpenGL ${GL_REQUIRED} ${QUIETLY} MODULE) - else() - #clunky but we need to make sure we use the upstream module if it exists - set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) - set(CMAKE_MODULE_PATH "") - find_package(OpenGL ${GL_REQUIRED} ${QUIETLY} MODULE) - set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) - endif() + find_package(OpenGL ${GL_REQUIRED} ${QUIETLY} MODULE) endif() #Find GLEW diff --git a/CMake/VTKmWrappers.cmake b/CMake/VTKmWrappers.cmake index 7e1f1b728..0109a23d0 100644 --- a/CMake/VTKmWrappers.cmake +++ b/CMake/VTKmWrappers.cmake @@ -35,11 +35,11 @@ endfunction(vtkm_get_kit_name) #----------------------------------------------------------------------------- function(vtkm_pyexpander_generated_file generated_file_name) # If pyexpander is available, add targets to build and check - if(PYEXPANDER_FOUND AND PYTHONINTERP_FOUND) + if(PYEXPANDER_FOUND AND TARGET Python::Interpreter) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name}.checked COMMAND ${CMAKE_COMMAND} - -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} + -DPYTHON_EXECUTABLE=${Python_EXECUTABLE} -DPYEXPANDER_COMMAND=${PYEXPANDER_COMMAND} -DSOURCE_FILE=${CMAKE_CURRENT_SOURCE_DIR}/${generated_file_name} -DGENERATED_FILE=${CMAKE_CURRENT_BINARY_DIR}/${generated_file_name} diff --git a/CMakeLists.txt b/CMakeLists.txt index aa1b0aeaa..ad9fde942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,7 +192,7 @@ if (VTKm_ENABLE_TESTING) #----------------------------------------------------------------------------- # Find the Python interpreter, which we will use during the build process - find_package(PythonInterp QUIET) + find_package(Python QUIET COMPONENTS Interpreter) #----------------------------------------------------------------------------- # Find Pyexpander in case somebody wants to update the auto generated @@ -268,7 +268,6 @@ if(NOT VTKm_INSTALL_ONLY_LIBRARIES) FILES ${VTKm_SOURCE_DIR}/CMake/FindTBB.cmake ${VTKm_SOURCE_DIR}/CMake/FindMPI.cmake - ${VTKm_SOURCE_DIR}/CMake/FindOpenGL.cmake DESTINATION ${VTKm_INSTALL_CMAKE_MODULE_DIR} )