diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 41bf606..f9e53d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -71,12 +71,12 @@ jobs: - name: Add startup file (if it exists) if: steps.check_files.outputs.files_exists == 'true' run: | - sed -i '6 s/# //' ${{github.workspace}}/project/CMakeLists.txt + sed -i '/KLIB_DIR.*startup.cpp/ s/# //' ${{github.workspace}}/project/CMakeLists.txt - name: Configure CMake # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type - run: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}} -Wno-dev + run: CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -S ${{github.workspace}}/project -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=${{matrix.cpu}} -Wno-dev - name: Build # Build your program with the given configuration @@ -88,12 +88,12 @@ jobs: with: name: ${{matrix.cpu}} path: | - ${{github.workspace}}/build/project/klib.elf - ${{github.workspace}}/build/project/klib.map - ${{github.workspace}}/build/project/klib.lss - ${{github.workspace}}/build/project/klib.memory - ${{github.workspace}}/build/project/klib.hex - ${{github.workspace}}/build/project/klib.bin + ${{github.workspace}}/build/klib.elf + ${{github.workspace}}/build/klib.map + ${{github.workspace}}/build/klib.lss + ${{github.workspace}}/build/klib.memory + ${{github.workspace}}/build/klib.hex + ${{github.workspace}}/build/klib.bin ${{github.workspace}}/targets/chip/${{matrix.cpu}}/${{matrix.cpu}}.h individual-header-build: @@ -154,6 +154,6 @@ jobs: echo "Building for header: $header_file" # Configure and build - CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=lpc1756 -Wno-dev + CC=arm-none-eabi-gcc CXX=arm-none-eabi-g++ cmake -S ${{github.workspace}}/project -B "$BUILD_DIR/$safe_name" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DTARGET_CPU=lpc1756 -Wno-dev cmake --build "$BUILD_DIR/$safe_name" --config ${{env.BUILD_TYPE}} done \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index cdbb20f..6173bbc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,8 @@ -# set minimum version of CMake. -cmake_minimum_required(VERSION 3.22) - # enable the folder property for the whole project set_property(GLOBAL PROPERTY USE_FOLDERS TRUE) -# The Generic system name is used for embedded targets (targets without OS) in -# CMake -set(CMAKE_SYSTEM_NAME Generic) -set(CMAKE_SYSTEM_PROCESSOR ARM) - -# Supress Error when trying to test the compiler -set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -set(BUILD_SHARED_LIBS OFF) - -# set project name and version -project(klib VERSION 0.0.1) +# provide the klib directory for the project +set(KLIB_DIR ${CMAKE_CURRENT_LIST_DIR}) # enable assembly enable_language(ASM) @@ -48,7 +36,7 @@ if (DEFINED TARGET_CPU) message("Building for target: ${TARGET_CPU}") # add the target directory - add_subdirectory(${CMAKE_SOURCE_DIR}/targets/chip/${TARGET_CPU}) + include(${KLIB_DIR}/targets/chip/${TARGET_CPU}/CMakeLists.txt) # check if the user configured the fpu if (DEFINED TARGET_FPU_ENABLED) @@ -74,7 +62,7 @@ else() endif() # add the klib library -add_subdirectory(${CMAKE_SOURCE_DIR}/klib) +include(${KLIB_DIR}/klib/CMakeLists.txt) -# add the project sources -add_subdirectory(${CMAKE_SOURCE_DIR}/project) \ No newline at end of file +# include the linkerscript generator needed to preprocess the linkerscripts +include(${KLIB_DIR}/targets/arm/linkerscript/linkerscript.cmake) \ No newline at end of file diff --git a/klib/CMakeLists.txt b/klib/CMakeLists.txt index 11f7223..116c442 100644 --- a/klib/CMakeLists.txt +++ b/klib/CMakeLists.txt @@ -1,38 +1,38 @@ # set the sources -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/entry/entry.c - ${CMAKE_CURRENT_SOURCE_DIR}/entry/secondary.cpp +set(SOURCES + ${CMAKE_CURRENT_LIST_DIR}/entry/entry.c + ${CMAKE_CURRENT_LIST_DIR}/entry/secondary.cpp ) set(HEADERS_PRIVATE - ${CMAKE_CURRENT_SOURCE_DIR}/comm/streams/stream_base.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/comm/streams/combined_stream.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/comm/streams/istream.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/comm/streams/ostream.hpp + ${CMAKE_CURRENT_LIST_DIR}/comm/streams/stream_base.hpp + ${CMAKE_CURRENT_LIST_DIR}/comm/streams/combined_stream.hpp + ${CMAKE_CURRENT_LIST_DIR}/comm/streams/istream.hpp + ${CMAKE_CURRENT_LIST_DIR}/comm/streams/ostream.hpp ) set(HEADERS_PUBLIC - ${CMAKE_CURRENT_SOURCE_DIR}/irq.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/klib.hpp - ${CMAKE_CURRENT_SOURCE_DIR}/stream.hpp + ${CMAKE_CURRENT_LIST_DIR}/irq.hpp + ${CMAKE_CURRENT_LIST_DIR}/klib.hpp + ${CMAKE_CURRENT_LIST_DIR}/stream.hpp ) # check if we need to add the segger rtt library -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/src/) +if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/comm/segger/src/) message("Segger RTT support enabled") # append the header implementation to the public headers - set(HEADERS_PUBLIC ${HEADERS_PUBLIC} ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/rtt.hpp) - set(HEADERS_PRIVATE ${HEADERS_PUBLIC} ${CMAKE_CURRENT_SOURCE_DIR}/comm/streams/rtt_stream.hpp) + set(HEADERS_PUBLIC ${HEADERS_PUBLIC} ${CMAKE_CURRENT_LIST_DIR}/comm/segger/rtt.hpp) + set(HEADERS_PRIVATE ${HEADERS_PUBLIC} ${CMAKE_CURRENT_LIST_DIR}/comm/streams/rtt_stream.hpp) # add the segger library source files - set(SOURCES ${SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/src/RTT/SEGGER_RTT.c) + set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/comm/segger/src/RTT/SEGGER_RTT.c) # check if we need to include the systemview sources - if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/src/SYSVIEW/) + if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/comm/segger/src/SYSVIEW/) # append the systemview sources - set(SOURCES ${SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/src/SYSVIEW/SEGGER_SYSVIEW.c) - set(SOURCES ${SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/src/SYSVIEW/SEGGER_SYSVIEW_Config_NoOS.c) + set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/comm/segger/src/SYSVIEW/SEGGER_SYSVIEW.c) + set(SOURCES ${SOURCES} ${CMAKE_CURRENT_LIST_DIR}/comm/segger/src/SYSVIEW/SEGGER_SYSVIEW_Config_NoOS.c) endif() else() message("Segger RTT support disabled") @@ -99,7 +99,7 @@ endif() # enabled segger support in the defines to prevent a # include of the segger files -if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/comm/segger/src/) +if (EXISTS ${CMAKE_CURRENT_LIST_DIR}/comm/segger/src/) target_compile_definitions(klib PUBLIC "KLIB_SEGGER_SUPPORT=1") else() target_compile_definitions(klib PUBLIC "KLIB_SEGGER_SUPPORT=0") @@ -111,7 +111,7 @@ endif() # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( klib PUBLIC - "$" - "$" + "$" + "$" "$" ) diff --git a/project/CMakeLists.txt b/project/CMakeLists.txt index 7d8ad36..d6503e3 100644 --- a/project/CMakeLists.txt +++ b/project/CMakeLists.txt @@ -1,12 +1,34 @@ -# include the linkerscript generator needed to preprocess the linkerscripts -include (${CMAKE_SOURCE_DIR}/targets/arm/linkerscript/linkerscript.cmake) +# The Generic system name is used for embedded targets (targets without OS) in +# CMake +set(CMAKE_SYSTEM_NAME Generic) +set(CMAKE_SYSTEM_PROCESSOR ARM) + +# Supress Error when trying to test the compiler +set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) +set(BUILD_SHARED_LIBS OFF) + +# set minimum version of CMake. +cmake_minimum_required(VERSION 3.22) + +# set project name and version +project(klib VERSION 0.0.1) + +# provide the klib directory for the project (repo root, one level up) +set(KLIB_DIR ${CMAKE_CURRENT_LIST_DIR}/..) + +# include klib and all common toolchain + target setup from the klib repo root. +# This configures the build-type flags, includes the target cpu (creating the +# target_cpu / target_cpu_options targets), defines the add_linkerscript() +# helper and builds the klib library target. +# Note: KLIB_DIR needs to point to your klib installation folder. +include(${KLIB_DIR}/CMakeLists.txt) # set the sources set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp # example for including the startup.cpp - # ${CMAKE_SOURCE_DIR}/targets/chip/${TARGET_CPU}/startup.cpp + # ${KLIB_DIR}/targets/chip/${TARGET_CPU}/startup.cpp ) set(HEADERS) @@ -42,6 +64,9 @@ target_link_libraries(klib_project PUBLIC target_cpu) # Libraries to link for all targets target_link_libraries(klib_project PUBLIC m) +# get the linkerscript we should link against +get_property(TARGET_LINKERSCRIPT GLOBAL PROPERTY TARGET_LINKERSCRIPT) + # link to the linkerscript of the target cpu add_linkerscript(klib_project ${TARGET_LINKERSCRIPT} "") diff --git a/targets/arm/linkerscript/linkerscript.cmake b/targets/arm/linkerscript/linkerscript.cmake index 4bf9ea4..da48512 100644 --- a/targets/arm/linkerscript/linkerscript.cmake +++ b/targets/arm/linkerscript/linkerscript.cmake @@ -3,7 +3,7 @@ # macroes, conditionals, etc) function(add_linkerscript target linkerscript options) set(output "${CMAKE_BINARY_DIR}/linkerscript.ld") - set(CURRENT_DIR "${CMAKE_SOURCE_DIR}/targets/arm/linkerscript") + set(CURRENT_DIR "${KLIB_DIR}/targets/arm/linkerscript") # run the preprocessor on the linkerscript add_custom_command( diff --git a/targets/chip/atsam3x8e/CMakeLists.txt b/targets/chip/atsam3x8e/CMakeLists.txt index 4d0dc1b..09c0563 100644 --- a/targets/chip/atsam3x8e/CMakeLists.txt +++ b/targets/chip/atsam3x8e/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the atsam3x8e cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) if (DEFINED TARGET_FPU_ENABLED) message(FATAL_ERROR "Target does not have a FPU") @@ -37,7 +37,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu atsam3x8e target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -63,8 +63,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -80,7 +80,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/atsam4s2b/CMakeLists.txt b/targets/chip/atsam4s2b/CMakeLists.txt index cda80a1..0a669eb 100644 --- a/targets/chip/atsam4s2b/CMakeLists.txt +++ b/targets/chip/atsam4s2b/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the atsam4s2b cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7e-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu atsam4s2b target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m4.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m4.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/lpc1752/CMakeLists.txt b/targets/chip/lpc1752/CMakeLists.txt index 1dec5d4..2ba3fda 100644 --- a/targets/chip/lpc1752/CMakeLists.txt +++ b/targets/chip/lpc1752/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc1752 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc1752 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/lpc1754/CMakeLists.txt b/targets/chip/lpc1754/CMakeLists.txt index 64424a3..7fe01ab 100644 --- a/targets/chip/lpc1754/CMakeLists.txt +++ b/targets/chip/lpc1754/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc1754 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc1754 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/lpc1756/CMakeLists.txt b/targets/chip/lpc1756/CMakeLists.txt index 16a8894..e6306fa 100644 --- a/targets/chip/lpc1756/CMakeLists.txt +++ b/targets/chip/lpc1756/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc1756 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc1756 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/lpc1759/CMakeLists.txt b/targets/chip/lpc1759/CMakeLists.txt index ae0e307..6f1e8b7 100644 --- a/targets/chip/lpc1759/CMakeLists.txt +++ b/targets/chip/lpc1759/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc1759 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc1759 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/lpc1788/CMakeLists.txt b/targets/chip/lpc1788/CMakeLists.txt index fc0ccf6..fcc9b12 100644 --- a/targets/chip/lpc1788/CMakeLists.txt +++ b/targets/chip/lpc1788/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc1788 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -32,7 +32,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc1788 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -58,8 +58,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -75,7 +75,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) diff --git a/targets/chip/lpc55s66/CMakeLists.txt b/targets/chip/lpc55s66/CMakeLists.txt index 7b79d37..45d9ecf 100644 --- a/targets/chip/lpc55s66/CMakeLists.txt +++ b/targets/chip/lpc55s66/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc55s66 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-mcpu=cortex-m33+nodsp") @@ -39,7 +39,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc55s66 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m33.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m33.cpp ) set(HEADERS_PRIVATE @@ -65,8 +65,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -82,7 +82,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/lpc802/CMakeLists.txt b/targets/chip/lpc802/CMakeLists.txt index 4533bd5..4c13f41 100644 --- a/targets/chip/lpc802/CMakeLists.txt +++ b/targets/chip/lpc802/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the lpc802 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv6-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu lpc802 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m0.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m0.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/max32625/CMakeLists.txt b/targets/chip/max32625/CMakeLists.txt index e9cfcc5..0f52e22 100644 --- a/targets/chip/max32625/CMakeLists.txt +++ b/targets/chip/max32625/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the max32625 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7e-m") @@ -41,7 +41,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu max32625 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m4.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m4.cpp ) set(HEADERS_PRIVATE @@ -67,8 +67,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -84,7 +84,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/max32660/CMakeLists.txt b/targets/chip/max32660/CMakeLists.txt index e4f96ba..afe2e99 100644 --- a/targets/chip/max32660/CMakeLists.txt +++ b/targets/chip/max32660/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the max32660 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7e-m") @@ -41,7 +41,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu max32660 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m4.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m4.cpp ) set(HEADERS_PRIVATE @@ -67,8 +67,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -84,7 +84,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/mb9bf566k/CMakeLists.txt b/targets/chip/mb9bf566k/CMakeLists.txt index cada2c9..a3f240f 100644 --- a/targets/chip/mb9bf566k/CMakeLists.txt +++ b/targets/chip/mb9bf566k/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the mb9bf566k cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${KLIB_DIR}/targets/arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7e-m") @@ -41,7 +41,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu mb9bf566k target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m4.cpp + ${KLIB_DIR}/targets/arm/vector_table/cortex-m4.cpp ) set(HEADERS_PRIVATE @@ -67,8 +67,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -84,7 +84,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/rp2350/CMakeLists.txt b/targets/chip/rp2350/CMakeLists.txt index b228878..a201e06 100644 --- a/targets/chip/rp2350/CMakeLists.txt +++ b/targets/chip/rp2350/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the rp2350 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-mcpu=cortex-m33+nodsp") @@ -39,8 +39,8 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu rp2350 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m33.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/metadata.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m33.cpp + ${CMAKE_CURRENT_LIST_DIR}/metadata.cpp ) set(HEADERS_PRIVATE @@ -66,8 +66,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -83,7 +83,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/stm32f103/CMakeLists.txt b/targets/chip/stm32f103/CMakeLists.txt index 604a497..e47e8cc 100644 --- a/targets/chip/stm32f103/CMakeLists.txt +++ b/targets/chip/stm32f103/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the stm32f103 cpu options as a seperate target so the driver layer can link agains klib add_library (target_cpu_options INTERFACE) @@ -8,7 +8,7 @@ add_library (target_cpu_options INTERFACE) add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -32,7 +32,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu stm32f103 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -57,8 +57,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -74,7 +74,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/stm32f407/CMakeLists.txt b/targets/chip/stm32f407/CMakeLists.txt index 2fe5204..0cb915c 100644 --- a/targets/chip/stm32f407/CMakeLists.txt +++ b/targets/chip/stm32f407/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the stm32f407 cpu options as a seperate target so the driver layer can link agains klib add_library (target_cpu_options INTERFACE) @@ -8,7 +8,7 @@ add_library (target_cpu_options INTERFACE) add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-mcpu=cortex-m4") @@ -38,7 +38,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu stm32f407 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m4.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m4.cpp ) set(HEADERS_PRIVATE @@ -63,8 +63,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # other compile options @@ -80,7 +80,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/stm32f469/CMakeLists.txt b/targets/chip/stm32f469/CMakeLists.txt index 1909f95..459a538 100644 --- a/targets/chip/stm32f469/CMakeLists.txt +++ b/targets/chip/stm32f469/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the stm32f469 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7e-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu stm32f469 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m4.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m4.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/stm32h723/CMakeLists.txt b/targets/chip/stm32h723/CMakeLists.txt index 7a20946..dbe2b7d 100644 --- a/targets/chip/stm32h723/CMakeLists.txt +++ b/targets/chip/stm32h723/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the stm32h723 cpu options as a seperate target so the driver layer can link agains klib add_library (target_cpu_options INTERFACE) @@ -8,7 +8,7 @@ add_library (target_cpu_options INTERFACE) add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-mcpu=cortex-m7") @@ -38,7 +38,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu stm32h723 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m7.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m7.cpp ) set(HEADERS_PRIVATE @@ -61,8 +61,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -78,7 +78,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/chip/tmpm373/CMakeLists.txt b/targets/chip/tmpm373/CMakeLists.txt index 2a43a71..9691cae 100644 --- a/targets/chip/tmpm373/CMakeLists.txt +++ b/targets/chip/tmpm373/CMakeLists.txt @@ -1,5 +1,5 @@ # export our linkerscript -set(TARGET_LINKERSCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/linkerscript.ld" PARENT_SCOPE) +set_property(GLOBAL PROPERTY TARGET_LINKERSCRIPT "${CMAKE_CURRENT_LIST_DIR}/linkerscript.ld") # set the tmpm373 cpu options as a seperate target so the driver layer can link agains klib add_library(target_cpu_options INTERFACE) @@ -9,7 +9,7 @@ set_target_properties(target_cpu_options PROPERTIES FOLDER "klib") add_library(${PROJECT_NAME}::target_cpu_options ALIAS target_cpu_options) # include the arm directory for all the cmsis files -target_include_directories(target_cpu_options INTERFACE ${CMAKE_SOURCE_DIR}/targets/arm/) +target_include_directories(target_cpu_options INTERFACE ${CMAKE_CURRENT_LIST_DIR}/../../arm/) # set the cpu options for the compiler target_compile_options(target_cpu_options INTERFACE "-march=armv7-m") @@ -33,7 +33,7 @@ target_compile_options(target_cpu_options INTERFACE "-fno-asynchronous-unwind-ta # cpu tmpm373 target drivers set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/../../arm/vector_table/cortex-m3.cpp + ${CMAKE_CURRENT_LIST_DIR}/../../arm/vector_table/cortex-m3.cpp ) set(HEADERS_PRIVATE @@ -59,8 +59,8 @@ add_library(${PROJECT_NAME}::target_cpu ALIAS target_cpu) target_compile_features(target_cpu PUBLIC cxx_std_20) # set the target_cpu for klib -get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} NAME) -set(TARGET_CPU ${TARGET_CPU_FOLDER} PARENT_SCOPE) +get_filename_component(TARGET_CPU_FOLDER ${CMAKE_CURRENT_LIST_DIR} NAME) +set_property(GLOBAL PROPERTY TARGET_CPU ${TARGET_CPU_FOLDER}) target_compile_definitions(target_cpu PUBLIC "TARGET_CPU=${TARGET_CPU}") # add target specific compile options @@ -76,7 +76,6 @@ target_link_libraries(target_cpu PUBLIC klib) # - header location in project: ${CMAKE_CURRENT_BINARY_DIR}/generated_headers target_include_directories( target_cpu PUBLIC - "$" - "$" + "$" "$" ) \ No newline at end of file diff --git a/targets/core/nxp/lpc178x/system.hpp b/targets/core/nxp/lpc178x/system.hpp index 6912af2..697815e 100644 --- a/targets/core/nxp/lpc178x/system.hpp +++ b/targets/core/nxp/lpc178x/system.hpp @@ -3,6 +3,7 @@ #include #include +#include namespace klib::core::lpc178x::io::system { class crystal { diff --git a/targets/core/nxp/lpc17xx/system.hpp b/targets/core/nxp/lpc17xx/system.hpp index e60b38c..fca6d5f 100644 --- a/targets/core/nxp/lpc17xx/system.hpp +++ b/targets/core/nxp/lpc17xx/system.hpp @@ -2,7 +2,6 @@ #define KLIB_NXP_LPC17XX_SYSTEM_HPP #include -#include namespace klib::core::lpc17xx::io::system { class flash {