forked from adolfogc/stg-8nn-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (47 loc) · 1.51 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
# Copyright (C) 2018 Adolfo E. García
#
# This file is part of STG-8nn-Scaffold.
#
# STG-8nn-Scaffold is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# STG-8nn-Scaffold is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with STG-8nn-Scaffold. If not, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.5)
project(STG-8nn-Scaffold C ASM) # it's important to select both C and ASM here
##
## Add dependency: STG-8nn Scaffold
##
include(CMakeLists_scaffold.txt)
##
## ELF file
##
set(OUTPUT_NAME firmware)
add_executable(${OUTPUT_NAME}.elf ${SCAFFOLD_SOURCES})
target_include_directories(${OUTPUT_NAME}.elf PRIVATE ${SCAFFOLD_INCLUDE})
##
## Platform specific commands
##
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
###
### ARM
###
### BIN file
add_custom_command(TARGET ${OUTPUT_NAME}.elf
POST_BUILD
COMMAND ${CMAKE_OBJCOPY} -O binary -S ${OUTPUT_NAME}.elf ${OUTPUT_NAME}.bin && (du -h ${OUTPUT_NAME}.bin | cut -f1)
)
else()
###
### x86
###
### Link to PThreads library
target_link_libraries(${OUTPUT_NAME}.elf pthread)
endif()