Skip to content

Commit

Permalink
Make sure defines are defined correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Feb 7, 2024
1 parent fa89f87 commit a1e1df6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 17 deletions.
17 changes: 16 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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)
Expand All @@ -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})
Expand Down Expand Up @@ -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})
Expand All @@ -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()

################################################################################
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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 "----------------------------------------------------------------------")
Expand All @@ -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})
Expand Down
32 changes: 16 additions & 16 deletions src/apex/apex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit a1e1df6

Please sign in to comment.