From bd5f7c15954cb5a2aa8923ba1c072f63cdf9f74a Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Tue, 10 Dec 2024 17:22:24 +0100 Subject: [PATCH] update --- src/cpp/CMakeLists.txt | 11 +++++++++++ src/cpp/benders/benders_by_batch/CMakeLists.txt | 10 ++++++++++ src/cpp/benders/benders_mpi/CMakeLists.txt | 10 ++++++++++ src/cpp/benders/outer_loop/CMakeLists.txt | 10 ++++++++++ src/cpp/exe/benders/CMakeLists.txt | 10 ++++++++++ src/cpp/exe/full_run/CMakeLists.txt | 10 ++++++++++ src/cpp/exe/outer_loop/CMakeLists.txt | 10 ++++++++++ tests/cpp/CMakeLists.txt | 10 ++++++++++ 8 files changed, 81 insertions(+) diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt index a38b54b29..c708eb74d 100644 --- a/src/cpp/CMakeLists.txt +++ b/src/cpp/CMakeLists.txt @@ -13,6 +13,17 @@ endif() find_package(MPI REQUIRED) if(UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) +# Check if ccache is installed and available in PATH +find_program(CCACHE_EXECUTABLE ccache) + +if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") +else () + message(WARNING "ccache not found. Proceeding without it.") +endif () + endif() # =========================================================================== # Targets diff --git a/src/cpp/benders/benders_by_batch/CMakeLists.txt b/src/cpp/benders/benders_by_batch/CMakeLists.txt index ae5b63f73..be2ebe158 100644 --- a/src/cpp/benders/benders_by_batch/CMakeLists.txt +++ b/src/cpp/benders/benders_by_batch/CMakeLists.txt @@ -14,6 +14,16 @@ message("MPI_C_LIBRARIES ${MPI_C_LIBRARIES}") if (UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) + # Check if ccache is installed and available in PATH + find_program(CCACHE_EXECUTABLE ccache) + + if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + else () + message(WARNING "ccache not found. Proceeding without it.") + endif () endif () add_library(benders_by_batch_core) target_sources(benders_by_batch_core PRIVATE diff --git a/src/cpp/benders/benders_mpi/CMakeLists.txt b/src/cpp/benders/benders_mpi/CMakeLists.txt index 828ac9d12..bac731d48 100644 --- a/src/cpp/benders/benders_mpi/CMakeLists.txt +++ b/src/cpp/benders/benders_mpi/CMakeLists.txt @@ -15,6 +15,16 @@ find_package(MPI REQUIRED) if (UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) + # Check if ccache is installed and available in PATH + find_program(CCACHE_EXECUTABLE ccache) + + if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + else () + message(WARNING "ccache not found. Proceeding without it.") + endif () endif () add_library(benders_mpi_core) diff --git a/src/cpp/benders/outer_loop/CMakeLists.txt b/src/cpp/benders/outer_loop/CMakeLists.txt index 804963ec3..3da78e810 100644 --- a/src/cpp/benders/outer_loop/CMakeLists.txt +++ b/src/cpp/benders/outer_loop/CMakeLists.txt @@ -16,6 +16,16 @@ find_package(MPI REQUIRED) if (UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) + # Check if ccache is installed and available in PATH + find_program(CCACHE_EXECUTABLE ccache) + + if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + else () + message(WARNING "ccache not found. Proceeding without it.") + endif () endif () add_library(outer_loop_lib) diff --git a/src/cpp/exe/benders/CMakeLists.txt b/src/cpp/exe/benders/CMakeLists.txt index dd8989d17..d042c0707 100644 --- a/src/cpp/exe/benders/CMakeLists.txt +++ b/src/cpp/exe/benders/CMakeLists.txt @@ -17,6 +17,16 @@ add_executable (benders find_package(MPI REQUIRED) if(UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) +# Check if ccache is installed and available in PATH +find_program(CCACHE_EXECUTABLE ccache) + +if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") +else () + message(WARNING "ccache not found. Proceeding without it.") +endif () endif() #IF (WIN32) diff --git a/src/cpp/exe/full_run/CMakeLists.txt b/src/cpp/exe/full_run/CMakeLists.txt index 64eb11772..751cdab88 100644 --- a/src/cpp/exe/full_run/CMakeLists.txt +++ b/src/cpp/exe/full_run/CMakeLists.txt @@ -18,6 +18,16 @@ find_package(MPI REQUIRED) if (UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) + # Check if ccache is installed and available in PATH + find_program(CCACHE_EXECUTABLE ccache) + + if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + else () + message(WARNING "ccache not found. Proceeding without it.") + endif () endif () target_link_libraries(full_run diff --git a/src/cpp/exe/outer_loop/CMakeLists.txt b/src/cpp/exe/outer_loop/CMakeLists.txt index 0d73f07db..b83677379 100644 --- a/src/cpp/exe/outer_loop/CMakeLists.txt +++ b/src/cpp/exe/outer_loop/CMakeLists.txt @@ -17,6 +17,16 @@ add_executable(outer_loop find_package(MPI REQUIRED) if (UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) + # Check if ccache is installed and available in PATH + find_program(CCACHE_EXECUTABLE ccache) + + if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + else () + message(WARNING "ccache not found. Proceeding without it.") + endif () endif () target_link_libraries(outer_loop diff --git a/tests/cpp/CMakeLists.txt b/tests/cpp/CMakeLists.txt index 1be9c92fa..d7e0d254f 100644 --- a/tests/cpp/CMakeLists.txt +++ b/tests/cpp/CMakeLists.txt @@ -12,6 +12,16 @@ find_package(MPI REQUIRED) if(UNIX) set(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) +# Check if ccache is installed and available in PATH +find_program(CCACHE_EXECUTABLE ccache) + +if (CCACHE_EXECUTABLE) + message(STATUS "Using ccache as the compiler launcher") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_EXECUTABLE}") +else () + message(WARNING "ccache not found. Proceeding without it.") +endif () endif() # =========================================================================== # Targets