Commit bcb78465 authored by Patrick McCormick's avatar Patrick McCormick
Browse files

Overhaul of the build system.

parent 2adc4718
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -498,11 +498,11 @@ def err_drv_cannot_read_kitsune_cfg_file : Error<
// used but were not enabled at build time.  
def warn_drv_kokkos_disabled : Warning<
  "kokkos support was not enabled when clang was built.">;
def warn_drv_openmp_rt_target_disabled : Warning<
def warn_drv_openmp_target_disabled : Warning<
  "the openmp runtime ABI transform target was not enabled when clang was built.">;
def warn_drv_qthreads_rt_target_disabled: Warning<
def warn_drv_qthreads_target_disabled: Warning<
  "the qthreads runtime ABI transform target was not enabled when clang was built.">;
def warn_drv_realm_rt_target_disabled: Warning<
def warn_drv_realm_target_disabled: Warning<
  "the realm runtime ABI transform target was not enabled when clang was built.">;
def warn_drv_cudatk_target_disabled: Warning<
  "the cuda toolkit runtime ABI transform target was not enabled when clang was built.">;
+0 −6
Original line number Diff line number Diff line
@@ -444,15 +444,9 @@ KEYWORD(_Cilk_spawn , KEYALL)
KEYWORD(_Cilk_sync                  , KEYALL)
KEYWORD(_Cilk_for                   , KEYALL)
// Kitsune Extensions
#ifdef KITSUNE_MANGLE_PARALLEL_KEYWORDS
KEYWORD(_kitsune_spawn              , KEYKITSUNE)
KEYWORD(_kitsune_sync               , KEYKITSUNE)
KEYWORD(_kitsune_forall             , KEYKITSUNE)
#else
KEYWORD(spawn                       , KEYKITSUNE)
KEYWORD(sync                        , KEYKITSUNE)
KEYWORD(forall                      , KEYKITSUNE)
#endif

// MSVC12.0 / VS2013 Type Traits
TYPE_TRAIT_1(__is_destructible, IsDestructible, KEYMS)
+8 −17
Original line number Diff line number Diff line
@@ -10,26 +10,15 @@
#else
#define KITSUNE_CONFIG_H

/* This should really never happen but just in case some 
 * old code sneaks in... 
 */
/* This shouldn't happen but could help us catch config issues. */
#ifndef CLANG_ENABLE_KITSUNE
#error kitsune config included when CLANG_ENABLE_KITSUNE undefined.
#endif

#cmakedefine01 KITSUNE_MANGLE_PARALEL_KEYWORDS 

#cmakedefine01 KITSUNE_ENABLE_KOKKOS_SUPPORT

#cmakedefine01 KITSUNE_ENABLE_OPENMP_TARGET 
#camkedefine01 KITSUNE_ENABLE_QTHREADS_TARGET
#cmakedefine01 KITSUNE_ENABLE_REALM_TARGET 
#cmakedefine01 KITSUNE_ENABLE_CUDATK_TARGET 
#cmakedefine01 KITSUNE_ENABLE_HIP_TARGET 
#cmakedefine01 KITSUNE_ENABLE_OPENCL_TARGET

/* kitsune-centric cfg file search location */
#cmakedefine KITSUNE_CONFIG_FILE_DIR "${KITSUNE_CONFIG_FILE_DIR}"
#cmakedefine CLANG_CONFIG_FILE_KITSUNE_DIR "${CLANG_CONFIG_FILE_KITSUNE_DIR}"

/* kitsune+tapir ABI/runtime codegen targets */
/* Note: The OpenCilk target is (now) always enabled */
@@ -37,6 +26,8 @@
#cmakedefine01 KITSUNE_ENABLE_QTHREADS_TARGET
#cmakedefine01 KITSUNE_ENABLE_CUDATK_TARGET
#cmakedefine01 KITSUNE_ENABLE_REALM_TARGET
#cmakedefine01 KITSUNE_ENABLE_OPENCL_TARGET
#cmakedefine01 KITSUNE_ENABLE_HIP_TARGET

/* kitsune+tapir default configuration filenames */
#cmakedefine KITSUNE_KOKKOS_CFG_FILENAME "${KITSUNE_KOKKOS_CFG_FILENAME}"
+1 −1
Original line number Diff line number Diff line
@@ -538,7 +538,7 @@ def config_system_dir_EQ : Joined<["--"], "config-system-dir=">, Flags<[DriverOp
  HelpText<"System directory for configuration files">;
def config_user_dir_EQ : Joined<["--"], "config-user-dir=">, Flags<[DriverOption, HelpHidden]>,
  HelpText<"User directory for configuration files">;
def kitsune_config_dir_EQ : Joined<["--"], "kitsune-config-dir=">, Flags<[DriverOption, HelpHidden]>,
def config_kitsune_dir_EQ : Joined<["--"], "config-kitsune-dir=">, Flags<[DriverOption, HelpHidden]>,
  HelpText<"Kitsune directory for configuration files">;
def coverage : Flag<["-", "--"], "coverage">, Flags<[CoreOption]>;
def cpp_precomp : Flag<["-"], "cpp-precomp">, Group<clang_ignored_f_Group>;
+126 −109
Original line number Diff line number Diff line
@@ -7,48 +7,50 @@
#
# Supports configuration of extensions to Clang in support of
# the Kitsune+Tapir feature set.


# Add a kitsune-centric directory to Clang's .cfg (configure) search path.
# For more information see Clang's -config option.  
set(KITSUNE_CONFIG_FILE_DIR 
    ${CMAKE_INSTALL_PREFIX}/share/kitsune
    CACHE 
    STRING "Directory for Kitsune Clang configuration (.cfg) files.")

option(KITSUNE_MANGLE_PARALLEL_KEYWORDS
    "Rename kitsune introduced keywords via the preprocessor (e.g., forall, spawn, sync)." OFF) 
cmake_minimum_required(VERSION 3.14)

option(KITSUNE_ENABLE_KOKKOS_SUPPORT
    "Enable custom recognition and compilation of Kokkos." ON)
    
if (KITSUNE_ENABLE_KOKKOS_SUPPORT)
    set(KITSUNE_KOKKOS_CFG_FILENAME "kokkos.cfg"
        CACHE STRING "Default Kokkos .cfg filename.")
  set(KITSUNE_KOKKOS_CFG_FILENAME 
      "kokkos.cfg" 
      CACHE 
      STRING "Default Kokkos .cfg filename.")
  set(KITSUNE_KOKKOS_CXX_FLAGS
        "-I${Kokkos_ROOT_DIR}/include -I${Kokkos_ROOT_DIR}/include/kokkos"
        CACHE STRING "Additional C++ compile flags needed by Kokkos applications.")
      "-I${CMAKE_INSTALL_PREFIX}/include -I${CMAKE_INSTALL_PREFIX}/include/kokkos"
      CACHE 
      STRING "Additional C++ compile flags needed by Kokkos applications.")
  set(KITSUNE_KOKKOS_LINK_LIBS_FLAGS
        "-L${Kokkos_ROOT_DIR}/lib -lkokkoscore"
        CACHE STRING "Library flags (e.g. -lkokkoscore) needed for Kokkos applications -- NOTE: Use serial config of Kokkos!")
      "-L${CMAKE_INSTALL_PREFIX}/lib -lkokkoscore"
      CACHE 
      STRING "Library flags (e.g. -lkokkoscore) needed by Kokkos applications.")
  set(KITSUNE_KOKKOS_EXTRA_LINK_FLAGS
      "" 
        CACHE STRING "Additional link flags needed for Kokkos applications.")
      CACHE 
      STRING "Additional link flags needed for Kokkos applications.")
  # 
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_KOKKOS_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_KOKKOS_CFG_FILENAME})
endif()


#
# Configuration options for enabling the ABI transform targets
# within Clang.
#

# OpenCilk is always enabled.
set(KITSUNE_OPENCILK_TARGET_ENABLED ON CACHE BOOL "The OpenCilk runtime is always enabled -- this is a doppelganger for use in macros...")
if (NOT KITSUNE_OPENCILK_TARGET_ENABLED)
  message(WARNING "The OpenCilk runtime is always enabled, resetting it to ON.")
  set(KITSUNE_OPENCILK_TARGET_ENABLED ON BOOL FORCE)
endif()
set(KITSUNE_OPENCILK_TARGET_CFG_FILENAME "opencilk.cfg"
    CACHE STRING "Default OpenCilk runtime ABI target Clang .cfg filename.")
set(KITSUNE_OPENCILK_TARGET_EXTRA_LINK_FLAGS
    ""
    CACHE STRING "Additional link flags needed for the OpenCilk runtime ABI target.")
    CACHE 
    STRING "Additional link flags needed for the OpenCilk runtime ABI target.")
# Note that link libraries are hard-coded into Clang source for OpenCilk support.
configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_OPENCILK_TARGET_CFG_FILENAME}.in
    ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_OPENCILK_TARGET_CFG_FILENAME})
@@ -58,13 +60,17 @@ option(KITSUNE_ENABLE_OPENMP_TARGET
if (KITSUNE_ENABLE_OPENMP_TARGET)
  set(KITSUNE_OPENMP_TARGET_CFG_FILENAME
      "openmp.cfg"
        CACHE STRING "Default OpenMP runtime ABI target Clang .cfg filename.")
      CACHE 
      STRING "Default OpenMP runtime ABI target Clang .cfg filename.")
  set(KITSUNE_OPENMP_TARGET_EXTRA_LINK_FLAGS
      "-fopenmp" 
        CACHE STRING "Additional link flags needed for the OpenMP runtime ABI target.")
      CACHE 
      STRING "Additional link flags needed for the OpenMP runtime ABI target.")
  set(KITSUNE_OPENMP_TARGET_LINK_LIBS_FLAGS
      "" 
        CACHE STRING "Link library flags needed for the OpenMP runtime ABI target (e.g., -Lpath -lname).")
      CACHE 
      STRING "Link library flags (-L, -lxxx) for the OpenMP runtime ABI target.")
  #
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_OPENMP_TARGET_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_OPENMP_TARGET_CFG_FILENAME})
endif()
@@ -74,13 +80,17 @@ option(KITSUNE_ENABLE_QTHREADS_TARGET
if (KITSUNE_ENABLE_QTHREADS_TARGET)
  set(KITSUNE_QTHREADS_TARGET_CFG_FILENAME
      "qthreads.cfg"
        CACHE STRING "Default Qthreads runtime ABI target Clang .cfg filename.")
      CACHE 
      STRING "Default Qthreads runtime ABI target Clang .cfg filename.")
  set(KITSUNE_QTHREADS_TARGET_EXTRA_LINK_FLAGS
      ""
        CACHE STRING "Additional link flags needed for Qthreads runtime ABI target.")
      CACHE 
      STRING "Additional link flags needed for Qthreads runtime ABI target.")
  set(KITSUNE_QTHREADS_TARGET_LINK_LIBS_FLAGS
      "-lqthread -lhwloc -lpthread"
        CACHE STRING "Link library flags needed for the Qthreads runtime ABI target (e.g., -Lpath -lname).")
      CACHE 
      STRING "Link library flags (-L, -lxxx) needed for the Qthreads runtime ABI target.")
  #
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_QTHREADS_TARGET_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_QTHREADS_TARGET_CFG_FILENAME})
endif()
@@ -90,13 +100,17 @@ option(KITSUNE_ENABLE_REALM_TARGET
if (KITSUNE_ENABLE_REALM_TARGET)
  set(KITSUNE_REALM_TARGET_CFG_FILENAME
      "realm.cfg"
        CACHE STRING "Default Realm runtime ABI target Clang .cfg filename.")
      CACHE 
      STRING "Default Realm runtime ABI target Clang .cfg filename.")
  set(KITSUNE_REALM_TARGET_EXTRA_LINK_FLAGS
      ""
        CACHE STRING "Additional link flags needed for the Realm runtime ABI target.")
      CACHE 
      STRING "Additional link flags needed for the Realm runtime ABI target.")
  set(KITSUNE_REALM_TARGET_LINK_LIBS_FLAGS
      "-lrealm"
        CACHE STRING "Link library flags needed for the Realm runtime ABI target (e.g., -Lpath -lname).")
      CACHE 
      STRING "Link library flags (-L, -lxx) needed for the Realm runtime ABI target.")
  #
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_REALM_TARGET_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_REALM_TARGET_CFG_FILENAME})
endif()
@@ -106,14 +120,18 @@ option(KITSUNE_ENABLE_CUDATK_TARGET
if (KITSUNE_ENABLE_CUDATK_TARGET)
  find_package(CUDAToolkit 10...11 REQUIRED)  # We may need to be a bit more specifc on minor versions here.
  set(KITSUNE_CUDATK_TARGET_CFG_FILENAME
        "cuda.cfg"
        CACHE STRING "Default CUDA Toolkit runtime ABI target Clang .cfg filename.")
      "cudatk.cfg"
      CACHE 
      STRING "Default CUDA Toolkit runtime ABI target Clang .cfg filename.")
  set(KITSUNE_CUDATK_TARGET_EXTRA_LINK_FLAGS
      ""
        CACHE STRING "Additional link flags needed for the CUDA Toolkit runtime ABI target.")
      CACHE 
      STRING "Additional link flags needed for the CUDA Toolkit runtime ABI target.")
  set(KITSUNE_CUDATK_TARGET_LINK_LIBS_FLAGS
      "-L${CUDAToolkit_LIBRARY_DIR} -lcudart"
        CACHE STRING "Link library flags needed for the CUDA Toolkit runtime ABI target (e.g., -Lpath -lname).")
      CACHE 
      STRING "Link library flags (-L, -lxxx) needed for the CUDA Toolkit runtime ABI target.")
  #
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_CUDATK_TARGET_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_CUDATK_TARGET_CFG_FILENAME})
endif()
@@ -124,13 +142,16 @@ option(KITSUNE_ENABLE_HIP_TARGET
if (KITSUNE_ENABLE_HIP_TARGET)
  set(KITSUNE_HIP_TARGET_CFG_FILENAME
      "hip.cfg"
        CACHE STRING "Default HIP runtime ABI target Clang .cfg filename.")
      CACHE 
      STRING "Default HIP runtime ABI target Clang .cfg filename.")
  set(KITSUNE_HIP_TARGET_EXTRA_LINK_FLAGS
      ""
        CACHE STRING "Additional link flags needed for the HIP runtime ABI target.")
      CACHE 
      STRING "Additional link flags needed for the HIP runtime ABI target.")
  set(KITSUNE_HIP_TARGET_LINK_LIBS_FLAGS
      "-L${-lhip" # I made this up... --PM
        CACHE STRING "Link library flags needed for the for the HIP runtime ABI target (e.g., -Lpath -lname).")
      CACHE STRING "Link library flags (-L, -lxxx) needed for the for the HIP runtime ABI target.")
  #
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_HIP_TARGET_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_HIP_TARGET_CFG_FILENAME})
endif()
@@ -149,6 +170,7 @@ if (KITSUNE_ENABLE_OPENCL_TARGET)
  set(KITSUNE_OPENCL_TARGET_LINK_LIBS_FLAGS
      "-lopencl" # I made this up... --PM
      CACHE STRING "Additional link flags needed for OpenCL runtime ABI target.")
  #
  configure_file(${CLANG_SOURCE_DIR}/kitsune/${KITSUNE_OPENCL_TARGET_CFG_FILENAME}.in
      ${LLVM_BINARY_DIR}/share/kitsune/${KITSUNE_OPENCL_TARGET_CFG_FILENAME})
endif()
@@ -157,12 +179,7 @@ file(GLOB KITSUNE_CLANG_CFG_FILES
    ${LLVM_BINARY_DIR}/share/kitsune/*.cfg)

install(DIRECTORY ${LLVM_BINARY_DIR}/share/kitsune/
    DESTINATION share
  DESTINATION share/kitsune
  COMPONENT install-clang-cfgs
  FILES_MATCHING
  PATTERN "*.cfg")

# ****
# NOTE: We do additional configuration and generation of default .cfg 
# files within the top-level 'kitsune' directory (at the same level as 
# clang, llvm, lld, lldb, etc.)
Loading