Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.
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
6 changes: 5 additions & 1 deletion cmake/Platform/Other/ArchitectureSupportQuery.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ function(get_unsupported_architectures _arch_list _return_var)
list(FILTER _arch_list EXCLUDE REGEX ${ARDUINO_CMAKE_PLATFORM_ARCHITECTURE})
set(unsupported_arch_list ${_arch_list}) # Just for better readability

if (NOT unsupported_arch_list) # The only supported architecture is our platform's architecture
return() # Return nothing as there are no uspported architectures
endif ()

if (parsed_args_REGEX) # Return in regex format

foreach (arch ${unsupported_arch_list})
# Append every unsupported-architecture and "|" to represent "or" in regex-fomart
# Append an "|" to every unsupported-architecture to represent "or" in regex-fomart
string(APPEND unsupported_archs_regex "${arch}" "|")
endforeach ()

Expand Down
9 changes: 6 additions & 3 deletions cmake/Platform/Targets/PlatformLibraryTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,19 @@ endfunction()
#=============================================================================#
function(_add_platform_library _library_name _board_id)

find_header_files("${ARDUINO_CMAKE_PLATFORM_LIBRARIES_PATH}/${_library_name}/src" lib_headers)
find_source_files("${ARDUINO_CMAKE_PLATFORM_LIBRARIES_PATH}/${_library_name}/src" lib_source_files)
find_library_header_files("${ARDUINO_CMAKE_PLATFORM_LIBRARIES_PATH}/${_library_name}/src"
lib_headers)
find_library_source_files("${ARDUINO_CMAKE_PLATFORM_LIBRARIES_PATH}/${_library_name}/src"
lib_source_files)

set(lib_sources ${lib_headers} ${lib_source_files})

_add_arduino_cmake_library(${_library_name} ${_board_id} "${lib_sources}")

endfunction()

#=============================================================================#
# Links the given platform library target to the given target, be it an executable or another library.
# Links the given platform library target to the given target.
# _target_name - Name of the target to link against.
# _library_name - Name of the library target to create, usually the platform library name.
# _board_id - Board ID associated with the linked Core Lib.
Expand Down
2 changes: 2 additions & 0 deletions examples/3rd-party-library/3rd_party.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#include <Arduino.h>
#include "NeoPixelTest.hpp"
#include "GFXTest.h"
#include "LiquidCrystalTest.hpp"

void setup()
{
testNeoPixel();
testGFX();
testLiquidCrystal();
}

void loop()
Expand Down
6 changes: 5 additions & 1 deletion examples/3rd-party-library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ get_board_id(board_id nano atmega328)

# First, declare and create our executable - It'll use 4 sources
add_arduino_executable(3rd_Party_Arduino_Library ${board_id} 3rd_party.cpp
NeoPixelTest.cpp GFXTest.cpp)
NeoPixelTest.cpp GFXTest.cpp LiquidCrystalTest.cpp)
target_include_directories(3rd_Party_Arduino_Library PRIVATE include)

# Add the "NeoPixel" library manually using the library addition API
Expand All @@ -21,7 +21,11 @@ target_source_directories(adafruit_GFX DIRS libraries/Adafruit-GFX-Library/Fonts
# We can even automatically find a library that doesn't have a properties file!
find_arduino_library(sky_writer Skywriter ${board_id} 3RD_PARTY)

# Libraries that have an inner-dependency on a platform library are also suported!
find_arduino_library(liquid_Crystal LiquidCrystal_I2C ${board_id} 3RD_PARTY)

# Link all libraries to our previously created target
link_arduino_library(3rd_Party_Arduino_Library adafruit_NeoPixel ${board_id})
link_arduino_library(3rd_Party_Arduino_Library adafruit_GFX ${board_id})
link_arduino_library(3rd_Party_Arduino_Library sky_writer ${board_id})
link_arduino_library(3rd_Party_Arduino_Library liquid_Crystal ${board_id})
9 changes: 9 additions & 0 deletions examples/3rd-party-library/LiquidCrystalTest.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#include "LiquidCrystalTest.hpp"

LiquidCrystal_I2C lcd(LCD_ADDRESS, LCD_COLUMNS, LCD_ROWS);

void testLiquidCrystal()
{
lcd.begin(LCD_COLUMNS, LCD_ROWS);
lcd.clear();
}
13 changes: 13 additions & 0 deletions examples/3rd-party-library/include/LiquidCrystalTest.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#ifndef EXAMPLES_LIQUIDCRYSTALTEST_HPP
#define EXAMPLES_LIQUIDCRYSTALTEST_HPP

#include <LiquidCrystal_I2C.h>
#include <Arduino.h>

#define LCD_ADDRESS 0x27
#define LCD_COLUMNS 20
#define LCD_ROWS 4

void testLiquidCrystal();

#endif //EXAMPLES_LIQUIDCRYSTALTEST_HPP
Loading