Skip to content

Commit

Permalink
initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bechir-Brahem committed Feb 12, 2024
1 parent ae71e23 commit 2e466c7
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 0 deletions.
76 changes: 76 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Empty file added LICENSE.txt
Empty file.
6 changes: 6 additions & 0 deletions cmake/helpers.cmake
Original file line number Diff line number Diff line change
@@ -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()
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Empty file added src/file_io/CMakeLists.txt
Empty file.
8 changes: 8 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Your First C++ Program

#include <iostream>

int main() {
std::cout << "Hello World!";
return 0;
}
Empty file added src/main.hpp
Empty file.
Empty file added src/models/CMakeLists.txt
Empty file.
Empty file added src/processing/CMakeLists.txt
Empty file.

0 comments on commit 2e466c7

Please sign in to comment.