mirror of
https://github.com/slsdetectorgroup/aare.git
synced 2025-06-05 12:30:39 +02:00
initial setup
This commit is contained in:
parent
ae71e23dd2
commit
2e466c7a73
76
CMakeLists.txt
Normal file
76
CMakeLists.txt
Normal file
@ -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)
|
0
LICENSE.txt
Normal file
0
LICENSE.txt
Normal file
6
cmake/helpers.cmake
Normal file
6
cmake/helpers.cmake
Normal file
@ -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
src/CMakeLists.txt
Normal file
6
src/CMakeLists.txt
Normal file
@ -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)
|
0
src/file_io/CMakeLists.txt
Normal file
0
src/file_io/CMakeLists.txt
Normal file
8
src/main.cpp
Normal file
8
src/main.cpp
Normal file
@ -0,0 +1,8 @@
|
||||
// Your First C++ Program
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "Hello World!";
|
||||
return 0;
|
||||
}
|
0
src/main.hpp
Normal file
0
src/main.hpp
Normal file
0
src/models/CMakeLists.txt
Normal file
0
src/models/CMakeLists.txt
Normal file
0
src/processing/CMakeLists.txt
Normal file
0
src/processing/CMakeLists.txt
Normal file
Loading…
x
Reference in New Issue
Block a user