Skip to content

Commit

Permalink
Merge pull request #5 from nashif/cmake_anas5
Browse files Browse the repository at this point in the history
More cmake related changes
  • Loading branch information
SebastianBoe authored Aug 29, 2017
2 parents 9aff0fc + 8dffa8c commit 716542d
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .shippable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ compiler: gcc
env:
global:
- SDK=0.9.1
- SANITYCHECK_OPTIONS=" --inline-logs -R -p nrf52_pca10040 -T samples/bluetooth/"
- SANITYCHECK_OPTIONS=" --inline-logs -R -p nrf52_pca10040 -p qemu_cortex_m3 -p qemu_x86_iamcu -p qemu_x86 -p arduino_101"
- SANITYCHECK_OPTIONS_RETRY="${SANITYCHECK_OPTIONS} --only-failed --outdir=out-2nd-pass"
- ZEPHYR_SDK_INSTALL_DIR=/opt/sdk/zephyr-sdk-0.9.1
- ZEPHYR_GCC_VARIANT=zephyr
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if(CONFIG_FLOAT)
set(FPU_FOR_cortex-m4 fpv4-sp-d16)
set(FPU_FOR_cortex-m7 fpv5-d16)
set(FPU_FOR_cortex-m33 fpv5-d16)
target_cc_options(zephyr PUBLIC -mfpu=${FPU_FOR_${GCC_M_CPU}})
target_cc_option(zephyr PUBLIC -mfpu=${FPU_FOR_${GCC_M_CPU}})

if (CONFIG_FP_SOFTABI)
target_cc_option(zephyr PUBLIC -mfloat-abi=soft)
Expand Down
9 changes: 4 additions & 5 deletions boards/x86/arduino_101/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
zephyr_library()
zephyr_library_sources(${CMAKE_CURRENT_SOURCE_DIR}/pinmux.c)
target_link_libraries(boards__x86__arduino_101 zephyr drivers__pinmux)
target_include_directories(boards__x86__arduino_101 PRIVATE
${PROJECT_SOURCE_DIR}/include
zephyr_library_sources(pinmux.c)


zephyr_library_include_directories(PRIVATE
${PROJECT_SOURCE_DIR}/drivers
${PROJECT_SOURCE_DIR}/drivers/pinmux
)
2 changes: 2 additions & 0 deletions boards/x86/quark_d2000_crb/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zephyr_sources(pinmux.c)
zephyr_library_include_directories(PRIVATE ${PROJECT_SOURCE_DIR}/drivers)
8 changes: 7 additions & 1 deletion cmake/extensions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ endfunction()

function(target_cc_option_ifdef feature_toggle target scope option)
if(${feature_toggle})
target_cc_options(${target} ${scope} ${option})
target_cc_option(${target} ${scope} ${option})
endif()
endfunction()

Expand All @@ -68,6 +68,12 @@ function(zephyr_library_sources_ifdef feature_toggle source)
endif()
endfunction()

function(zephyr_library_sources_if_kconfig item)
get_filename_component(item_basename ${item} NAME_WE)
string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG)
zephyr_library_sources_ifdef(${UPPER_CASE_CONFIG} ${item})
endfunction()

function(zephyr_sources_if_kconfig item)
get_filename_component(item_basename ${item} NAME_WE)
string(TOUPPER CONFIG_${item_basename} UPPER_CASE_CONFIG)
Expand Down
18 changes: 9 additions & 9 deletions drivers/console/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
zephyr_library()

target_sources_if_kconfig(drivers__console PRIVATE uart_console.c)
target_sources_if_kconfig(drivers__console PRIVATE ram_console.c)
target_sources_if_kconfig(drivers__console PRIVATE rtt_console.c)
target_sources_if_kconfig(drivers__console PRIVATE ipm_console_receiver.c)
target_sources_if_kconfig(drivers__console PRIVATE ipm_console_sender.c)
target_sources_if_kconfig(drivers__console PRIVATE uart_pipe.c)
target_sources_if_kconfig(drivers__console PRIVATE telnet_console.c)
target_sources_if_kconfig(drivers__console PRIVATE xtensa_sim_console.c)
zephyr_library_sources_if_kconfig(uart_console.c)
zephyr_library_sources_if_kconfig(ram_console.c)
zephyr_library_sources_if_kconfig(rtt_console.c)
zephyr_library_sources_if_kconfig(ipm_console_receiver.c)
zephyr_library_sources_if_kconfig(ipm_console_sender.c)
zephyr_library_sources_if_kconfig(uart_pipe.c)
zephyr_library_sources_if_kconfig(telnet_console.c)
zephyr_library_sources_if_kconfig(xtensa_sim_console.c)

target_link_libraries(drivers__console drivers)
zephyr_library_link_libraries(drivers)
31 changes: 16 additions & 15 deletions drivers/serial/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
zephyr_library()
target_link_libraries(drivers__serial drivers)

target_sources_if_kconfig(drivers__serial PRIVATE uart_ns16550.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_mcux.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_mcux_lpuart.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_stellaris.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_nsim.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_atmel_sam3.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_sam.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_qmsi.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_stm32.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_nrf5.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_altera_jtag.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_cc32.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_cmsdk_apb.c)
target_sources_if_kconfig(drivers__serial PRIVATE uart_riscv_qemu.c)
zephyr_library_link_libraries(drivers)

zephyr_library_sources_if_kconfig(uart_ns16550.c)
zephyr_library_sources_if_kconfig(uart_mcux.c)
zephyr_library_sources_if_kconfig(uart_mcux_lpuart.c)
zephyr_library_sources_if_kconfig(uart_stellaris.c)
zephyr_library_sources_if_kconfig(uart_nsim.c)
zephyr_library_sources_if_kconfig(uart_atmel_sam3.c)
zephyr_library_sources_if_kconfig(uart_sam.c)
zephyr_library_sources_if_kconfig(uart_qmsi.c)
zephyr_library_sources_if_kconfig(uart_stm32.c)
zephyr_library_sources_if_kconfig(uart_nrf5.c)
zephyr_library_sources_if_kconfig(uart_altera_jtag.c)
zephyr_library_sources_if_kconfig(uart_cc32.c)
zephyr_library_sources_if_kconfig(uart_cmsdk_apb.c)
zephyr_library_sources_if_kconfig(uart_riscv_qemu.c)
18 changes: 9 additions & 9 deletions drivers/timer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ zephyr_library()

zephyr_library_sources(sys_clock_init.c)

target_sources_ifdef(CONFIG_HPET_TIMER drivers__timer PRIVATE hpet.c)
target_sources_ifdef(CONFIG_ARCV2_TIMER drivers__timer PRIVATE arcv2_timer0.c)
zephyr_library_sources_ifdef(CONFIG_HPET_TIMER hpet.c)
zephyr_library_sources_ifdef(CONFIG_ARCV2_TIMER arcv2_timer0.c)

target_sources_if_kconfig( drivers__timer PRIVATE loapic_timer.c)
target_sources_if_kconfig( drivers__timer PRIVATE altera_avalon_timer.c)
target_sources_if_kconfig( drivers__timer PRIVATE nrf_rtc_timer.c)
target_sources_if_kconfig( drivers__timer PRIVATE pulpino_timer.c)
target_sources_if_kconfig( drivers__timer PRIVATE riscv_machine_timer.c)
target_sources_if_kconfig( drivers__timer PRIVATE cortex_m_systick.c)
zephyr_library_sources_if_kconfig(loapic_timer.c)
zephyr_library_sources_if_kconfig(altera_avalon_timer.c)
zephyr_library_sources_if_kconfig(nrf_rtc_timer.c)
zephyr_library_sources_if_kconfig(pulpino_timer.c)
zephyr_library_sources_if_kconfig(riscv_machine_timer.c)
zephyr_library_sources_if_kconfig(cortex_m_systick.c)

target_link_libraries(drivers__timer drivers)
zephyr_library_link_libraries(drivers)
4 changes: 2 additions & 2 deletions lib/libc/minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target_sources(zephyr PRIVATE
target_sources(app PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/atoi.c
${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/strtol.c
${CMAKE_CURRENT_SOURCE_DIR}/source/stdlib/strtoul.c
Expand All @@ -10,7 +10,7 @@ target_sources(zephyr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/sprintf.c
${CMAKE_CURRENT_SOURCE_DIR}/source/stdout/fprintf.c
)
target_include_directories(zephyr
target_include_directories(app
PUBLIC
include
)
3 changes: 3 additions & 0 deletions scripts/sanitycheck
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,9 @@ class TestSuite:
for dirpath, dirnames, filenames in os.walk(testcase_root,
topdown=True):
verbose("scanning %s" % dirpath)
# FIXME: To only run on ported tests and samples when migrating to cmake
if 'CMakeLists.txt' not in filenames:
continue
if 'sample.yaml' in filenames:
filename = 'sample.yaml'
elif 'testcase.yaml' in filenames:
Expand Down
1 change: 1 addition & 0 deletions subsys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
add_subdirectory_ifdef(CONFIG_CONSOLE_PULL console)
# add_subdirectory_ifdef(CONFIG_FILE_SYSTEM fs)
# add_subdirectory_ifdef(CONFIG_USB usb)
add_subdirectory_ifdef(CONFIG_BT bluetooth)
Expand Down
2 changes: 2 additions & 0 deletions subsys/console/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
zephyr_sources_ifdef(CONFIG_CONSOLE_GETCHAR getchar.c)
zephyr_sources_ifdef(CONFIG_CONSOLE_GETLINE getline.c)

0 comments on commit 716542d

Please sign in to comment.