cmake_minimum_required(VERSION 3.19) set(KEYMAPFILE keymaps.txt) # Set up the toolchain and other architecture specific details if(ARCH MATCHES atmega328p) message(STATUS "setting up for atmega328p") set(AVF_H_FUSE 0xd9) set(AVR_L_FUSE 0xd2) set(AVR_MCU ${ARCH}) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/generic-gcc-avr.cmake) set (PROJECT_OUT_TARGET ${PROJECT_TARGET}.elf) elseif(ARCH MATCHES atmega2560) message(STATUS "setting up for atmega2560") set(AVF_H_FUSE 0x99) set(AVR_L_FUSE 0xe7) set(AVR_MCU ${ARCH}) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake/generic-gcc-avr.cmake) set (PROJECT_OUT_TARGET ${PROJECT_TARGET}.elf) endif() project("asdf" VERSION 1.6.3 DESCRIPTION "A customizable keyboard matrix controller for retrocomputers" LANGUAGES C) set_property(GLOBAL PROPERTY C_STANDARD 99) set(PROJECT_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src) message("SRC Dir is ${PROJECT_SRC_DIR}") #set(PYTHON_SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scripts) #message("Python scripts Dir is ${PYTHON_SCRIPTS_DIR}") set(DOC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/docs) message("Documentation and web page directory is ${DOC_DIR}") set (PROJECT_TARGET_NAME asdf-v${PROJECT_VERSION}-${ARCH}) set (PROJECT_EXECUTABLE_TARGET_NAME ${PROJECT_TARGET_NAME}) if(ARCH MATCHES test) add_subdirectory(test) else() if((ARCH MATCHES atmega328p) OR (ARCH MATCHES atmega2560)) set (PROJECT_EXECUTABLE_TARGET_NAME ${PROJECT_TARGET_NAME}.elf) function(custom_add_library EXECUTABLE_NAME) add_avr_library(${EXECUTABLE_NAME} ${ARGN}) endfunction(custom_add_library) function(custom_add_executable EXECUTABLE_NAME) add_avr_executable(${EXECUTABLE_NAME} ${ARGN}) endfunction(custom_add_executable) endif() add_subdirectory(src) endif() # generate reStructuredText index file for project version: Note: this may be # rebuilt for each target, but as long as all have the same project version, the # build is idempotent, so no issues. configure_file(${DOC_DIR}/source/_templates/index.rst.in ${DOC_DIR}/source/index.rst)