2021-07-17 19:09:04 +00:00
|
|
|
cmake_minimum_required(VERSION 3.13)
|
|
|
|
project(SIMMProgrammer)
|
|
|
|
|
|
|
|
# Create a list of all source files common to all architectures
|
|
|
|
set(SOURCES
|
|
|
|
drivers/mcp23s17.c
|
|
|
|
drivers/parallel_flash.c
|
|
|
|
tests/simm_electrical_test.c
|
|
|
|
main.c
|
|
|
|
simm_programmer.c
|
|
|
|
)
|
|
|
|
|
2021-07-17 21:59:18 +00:00
|
|
|
# Get hardware-specific source files
|
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "avr")
|
|
|
|
include(hal/at90usb646/at90usb646_sources.cmake)
|
|
|
|
else()
|
|
|
|
include(hal/pc/pc_sources.cmake)
|
|
|
|
endif()
|
2021-07-17 19:09:04 +00:00
|
|
|
|
2021-07-17 21:59:18 +00:00
|
|
|
# The actual executable, in ELF format
|
|
|
|
add_executable(SIMMProgrammer.elf ${SOURCES} ${HWSOURCES})
|
2021-07-17 19:09:04 +00:00
|
|
|
|
|
|
|
# Common compiler options
|
|
|
|
target_compile_options(SIMMProgrammer.elf PRIVATE
|
2021-07-25 23:21:36 +00:00
|
|
|
-Wall -Os -ffunction-sections -fdata-sections
|
2021-07-17 19:09:04 +00:00
|
|
|
)
|
2021-07-25 23:21:36 +00:00
|
|
|
set_property(TARGET SIMMProgrammer.elf PROPERTY C_STANDARD 99)
|
2021-07-17 19:09:04 +00:00
|
|
|
|
|
|
|
# Common linker options
|
|
|
|
target_link_options(SIMMProgrammer.elf PRIVATE
|
|
|
|
-Wl,-Map,SIMMProgrammer.map -Wl,--gc-sections
|
|
|
|
)
|
|
|
|
|
2021-07-17 21:59:18 +00:00
|
|
|
# Get hardware-specific options
|
|
|
|
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "avr")
|
|
|
|
include(hal/at90usb646/at90usb646_options.cmake)
|
|
|
|
else()
|
|
|
|
include(hal/pc/pc_options.cmake)
|
|
|
|
endif()
|