Skip to content

Commit 7647a2c

Browse files
authored
Merge pull request #14244 from 0xc0170/cmake-refactor-analog-devices
Analog Devices: refactor CMake targets
2 parents da34eec + a922ed1 commit 7647a2c

File tree

7 files changed

+62
-52
lines changed

7 files changed

+62
-52
lines changed
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if("ADUCM302X" IN_LIST MBED_TARGET_LABELS)
5-
add_subdirectory(TARGET_ADUCM302X)
6-
elseif("ADUCM4X50" IN_LIST MBED_TARGET_LABELS)
7-
add_subdirectory(TARGET_ADUCM4X50)
8-
endif()
4+
add_subdirectory(TARGET_ADUCM302X EXCLUDE_FROM_ALL)
5+
add_subdirectory(TARGET_ADUCM4X50 EXCLUDE_FROM_ALL)
96

10-
target_include_directories(mbed-core
7+
add_library(mbed-analog-devices INTERFACE)
8+
9+
target_include_directories(mbed-analog-devices
1110
INTERFACE
1211
.
1312
)
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if("ADUCM3029" IN_LIST MBED_TARGET_LABELS)
5-
add_subdirectory(TARGET_ADUCM3029)
6-
endif()
4+
add_subdirectory(TARGET_ADUCM3029 EXCLUDE_FROM_ALL)
5+

targets/TARGET_Analog_Devices/TARGET_ADUCM302X/TARGET_ADUCM3029/CMakeLists.txt

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
add_subdirectory(TARGET_EV_COG_AD3029LZ EXCLUDE_FROM_ALL)
5+
6+
add_library(mbed-aducm3029 INTERFACE)
7+
48
if(${MBED_TOOLCHAIN} STREQUAL "ARM")
59
set(LINKER_FILE TOOLCHAIN_ARM_STD/ADuCM3029.sct)
610
elseif(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
711
set(LINKER_FILE TOOLCHAIN_GCC_ARM/ADuCM3029.ld)
812
endif()
913

10-
if ("EV_COG_AD3029LZ" IN_LIST MBED_TARGET_LABELS)
11-
target_include_directories(mbed-core
12-
INTERFACE
13-
TARGET_EV_COG_AD3029LZ
14-
TARGET_EV_COG_AD3029LZ/device
15-
)
16-
17-
target_sources(mbed-core
18-
INTERFACE
19-
TARGET_EV_COG_AD3029LZ/device/system_ADuCM3029.c
20-
)
21-
22-
set(STARTUP_FILE TARGET_EV_COG_AD3029LZ/device/startup_ADuCM3029.c)
23-
endif()
24-
25-
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
14+
mbed_set_linker_script(mbed-aducm3029 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2615

27-
target_include_directories(mbed-core
16+
target_include_directories(mbed-aducm3029
2817
INTERFACE
2918
api
3019
bsp
@@ -65,7 +54,7 @@ target_include_directories(mbed-core
6554
bsp/xint
6655
)
6756

68-
target_sources(mbed-core
57+
target_sources(mbed-aducm3029
6958
INTERFACE
7059
api/analogin_api.c
7160
api/flash_api.c
@@ -121,6 +110,6 @@ target_sources(mbed-core
121110
bsp/wdt/adi_wdt.c
122111

123112
bsp/xint/adi_xint.c
124-
125-
${STARTUP_FILE}
126113
)
114+
115+
target_link_libraries(mbed-aducm3029 INTERFACE mbed-analog-devices)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2020 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-ev-cog-ad3029lz INTERFACE)
5+
6+
target_include_directories(mbed-ev-cog-ad3029lz
7+
INTERFACE
8+
.
9+
device
10+
)
11+
12+
target_sources(mbed-ev-cog-ad3029lz
13+
INTERFACE
14+
device/system_ADuCM3029.c
15+
device/startup_ADuCM3029.c
16+
)
17+
18+
target_link_libraries(mbed-ev-cog-ad3029lz INTERFACE mbed-aducm3029)
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if ("ADUCM4050" IN_LIST MBED_TARGET_LABELS)
5-
add_subdirectory(TARGET_ADUCM4050)
6-
endif()
4+
add_subdirectory(TARGET_ADUCM4050 EXCLUDE_FROM_ALL)

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/CMakeLists.txt

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4+
add_subdirectory(TARGET_EV_COG_AD4050LZ EXCLUDE_FROM_ALL)
5+
6+
add_library(mbed-aducm4050 INTERFACE)
7+
48
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
59
set(LINKER_FILE TOOLCHAIN_GCC_ARM/ADuCM4050.ld)
610
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
711
set(LINKER_FILE TOOLCHAIN_ARM_STD/ADuCM4050.sct)
812
endif()
913

10-
if("EV_COG_AD4050LZ" IN_LIST MBED_TARGET_LABELS)
11-
target_include_directories(mbed-core
12-
INTERFACE
13-
TARGET_EV_COG_AD4050LZ
14-
TARGET_EV_COG_AD4050LZ/device
15-
)
16-
17-
target_sources(mbed-core
18-
INTERFACE
19-
TARGET_EV_COG_AD4050LZ/device/system_ADuCM4050.c
20-
)
21-
22-
set(STARTUP_FILE TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c)
23-
endif()
24-
25-
set_property(GLOBAL PROPERTY MBED_TARGET_LINKER_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
14+
mbed_set_linker_script(mbed-aducm4050 ${CMAKE_CURRENT_SOURCE_DIR}/${LINKER_FILE})
2615

27-
target_include_directories(mbed-core
16+
target_include_directories(mbed-aducm4050
2817
INTERFACE
2918
api
3019
bsp
@@ -65,7 +54,7 @@ target_include_directories(mbed-core
6554
bsp/xint
6655
)
6756

68-
target_sources(mbed-core
57+
target_sources(mbed-aducm4050
6958
INTERFACE
7059
api/analogin_api.c
7160
api/flash_api.c
@@ -121,6 +110,6 @@ target_sources(mbed-core
121110
bsp/wdt/adi_wdt.c
122111

123112
bsp/xint/adi_xint.c
124-
125-
${STARTUP_FILE}
126113
)
114+
115+
target_link_libraries(mbed-aducm4050 INTERFACE mbed-analog-devices)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2021 ARM Limited. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
add_library(mbed-ev-cog-ad4050lz INTERFACE)
5+
6+
target_include_directories(mbed-ev-cog-ad4050lz
7+
INTERFACE
8+
.
9+
device
10+
)
11+
12+
target_sources(mbed-ev-cog-ad4050lz
13+
INTERFACE
14+
device/system_ADuCM4050.c
15+
device/startup_ADuCM4050.c
16+
)
17+
18+
target_link_libraries(mbed-ev-cog-ad4050lz INTERFACE mbed-aducm4050)

0 commit comments

Comments
 (0)