Formatting CMakeLists.txt files and updating gitingore for build directories.
authorandre Ebersold <andre.ebersold@free.fr>
Thu, 16 May 2024 20:02:57 +0000 (22:02 +0200)
committerandre Ebersold <andre.ebersold@free.fr>
Thu, 16 May 2024 20:02:57 +0000 (22:02 +0200)
.gitignore
Application/CMakeLists.txt
Application/DCMotor/CMakeLists.txt
Application/Led0/CMakeLists.txt
Application/PowerSwitch/CMakeLists.txt
Application/ShutterCtrl/CMakeLists.txt
Application/WorkhourMeter/CMakeLists.txt
CMakeLists.txt
HAL/AVR/CMakeLists.txt
HAL/Drivers/CMakeLists.txt

index 5c19d701430f970f59347cd955917386a0a74fae..8c65832c78234f066316c2f8cc8314ceae3e1171 100644 (file)
@@ -1,3 +1,5 @@
 *~
 *.bat~
 *.swp
+Build
+Build*
index b7215e37a3d3bb614e69791e686f52a0fe39252b..34fda20fab20201fc6f6d25e1953b858cd0c0529 100644 (file)
@@ -1,25 +1,25 @@
-SET(APPLIST "")
+set(APPLIST "")
 if(TINYAPP_LED0)
-  LIST(APPEND APPLIST Led0)
+  list(APPEND APPLIST Led0)
 endif()
 if(TINYAPP_DCMOTOR)
-  LIST(APPEND APPLIST DCMotor)
+  list(APPEND APPLIST DCMotor)
 endif()
 if(TINYAPP_SHUTTERCTRL)
-  LIST(APPEND APPLIST ShutterCtrl)
+  list(APPEND APPLIST ShutterCtrl)
 endif()
 if(TINYAPP_POWERSWITCH)
-  LIST(APPEND APPLIST PowerSwitch)
+  list(APPEND APPLIST PowerSwitch)
 endif()
 if(TINYAPP_WORKHOURMETER)
-  LIST(APPEND APPLIST WorkhourMeter)
+  list(APPEND APPLIST WorkhourMeter)
 endif()
 
-OPTION(TINYAPP_LED0          "Build Led application" ON)
-OPTION(TINYAPP_DCMOTOR       "Build DC Motor application" OFF)
-OPTION(TINYAPP_SHUTTERCTRL   "Build Shutter Handler application" ON)
-OPTION(TINYAPP_POWERSWITCH   "Build Powerswitch application" ON)
-OPTION(TINYAPP_WORKHOURMETER "Build WorkHourMeter application" ON)
+option(TINYAPP_LED0 "Build Led application" ON)
+option(TINYAPP_DCMOTOR "Build DC Motor application" OFF)
+option(TINYAPP_SHUTTERCTRL "Build Shutter Handler application" ON)
+option(TINYAPP_POWERSWITCH "Build Powerswitch application" ON)
+option(TINYAPP_WORKHOURMETER "Build WorkHourMeter application" ON)
 
 subdirs(${APPLIST})
-#subdirs(Led0 DCMotor PowerSwitch ShutterCtrl WorkhourMeter)
+# subdirs(Led0 DCMotor PowerSwitch ShutterCtrl WorkhourMeter)
index 2c38bcc53d1859bbc12d2c8b73ed8a298e30c618..63b54cfba6192cd7a113848d7e5b06a3f116e2aa 100644 (file)
@@ -1,45 +1,27 @@
-#####################################################################
+# ##############################################################################
 # simple AVR executable
-#####################################################################
-add_avr_executable(
-   dcmotor
-   main.cpp
-   Led0.cpp
-   DCMotor.cpp
-   MotorHandler.cpp
-   )
-if (AVR_MCU)
-target_link_libraries(
-  dcmotor-${AVR_MCU}.elf
-  avrHAL-${AVR_MCU}
-  avrDrivers-${AVR_MCU}
-  avrComm-${AVR_MCU}
-  avrPtf-${AVR_MCU}
-  avrDCMotorParameters-${AVR_MCU}
-)
-IF (${AVR_MCU} EQUAL "atmega328p")
- SET(AVRPROG arduino)
- SET(AVRPROG_MCU Atmega328p)
-ELSE(${AVR_MCU} EQUAL "atmega328p")
- SET(AVRPROG avr109)
- SET(AVRPROG_MCU m32u4)
-ENDIF(${AVR_MCU} EQUAL "atmega328p")
+# ##############################################################################
+add_avr_executable(dcmotor main.cpp Led0.cpp DCMotor.cpp MotorHandler.cpp)
+if(AVR_MCU)
+  target_link_libraries(
+    dcmotor-${AVR_MCU}.elf avrHAL-${AVR_MCU} avrDrivers-${AVR_MCU}
+    avrComm-${AVR_MCU} avrPtf-${AVR_MCU} avrDCMotorParameters-${AVR_MCU})
+  if(${AVR_MCU} EQUAL "atmega328p")
+    set(AVRPROG arduino)
+    set(AVRPROG_MCU Atmega328p)
+  else(${AVR_MCU} EQUAL "atmega328p")
+    set(AVRPROG avr109)
+    set(AVRPROG_MCU m32u4)
+  endif(${AVR_MCU} EQUAL "atmega328p")
 
 elseif(STM32_MCU)
-target_link_libraries(
-       dcmotor-${STM32_MCU}.elf
-       avrHAL-${STM32_MCU}
-       avrDrivers-${STM32_MCU}
-       avrComm-${STM32_MCU}
-       avrPtf-${STM32_MCU}
-       avrDCMotorParameters-${STM32_MCU}
-)
+  target_link_libraries(
+    dcmotor-${STM32_MCU}.elf avrHAL-${STM32_MCU} avrDrivers-${STM32_MCU}
+    avrComm-${STM32_MCU} avrPtf-${STM32_MCU} avrDCMotorParameters-${STM32_MCU})
 endif()
 
 add_custom_target(
-      flash_dcmotor
-      COMMAND
-      avrdude -c ${AVRPROG} -P ${AVRDUDE_PORT} -p ${AVRPROG_MCU} -b 57600 -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
-      DEPENDS dcmotor-${AVR_MCU}.hex
-    )
-
+  flash_dcmotor
+  COMMAND avrdude -c ${AVRPROG} -P ${AVRDUDE_PORT} -p ${AVRPROG_MCU} -b 57600
+          -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
+  DEPENDS dcmotor-${AVR_MCU}.hex)
index 8da43c8d7109cfcdeccb063eaf0ba0b6fc0b6eaf..34fe492d5ce8c8670296ba78b1224564122016fa 100644 (file)
@@ -1,9 +1,4 @@
-#####################################################################
+# ##############################################################################
 # simple AVR executable
-#####################################################################
-add_avr_executable(
-   toggle-led-cpp
-   main.cpp
-   Led0.cpp
-   )
-
+# ##############################################################################
+add_avr_executable(toggle-led-cpp main.cpp Led0.cpp)
index ee360ec0b82894f5bf2581880ee48662f7ea9dea..cfba4bd943d228adfc979fe8f6258d811dfe04e9 100644 (file)
@@ -1,38 +1,27 @@
-#####################################################################
+# ##############################################################################
 # simple AVR executable
-#####################################################################
-add_avr_executable(
-   powerswitch
-   main.cpp
-   Led0.cpp
-   Switch.cpp
-   PowerswitchHandler.cpp
-   )
+# ##############################################################################
+add_avr_executable(powerswitch main.cpp Led0.cpp Switch.cpp
+                   PowerswitchHandler.cpp)
 
 target_link_libraries(
-  powerswitch-${AVR_MCU}.elf
-  avrHAL-${AVR_MCU}
-  avrDrivers-${AVR_MCU}
-  avrComm-${AVR_MCU}
-  avrPS-Ptf-${AVR_MCU}
-  avrPowerswitchParameters-${AVR_MCU}
-)
+  powerswitch-${AVR_MCU}.elf avrHAL-${AVR_MCU} avrDrivers-${AVR_MCU}
+  avrComm-${AVR_MCU} avrPS-Ptf-${AVR_MCU} avrPowerswitchParameters-${AVR_MCU})
 
-IF ( "${AVR_MCU}" STREQUAL "atmega328p")
SET(AVRPROG arduino)
SET(AVRPROG_MCU Atmega328p)
MESSAGE("AVR_MCU = ${AVR_MCU} Yes atmega")
-ELSE( "${AVR_MCU}" STREQUAL "atmega32u4")
SET(AVRPROG avr109)
SET(AVRPROG_MCU m32u4)
MESSAGE("AVR_MCU = '${AVR_MCU}' if atmega328p not goot at all")
-ENDIF("${AVR_MCU}" STREQUAL "atmega328p")
+if("${AVR_MCU}" STREQUAL "atmega328p")
 set(AVRPROG arduino)
 set(AVRPROG_MCU Atmega328p)
 message("AVR_MCU = ${AVR_MCU} Yes atmega")
+else("${AVR_MCU}" STREQUAL "atmega32u4")
 set(AVRPROG avr109)
 set(AVRPROG_MCU m32u4)
 message("AVR_MCU = '${AVR_MCU}' if atmega328p not goot at all")
+endif("${AVR_MCU}" STREQUAL "atmega328p")
 
 add_custom_target(
-      flash_powerswitch
-      COMMAND
-      # avrdude -c arduino -P ${AVRDUDE_PORT} -p Atmega328p -b 57600 -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
-      avrdude -c ${AVRPROG} -P ${AVRDUDE_PORT} -p ${AVRPROG_MCU} -b 57600 -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/powerswitch-${AVR_MCU}.hex:i
-      DEPENDS powerswitch-${AVR_MCU}.hex
-    )
-
+  flash_powerswitch
+  COMMAND # avrdude -c arduino -P ${AVRDUDE_PORT} -p Atmega328p -b 57600
+          # -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
+          avrdude -c ${AVRPROG} -P ${AVRDUDE_PORT} -p ${AVRPROG_MCU} -b 57600
+          -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/powerswitch-${AVR_MCU}.hex:i
+  DEPENDS powerswitch-${AVR_MCU}.hex)
index 647737edaeb46f70005a2743445b3b0e564c8996..e86333cdefdce12c099d8fb855c120929443978b 100644 (file)
@@ -1,36 +1,25 @@
-#####################################################################
+# ##############################################################################
 # simple AVR executable
-#####################################################################
-add_avr_executable(
-   shutterctrl
-   main.cpp
-   Led0.cpp
-   ShutterHandler.cpp
-   TouchScrHandler.cpp
-   )
+# ##############################################################################
+add_avr_executable(shutterctrl main.cpp Led0.cpp ShutterHandler.cpp
+                   TouchScrHandler.cpp)
 
 target_link_libraries(
-  shutterctrl-${AVR_MCU}.elf
-  avrHAL-${AVR_MCU}
-  avrDrivers-${AVR_MCU}
-  avrComm-${AVR_MCU}
-  avrSC-Ptf-${AVR_MCU}
-  avrShutterCtrlParameters-${AVR_MCU}
-)
+  shutterctrl-${AVR_MCU}.elf avrHAL-${AVR_MCU} avrDrivers-${AVR_MCU}
+  avrComm-${AVR_MCU} avrSC-Ptf-${AVR_MCU} avrShutterCtrlParameters-${AVR_MCU})
 
-IF (${AVR_MCU} EQUAL "atmega328p")
SET(AVRPROG arduino)
SET(AVRPROG_MCU Atmega328p)
-ELSE(${AVR_MCU} EQUAL "atmega328p")
SET(AVRPROG avr109)
SET(AVRPROG_MCU m32u4)
-ENDIF(${AVR_MCU} EQUAL "atmega328p")
+if(${AVR_MCU} EQUAL "atmega328p")
 set(AVRPROG arduino)
 set(AVRPROG_MCU Atmega328p)
+else(${AVR_MCU} EQUAL "atmega328p")
 set(AVRPROG avr109)
 set(AVRPROG_MCU m32u4)
+endif(${AVR_MCU} EQUAL "atmega328p")
 
 add_custom_target(
-      flash_shutter
-      COMMAND
-      # avrdude -c arduino -P ${AVRDUDE_PORT} -p Atmega328p -b 57600 -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
-      avrdude -c ${AVRPROG} -P ${AVRDUDE_PORT} -p ${AVRPROG_MCU} -b 57600 -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
-      DEPENDS dcmotor-${AVR_MCU}.hex
-    )
-
+  flash_shutter
+  COMMAND # avrdude -c arduino -P ${AVRDUDE_PORT} -p Atmega328p -b 57600
+          # -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
+          avrdude -c ${AVRPROG} -P ${AVRDUDE_PORT} -p ${AVRPROG_MCU} -b 57600
+          -Uflash:w:${CMAKE_CURRENT_BINARY_DIR}/dcmotor-${AVR_MCU}.hex:i
+  DEPENDS dcmotor-${AVR_MCU}.hex)
index 87e02bd3d081ade0c3aec7a22727b00fad82e5b8..2dec82220a94325cb81c9545ed2cf4a3f9de54a2 100644 (file)
@@ -1,35 +1,22 @@
-#####################################################################
+# ##############################################################################
 # simple AVR executable
-#####################################################################
-add_avr_executable(
-   workmeter
-   main.cpp
-   Led0.cpp
-   WorkMeterHandler.cpp
-   Scheduler.cpp
-   )
+# ##############################################################################
+add_avr_executable(workmeter main.cpp Led0.cpp WorkMeterHandler.cpp
+                   Scheduler.cpp)
 
-set_target_properties(
-       workmeter-${AVR_MCU}.elf PROPERTIES
-    COMPILE_DEFINITIONS WORKMETER_PARAMETERS
-    )
+set_target_properties(workmeter-${AVR_MCU}.elf PROPERTIES COMPILE_DEFINITIONS
+                                                          WORKMETER_PARAMETERS)
 
 target_link_libraries(
-  workmeter-${AVR_MCU}.elf
-  avrHAL-${AVR_MCU}
-  avrDrivers-${AVR_MCU}
-  avrComm-${AVR_MCU}
-  avrWM-Ptf-${AVR_MCU}
-  avrWorkMeterParameters-${AVR_MCU}
-)
-
-IF ( "${AVR_MCU}" STREQUAL "atmega328p")
- SET(AVRPROG arduino)
- SET(AVRPROG_MCU Atmega328p)
- MESSAGE("AVR_MCU = ${AVR_MCU} Yes atmega")
-ELSE( "${AVR_MCU}" STREQUAL "atmega32u4")
- SET(AVRPROG avr109)
- SET(AVRPROG_MCU m32u4)
- MESSAGE("AVR_MCU = '${AVR_MCU}' if atmega328p not goot at all")
-ENDIF("${AVR_MCU}" STREQUAL "atmega328p")
+  workmeter-${AVR_MCU}.elf avrHAL-${AVR_MCU} avrDrivers-${AVR_MCU}
+  avrComm-${AVR_MCU} avrWM-Ptf-${AVR_MCU} avrWorkMeterParameters-${AVR_MCU})
 
+if("${AVR_MCU}" STREQUAL "atmega328p")
+  set(AVRPROG arduino)
+  set(AVRPROG_MCU Atmega328p)
+  message("AVR_MCU = ${AVR_MCU} Yes atmega")
+else("${AVR_MCU}" STREQUAL "atmega32u4")
+  set(AVRPROG avr109)
+  set(AVRPROG_MCU m32u4)
+  message("AVR_MCU = '${AVR_MCU}' if atmega328p not goot at all")
+endif("${AVR_MCU}" STREQUAL "atmega328p")
index d82cb2cdf0e1e924664567336a907e7148443f34..004f78c16f3187b84cc7b1629765f7a00adbfab5 100644 (file)
@@ -2,47 +2,50 @@ cmake_minimum_required(VERSION 2.8)
 project(tinyapp)
 
 set(OPTSUBDIRS "")
-set(BUILD_TARGET "stm32g030" CACHE STRING "Target [stm32g030, stm32F103, atmega328p,atmega32u4]")
+set(BUILD_TARGET
+    "stm32g030"
+    CACHE STRING "Target [stm32g030, stm32F103, atmega328p,atmega32u4]")
 
 if("${BUILD_TARGET}" STREQUAL "atmega328p")
   include(${CMAKE_CURRENT_SOURCE_DIR}/rules/target-atmega328p.cmake)
-elseif ("${BUILD_TARGET}" STREQUAL "atmega32u4")
+elseif("${BUILD_TARGET}" STREQUAL "atmega32u4")
   include(${CMAKE_CURRENT_SOURCE_DIR}/rules/target-atmega32u4.cmake)
   list(APPEND OPTSUBDIRS Externals/LUFA-210130)
-elseif ("${BUILD_TARGET}" STREQUAL "stm32g030")
+elseif("${BUILD_TARGET}" STREQUAL "stm32g030")
   include(${CMAKE_CURRENT_SOURCE_DIR}/rules/target-stm32g030.cmake)
 else()
   include(${CMAKE_CURRENT_SOURCE_DIR}/rules/target-atmega328p.cmake)
 endif()
 
-if (NOT CMAKE_BUILD_TYPE)
+if(NOT CMAKE_BUILD_TYPE)
   set(CMAKE_BUILD_TYPE "Debug")
 endif(NOT CMAKE_BUILD_TYPE)
 
 set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
 
-SUBDIRS(HAL Application Platform Communication Metadata ${OPTSUBDIRS})
+subdirs(HAL Application Platform Communication Metadata ${OPTSUBDIRS})
 
-INCLUDE_DIRECTORIES("${tinyapp_SOURCE_DIR}")
-INCLUDE_DIRECTORIES("${tinyapp_SOURCE_DIR}/HAL")
-INCLUDE_DIRECTORIES("${tinyapp_BINARY_DIR}")
-INCLUDE_DIRECTORIES("${tinyapp_BINARY_DIR}/Application")
+include_directories("${tinyapp_SOURCE_DIR}")
+include_directories("${tinyapp_SOURCE_DIR}/HAL")
+include_directories("${tinyapp_BINARY_DIR}")
+include_directories("${tinyapp_BINARY_DIR}/Application")
 
+option(TINYAPP_LED0 "Build Led application" ON)
+option(TINYAPP_DCMOTOR "Build DC Motor application" OFF)
+option(TINYAPP_SHUTTERCTRL "Build Shutter Handler application" ON)
+option(TINYAPP_POWERSWITCH "Build Powerswitch application" ON)
 
+if(WIN32)
+  set(AVRDUDE_PORT
+      "COM3"
+      CACHE STRING "Avrdude port to use for flashing")
+endif(WIN32)
 
-OPTION(TINYAPP_LED0        "Build Led application" ON)
-OPTION(TINYAPP_DCMOTOR     "Build DC Motor application" OFF)
-OPTION(TINYAPP_SHUTTERCTRL "Build Shutter Handler application" ON)
-OPTION(TINYAPP_POWERSWITCH "Build Powerswitch application" ON)
+if(LINUX)
+  set(AVRDUDE_PORT
+      "/dev/ttyS3"
+      CACHE STRING "Avrdude port to use for flashing")
+endif(LINUX)
 
-IF (WIN32)
-       SET(AVRDUDE_PORT "COM3" CACHE STRING "Avrdude port to use for flashing")
-ENDIF(WIN32)
-
-IF(LINUX)
-SET(AVRDUDE_PORT "/dev/ttyS3" CACHE STRING "Avrdude port to use for flashing")
-ENDIF(LINUX)
-
-# new way
-#CONFIGURE_FILE(${antcc_SOURCE_DIR}/src/antcc/config.h.cmake
-#      ${antcc_BINARY_DIR}/src/antcc/config.h)
+# new way CONFIGURE_FILE(${antcc_SOURCE_DIR}/src/antcc/config.h.cmake
+# ${antcc_BINARY_DIR}/src/antcc/config.h)
index b8cb2e8cace8a73cc75fb8f21be314ba78c7489e..57022da7b0fc0b44089b9565fe3f98e68fd1f0bf 100644 (file)
@@ -1,6 +1,6 @@
-#####################################################################
+# ##############################################################################
 # simple AVR library
-#####################################################################
+# ##############################################################################
 add_avr_library(
   avrHAL
   AvrTimer0.cpp
@@ -10,6 +10,4 @@ add_avr_library(
   AvrAdc.cpp
   AvrPwm.cpp
   AvrSpi.cpp
-  AvrI2C.cpp
-   )
-
+  AvrI2C.cpp)
index e9cadd1c69f56763b1f962b8c80ddf3a4d3b56f2..b16f1b67f06f2613963412cb0bed14f476d55286 100644 (file)
@@ -1,6 +1,6 @@
-#####################################################################
+# ##############################################################################
 # simple AVR library
-#####################################################################
+# ##############################################################################
 add_avr_library(
   avrDrivers
   NetString.cpp
@@ -10,6 +10,4 @@ add_avr_library(
   LiquidCrystal.cpp
   PN532Interface_I2C.cpp
   PN532.cpp
-  Eeprom24C32_64.cpp
-   )
-
+  Eeprom24C32_64.cpp)