From a1e1df62e264f9afc3cb6f3eb513c0303ee60986 Mon Sep 17 00:00:00 2001 From: Kevin Huck Date: Thu, 19 Oct 2023 13:08:01 -0400 Subject: [PATCH] Make sure defines are defined correctly. --- CMakeLists.txt | 17 ++++++++++++++++- src/apex/apex.cpp | 32 ++++++++++++++++---------------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ce9bce8..9805701f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -587,6 +587,7 @@ if((DEFINED JEMALLOC_ROOT) OR (APEX_WITH_JEMALLOC)) find_package(JEmalloc) if (JEmalloc_FOUND) include_directories(${JEmalloc_INCLUDE_DIRS}) + add_definitions(-DAPEX_WITH_JEMALLOC) set(LIBS ${LIBS} ${JEmalloc_LIBRARIES}) if (NOT BUILD_STATIC_EXECUTABLES) set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${JEmalloc_LIBRARY_DIR}) @@ -598,6 +599,7 @@ if((DEFINED GPERFTOOLS_ROOT) OR (APEX_WITH_TCMALLOC)) find_package(Tcmalloc REQUIRED) if (Tcmalloc_FOUND) add_definitions(-DAPEX_HAVE_TCMALLOC) + add_definitions(-DAPEX_WITH_TCMALLOC) include_directories(${Tcmalloc_INCLUDE_DIR}) set(LIBS ${LIBS} ${Tcmalloc_LIBRARIES}) if (NOT BUILD_STATIC_EXECUTABLES) @@ -623,6 +625,7 @@ if((DEFINED LM_SENSORS_ROOT) OR (APEX_WITH_LM_SENSORS)) find_package(LM_SENSORS) if (LM_SENSORS_FOUND) include_directories(${LM_SENSORS_INCLUDE_DIRS}) + add_definitions(-DAPEX_WITH_LM_SENSORS) set(LIBS ${LIBS} ${LM_SENSORS_LIBRARIES}) if (NOT BUILD_STATIC_EXECUTABLES) set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${LM_SENSORS_LIBRARY_DIR}) @@ -651,11 +654,13 @@ add_dependencies (project_activeharmony project_gperftools) ################################################################################ if((DEFINED PAPI_ROOT) OR (APEX_WITH_PAPI)) - find_package(PAPI) + find_package(PAPI REQUIRED) if (PAPI_FOUND) message(INFO " Using PAPI include: ${PAPI_INCLUDE_DIRS}") message(INFO " Using PAPI libraries: ${PAPI_LIBRARIES}") include_directories(${PAPI_INCLUDE_DIRS}) + add_definitions(-DAPEX_WITH_PAPI) + add_definitions(-DAPEX_HAVE_PAPI) set(LIBS ${LIBS} ${PAPI_LIBRARIES}) if (NOT BUILD_STATIC_EXECUTABLES) set (CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${PAPI_LIBRARY_DIR}) @@ -679,6 +684,7 @@ if(APEX_WITH_KOKKOS) add_git_submodule(kokkos FALSE) include_directories(${PROJECT_SOURCE_DIR}/kokkos/core/src/impl) endif() + add_definitions(-DAPEX_WITH_KOKKOS) endif() ################################################################################ @@ -857,6 +863,7 @@ if((DEFINED BFD_ROOT) OR (APEX_WITH_BFD) OR (APEX_BUILD_BFD)) find_package(BFD) if (BFD_FOUND) include_directories(${BFD_INCLUDE_DIRS}) + add_definitions(-DAPEX_WITH_BFD) set(LIBS ${LIBS} ${BFD_LIBRARIES}) if (NOT BUILD_STATIC_EXECUTABLES) set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${BFD_LIBRARY_DIR}) @@ -1196,6 +1203,13 @@ function(dump_cmake_variables) endforeach() endfunction() +function(dump_defines) + get_directory_property( DirDefs DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS ) + foreach( d ${DirDefs} ) + message( STATUS "Found Define: " ${d} ) + endforeach() +endfunction() + message(STATUS "----------------------------------------------------------------------") message(STATUS "APEX Variable Report:") message(STATUS "----------------------------------------------------------------------") @@ -1213,6 +1227,7 @@ dump_cmake_variables("^PAPI") dump_cmake_variables("^STARPU") dump_cmake_variables("^PHIPROF") dump_cmake_variables("^HWLOC") +dump_defines() MESSAGE(STATUS "Build type: " ${CMAKE_BUILD_TYPE}) MESSAGE(STATUS "Libraries: " ${LIBS}) MESSAGE(STATUS "Compiler cxx debug flags:" ${CMAKE_CXX_FLAGS_DEBUG}) diff --git a/src/apex/apex.cpp b/src/apex/apex.cpp index 11cf187d..2686e318 100644 --- a/src/apex/apex.cpp +++ b/src/apex/apex.cpp @@ -279,52 +279,52 @@ void apex::_initialize() tmp << "\nOracle Compiler version : " << __SUNPRO_CC; #endif tmp << "\nConfigured features: Pthread"; -#ifdef APEX_WITH_ACTIVEHARMONY +#if defined(APEX_WITH_ACTIVEHARMONY) || defined(APEX_HAVE_ACTIVEHARMONY) tmp << ", AH"; #endif -#ifdef APEX_WITH_BFD +#if defined(APEX_WITH_BFD) || defined(APEX_HAVE_BFD) tmp << ", BFD"; #endif -#ifdef APEX_WITH_CUDA +#if defined(APEX_WITH_CUDA) || defined(APEX_HAVE_CUDA) tmp << ", CUDA"; #endif -#ifdef APEX_WITH_HIP +#if defined(APEX_WITH_HIP) || defined(APEX_HAVE_HIP) tmp << ", HIP"; #endif -#ifdef APEX_WITH_LEVEL0 +#if defined(APEX_WITH_LEVEL0) || defined(APEX_HAVE_LEVEL0) tmp << ", L0"; #endif -#ifdef APEX_WITH_MPI +#if defined(APEX_WITH_MPI) || defined(APEX_HAVE_MPI) tmp << ", MPI"; #endif -#ifdef APEX_WITH_OMPT +#if defined(APEX_WITH_OMPT) || defined(APEX_HAVE_OMPT) tmp << ", OMPT"; #endif -#ifdef APEX_WITH_OTF2 +#if defined(APEX_WITH_OTF2) || defined(APEX_HAVE_OTF2) tmp << ", OTF2"; #endif -#ifdef APEX_WITH_PAPI +#if defined(APEX_WITH_PAPI) || defined(APEX_HAVE_PAPI) tmp << ", PAPI"; #endif -#ifdef APEX_WITH_PLUGINS +#if defined(APEX_WITH_PLUGINS) || defined(APEX_HAVE_PLUGINS) tmp << ", PLUGINS"; #endif -#ifdef APEX_WITH_STARPU +#if defined(APEX_WITH_STARPU) || defined(APEX_HAVE_STARPU) tmp << ", StarPU"; #endif -#ifdef APEX_WITH_PHIPROF +#if defined(APEX_WITH_PHIPROF) || defined(APEX_HAVE_PHIPROF) tmp << ", PhiProf"; #endif -#ifdef APEX_WITH_TCMALLOC +#if defined(APEX_WITH_TCMALLOC) || defined(APEX_HAVE_TCMALLOC) tmp << ", TCMalloc"; #endif -#ifdef APEX_WITH_JEMALLOC +#if defined(APEX_WITH_JEMALLOC) || defined(APEX_HAVE_JEMALLOC) tmp << ", JEMalloc"; #endif -#ifdef APEX_WITH_LM_SENSORS +#if defined(APEX_WITH_LM_SENSORS) || defined(APEX_HAVE_LM_SENSORS) tmp << ", LM Sensors"; #endif -#ifdef APEX_WITH_PERFETTO +#if defined(APEX_WITH_PERFETTO) || defined(APEX_HAVE_PERFETTO) tmp << ", Perfetto"; #endif tmp << "\n";