Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore support for avr-libcpp injection #994

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,25 @@ if( "${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}" )
endif( "${PROJECT_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}" )

# configure avr-libcpp
set( AVRLIBCPP_SUPPRESS_SFR_MACROS ON CACHE INTERNAL "" )
option(
PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP
"picolibrary-microchip-megaavr0: use parent project's avr-libcpp"
ON
)

if( NOT ${PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP} )
set( AVRLIBCPP_SUPPRESS_SFR_MACROS ON CACHE INTERNAL "" )
endif( NOT ${PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP} )

if( NOT ${AVRLIBCPP_SUPPRESS_SFR_MACROS} )
message( FATAL_ERROR "AVRLIBCPP_SUPPRESS_SFR_MACROS must be ON" )
endif( NOT ${AVRLIBCPP_SUPPRESS_SFR_MACROS} )

add_subdirectory( avr-libcpp )
if( NOT ${PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP} )
add_subdirectory( avr-libcpp )

link_libraries( avr-libcpp )
link_libraries( avr-libcpp )
endif( NOT ${PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP} )

# configure picolibrary
set( PICOLIBRARY_ENABLE_AUTOMATED_TESTING OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega1608/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega1608" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega1609/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega1609" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega3208/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega3208" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega3209/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega3209" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega4808/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega4808" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega4809/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega4809" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega808/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega808" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
3 changes: 3 additions & 0 deletions configuration/release-atmega809/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega809" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_F_CPU "16000000UL" CACHE INTERNAL "" )
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_MCU "atmega4809" CACHE INTERNAL "" )

# avr-libcpp configuration
set( PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP OFF CACHE INTERNAL "" )

# picolibrary configuration
set( PICOLIBRARY_SUPPRESS_ASSERTION_FAILURE_LOCATION_INFORMATION OFF CACHE INTERNAL "" )
set( PICOLIBRARY_SUPPRESS_HUMAN_READABLE_ERROR_INFORMATION OFF CACHE INTERNAL "" )
Expand Down
7 changes: 7 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ picolibrary-microchip-megaavr0 supports the following project configuration opti
USART clock generator scaling factor (see
[`include/picolibrary/testing/interactive/microchip/megaavr0/log.h`](https://github.com/apcountryman/picolibrary-microchip-megaavr0/blob/main/include/picolibrary/testing/interactive/microchip/megaavr0/log.h)
for more information)
- `PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP` (defaults to `ON`): use
parent project's avr-libcpp

### avr-libcpp Configuration Requirements
If `PICOLIBRARY_MICROCHIP_MEGAAVR0_USE_PARENT_PROJECT_AVRLIBCPP` is `ON`, avr-libcpp must
be configured as follows:
- `AVRLIBCPP_SUPPRESS_SFR_MACROS` must be `ON`

## Development
The repository's Git `pre-commit` hook script is the simplest way to configure, and build
Expand Down
Loading