-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
59 lines (51 loc) · 2.09 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
cmake_minimum_required(VERSION 3.10)
# set the project name
project(ddr_umctl)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSTANDALONE -Wall")
# add the executable
add_executable(sparx5_ddr_umctl src/main.c src/pcb135_ddr3_config.c src/pcb134_ddr4_config.c src/sparx5_reset.c src/ddr_umctl.c)
target_include_directories(sparx5_ddr_umctl PUBLIC
"${PROJECT_BINARY_DIR}"
"${PROJECT_SOURCE_DIR}/include"
"${PROJECT_SOURCE_DIR}/include/sparx5"
)
add_dependencies(sparx5_ddr_umctl gen_configs)
set(yaml_config_targets lan966x lan969x_evb_ddr4 lan969x_svb_ddr3 pcb134_ddr4 pcb135_ddr3)
foreach(TRG IN LISTS yaml_config_targets)
add_custom_command(
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen_cfg.rb
${CMAKE_CURRENT_SOURCE_DIR}/scripts/ddr/ddr3.rb
${CMAKE_CURRENT_SOURCE_DIR}/scripts/ddr/ddr4.rb
${CMAKE_CURRENT_SOURCE_DIR}/configs/profiles/${TRG}.yaml
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/output/${TRG}.yaml
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen_cfg.rb -f yaml ${CMAKE_CURRENT_SOURCE_DIR}/configs/profiles/${TRG}.yaml > ${CMAKE_CURRENT_SOURCE_DIR}/output/${TRG}.yaml
)
endforeach()
set(source_config_targets pcb134_ddr4 pcb135_ddr3)
foreach(TRG IN LISTS source_config_targets)
add_custom_command(
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen_cfg.rb
${CMAKE_CURRENT_SOURCE_DIR}/scripts/ddr/ddr3.rb
${CMAKE_CURRENT_SOURCE_DIR}/scripts/ddr/ddr4.rb
${CMAKE_CURRENT_SOURCE_DIR}/configs/profiles/${TRG}.yaml
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/src/${TRG}_config.c
COMMAND
${CMAKE_CURRENT_SOURCE_DIR}/scripts/gen_cfg.rb -f source ${CMAKE_CURRENT_SOURCE_DIR}/configs/profiles/${TRG}.yaml > ${CMAKE_CURRENT_SOURCE_DIR}/src/${TRG}_config.c
)
endforeach()
add_custom_target(
gen_configs ALL
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/output/lan966x.yaml
${CMAKE_CURRENT_SOURCE_DIR}/output/lan969x_evb_ddr4.yaml
${CMAKE_CURRENT_SOURCE_DIR}/output/lan969x_svb_ddr3.yaml
${CMAKE_CURRENT_SOURCE_DIR}/output/pcb134_ddr4.yaml
${CMAKE_CURRENT_SOURCE_DIR}/output/pcb135_ddr3.yaml
${CMAKE_CURRENT_SOURCE_DIR}/src/pcb134_ddr4_config.c
${CMAKE_CURRENT_SOURCE_DIR}/src/pcb135_ddr3_config.c
)