-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
52 lines (41 loc) · 1.73 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
cmake_minimum_required(VERSION 3.10)
project(MachineLearningToolbox)
# Set C++ 17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Find Eigen
find_package(Eigen3 REQUIRED)
# Find Google Test
find_package(GTest REQUIRED)
include_directories(${GTEST_INCLUDE_DIRS})
# Specify the include directories
include_directories(include ${EIGEN3_INCLUDE_DIRS})
# Create the static library from the source files
add_library(Mlt STATIC src/SupervisedLearning/Regression/LinearRegression.cpp
src/SupervisedLearning/Regression/PolynomialRegression.cpp)
# Set lib output directory
set_target_properties(Mlt PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
)
# Add the test executable and link
add_executable(MltTest test/testMain.cpp test/SupervisedLearning/Regression/LinearRegressionTest.cpp
test/SupervisedLearning/Regression/PolynomialRegressionTest.cpp)
target_link_libraries(MltTest Mlt ${GTEST_LIBRARIES})
# Set test binary output directory
set_target_properties(MltTest PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
)
# Enable Testing
enable_testing()
# Optional Example Builds
option(BUILD_LINEAR_REGRESSION "Build Linear Regression Example" OFF)
option(BUILD_POLYNOMIAL_REGRESSION "Build Polynomial Regression Example" OFF)
# Optional Builds
if (BUILD_LINEAR_REGRESSION)
add_executable(LinearRegressionExample examples/SupervisedLearning/Regression/LinearRegression.cpp)
target_link_libraries(LinearRegressionExample Mlt)
endif()
if (BUILD_POLYNOMIAL_REGRESSION)
add_executable(PolynomialRegressionExample examples/SupervisedLearning/Regression/PolynomialRegression.cpp)
target_link_libraries(PolynomialRegressionExample Mlt)
endif()