-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (52 loc) · 1.72 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# To build the build system debug purpuse
# cmake . -B build/
# To build the project for release version
# cmake . -B build/ -DCMAKE_BUILD_TYPE=Release
# To build the project with a local install directory
# cmake . -B build/ -DCMAKE_INSTALL_PREFIX=./install/
# To compile the project:
# `cd build/ && make `
cmake_minimum_required(VERSION 3.5)
project(cnet VERSION 1.0.0
DESCRIPTION "ComplexNet is an artificial neural network framework designed to handle complex-val parameters."
LANGUAGES CXX
)
set(CMAKE_CXX_STANDARD 20)
if(UNIX)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wextra -pedantic -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -ffast-math -march=native")
else()
# Flags for Windows with MSVC
set(CMAKE_CXX_FLAGS_DEBUG "/W3 /Od /Zi /DDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "/O2 /DNDEBUG")
endif()
if(DEFINED CMAKE_BUILD_TYPE AND CMAKE_BUILD_TYPE EQUAL Release)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE})
else()
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG})
endif()
message("-- CXX Compiler Flags: ${CMAKE_CXX_FLAGS}")
include(GNUInstallDirs)
set(APP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cnet)
set(EXAMPLE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/examples)
add_subdirectory(${APP_DIR}/)
# To build the tests
if(NOT DEFINED CMAKE_BUILD_TYPE OR NOT CMAKE_BUILD_TYPE STREQUAL "Release")
enable_testing()
add_subdirectory(${EXAMPLE_DIR}/)
endif()
# To format the code
file(GLOB SOURCES
${APP_DIR}/*.cpp
)
file(GLOB HEADERS
${APP_DIR}/*.hpp
)
set(CLANG_FORMAT "clang-format")
set(FORMAT "format")
add_custom_target(${FORMAT})
add_custom_command(
TARGET ${FORMAT}
COMMAND ${CLANG_FORMAT} -i ${SOURCES} ${HEADERS}
COMMENT "Running clang-format on source files: ${SOURCES} ${HEADERS}"
)