-
Notifications
You must be signed in to change notification settings - Fork 23
/
CMakeLists.txt
79 lines (65 loc) · 1.66 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
cmake_minimum_required(VERSION 3.12)
project (riscv_em)
set(CMAKE_BUILD_TYPE Release)
add_definitions ("-Wall -Werror -Wextra -Wpedantic")
OPTION(RV_ARCH "RISC-V Arch" "64")
if(RV_ARCH STREQUAL "64")
add_compile_definitions(RV64)
endif()
OPTION(RISCV_EM_DEBUG "RISC-V Debug Enable" "1")
if(RISCV_EM_DEBUG STREQUAL "1")
add_compile_definitions(RISCV_EM_DEBUG)
else()
add_compile_definitions(USE_SIMPLE_UART)
endif()
set(SRC_HELPER
src/helpers/fifo.c
src/helpers/file_helper.c
)
set(INC_HELPER
src/helpers
)
set(SRC_CORE
src/core/core.c
src/core/csr/csr.c
src/core/pmp/pmp.c
src/core/trap/trap.c
src/core/mmu/mmu.c
)
set(INC_CORE
src/core
src/core/csr
src/core/pmp
src/core/trap
src/core/mmu
)
set(SRC_PERIPH
src/peripherals/clint/clint.c
src/peripherals/plic/plic.c
src/peripherals/uart/simple_uart.c
src/peripherals/uart/uart_8250.c
)
set(INC_PERIPH
src/peripherals/clint
src/peripherals/plic
src/peripherals/uart
)
set(SRC_SOC
src/soc/riscv_example_soc.c
)
set(INC_SOC
src/soc
)
add_executable(riscv_em ${SRC_HELPER} ${SRC_CORE} ${SRC_PERIPH} ${SRC_SOC} src/main.c)
target_include_directories(riscv_em PUBLIC . ${INC_HELPER} ${INC_CORE} ${INC_PERIPH} ${INC_SOC})
target_compile_options(riscv_em PRIVATE -Wall -Wextra -pedantic -Werror)
target_link_libraries(riscv_em pthread)
install (TARGETS riscv_em
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin)
### Debian Package generation
set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_VERSION "0.1.0")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "https://github.com/franzflasch")
include(CPack)