-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (48 loc) · 1.49 KB
/
CMakeLists.txt
File metadata and controls
58 lines (48 loc) · 1.49 KB
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
cmake_minimum_required(VERSION 3.10)
project(basednn C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -g")
# Include directories
include_directories(core/include)
# Source files
set(SOURCES
core/src/tensor.c
core/src/ops.c
core/src/layer.c
core/src/network.c
core/src/optimizer.c
core/src/registry.c
)
# Create library
add_library(basednn ${SOURCES})
target_link_libraries(basednn m)
# Enable testing
enable_testing()
# Unit tests
set(TEST_SOURCES
core/tests/unit/test_tensor.c
core/tests/unit/test_ops.c
core/tests/unit/test_registry.c
core/tests/unit/test_layer.c
core/tests/unit/test_network.c
core/tests/unit/test_optimizer.c
)
# Create individual test executables
foreach(test_src ${TEST_SOURCES})
get_filename_component(test_name ${test_src} NAME_WE)
add_executable(${test_name} ${test_src})
target_link_libraries(${test_name} basednn m)
add_test(NAME ${test_name} COMMAND ${test_name})
endforeach()
# Full tests
add_executable(xor core/tests/full/xor.c)
target_link_libraries(xor basednn m)
add_executable(mnist core/tests/full/mnist.c)
target_link_libraries(mnist basednn m)
# Examples (if they exist)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/examples/custom_tensor_op.c")
add_executable(custom_tensor_op examples/custom_tensor_op.c)
target_link_libraries(custom_tensor_op basednn m)
endif()
# Custom compiler rules to allow relaxed static inline in C99
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-function")