-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
46 lines (39 loc) · 1.29 KB
/
CMakeLists.txt
File metadata and controls
46 lines (39 loc) · 1.29 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
cmake_minimum_required(VERSION 3.20.0)
project(cformer VERSION 0.1 LANGUAGES CXX)
set(FILES
cformer.h
tensor.cpp
net.cpp
data.cpp
backtrace.cpp
)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(CF_DEBUG "Enable debug" off)
if(CF_DEBUG)
add_compile_definitions(CF_DEBUG)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ofast -march=native -std=c++11 -g")
find_package(ArrayFire)
option(CF_MNIST "Enable MNIST" off)
option(CF_CHARGEN "Enable CharGen" off)
if(CF_MNIST)
add_executable(cformer_mnist ${FILES} examples/mnist.cpp)
target_link_libraries(cformer_mnist ArrayFire::af -ldw)
elseif(CF_CHARGEN)
add_executable(cformer_chargen ${FILES} examples/chargen.cpp)
target_link_libraries(cformer_chargen ArrayFire::af -ldw)
else()
add_executable(cformer ${FILES} main.cpp)
target_link_libraries(cformer ArrayFire::afcuda -ldw)
endif()
option(CF_TEST "Enable tests" off)
if(CF_TEST)
enable_testing()
find_package(GTest)
add_executable(test_cformer tensor.cpp net.cpp data.cpp backtrace.cpp
tests/tensor.cpp tests/net.cpp tests/data.cpp
)
target_link_libraries(test_cformer ArrayFire::afcpu GTest::gtest_main -ldw)
gtest_discover_tests(test_cformer)
#gtest_discover_tests(test_cformer WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()