Unverified Commit 28379e14 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

set using C++11 w/o extensions globally. move KOKKOS only checks to KOKKOS.cmake

parent c83dfd2b
Loading
Loading
Loading
Loading
+2 −9
Original line number Diff line number Diff line
@@ -64,9 +64,10 @@ if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
  set(CMAKE_TUNE_DEFAULT "-ffast-math -march=native")
endif()

# we require C++11
# we require C++11 without extensions
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# GNU compiler specific features for testing
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
@@ -123,10 +124,6 @@ else()
  endif()
  add_executable(lammps ${ALL_SOURCES})
  set_target_properties(lammps PROPERTIES OUTPUT_NAME ${LAMMPS_BINARY})
  if(Kokkos_ENABLE_CUDA)
    # The Kokkos nvcc wrapper does not like -std=gnu++11 and wants -std=c++11
    set_target_properties(lammps PROPERTIES CXX_EXTENSIONS OFF)
  endif()
  install(TARGETS lammps DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()

@@ -261,10 +258,6 @@ if(BUILD_OMP)
    message(FATAL_ERROR "Cannot find the 'omp.h' header file required for full OpenMP support")
  endif()
  target_link_libraries(lammps PRIVATE OpenMP::OpenMP_CXX)
else()
  if(Kokkos_ENABLE_OPENMP)
    message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
  endif()
endif()

if(PKG_MSCG OR PKG_USER-ATC OR PKG_USER-AWPMD OR PKG_USER-QUIP OR PKG_LATTE)
+12 −4
Original line number Diff line number Diff line
########################################################################
# consistency checks and Kokkos options/settings required by LAMMPS
if(Kokkos_ENABLE_CUDA)
  set(Kokkos_ENABLE_CUDA_LAMBDA ON)
endif()
# Adding OpenMP compiler flags without the checks done for
# BUILD_OMP can result in compile failures. Enforce consistency.
if(Kokkos_ENABLE_OPENMP AND NOT BUILD_OMP)
  message(FATAL_ERROR "Must enable BUILD_OMP with Kokkos_ENABLE_OPENMP")
endif()
########################################################################

option(EXTERNAL_KOKKOS "Build against external kokkos library" OFF)
option(DOWNLOAD_KOKKOS "Download the KOKKOS library instead of using the bundled one" OFF)
if(DOWNLOAD_KOKKOS)
@@ -31,10 +43,6 @@ elseif(EXTERNAL_KOKKOS)
else()
  set(LAMMPS_LIB_KOKKOS_SRC_DIR ${LAMMPS_LIB_SOURCE_DIR}/kokkos)
  set(LAMMPS_LIB_KOKKOS_BIN_DIR ${LAMMPS_LIB_BINARY_DIR}/kokkos)
  # enforce using nvcc_wrapper as compiler wrapper
  if(Kokkos_ENABLE_CUDA)
    set(CMAKE_CXX_COMPILER ${LAMMPS_LIB_KOKKOS_SRC_DIR}/bin/nvcc_wrapper CACHE FILEPATH "Path to nvcc wrapper for Kokkos with CUDA" FORCE)
  endif()
  add_subdirectory(${LAMMPS_LIB_KOKKOS_SRC_DIR} ${LAMMPS_LIB_KOKKOS_BIN_DIR})

  set(Kokkos_INCLUDE_DIRS ${LAMMPS_LIB_KOKKOS_SRC_DIR}/core/src