-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
129 lines (99 loc) · 3.19 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#[[
SPDX-License-Identifier: MIT
Project CMakeLists.txt
Author : Debayan Sutradhar (@rnayabed)
]]
cmake_minimum_required(VERSION 3.16)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/taurusToolchain.cmake)
set(VERSION 0.1)
project(taurus
VERSION ${VERSION}
LANGUAGES C ASM
DESCRIPTION "SDK For CDAC Vega Processors")
set(HEADERS
include/gpio.h
include/i2c.h
include/qspi.h
include/m25p80_eeprom.h
include/config.h
include/spi.h
include/timer.h
include/uart.h
include/debug_uart.h
include/adc.h
include/interrupt.h
include/pwmc.h
include/encoding.h
include/stdlib.h)
add_library(taurus STATIC
common/crt.S
common/rawfloat.c
common/stdlib.c
${HEADERS}
drivers/uart.c
drivers/debug_uart.c
drivers/gpio.c
drivers/i2c.c
drivers/qspi.c
drivers/spi.c
drivers/timer.c
drivers/interrupt.c
drivers/pwmc.c)
set_target_properties(taurus PROPERTIES
PUBLIC_HEADER "${HEADERS}"
C_STANDARD 17
C_EXTENSIONS ON)
target_include_directories(taurus PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING)
message(WARNING "CMAKE_BUILD_TYPE not specified. Defaulting to '${CMAKE_BUILD_TYPE}'")
endif()
# -Wall -Wextra -Werror -Wpedantic
target_compile_options(taurus PUBLIC
-T${CMAKE_SOURCE_DIR}/common/mbl.lds
-march=${RISCV_ARCH} -mabi=${RISCV_ABI} -mcmodel=${RISCV_CMODEL}
--specs=nosys.specs --specs=nano.specs
$<$<CONFIG:Debug>:-Og -ggdb3>
$<$<CONFIG:Release>:-O3>
$<$<CONFIG:MinSizeRel>:-Os>
$<$<CONFIG:RelWithDebInfo>:-O3 -ggdb3>
)
target_link_options(taurus PUBLIC
-T${CMAKE_SOURCE_DIR}/common/mbl.lds
--specs=nosys.specs --specs=nano.specs
-march=${RISCV_ARCH} -mabi=${RISCV_ABI} -mcmodel=${RISCV_CMODEL}
-Wl,--gc-sections -Wl,-Map=taurus.map
-nostartfiles -fno-builtin-printf -fno-builtin-puts
-fdata-sections -ffunction-sections -fno-builtin-memcmp
$<$<OR:$<CONFIG:Release>,$<CONFIG:MinSizeRelease>,$<STREQUAL:${TAURUS_TARGET_BOARD},ARIES_V2>>:-s>)
install(TARGETS taurus
EXPORT taurus-export
PUBLIC_HEADER DESTINATION include/taurus
ARCHIVE DESTINATION lib)
install(EXPORT taurus-export
FILE taurusTargets.cmake
NAMESPACE taurus::
DESTINATION lib/cmake/taurus)
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/cmake/taurusConfigVersion.cmake
VERSION ${VERSION}
COMPATIBILITY SameMajorVersion)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/taurusConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/taurusConfig.cmake
@ONLY)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/cmake/taurusConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/cmake/taurusConfigVersion.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/taurusToolchain.cmake
${CMAKE_CURRENT_SOURCE_DIR}/cmake/taurusUploader.cmake.in
DESTINATION lib/cmake/taurus)
if(CMAKE_HOST_UNIX)
add_custom_target(uninstall COMMAND
xargs rm -rfv < install_manifest.txt &&
rm -rfv ${CMAKE_INSTALL_PREFIX}/lib/cmake/taurus &&
rm -rfv ${CMAKE_INSTALL_PREFIX}/include/taurus)
endif()