-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cbuild2cmake] Replace blanks in CMake target names derived from buil…
…d contexts (#182)
- Loading branch information
Showing
10 changed files
with
333 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include "RTE_Components.h" | ||
#include CMSIS_device_header | ||
|
||
int main(void) { | ||
return 0; | ||
} |
120 changes: 120 additions & 0 deletions
120
test/data/solutions/blanks/project/project X.AC6 X+ARMCM0 X.cbuild.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
build: | ||
generated-by: csolution version 0.0.0 | ||
solution: ../solution.csolution.yml | ||
project: project X.cproject.yml | ||
context: project X.AC6 X+ARMCM0 X | ||
compiler: AC6 | ||
device: ARMCM0 | ||
device-pack: ARM::[email protected] | ||
processor: | ||
fpu: off | ||
core: Cortex-M0 | ||
packs: | ||
- pack: ARM::[email protected] | ||
path: ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0 | ||
- pack: ARM::[email protected] | ||
path: ${CMSIS_PACK_ROOT}/ARM/Cortex_DFP/1.1.0 | ||
misc: | ||
ASM: | ||
- -masm=auto | ||
C: | ||
- -std=gnu11 | ||
- -Wno-macro-redefined | ||
- -Wno-pragma-pack | ||
- -Wno-parentheses-equality | ||
- -Wno-license-management | ||
CPP: | ||
- -Wno-macro-redefined | ||
- -Wno-pragma-pack | ||
- -Wno-parentheses-equality | ||
- -Wno-license-management | ||
Link: | ||
- --entry=Reset_Handler | ||
- --map | ||
- --info summarysizes | ||
- --summary_stderr | ||
- --diag_suppress=L6314W | ||
define: | ||
- ARMCM0 | ||
- _RTE_ | ||
define-asm: | ||
- ARMCM0 | ||
- _RTE_ | ||
add-path: | ||
- RTE/_AC6_X_ARMCM0_X | ||
- ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Include | ||
- ${CMSIS_PACK_ROOT}/ARM/Cortex_DFP/1.1.0/Device/ARMCM0/Include | ||
add-path-asm: | ||
- RTE/_AC6_X_ARMCM0_X | ||
- ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Include | ||
- ${CMSIS_PACK_ROOT}/ARM/Cortex_DFP/1.1.0/Device/ARMCM0/Include | ||
output-dirs: | ||
intdir: ../tmp | ||
outdir: ../out/project X/ARMCM0 X/AC6 X | ||
rtedir: RTE | ||
output: | ||
- type: elf | ||
file: project X.axf | ||
components: | ||
- component: ARM::CMSIS:[email protected] | ||
condition: ARMv6_7_8-M Device | ||
from-pack: ARM::[email protected] | ||
selected-by: ARM::CMSIS:CORE | ||
files: | ||
- file: ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Include | ||
category: include | ||
version: 6.1.0 | ||
- file: ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Include/tz_context.h | ||
category: header | ||
version: 6.1.0 | ||
- file: ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Template/ARMv8-M/main_s.c | ||
category: sourceC | ||
attr: template | ||
version: 1.1.1 | ||
select: Secure mode 'main' module for ARMv8-M | ||
- file: ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Template/ARMv8-M/tz_context.c | ||
category: sourceC | ||
attr: template | ||
version: 1.1.1 | ||
select: RTOS Context Management (TrustZone for ARMv8-M) | ||
- file: ${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Documentation/html/Core/index.html | ||
category: doc | ||
version: 6.1.0 | ||
- component: ARM::Device:Startup&C [email protected] | ||
condition: ARMCM0 CMSIS | ||
from-pack: ARM::[email protected] | ||
selected-by: ARM::Device:Startup&C Startup | ||
files: | ||
- file: ${CMSIS_PACK_ROOT}/ARM/Cortex_DFP/1.1.0/Device/ARMCM0/Include/ARMCM0.h | ||
category: header | ||
version: 2.2.0 | ||
- file: RTE/Device/ARMCM0/ARMCM0_ac6.sct | ||
category: linkerScript | ||
attr: config | ||
version: 1.0.0 | ||
- file: RTE/Device/ARMCM0/startup_ARMCM0.c | ||
category: sourceC | ||
attr: config | ||
version: 2.0.3 | ||
- file: RTE/Device/ARMCM0/system_ARMCM0.c | ||
category: sourceC | ||
attr: config | ||
version: 1.0.0 | ||
linker: | ||
script: RTE/Device/ARMCM0/ARMCM0_ac6.sct | ||
groups: | ||
- group: Source | ||
files: | ||
- file: main.c | ||
category: sourceC | ||
constructed-files: | ||
- file: RTE/_AC6_X_ARMCM0_X/RTE_Components.h | ||
category: header | ||
licenses: | ||
- license: Apache-2.0 | ||
packs: | ||
- pack: ARM::[email protected] | ||
- pack: ARM::[email protected] | ||
components: | ||
- component: ARM::CMSIS:[email protected] | ||
- component: ARM::Device:Startup&C [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
project: | ||
|
||
components: | ||
- component: ARM::CMSIS:CORE | ||
- component: ARM::Device:Startup&C Startup | ||
|
||
groups: | ||
- group: Source | ||
files: | ||
- file: ./main.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
include(ExternalProject) | ||
|
||
project("solution" NONE) | ||
|
||
# Roots | ||
include("roots.cmake") | ||
|
||
# Context specific lists | ||
set(CONTEXTS | ||
"project_X.AC6_X+ARMCM0_X" | ||
) | ||
list(LENGTH CONTEXTS CONTEXTS_LENGTH) | ||
math(EXPR CONTEXTS_LENGTH "${CONTEXTS_LENGTH}-1") | ||
|
||
set(DIRS | ||
"${CMAKE_CURRENT_SOURCE_DIR}/project X.AC6 X+ARMCM0 X" | ||
) | ||
|
||
set(OUTPUTS_1 | ||
"${SOLUTION_ROOT}/out/project X/ARMCM0 X/AC6 X/project X.axf" | ||
) | ||
|
||
|
||
set(ARGS | ||
"-DSOLUTION_ROOT=${SOLUTION_ROOT}" | ||
"-DCMSIS_PACK_ROOT=${CMSIS_PACK_ROOT}" | ||
"-DCMSIS_COMPILER_ROOT=${CMSIS_COMPILER_ROOT}" | ||
) | ||
|
||
# Iterate over contexts | ||
foreach(INDEX RANGE ${CONTEXTS_LENGTH}) | ||
|
||
math(EXPR N "${INDEX}+1") | ||
list(GET CONTEXTS ${INDEX} CONTEXT) | ||
list(GET DIRS ${INDEX} DIR) | ||
|
||
# Create external project, set configure and build steps | ||
ExternalProject_Add(${CONTEXT} | ||
PREFIX ${DIR} | ||
SOURCE_DIR ${DIR} | ||
BINARY_DIR ${N} | ||
INSTALL_COMMAND "" | ||
TEST_COMMAND "" | ||
CONFIGURE_COMMAND ${CMAKE_COMMAND} -G Ninja -S <SOURCE_DIR> -B <BINARY_DIR> ${ARGS} | ||
BUILD_COMMAND ${CMAKE_COMMAND} -E echo "Building CMake target '${CONTEXT}'" | ||
COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --verbose | ||
BUILD_ALWAYS TRUE | ||
BUILD_BYPRODUCTS ${OUTPUTS_${N}} | ||
USES_TERMINAL_BUILD ON | ||
) | ||
ExternalProject_Add_StepTargets(${CONTEXT} build configure) | ||
|
||
# Debug | ||
message(VERBOSE "Configure Context: ${CMAKE_COMMAND} -G Ninja -S ${DIR} -B ${N}") | ||
|
||
# Database generation step | ||
ExternalProject_Add_Step(${CONTEXT} database | ||
COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target database | ||
EXCLUDE_FROM_MAIN TRUE | ||
ALWAYS TRUE | ||
DEPENDEES configure | ||
) | ||
ExternalProject_Add_StepTargets(${CONTEXT} database) | ||
|
||
endforeach() |
84 changes: 84 additions & 0 deletions
84
test/data/solutions/blanks/ref/project X.AC6 X+ARMCM0 X/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
|
||
# Roots | ||
include("../roots.cmake") | ||
|
||
set(CONTEXT project_X.AC6_X+ARMCM0_X) | ||
set(TARGET ${CONTEXT}) | ||
set(OUT_DIR "${SOLUTION_ROOT}/out/project X/ARMCM0 X/AC6 X") | ||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||
set(LD_SCRIPT "${SOLUTION_ROOT}/project/RTE/Device/ARMCM0/ARMCM0_ac6.sct") | ||
set(LD_SCRIPT_PP ${LD_SCRIPT}) | ||
|
||
# Processor Options | ||
set(CPU Cortex-M0) | ||
set(FPU NO_FPU) | ||
|
||
# Toolchain config map | ||
include("toolchain.cmake") | ||
|
||
# Setup project | ||
project(${CONTEXT} LANGUAGES C) | ||
|
||
# Compilation database | ||
add_custom_target(database | ||
COMMAND ${CMAKE_COMMAND} -E make_directory "${OUT_DIR}" | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/compile_commands.json" "${OUT_DIR}" | ||
) | ||
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}) | ||
|
||
# Setup context | ||
add_executable(${CONTEXT}) | ||
set_target_properties(${CONTEXT} PROPERTIES PREFIX "" SUFFIX ".axf" OUTPUT_NAME "project X") | ||
set_target_properties(${CONTEXT} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OUT_DIR}) | ||
add_library(${CONTEXT}_GLOBAL INTERFACE) | ||
|
||
# Includes | ||
target_include_directories(${CONTEXT} PUBLIC | ||
${SOLUTION_ROOT}/project/RTE/_AC6_X_ARMCM0_X | ||
${CMSIS_PACK_ROOT}/ARM/CMSIS/6.1.0/CMSIS/Core/Include | ||
${CMSIS_PACK_ROOT}/ARM/Cortex_DFP/1.1.0/Device/ARMCM0/Include | ||
) | ||
|
||
# Defines | ||
target_compile_definitions(${CONTEXT} PUBLIC | ||
$<$<COMPILE_LANGUAGE:C,CXX>: | ||
ARMCM0 | ||
_RTE_ | ||
> | ||
) | ||
|
||
# Compile options | ||
target_compile_options(${CONTEXT} PUBLIC | ||
$<$<COMPILE_LANGUAGE:C>: | ||
"SHELL:${CC_CPU}" | ||
"SHELL:${CC_FLAGS}" | ||
"SHELL:-std=gnu11" | ||
"SHELL:-Wno-macro-redefined" | ||
"SHELL:-Wno-pragma-pack" | ||
"SHELL:-Wno-parentheses-equality" | ||
"SHELL:-Wno-license-management" | ||
> | ||
) | ||
|
||
# Add groups and components | ||
include("groups.cmake") | ||
include("components.cmake") | ||
|
||
target_link_libraries(${CONTEXT} PUBLIC | ||
Group_Source | ||
ARM_CMSIS_CORE_6_1_0 | ||
ARM_Device_Startup_C_Startup_2_2_0 | ||
) | ||
|
||
# Linker options | ||
target_link_options(${CONTEXT} PUBLIC | ||
"SHELL:${LD_CPU}" | ||
"SHELL:${_LS}\"${LD_SCRIPT_PP}\"" | ||
"SHELL:--entry=Reset_Handler" | ||
"SHELL:--map" | ||
"SHELL:--info summarysizes" | ||
"SHELL:--summary_stderr" | ||
"SHELL:--diag_suppress=L6314W" | ||
) | ||
set_target_properties(${CONTEXT} PROPERTIES LINK_DEPENDS ${LD_SCRIPT}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
build-idx: | ||
generated-by: csolution version 0.0.0 | ||
cdefault: ${CMSIS_COMPILER_ROOT}/cdefault.yml | ||
csolution: solution.csolution.yml | ||
tmpdir: tmp | ||
cprojects: | ||
- cproject: project/project X.cproject.yml | ||
cbuilds: | ||
- cbuild: project/project X.AC6 X+ARMCM0 X.cbuild.yml | ||
project: project X | ||
configuration: .AC6 X+ARMCM0 X |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
solution: | ||
created-for: [email protected] | ||
cdefault: | ||
|
||
packs: | ||
- pack: ARM::Cortex_DFP | ||
- pack: ARM::CMSIS | ||
|
||
target-types: | ||
- type: ARMCM0 X | ||
device: ARMCM0 | ||
|
||
build-types: | ||
- type: AC6 X | ||
compiler: AC6 | ||
|
||
projects: | ||
- project: ./project/project X.cproject.yml |