mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2025-02-06 03:40:02 +00:00
1ac90374e3
* Fix various non-GCC warnings (no effect on GCC) * Reduce use of typeof since non GCC compilers may not support it * Introduce PICO_C_COMPILER_IS_GNU, PICO_C_COMPILER_IS_CLANG, PICO_C_COMPILER_IS_IAR to CMake as if (CMAKE_C_COMPILER_ID STREQUAL "xxx") is a bit verbose * Use "unified_asm" macro for all inline asm (it is "volatile __asm" on GNU with a .syntex unified) * Use NOLOAD instead of COPY in linker scripts (arguably more correct anyway) * Use the same style for setting _etext in all 4 linker scripts (to the beginning of .data). Clang aligns .data on a 16 byte boundary. Note ideally we'd add a new symbol __data_source, however that would break backwards compatibility with existing user linker scripts * Use "a" for .stack, .heap sections because clang complains otherwise, and they are explicitly NOLOAD anyway * Avoid duplicating __sev, __wfe, __wfi which Clang sometimes seems to provide as built-ins * Add missing kitchen_sink_blocked_ram binary * Allow build with LLVM Embedded Toolchain Form ARM v 14.0.0 (unsupported atm)
65 lines
2.2 KiB
CMake
65 lines
2.2 KiB
CMake
cmake_minimum_required(VERSION 3.13)
|
|
|
|
# Note: this CMakeLists.txt can be used as a top-level CMakeLists.txt for the SDK itself. For all other uses
|
|
# it is included as a subdirectory via the pico_sdk_init() method provided by pico_sdk_init.cmake
|
|
if (NOT TARGET _pico_sdk_inclusion_marker)
|
|
add_library(_pico_sdk_inclusion_marker INTERFACE)
|
|
# This is a no-op unless we are the top-level CMakeLists.txt
|
|
include(pico_sdk_init.cmake)
|
|
|
|
project(pico_sdk C CXX ASM)
|
|
|
|
string(REGEX MATCH "Clang" PICO_C_COMPILER_IS_CLANG "${CMAKE_C_COMPILER_ID}")
|
|
string(REGEX MATCH "GNU" PICO_C_COMPILER_IS_GNU "${CMAKE_C_COMPILER_ID}")
|
|
string(REGEX MATCH "IAR" PICO_C_COMPILER_IS_IAR "${CMAKE_C_COMPILER_ID}")
|
|
pico_register_common_scope_var(PICO_C_COMPILER_IS_CLANG)
|
|
pico_register_common_scope_var(PICO_C_COMPILER_IS_GNU)
|
|
pico_register_common_scope_var(PICO_C_COMPILER_IS_IAR)
|
|
|
|
message("Build type is ${CMAKE_BUILD_TYPE}")
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
|
if (PICO_DEOPTIMIZED_DEBUG)
|
|
message("Using fully de-optimized debug build (set PICO_DEOPTIMIZED_DEBUG=0 to optimize)")
|
|
else()
|
|
message("Using regular optimized debug build (set PICO_DEOPTIMIZED_DEBUG=1 to de-optimize)")
|
|
endif()
|
|
endif()
|
|
|
|
pico_is_top_level_project(PICO_SDK_TOP_LEVEL_PROJECT)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
|
|
set(PICO_SDK 1 PARENT_SCOPE)
|
|
endif()
|
|
|
|
# allow customization
|
|
add_sub_list_dirs(PICO_SDK_PRE_LIST_DIRS)
|
|
add_sub_list_files(PICO_SDK_PRE_LIST_FILES)
|
|
|
|
add_subdirectory(tools)
|
|
add_subdirectory(src)
|
|
|
|
# allow customization
|
|
add_sub_list_dirs(PICO_SDK_POST_LIST_DIRS)
|
|
add_sub_list_files(PICO_SDK_POST_LIST_FILES)
|
|
|
|
if (PICO_SDK_TOP_LEVEL_PROJECT AND NOT DEFINED PICO_SDK_TESTS_ENABLED)
|
|
set(PICO_SDK_TESTS_ENABLED 1)
|
|
endif()
|
|
if (PICO_SDK_TESTS_ENABLED)
|
|
add_subdirectory(test)
|
|
endif ()
|
|
|
|
set(PICO_SDK_TESTS_ENABLED "${PICO_SDK_TESTS_ENABLED}" CACHE INTERNAL "Enable build of SDK tests")
|
|
|
|
# add docs at the end, as we gather documentation dirs as we go
|
|
add_subdirectory(docs)
|
|
|
|
if (NOT PICO_SDK_TOP_LEVEL_PROJECT)
|
|
pico_promote_common_scope_vars()
|
|
endif()
|
|
endif()
|
|
|