-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
64 lines (42 loc) · 1.5 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
cmake_minimum_required(VERSION 3.10)
# ===== Main Part =====
#Set the project name
project(PPN LANGUAGES CXX DESCRIPTION "Machine Learning Tool for Regression Problems")
#Enable modern C++
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
# Required dependencies
find_package(MPI REQUIRED)
find_package(BLAS REQUIRED)
find_package(OpenMP REQUIRED)
find_package(Boost REQUIRED COMPONENTS serialization mpi)
# Set compile options for Release build -DNDEBUG
set(FLAGS_RELEASE -std=c++23 -Ofast -march=native -DNDEBUG)
# Set compile options for Debug build
set(FLAGS_DEBUG -std=c++23 -g -O0 -Wextra -Werror -Wpedantic)
# Add compilation options | -Wconversion
if(CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_options(${FLAGS_DEBUG})
else()
add_compile_options(${FLAGS_RELEASE})
endif()
# Add the subdirectory for the source files
add_subdirectory(src)
# Add the executable
add_executable(lngbm main.cpp)
target_link_libraries(lngbm PRIVATE Source_Lib)
# ===== Testing Part =====
#Find Google test package
find_package(GTest REQUIRED)
#To be able to launch tests with ctest
enable_testing()
add_subdirectory(test)
add_executable(tests test/main_Test.cpp)
add_test(myTest tests)
target_include_directories(tests PUBLIC include/ )
target_link_libraries(tests PRIVATE Test_Lib)
target_link_libraries(tests PRIVATE GTest::GTest GTest::Main)
target_link_libraries(tests PRIVATE Source_Lib)
target_link_libraries(tests PRIVATE BLAS::BLAS)
gtest_discover_tests(tests)