Skip to content

Commit

Permalink
Split CMake example and test targets into multiple CMakeLists.txt
Browse files Browse the repository at this point in the history
  • Loading branch information
NidasioAlberto committed Apr 24, 2024
1 parent 6754320 commit 5371758
Show file tree
Hide file tree
Showing 29 changed files with 882 additions and 149 deletions.
148 changes: 0 additions & 148 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,156 +27,8 @@ cmake_minimum_required(VERSION 3.25)

project(MiosixExamples C CXX ASM)

add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(miosix EXCLUDE_FROM_ALL)
add_subdirectory(miosix/_examples/datalogger/tscpp EXCLUDE_FROM_ALL)

include(miosix/cmake/miosix_link_target.cmake)

#-----------------------------------------------------------------------------#
# Examples #
#-----------------------------------------------------------------------------#

add_executable(main main.cpp)
miosix_link_target(main stm32f407vg_discovery)

add_executable(asm miosix/_examples/asm/main.s)
miosix_link_target(asm stm32f407vg_discovery)

add_executable(atsam4l_lcd miosix/_examples/atsam4l_lcd/main.cpp)
miosix_link_target(atsam4l_lcd atsam4lc2aa_generic)

add_executable(blinking_led miosix/_examples/blinking_led/simple.cpp)
miosix_link_target(blinking_led stm32f429zi_discovery)

add_executable(datalogger
miosix/_examples/datalogger/main.cpp
miosix/_examples/datalogger/Logger.cpp
)
target_link_libraries(datalogger PUBLIC tscpp)
miosix_link_target(datalogger stm32f407vg_discovery)

add_executable(hd44780 miosix/_examples/hd44780/hd44780.cpp)
miosix_link_target(hd44780 stm32f407vg_discovery)

add_executable(ir_decoder miosix/_examples/ir_decoder/ir_decoder.cpp)
miosix_link_target(ir_decoder stm32f407vg_discovery)

add_executable(led_display miosix/_examples/led_display/main.cpp)
miosix_link_target(led_display stm32f100rb_discovery)

add_executable(sad_trombone
miosix/_examples/sad_trombone/main.cpp
miosix/_examples/sad_trombone/player.cpp
miosix/_examples/sad_trombone/adpcm.c
)
miosix_link_target(sad_trombone stm32f407vg_discovery)

add_executable(servo-prompt miosix/_examples/servo/prompt.cpp)
miosix_link_target(servo-prompt stm32f407vg_discovery)

add_executable(servo-sweep miosix/_examples/servo/sweep.cpp)
miosix_link_target(servo-sweep stm32f407vg_discovery)

add_executable(streamwriter miosix/_examples/streamwriter/streamwriter.cpp)
miosix_link_target(streamwriter stm32f407vg_discovery)

add_executable(termios miosix/_examples/termios/main.cpp)
miosix_link_target(termios stm32f407vg_discovery)

add_executable(thread_native miosix/_examples/thread_native/native_thread_example.cpp)
miosix_link_target(thread_native stm32f407vg_discovery)

add_executable(thread_pthread miosix/_examples/thread_pthread/pthread_example.cpp)
miosix_link_target(thread_pthread stm32f407vg_discovery)

#-----------------------------------------------------------------------------#
# Others #
#-----------------------------------------------------------------------------#

add_executable(delay_test miosix/_tools/delay_test/delay_test.cpp)
miosix_link_target(delay_test stm32f407vg_discovery)

add_executable(feedforward_profiling miosix/_tools/feedforward_profiling/test.cpp)
miosix_link_target(feedforward_profiling stm32f407vg_discovery)

add_executable(fs_backend miosix/_tools/fs_backend/backend_benchmark.cpp)
miosix_link_target(fs_backend stm32f407vg_discovery)

add_executable(fs_misc_testcode miosix/_tools/fs_misc_testcode/dirlist.cpp)
miosix_link_target(fs_misc_testcode stm32f407vg_discovery)

# To build this entrypoint remember to:
# - Define WITH_PROCESSES in miosix_settings.h
# - Select a linker script like stm32_1m+192k_rom_processes.ld
# add_executable(processes miosix/_tools/processes/main_processes.cpp)
# target_include_directories(processes PUBLIC miosix/_tools/processes)
# add_custom_command(
# TARGET processes
# PRE_BUILD COMMAND make
# WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/miosix/_tools/processes/process_template
# )
# miosix_link_target(processes stm32f407vg_discovery)

add_executable(ram_test
miosix/_tools/ram_test/main.cpp
miosix/_tools/ram_test/sha1.cpp
)
miosix_link_target(ram_test stm32f407vg_discovery)

# If you want to test the MPU remember to run build.sh in miosix/_tools/testsuite
# add_executable(testsuite miosix/_tools/testsuite/testsuite.cpp)
# miosix_link_target(testsuite stm32f407vg_discovery)

# Build the testsuite for all supported boards to test compilation
set(TESTSUITE_BOARDS
lpc2138_miosix_board
# stm32f072rb_discovery
efm32gg332f1024_wandstem
# stm32f100c8_microboard
# stm32f100c8_vaisala_rs41
# stm32f100cb_tempsensor
# stm32f100cx_generic
# stm32f100rb_discovery
stm32f100rc_solertegiard
# stm32f103c8_breakout
# stm32f103cb_als_mainboard_rev2
# stm32f103cx_generic
stm32f103ve_mp3v2
stm32f103ve_strive_mini
stm32f103ze_redbull_v2
stm32f103ze_evaluation
stm32f205_generic
stm32f205rc_skyward_stormtrooper
stm32f205rg_sony_newman
stm32f207ig_evaluation
stm32f207ze_als_camboard
stm32f207zg_ethboard_v2
stm32f207zg_nucleo
# stm32l151c8_als_mainboard
# atsam4lcc
stm32f303vc_discovery
stm32f401re_nucleo
stm32f401vc_discovery
stm32f407vg_bitsboard
stm32f407vg_discovery
stm32f407vg_thermal_test_chip
stm32f411ce_blackpill
stm32f411re_nucleo
stm32f429zi_oledboard2
stm32f429zi_skyward_anakin
stm32f429zi_skyward_homeone
stm32f429zi_discovery
stm32f469ni_discovery
stm32l4r9zi_sensortile
stm32l476rg_nucleo
stm32f746zg_nucleo
stm32f767zi_nucleo
# stm32f769ni_discovery
stm32h753xi_evaluation
)
foreach(OPT_BOARD ${TESTSUITE_BOARDS})
add_executable(testsuite-${OPT_BOARD} miosix/_tools/testsuite/testsuite.cpp)
miosix_link_target(testsuite-${OPT_BOARD} ${OPT_BOARD})
endforeach()
37 changes: 37 additions & 0 deletions miosix/_examples/asm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.25)

project(Asm C CXX ASM)

# Bypass the ckeck in miosix_settings.h
add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(../.. miosix EXCLUDE_FROM_ALL)
include(../../cmake/miosix_link_target.cmake)

add_executable(asm main.s)
miosix_link_target(asm stm32f407vg_discovery)
37 changes: 37 additions & 0 deletions miosix/_examples/atsam4l_lcd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.25)

project(atsam4lLCD C CXX ASM)

# Bypass the ckeck in miosix_settings.h
add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(../.. miosix EXCLUDE_FROM_ALL)
include(../../cmake/miosix_link_target.cmake)

add_executable(atsam4l_lcd main.cpp)
miosix_link_target(atsam4l_lcd atsam4lc2aa_generic)
37 changes: 37 additions & 0 deletions miosix/_examples/blinking_led/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.25)

project(BlinkingLED C CXX ASM)

# Bypass the ckeck in miosix_settings.h
add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(../.. miosix EXCLUDE_FROM_ALL)
include(../../cmake/miosix_link_target.cmake)

add_executable(blinking_led simple.cpp)
miosix_link_target(blinking_led stm32f429zi_discovery)
39 changes: 39 additions & 0 deletions miosix/_examples/datalogger/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.25)

project(Datalogger C CXX ASM)

# Bypass the ckeck in miosix_settings.h
add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(../.. miosix EXCLUDE_FROM_ALL)
add_subdirectory(tscpp EXCLUDE_FROM_ALL)
include(../../cmake/miosix_link_target.cmake)

add_executable(datalogger main.cpp Logger.cpp)
target_link_libraries(datalogger PUBLIC tscpp)
miosix_link_target(datalogger stm32f407vg_discovery)
37 changes: 37 additions & 0 deletions miosix/_examples/deep_sleep/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.25)

project(DeepSleep C CXX ASM)

# Bypass the ckeck in miosix_settings.h
add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(../.. miosix EXCLUDE_FROM_ALL)
include(../../cmake/miosix_link_target.cmake)

add_executable(deep_sleep main-test.cpp)
miosix_link_target(deep_sleep stm32f407vg_discovery)
37 changes: 37 additions & 0 deletions miosix/_examples/hd44780/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (C) 2024 by Skyward
#
# This program is free software; you can redistribute it and/or
# it under the terms of the GNU General Public License as published
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# As a special exception, if other files instantiate templates or use
# macros or inline functions from this file, or you compile this file
# and link it with other works to produce a work based on this file,
# this file does not by itself cause the resulting work to be covered
# by the GNU General Public License. However the source code for this
# file must still be made available in accordance with the GNU
# Public License. This exception does not invalidate any other
# why a work based on this file might be covered by the GNU General
# Public License.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>

cmake_minimum_required(VERSION 3.25)

project(HD44780 C CXX ASM)

# Bypass the ckeck in miosix_settings.h
add_compile_definitions($<$<COMPILE_LANGUAGE:C,CXX>:PARSING_FROM_IDE>)

add_subdirectory(../.. miosix EXCLUDE_FROM_ALL)
include(../../cmake/miosix_link_target.cmake)

add_executable(hd44780 hd44780.cpp)
miosix_link_target(hd44780 stm32f407vg_discovery)
Loading

0 comments on commit 5371758

Please sign in to comment.