Skip to content

Commit 9127923

Browse files
committed
working header for NN
1 parent adee8be commit 9127923

19 files changed

+26
-143
lines changed

Diff for: CMakeLists.txt

+25-13
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ project(CppMLLibrary VERSION 1.0.0)
44
set(CMAKE_CXX_STANDARD 20)
55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66

7+
# Option to build examples
8+
option(BUILD_EXAMPLES "Build examples" ON)
9+
710
# Source files
811
file(GLOB_RECURSE SOURCES "src/*.cpp")
912

@@ -20,24 +23,33 @@ install(DIRECTORY ml_library_include/ DESTINATION include)
2023
# Enable testing
2124
enable_testing()
2225

23-
# Add tests (if applicable)
24-
enable_testing()
26+
# Add Catch2 for testing
27+
include(FetchContent)
28+
FetchContent_Declare(
29+
Catch2
30+
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
31+
GIT_TAG v2.13.4 # You can adjust to a newer stable version if needed
32+
)
33+
FetchContent_MakeAvailable(Catch2)
2534

26-
# Add tests
35+
# Add tests with Catch2
2736
file(GLOB_RECURSE TEST_SOURCES "tests/**/*.cpp")
2837
foreach(TEST_SOURCE ${TEST_SOURCES})
2938
get_filename_component(TEST_NAME ${TEST_SOURCE} NAME_WE)
3039
add_executable(${TEST_NAME} ${TEST_SOURCE})
31-
target_link_libraries(${TEST_NAME} cpp_ml_library)
32-
target_include_directories(${TEST_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
40+
target_link_libraries(${TEST_NAME} cpp_ml_library Catch2::Catch2)
41+
target_include_directories(${TEST_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/ml_library_include)
3342
add_test(NAME ${TEST_NAME} COMMAND ${TEST_NAME})
3443
endforeach()
3544

36-
# Example executables
37-
file(GLOB_RECURSE EXAMPLE_SOURCES "examples/*.cpp")
38-
foreach(EXAMPLE_SOURCE ${EXAMPLE_SOURCES})
39-
get_filename_component(EXAMPLE_NAME ${EXAMPLE_SOURCE} NAME_WE)
40-
add_executable(${EXAMPLE_NAME} ${EXAMPLE_SOURCE})
41-
target_link_libraries(${EXAMPLE_NAME} cpp_ml_library)
42-
target_include_directories(${EXAMPLE_NAME} PUBLIC ${PROJECT_SOURCE_DIR}/include)
43-
endforeach()
45+
# Add example executables if BUILD_EXAMPLES is ON
46+
if(BUILD_EXAMPLES)
47+
file(GLOB_RECURSE EXAMPLE_SOURCES "examples/*.cpp")
48+
foreach(EXAMPLE_SOURCE ${EXAMPLE_SOURCES})
49+
get_filename_component(EXAMPLE_NAME ${EXAMPLE_SOURCE} NAME_WE)
50+
set(EXAMPLE_TARGET "example_${EXAMPLE_NAME}") # Add a prefix to the executable name
51+
add_executable(${EXAMPLE_TARGET} ${EXAMPLE_SOURCE}) # Use prefixed name for executable
52+
target_link_libraries(${EXAMPLE_TARGET} cpp_ml_library)
53+
target_include_directories(${EXAMPLE_TARGET} PUBLIC ${PROJECT_SOURCE_DIR}/ml_library_include)
54+
endforeach()
55+
endif()

Diff for: cpp-ml-library/x64/Debug/vc143.idb

0 Bytes
Binary file not shown.

Diff for: cpp-ml-library/x64/Debug/vc143.pdb

0 Bytes
Binary file not shown.

Diff for: examples/ann_example.cpp

-7
This file was deleted.

Diff for: examples/apriori_example.cpp

-7
This file was deleted.

Diff for: examples/cnn_example.cpp

-7
This file was deleted.

Diff for: examples/decision_tree_example.cpp

-7
This file was deleted.

Diff for: examples/kmeans_example.cpp

-7
This file was deleted.

Diff for: examples/nn_example.cpp

-36
This file was deleted.

Diff for: examples/random_forest_example.cpp

-7
This file was deleted.

Diff for: src/neural_network/NN.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "ml_library_include/ml/neural_network/NN.h"
1+
#include "ml/neural_network/NN.h"
22

33
#include <cmath>
44
#include <cstdlib>

Diff for: tests/association/AprioriTest.cpp

Whitespace-only changes.

Diff for: tests/clustering/KMeansTest.cpp

Whitespace-only changes.

Diff for: tests/neural_network/ANNTest.cpp

Whitespace-only changes.

Diff for: tests/neural_network/NNTest.cpp

-51
This file was deleted.

Diff for: tests/regression/MultiLinearRegressionTest.cpp

Whitespace-only changes.

Diff for: tests/regression/PolynomialRegressionTest.cpp

Whitespace-only changes.

Diff for: tests/tree/DecisionTreeClassifierTest.cpp

Whitespace-only changes.

Diff for: tests/tree/RandomForestClassifierTest.cpp

Whitespace-only changes.

0 commit comments

Comments
 (0)