Commit fef41372 authored by James Kress's avatar James Kress

Merge remote-tracking branch 'upstream/master'

parents 3be8b9c5 adfff37e
##============================================================================
## 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.
##
## Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
# Try to find EGL library and include dir.
# Once done this will define
#
# EGL_FOUND - true if EGL has been found
# EGL_INCLUDE_DIRS - where the EGL/egl.h and KHR/khrplatform.h can be found
# EGL_LIBRARY - link this to use libEGL.so.1
# EGL_opengl_LIBRARY - link with these two libraries instead of the gl library
# EGL_gldispatch_LIBRARY for full OpenGL support through EGL
# EGL_LIBRARIES - all EGL related libraries: EGL, OpenGL, GLdispatch
if(NOT EGL_INCLUDE_DIR)
# If we have a root defined look there first
if(EGL_ROOT)
find_path(EGL_INCLUDE_DIR EGL/egl.h PATHS ${EGL_ROOT}/include
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_INCLUDE_DIR)
find_path(EGL_INCLUDE_DIR EGL/egl.h PATHS
/usr/local/include
/usr/include
)
endif()
endif()
if(NOT EGL_LIBRARY)
# If we have a root defined look there first
if(EGL_ROOT)
find_library(EGL_LIBRARY EGL PATHS ${EGL_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_LIBRARY)
find_library(EGL_LIBRARY EGL PATHS
/usr/local/lib
/usr/lib
)
endif()
endif()
if(NOT EGL_opengl_LIBRARY)
# If we have a root defined look there first
if(EGL_ROOT)
find_library(EGL_opengl_LIBRARY OpenGL PATHS ${EGL_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_opengl_LIBRARY)
find_library(EGL_opengl_LIBRARY OpenGL PATHS
/usr/local/lib
/usr/lib
)
endif()
endif()
if(NOT EGL_gldispatch_LIBRARY)
# If we have a root defined look there first
if(EGL_ROOT)
find_library(EGL_gldispatch_LIBRARY GLdispatch PATHS ${EGL_ROOT}/lib
NO_DEFAULT_PATH
)
endif()
if(NOT EGL_gldispatch_LIBRARY)
find_library(EGL_gldispatch_LIBRARY GLdispatch PATHS
/usr/local/lib
/usr/lib
)
endif()
# For the NVIDIA 358 drivers there isn't a libGLdispath.so. The
# proper one gets installed as libGLdispatch.so.0.
if(NOT EGL_gldispatch_LIBRARY)
find_library(EGL_gldispatch_LIBRARY libGLdispatch.so.0 PATHS
/usr/local/lib
/usr/lib
)
endif()
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(EGL
FOUND_VAR EGL_FOUND
REQUIRED_VARS EGL_LIBRARY EGL_opengl_LIBRARY EGL_gldispatch_LIBRARY EGL_INCLUDE_DIR)
if(EGL_FOUND)
set(EGL_LIBRARIES ${EGL_LIBRARY} ${EGL_opengl_LIBRARY} ${EGL_gldispatch_LIBRARY})
set(EGL_INCLUDE_DIRS ${EGL_INCLUDE_DIR})
endif()
mark_as_advanced(EGL_DIR EGL_INCLUDE_DIR EGL_LIBRARY EGL_opengl_LIBRARY EGL_gldispatch_LIBRARY)
# - Find the OpenGL Extension Wrangler Library (GLEW)
# This module defines the following variables:
# GLEW_INCLUDE_DIRS - include directories for GLEW
# GLEW_LIBRARIES - libraries to link against GLEW
# GLEW_FOUND - true if GLEW has been found and can be used
#=============================================================================
# Copyright 2012 Benjamin Eikel
#
# CMake - Cross Platform Makefile Generator
# Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the names of Kitware, Inc., the Insight Software Consortium,
# nor the names of their contributors may be used to endorse or promote
# products derived from this software without specific prior written
# permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# ------------------------------------------------------------------------------
#
# The above copyright and license notice applies to distributions of
# CMake in source and binary form. Some source files contain additional
# notices of original copyright by their contributors; see each source
# for details. Third-party software packages supplied with CMake under
# compatible licenses provide their own copyright notices documented in
# corresponding subdirectories.
#
# ------------------------------------------------------------------------------
#
# CMake was initially developed by Kitware with the following sponsorship:
#
# * National Library of Medicine at the National Institutes of Health
# as part of the Insight Segmentation and Registration Toolkit (ITK).
#
# * US National Labs (Los Alamos, Livermore, Sandia) ASC Parallel
# Visualization Initiative.
#
# * National Alliance for Medical Image Computing (NAMIC) is funded by the
# National Institutes of Health through the NIH Roadmap for Medical Research,
# Grant U54 EB005149.
#
# * Kitware, Inc.
find_path(GLEW_INCLUDE_DIR GL/glew.h)
find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLEW
FOUND_VAR GLEW_FOUND
REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY)
if(GLEW_FOUND)
set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR})
set(GLEW_LIBRARIES ${GLEW_LIBRARY})
endif()
mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY)
##=============================================================================
##
## 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.
##
## Copyright 2016 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2016 UT-Battelle, LLC.
## Copyright 2016 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## the U.S. Government retains certain rights in this software.
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##
##=============================================================================
# Try to find EGL library and include dir.
# Once done this will define
#
# GLFW_FOUND
# GLFW_INCLUDE_DIRS
# GLFW_LIBRARIES
#
include(FindPackageHandleStandardArgs)
if (WIN32)
find_path( GLFW_INCLUDE_DIR
NAMES
GLFW/glfw3.h
PATHS
${PROJECT_SOURCE_DIR}/shared_external/glfw/include
${PROJECT_SOURCE_DIR}/../shared_external/glfw/include
${GLFW_LOCATION}/include
$ENV{GLFW_LOCATION}/include
$ENV{PROGRAMFILES}/GLFW/include
${GLFW_LOCATION}
$ENV{GLFW_LOCATION}
DOC "The directory where GLFW/glfw3.h resides" )
if(ARCH STREQUAL "x86")
find_library( GLFW_LIBRARY
NAMES
glfw3
PATHS
${GLFW_LOCATION}/lib
$ENV{GLFW_LOCATION}/lib
$ENV{PROGRAMFILES}/GLFW/lib
DOC "The GLFW library")
else()
find_library( GLFW_LIBRARY
NAMES
glfw3
PATHS
${GLFW_LOCATION}/lib
$ENV{GLFW_LOCATION}/lib
$ENV{PROGRAMFILES}/GLFW/lib
DOC "The GLFW library")
endif()
endif ()
if (${CMAKE_HOST_UNIX})
find_path( GLFW_INCLUDE_DIR
NAMES
GLFW/glfw3.h
PATHS
${GLFW_LOCATION}/include
$ENV{GLFW_LOCATION}/include
/usr/include
/usr/local/include
/sw/include
/opt/local/include
NO_DEFAULT_PATH
DOC "The directory where GLFW/glfw3.h resides"
)
find_library( GLFW_LIBRARY
NAMES
glfw3 glfw
PATHS
${GLFW_LOCATION}/lib
$ENV{GLFW_LOCATION}/lib
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
/usr/lib/x86_64-linux-gnu
NO_DEFAULT_PATH
DOC "The GLFW library")
endif ()
find_package_handle_standard_args(GLFW
FOUND_VAR GLFW_FOUND
REQUIRED_VARS GLFW_INCLUDE_DIR GLFW_LIBRARY
)
if(GLFW_FOUND)
set(GLFW_LIBRARIES ${GLFW_LIBRARY})
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
endif()
mark_as_advanced( GLFW_INCLUDE_DIR GLFW_LIBRARY )
This diff is collapsed.
##============================================================================
## 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.
##
## Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
#
# FindThrust
#
# This module finds the Thrust header files and extrats their version. It
# sets the following variables.
#
# THRUST_INCLUDE_DIR - Include directory for thrust header files. (All header
# files will actually be in the thrust subdirectory.)
# THRUST_VERSION - Version of thrust in the form "major.minor.patch".
#
find_path( THRUST_INCLUDE_DIR
HINTS
/usr/include/cuda
/usr/local/include
/usr/local/cuda/include
${CUDA_INCLUDE_DIRS}
${CUDA_TOOLKIT_ROOT_DIR}
${CUDA_SDK_ROOT_DIR}
NAMES thrust/version.h
DOC "Thrust headers"
)
if( THRUST_INCLUDE_DIR )
list( REMOVE_DUPLICATES THRUST_INCLUDE_DIR )
endif( THRUST_INCLUDE_DIR )
# Find thrust version
if (THRUST_INCLUDE_DIR)
file( STRINGS ${THRUST_INCLUDE_DIR}/thrust/version.h
version
REGEX "#define THRUST_VERSION[ \t]+([0-9x]+)"
)
string( REGEX REPLACE
"#define THRUST_VERSION[ \t]+"
""
version
"${version}"
)
string( REGEX MATCH "^[0-9]" major ${version} )
string( REGEX REPLACE "^${major}00" "" version "${version}" )
string( REGEX MATCH "^[0-9]" minor ${version} )
string( REGEX REPLACE "^${minor}0" "" version "${version}" )
set( THRUST_VERSION "${major}.${minor}.${version}")
set( THRUST_MAJOR_VERSION "${major}")
set( THRUST_MINOR_VERSION "${minor}")
endif()
# Check for required components
include( FindPackageHandleStandardArgs )
find_package_handle_standard_args( Thrust
FOUND_VAR Thrust_FOUND
REQUIRED_VARS THRUST_INCLUDE_DIR
VERSION_VAR THRUST_VERSION
)
if(Thrust_FOUND)
set(THRUST_INCLUDE_DIRS ${THRUST_INCLUDE_DIR})
endif()
mark_as_advanced(THRUST_INCLUDE_DIR)
//mark that we are including headers as test for completeness.
//This is used by headers that include thrust to properly define a proper
//device backend / system
#define VTKM_TEST_HEADER_BUILD
#include <@dir_prefix@/@header@>
int Test_Build_For_@headername@()
{
return 0;
}
......@@ -36,21 +36,19 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/CMake/doxyfile.in ${VTKm_DOXYFILE}
#-----------------------------------------------------------------------------
# Run Doxygen
#-----------------------------------------------------------------------------
function(vtkm_build_documentation)
if(WIN32)
set(doxygen_redirect NUL)
else()
set(doxygen_redirect /dev/null)
endif()
add_custom_command(
OUTPUT ${VTKm_BINARY_DIR}/docs/doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${VTKm_DOXYFILE} > ${doxygen_redirect}
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/CMake/doxyfile.in
DEPENDS ${VTKm_DOXYFILE}
COMMENT "Generating VTKm Documentation"
)
add_custom_target(VTKmDoxygenDocs
ALL
DEPENDS ${VTKm_BINARY_DIR}/docs/doxygen
)
endfunction(vtkm_build_documentation)
if(WIN32)
set(doxygen_redirect NUL)
else()
set(doxygen_redirect /dev/null)
endif()
add_custom_command(
OUTPUT ${VTKm_BINARY_DIR}/docs/doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${VTKm_DOXYFILE} > ${doxygen_redirect}
MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/CMake/doxyfile.in
DEPENDS ${VTKm_DOXYFILE}
COMMENT "Generating VTKm Documentation"
)
add_custom_target(VTKmDoxygenDocs
ALL
DEPENDS ${VTKm_BINARY_DIR}/docs/doxygen
)
##============================================================================
##=============================================================================
##
## 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.
##
## Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
## Copyright 2017 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2017 UT-Battelle, LLC.
## Copyright 2017 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
##
##=============================================================================
#Currently all we are going to build is a set of options that are possible
#based on the compiler. For now we are going on the presumption
......@@ -66,7 +68,23 @@
#
#
function(set_vectorization_flags_properties vec_levels_var)
# guard agaisnt building vectorization_flags more than once
if(TARGET vtkm_vectorization_flags)
return()
endif()
add_library(vtkm_vectorization_flags INTERFACE)
if(NOT VTKm_INSTALL_ONLY_LIBRARIES)
install(TARGETS vtkm_vectorization_flags EXPORT ${VTKm_EXPORT_NAME})
endif()
# If we are using MSVC stop after the interface so that the interface is
# consistently defined even for compilers such as MSVC that we don't
# have vectorization flag support for yet.
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
return()
endif()
set(vec_levels none native)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
......@@ -77,26 +95,27 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(native_flags -march=native)
set(avx_flags -mavx)
set(avx2_flags ${avx_flags} -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2)
if (CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 4.7 OR
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7)
#if GNU is less than 4.9 you get avx, avx2
list(APPEND vec_levels avx2)
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
#if GNU is less than 5.1 you get avx, avx2, and some avx512
list(APPEND vec_levels avx2 avx512)
set(avx512_flags ${avx2_flags} -mavx512f -mavx512pf -mavx512er -mavx512cd)
else()
#if GNU is 5.1+ you get avx, avx2, and more avx512
list(APPEND vec_levels avx2 avx512)
set(avx512_flags ${avx2_flags} -mavx512f -mavx512pf -mavx512er -mavx512cd -mavx512vl -mavx512bw -mavx512dq -mavx512ifma -mavx512vbmi)
endif()
CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.7)
#if GNU is less than 4.9 you get avx, avx2
list(APPEND vec_levels avx2)
elseif(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1)
#if GNU is less than 5.1 you get avx, avx2, and some avx512
list(APPEND vec_levels avx2 avx512-knl)
set(knl_flags ${avx2_flags} -mavx512f -mavx512pf -mavx512er -mavx512cd)
else()
#if GNU is 5.1+ you get avx, avx2, and more avx512
list(APPEND vec_levels avx2 avx512-skx avx512-knl)
set(knl_flags ${avx2_flags} -mavx512f -mavx512pf -mavx512er -mavx512cd)
set(skylake_flags ${avx2_flags} -mavx512f -mavx512dq -mavx512cd -mavx512bw -mavx512vl)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
list(APPEND vec_levels avx avx2 avx512)
list(APPEND vec_levels avx avx2 avx512-skx avx512-knl)
set(native_flags -march=native)
set(avx_flags -mavx)
set(avx2_flags ${avx_flags} -mf16c -mavx2 -mfma -mlzcnt -mbmi -mbmi2)
set(avx512_flags ${avx2_flags} -mavx512)
set(knl_flags ${avx2_flags} -avx512f -avx512cd -avx512dq -avx512bw -avx512vl)
set(skylake_flags ${avx2_flags} -avx512f -avx512cd -avx512er -avx512pf)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
#While Clang support AVX512, no version of AppleClang has that support yet
list(APPEND vec_levels avx avx2)
......@@ -123,25 +142,19 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
elseif (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 16.0)
list(APPEND vec_levels avx avx2)
else()
list(APPEND vec_levels avx avx2 avx512 knl)
set(avx512_flags -xCORE-AVX512)
set(knl_flags -xMIC-AVX512)
list(APPEND vec_levels avx avx2 avx512-skx avx512-knl)
set(knl_flags ${knl_flags} -xMIC-AVX512)
set(skylake_flags ${skylake_flags} -xCORE-AVX512)
endif()
endif()
set_property(GLOBAL PROPERTY VTKm_NATIVE_FLAGS ${native_flags})
set_property(GLOBAL PROPERTY VTKm_AVX_FLAGS ${avx_flags})
set_property(GLOBAL PROPERTY VTKm_AVX2_FLAGS ${avx2_flags})
set_property(GLOBAL PROPERTY VTKm_AVX512_FLAGS ${avx512_flags})
set_property(GLOBAL PROPERTY VTKm_KNLAVX512_FLAGS ${knl_flags})
set(${vec_levels_var} ${vec_levels} PARENT_SCOPE)
endfunction() # set_vectorization_flags_properties
set_property(GLOBAL PROPERTY VTKm_KNL_FLAGS ${knl_flags})
set_property(GLOBAL PROPERTY VTKm_SKYLAKE_FLAGS ${skylake_flags})
set_vectorization_flags_properties(vec_levels)
#
# Now that we have set up what levels the compiler lets setup the CMake option
# We use a combo box style property, so that ccmake and cmake-gui have a
# nice interface
......@@ -163,16 +176,21 @@ elseif(VTKm_Vectorization STREQUAL "avx")
get_property(flags GLOBAL PROPERTY VTKm_AVX_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx2")
get_property(flags GLOBAL PROPERTY VTKm_AVX2_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx512")
get_property(flags GLOBAL PROPERTY VTKm_AVX512_FLAGS)
elseif(VTKm_Vectorization STREQUAL "knl")
get_property(flags GLOBAL PROPERTY VTKm_KNLAVX512_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx512-skx")
get_property(flags GLOBAL PROPERTY VTKm_SKYLAKE_FLAGS)
elseif(VTKm_Vectorization STREQUAL "avx512-knl")
get_property(flags GLOBAL PROPERTY VTKm_KNL_FLAGS)
endif()
#guard against adding the flags multiple times, which happens when multiple
#backends include this file
if(NOT VTKm_Vectorization_flags_added)
set(VTKm_Vectorization_flags_added true)
set_property(GLOBAL PROPERTY VTKm_Vectorization_FLAGS ${flags})
list(APPEND VTKm_COMPILE_OPTIONS ${flags})
target_compile_options(vtkm_vectorization_flags
INTERFACE $<$<COMPILE_LANGUAGE:CXX>:${flags}>
)
if(TARGET vtkm::cuda AND flags AND NOT CMAKE_CUDA_HOST_COMPILER)
# Also propagate down these optimizations when building host side code
# with cuda. To be safe we only do this when we know the C++ and CUDA
# host compiler are from the same vendor
target_compile_options(vtkm_vectorization_flags
INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler="${flags}">
)
endif()
##============================================================================
## 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.
##
## Copyright 2014 National Technology & Engineering Solutions of Sandia, LLC (NTESS).
## Copyright 2014 UT-Battelle, LLC.
## Copyright 2014 Los Alamos National Security.
##
## Under the terms of Contract DE-NA0003525 with NTESS,
## the U.S. Government retains certain rights in this software.
##
## Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
## Laboratory (LANL), the U.S. Government retains certain rights in
## this software.
##============================================================================
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "PGI")
set(CMAKE_COMPILER_IS_PGIXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_COMPILER_IS_ICCXX 1)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(CMAKE_COMPILER_IS_MSVCXX 1)
endif()
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANGXX)
include(CheckCXXCompilerFlag)
# Standard warning flags we should always have
set(CMAKE_CXX_FLAGS_WARN " -Wall")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${CMAKE_CXX_FLAGS_WARN}")
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_WARN}")
# Additional warnings for GCC/Clang
set(CMAKE_CXX_FLAGS_WARN_EXTRA "-Wno-long-long -Wcast-align -Wconversion -Wchar-subscripts -Wextra -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter -fno-common")