Skip to content

Commit

Permalink
✨ Support SOURCES in *_build_demos
Browse files Browse the repository at this point in the history
The SOURCES argument allows developers to add additional SOURCE files to
the demo build for each demo application. Each demo application is still
associated with a single .cpp file, but the startup code can have ass
many files as necessary.

:bug: Fix bug where demos automatically links libhal::lpc40 package
:arrow_up: Bump version to 2.1.1
  • Loading branch information
Khalil Estell authored and kammce committed Oct 1, 2023
1 parent d30b8d1 commit 9002db0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions cmake/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,13 @@ function(libhal_build_demos)
# Parse CMake function arguments
set(options DISABLE_CLANG_TIDY)
set(one_value_args)
set(multi_value_args DEMOS INCLUDES PACKAGES LINK_LIBRARIES LINK_FLAGS)
set(multi_value_args
DEMOS
SOURCES
INCLUDES
PACKAGES
LINK_LIBRARIES
LINK_FLAGS)
cmake_parse_arguments(DEMO_ARGS
"${options}"
"${one_value_args}"
Expand All @@ -213,7 +219,7 @@ function(libhal_build_demos)
find_package(${PACKAGE} REQUIRED)
endforeach()

add_library(startup_code main.cpp)
add_library(startup_code main.cpp ${DEMO_ARGS_SOURCES})
target_compile_features(startup_code PRIVATE cxx_std_20)
target_include_directories(startup_code PUBLIC ${DEMO_ARGS_INCLUDES})
target_compile_options(startup_code PRIVATE
Expand All @@ -223,7 +229,7 @@ function(libhal_build_demos)
-Wextra
-Wshadow
)
target_link_libraries(startup_code PRIVATE libhal::lpc40)
target_link_libraries(startup_code PRIVATE ${DEMO_ARGS_LINK_LIBRARIES})

if(NOT ${DEMO_ARGS_DISABLE_CLANG_TIDY})
_libhal_add_clang_tidy_check(startup_code)
Expand Down
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class libhal_cmake_util_conan(ConanFile):
name = "libhal-cmake-util"
version = "2.1.0"
version = "2.1.1"
license = "Apache-2.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://libhal.github.io/libhal-armcortex"
Expand Down

0 comments on commit 9002db0

Please sign in to comment.