Skip to content

Commit 64829a3

Browse files
committed
Added option to turn off testing
1 parent 6f6f78f commit 64829a3

2 files changed

Lines changed: 16 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ endif()
1313

1414
message(STATUS "Building in ${CMAKE_BUILD_TYPE} mode")
1515

16+
option(ENABLE_TESTING "Enable C++ and testing features" ON)
17+
1618
enable_testing()
1719

1820
if(NOT DEFINED BLA_VENDOR)
1921
set(BLA_VENDOR OpenBLAS)
2022
endif()
2123
message(STATUS "Using BLAS vendor: ${BLA_VENDOR}")
2224
find_package(BLAS REQUIRED)
23-
find_package(GTest REQUIRED)
25+
26+
if(ENABLE_TESTING)
27+
find_package(GTest REQUIRED)
28+
endif()
29+
2430

2531
file(GLOB_RECURSE SRC_FILES src/*.c EXCLUDE "src/main.c")
2632
file(GLOB_RECURSE TEST_FILES test/*.cpp)
@@ -62,12 +68,14 @@ apply_target(${PROJECT_NAME})
6268
target_link_libraries(${PROJECT_NAME} PRIVATE libcneuron)
6369

6470
# Test executable
65-
add_executable(tests ${TEST_FILES})
66-
apply_target(tests)
67-
target_include_directories(tests PRIVATE ${CMAKE_SOURCE_DIR}/test)
68-
target_link_libraries(tests PRIVATE libcneuron GTest::gtest_main)
71+
if(ENABLE_TESTING)
72+
add_executable(tests ${TEST_FILES})
73+
apply_target(tests)
74+
target_include_directories(tests PRIVATE ${CMAKE_SOURCE_DIR}/test)
75+
target_link_libraries(tests PRIVATE libcneuron GTest::gtest_main)
76+
add_test(NAME tests COMMAND tests)
77+
endif()
6978

70-
add_test(NAME tests COMMAND tests)
7179

7280
message(STATUS "Copying data and input.py to the build directory...")
7381
file(COPY ${CMAKE_SOURCE_DIR}/data ${CMAKE_SOURCE_DIR}/input.py DESTINATION ${CMAKE_BINARY_DIR})
@@ -78,4 +86,5 @@ add_custom_target(run
7886
COMMAND ${CMAKE_COMMAND} -E echo "Building in: ${CMAKE_BUILD_TYPE} mode"
7987
COMMAND ${CMAKE_BINARY_DIR}/${PROJECT_NAME}
8088
DEPENDS ${PROJECT_NAME} tests
89+
$<$<BOOL:${ENABLE_TESTING}>:tests>
8190
)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Ensure that a BLAS (Basic Linear Algebra Subprograms) library is installed. This
77

88
## For optimal performance, compile the project using the following cmake command:
99
```
10-
cmake -S . -B build -DBLA_VENDOR=Intel10_64lp_seq -DCMAKE_BUILD_TYPE=Release -DUSE_THREADING=ON
10+
cmake -S . -B build -DBLA_VENDOR=Intel10_64lp_seq -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=OFF
1111
```
1212
## Benchmark - Highest average recorded
1313
- Intel Core i5 9th Gen: ~150,000 Data/s

0 commit comments

Comments
 (0)