-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
61 lines (48 loc) · 2.65 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
project(rc2017_1v1 C)
cmake_minimum_required(VERSION 3.6)
#set(CMAKE_VERBOSE_MAKEFILE ON)
file(GLOB_RECURSE USER_GOMI_MAIN_SOURCES "UP_TestAll/User_main/main_gomi.c")
file(GLOB_RECURSE USER_HGW_MAIN_SOURCES "UP_TestAll/User_main/main_hgw.c")
file(GLOB_RECURSE USER_CZY_MAIN_SOURCES "UP_TestAll/User_main/main_czy.c")
file(GLOB_RECURSE USER_UTILS_SOURCES "UP_TestAll/Utils/*.c")
file(GLOB_RECURSE UPLIB_SOURCES "UP_TestAll/UpLib/*.c")
add_library(UPLIB ${UPLIB_SOURCES})
add_library(USERLIB ${USER_UTILS_SOURCES} UP_TestAll/Utils/ColorDiscrimination.h UP_TestAll/Utils/ColorDiscrimination.c UP_TestAll/Utils/OnStage.h UP_TestAll/Utils/OnStage.c)
include_directories(UP_TestAll)
include_directories(UpLib)
include_directories(UpLib/STM32Lib)
include_directories(UP_TestAll/Utils)
add_definitions(-DSTM32F303xE)
add_definitions(-DSTM32F10X_HD)
if(${CMAKE_BUILD_TYPE} MATCHES "Debug")
add_definitions(-DDEBUG_ON)
else()
add_definitions(-DDEBUG_OFF)
endif()
#gomi target
add_executable(${PROJECT_NAME}_gomi.elf ${USER_GOMI_MAIN_SOURCES} ${USER_UTILS_SOURCES} ${UPLIB_SOURCES} ${LINKER_SCRIPT})
target_link_libraries(${PROJECT_NAME}_gomi.elf UPLIB USERLIB)
set(HEX_FILE ${PROJECT_NAME}_gomi.hex)
set(BIN_FILE ${PROJECT_NAME}_gomi.bin)
add_custom_command(TARGET ${PROJECT_NAME}_gomi.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}_gomi.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}_gomi.elf> ${BIN_FILE}
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}")
#hgw target
add_executable(${PROJECT_NAME}_hgw.elf ${USER_HGW_MAIN_SOURCES} ${USER_UTILS_SOURCES} ${UPLIB_SOURCES} ${LINKER_SCRIPT})
target_link_libraries(${PROJECT_NAME}_hgw.elf UPLIB USERLIB)
set(HEX_FILE ${PROJECT_NAME}_hgw.hex)
set(BIN_FILE ${PROJECT_NAME}_hgw.bin)
add_custom_command(TARGET ${PROJECT_NAME}_hgw.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}_hgw.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}_hgw.elf> ${BIN_FILE}
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}")
#czy target
add_executable(${PROJECT_NAME}_czy.elf ${USER_CZY_MAIN_SOURCES} ${USER_UTILS_SOURCES} ${UPLIB_SOURCES} ${LINKER_SCRIPT})
target_link_libraries(${PROJECT_NAME}_czy.elf UPLIB USERLIB)
set(HEX_FILE ${PROJECT_NAME}_czy.hex)
set(BIN_FILE ${PROJECT_NAME}_czy.bin)
add_custom_command(TARGET ${PROJECT_NAME}_czy.elf POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -Oihex $<TARGET_FILE:${PROJECT_NAME}_czy.elf> ${HEX_FILE}
COMMAND ${CMAKE_OBJCOPY} -Obinary $<TARGET_FILE:${PROJECT_NAME}_czy.elf> ${BIN_FILE}
COMMENT "Building ${HEX_FILE} \nBuilding ${BIN_FILE}")