Introduce cmake-based rewrite of KBuild

Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
This commit is contained in:
Sebastian Bøe 2017-10-27 15:43:34 +02:00 committed by Anas Nashif
parent bb6abea14f
commit 1fd9c72f9b
5 changed files with 98 additions and 0 deletions

1
CMakeLists.txt Normal file
View File

@ -0,0 +1 @@
add_subdirectory(simplelink)

67
simplelink/CMakeLists.txt Normal file
View File

@ -0,0 +1,67 @@
add_subdirectory(source/ti/devices)
if(CONFIG_SIMPLELINK_HOST_DRIVER)
zephyr_include_directories(
source
kernel/zephyr/dpl
)
zephyr_compile_definitions(
SL_SUPPORT_IPV6
SL_PLATFORM_MULTI_THREADED
)
endif()
if(CONFIG_HAS_CC3220SDK)
if(CONFIG_SIMPLELINK_HOST_DRIVER)
zephyr_library()
zephyr_library_compile_definitions(${COMPILER})
zephyr_library_sources(
source/ti/drivers/SPI.c
source/ti/drivers/spi/SPICC32XXDMA.c
source/ti/drivers/dma/UDMACC32XX.c
source/ti/drivers/power/PowerCC32XX.c
source/ti/drivers/utils/List.c
source/ti/drivers/net/wifi/source/device.c
source/ti/drivers/net/wifi/source/flowcont.c
source/ti/drivers/net/wifi/source/fs.c
source/ti/drivers/net/wifi/source/netapp.c
source/ti/drivers/net/wifi/source/netcfg.c
source/ti/drivers/net/wifi/source/netutil.c
source/ti/drivers/net/wifi/source/nonos.c
source/ti/drivers/net/wifi/source/spawn.c
source/ti/drivers/net/wifi/source/wlan.c
source/ti/drivers/net/wifi/porting/CC3220SF_LAUNCHXL.c
source/ti/drivers/net/wifi/porting/cc_pal.c
source/ti/drivers/net/wifi/eventreg.c
source/ti/drivers/net/wifi/source/socket.c
source/ti/devices/cc32xx/driverlib/timer.c
source/ti/devices/cc32xx/driverlib/udma.c
kernel/zephyr/dpl/dpl.c
kernel/zephyr/dpl/MutexP_zephyr.c
kernel/zephyr/dpl/SemaphoreP_zephyr.c
kernel/zephyr/dpl/ClockP_zephyr.c
kernel/zephyr/dpl/HwiP_zephyr.c
)
# Create library for these two source files because they need to be
# built slightly differently. TODO: Use set_source_files_properties
# instead?
zephyr_library_named(simplelink_wifi_driver)
zephyr_library_sources(source/ti/drivers/net/wifi/source/driver.c)
zephyr_library_compile_definitions(__LINUX_ERRNO_EXTENSIONS__)
zephyr_library_compile_definitions(${COMPILER})
zephyr_library_compile_options(-Wno-strict-aliasing) # driver.c warns on strict-aliasing
zephyr_library_named(simplelink_wifi_sl_socket)
zephyr_library_sources(source/ti/drivers/net/wifi/source/sl_socket.c)
zephyr_library_compile_definitions(${COMPILER})
zephyr_library_compile_options(-Wno-missing-braces) # sl_socket warns on missing braces
endif()
elseif(CONFIG_HAS_MSP432P4XXSDK)
zephyr_include_directories(
source
)
endif()

View File

@ -0,0 +1,3 @@
add_subdirectory_ifdef(CONFIG_HAS_CC3220SDK cc32xx)
add_subdirectory_ifdef(CONFIG_HAS_MSP432P4XXSDK msp432p4xx)

View File

@ -0,0 +1,16 @@
zephyr_include_directories(
.
inc
driverlib
)
zephyr_compile_definitions(
USE_CC3220_ROM_DRV_API
)
zephyr_library()
zephyr_library_compile_definitions(${COMPILER})
zephyr_library_sources(
driverlib/utils.c
driverlib/prcm.c
driverlib/pin.c
)

View File

@ -0,0 +1,11 @@
zephyr_include_directories(
.
)
zephyr_library()
zephyr_library_compile_definitions(${COMPILER})
zephyr_library_sources(
# Need system_msp432p401r for SystemInit which is not in ROM
startup_system_files/system_msp432p401r.c
)