From 2e466c7a73ee859a804d0e6d4635d8ceb226fc19 Mon Sep 17 00:00:00 2001 From: Bechir Braham Date: Mon, 12 Feb 2024 18:56:20 +0100 Subject: [PATCH] initial setup --- CMakeLists.txt | 76 +++++++++++++++++++++++++++++++++++ LICENSE.txt | 0 cmake/helpers.cmake | 6 +++ src/CMakeLists.txt | 6 +++ src/file_io/CMakeLists.txt | 0 src/main.cpp | 8 ++++ src/main.hpp | 0 src/models/CMakeLists.txt | 0 src/processing/CMakeLists.txt | 0 9 files changed, 96 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 LICENSE.txt create mode 100644 cmake/helpers.cmake create mode 100644 src/CMakeLists.txt create mode 100644 src/file_io/CMakeLists.txt create mode 100644 src/main.cpp create mode 100644 src/main.hpp create mode 100644 src/models/CMakeLists.txt create mode 100644 src/processing/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..fc2a3dad --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,76 @@ +cmake_minimum_required(VERSION 3.12) +set(CMAKE_CXX_STANDARD 17) +project(aare + VERSION 0.1 + DESCRIPTION "Data processing library for PSI detectors" + HOMEPAGE_URL "https://github.com/slsdetectorgroup/aare" + LANGUAGES C CXX +) +# cmake_policy(SET CMP0135 NEW) + +# include(GNUInstallDirs) + +# include(cmake/helpers.cmake) +# default_build_type("Debug")] + +set(CMAKE_BUILD_TYPE "Debug") + +if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set(OPTIMIZATION_FLAGS "-Og -ggdb3") +else() + set(OPTIMIZATION_FLAGS "-O3") + +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +option(USE_SANITIZER "Sanitizers for debugging" ON) +option(DISABLE_WARNINGS "Disbale compilation warnings" OFF) +# option(USE_TESTS "Unit tests" OFF) +# option(USE_PYTHON "Python bindings" OFF) +# option(TUNE_LOCAL "Tune to exact CPU architecture" OFF) +# option(BUILD_EXAMPLES "Build examples" OFF) +# option(DISABLE_LTO "Disable Link Time Optimizations" OFF) + + +# if(NOT APPLE) +# set(CMAKE_INSTALL_RPATH $ORIGIN) +# endif() + +set(OPTIONAL_FLAGS "") +if(DISABLE_WARNINGS) + set(OPTIONAL_FLAGS "${OPTIONAL_FLAGS} -Wall -Wextra -pedantic -Wno-unused-parameter -Wshadow -Wformat=2 -Wold-style-cast -Wnon-virtual-dtor -Wfloat-equal -Wconversion -Wlogical-op -Wshift-overflow=2 -Woverloaded-virtual -Winline") +endif() + +if(USE_SANITIZER) + set(OPTIONAL_FLAGS "${OPTIONAL_FLAGS} -fdiagnostics-parseable-fixits -fdiagnostics-generate-patch + -fdiagnostics-show-template-tree -fsanitize=address,undefined -fno-sanitize-recover + -D_FORTIFY_SOURCE=2 -fstack-protector") +endif() + +# if(TUNE_LOCAL) +# if(UNIX AND NOT APPLE) +# message(STATUS "unix") +# set(ARCH_FLAGS ) +# target_compile_options(project_options INTERFACE -mtune=native -march=native ) +# elseif(APPLE) +# message(STATUS "compiling for apple") +# target_compile_options(project_options INTERFACE -mtune=apple-m1 -mcpu=apple-m1 ) +# endif() +# # +# endif() + +if +set(CMAKE_CXX_FLAGS "") + + +#Enable LTO if available +include(CheckIPOSupported) +check_ipo_supported(RESULT LTO_AVAILABLE) +if((CMAKE_BUILD_TYPE STREQUAL "Release") AND LTO_AVAILABLE) + message(STATUS "Building with link time optimization") +else() + message(STATUS "Building without link time optimization") +endif() + +add_executable(aare) + +add_subdirectory(src) diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 00000000..e69de29b diff --git a/cmake/helpers.cmake b/cmake/helpers.cmake new file mode 100644 index 00000000..2a6dfb79 --- /dev/null +++ b/cmake/helpers.cmake @@ -0,0 +1,6 @@ +function(default_build_type val) +if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "No build type selected, default to Release") + set(CMAKE_BUILD_TYPE ${val} CACHE STRING "Build type (default ${val})" FORCE) +endif() +endfunction() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 00000000..eb3e5abd --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,6 @@ +add_subdirectory(file_io) +add_subdirectory(models) +add_subdirectory(processing) + +target_include_directories(aare PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +target_sources(aare PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp) \ No newline at end of file diff --git a/src/file_io/CMakeLists.txt b/src/file_io/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 00000000..a4718574 --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,8 @@ +// Your First C++ Program + +#include + +int main() { + std::cout << "Hello World!"; + return 0; +} diff --git a/src/main.hpp b/src/main.hpp new file mode 100644 index 00000000..e69de29b diff --git a/src/models/CMakeLists.txt b/src/models/CMakeLists.txt new file mode 100644 index 00000000..e69de29b diff --git a/src/processing/CMakeLists.txt b/src/processing/CMakeLists.txt new file mode 100644 index 00000000..e69de29b