Skip to content

Commit 947eb34

Browse files
committed
Revert "[nrf fromlist] scripts: gen_dts_cmake: Support variable target name in dts.cmake"
This reverts commit 61d3a82. Signed-off-by: Grzegorz Swiderski <[email protected]>
1 parent a7af3d3 commit 947eb34

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

cmake/modules/dts.cmake

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ set(GEN_DTS_CMAKE_SCRIPT ${DT_SCRIPTS}/gen_dts_cmake.py)
127127
# The generated information itself, which we include() after
128128
# creating it.
129129
set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake)
130-
# The CMake target to be initialized by including ${DTS_CMAKE}.
131-
set(DEVICETREE_TARGET devicetree_target)
132130

133131
# The location of a file containing known vendor prefixes, relative to
134132
# each element of DTS_ROOT. Users can define their own in their own

scripts/dts/gen_dts_cmake.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
1212
The generated CMake file looks like this:
1313
14-
add_custom_target(${DEVICETREE_TARGET})
15-
set_target_properties(${DEVICETREE_TARGET} PROPERTIES
14+
add_custom_target(devicetree_target)
15+
set_target_properties(devicetree_target PROPERTIES
1616
"DT_PROP|/soc|compatible" "vnd,soc;")
1717
...
1818
19-
It takes an input variable - DEVICETREE_TARGET - and creates a special
20-
CMake target with this name, which will contain various values in the
19+
It defines a special CMake target, and saves various values in the
2120
devicetree as CMake target properties.
2221
2322
Be careful:
@@ -171,13 +170,15 @@ def main():
171170
cmake_comp = f'DT_COMP|{comp}'
172171
cmake_props.append(f'"{cmake_comp}" "{cmake_path}"')
173172

174-
cmake_props = map(
175-
'set_target_properties(${{DEVICETREE_TARGET}} PROPERTIES {})'.format,
176-
cmake_props
177-
)
178173
with open(args.cmake_out, "w", encoding="utf-8") as cmake_file:
179-
print('add_custom_target(${DEVICETREE_TARGET})\n', *cmake_props,
180-
sep='\n', file=cmake_file)
174+
print('add_custom_target(devicetree_target)', file=cmake_file)
175+
print(file=cmake_file)
176+
177+
for prop in cmake_props:
178+
print(
179+
f'set_target_properties(devicetree_target PROPERTIES {prop})',
180+
file=cmake_file
181+
)
181182

182183

183184
if __name__ == "__main__":

0 commit comments

Comments
 (0)