Skip to content

Commit

Permalink
Zephyr cmakelist use ubxlib instead of app
Browse files Browse the repository at this point in the history
  • Loading branch information
PetervdPerk-NXP authored and bperseghetti committed Dec 3, 2023
1 parent 62b7a20 commit 41e5913
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions port/platform/zephyr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# This CMake file will select the ubxlib source and include directories
# to include in the Zephyr application based on Kconfig. Use menuconfig
# to view the available options.
#
# TODO: Instead of compiling the files directly with the app this cmake
# file should create an ubxlib library instead.
if(CONFIG_UBXLIB)

zephyr_library_named(ubxlib)

# we need to be able to include generated header files
zephyr_include_directories()

get_filename_component(UBXLIB_BASE ../../../ ABSOLUTE)
set(ENV{UBXLIB_BASE} ${UBXLIB_BASE})

# Add environment variables passed-in via U_FLAGS
if (DEFINED ENV{U_FLAGS})
separate_arguments(U_FLAGS NATIVE_COMMAND "$ENV{U_FLAGS}")
target_compile_options(app PRIVATE ${U_FLAGS})
target_compile_options(ubxlib PRIVATE ${U_FLAGS})
message("ubxlib: added ${U_FLAGS} due to environment variable U_FLAGS.")
endif()

Expand Down Expand Up @@ -53,7 +55,7 @@ endif()
include(${UBXLIB_BASE}/port/ubxlib.cmake)

# Set ubxlib source files
target_sources(app PRIVATE
target_sources(ubxlib PRIVATE
${UBXLIB_SRC}
src/u_port.c
src/u_port_debug.c
Expand All @@ -68,7 +70,7 @@ target_sources(app PRIVATE
)

if (CONFIG_UBXLIB_OPEN_CPU_BLE)
target_sources(app PRIVATE src/u_port_gatt.c)
target_sources(ubxlib PRIVATE src/u_port_gatt.c)
endif()

# Set the include directories
Expand All @@ -86,9 +88,9 @@ target_compile_options(app PRIVATE ${UBXLIB_COMPILE_OPTIONS})

# Add test source & include dirs if selected
if (CONFIG_UBXLIB_TEST)
target_compile_definitions(app PRIVATE UNITY_INCLUDE_CONFIG_H)
target_compile_definitions(ubxlib PRIVATE UNITY_INCLUDE_CONFIG_H)

target_sources(app PRIVATE
target_sources(ubxlib PRIVATE
${UBXLIB_TEST_SRC}
)

Expand Down Expand Up @@ -117,7 +119,7 @@ if (CONFIG_UBXLIB_TEST)

if (DEFINED UNITY_PATH)
message("Unity from ${UNITY_PATH} will be used")
target_sources(app PRIVATE
target_sources(ubxlib PRIVATE
${UNITY_PATH}/src/unity.c
)
zephyr_include_directories(
Expand All @@ -129,7 +131,7 @@ if (CONFIG_UBXLIB_TEST)
endif()

if (CONFIG_MINIMAL_LIBC)
target_sources(app PRIVATE
target_sources(ubxlib PRIVATE
${UBXLIB_BASE}/port/clib/u_port_clib_isblank.c
${UBXLIB_BASE}/port/clib/u_port_clib_mktime.c
${UBXLIB_BASE}/port/clib/u_port_setjmp.S
Expand All @@ -138,15 +140,15 @@ if (CONFIG_MINIMAL_LIBC)
endif()

if (CONFIG_UBXLIB_EDM_STREAM_DEBUG)
target_compile_definitions(app PRIVATE U_CFG_SHORT_RANGE_EDM_STREAM_DEBUG)
target_compile_definitions(ubxlib PRIVATE U_CFG_SHORT_RANGE_EDM_STREAM_DEBUG)
endif()

if (CONFIG_UBXLIB_EDM_STREAM_DEBUG_COLOR)
target_compile_definitions(app PRIVATE U_CFG_SHORT_RANGE_EDM_STREAM_DEBUG_COLOR)
target_compile_definitions(ubxlib PRIVATE U_CFG_SHORT_RANGE_EDM_STREAM_DEBUG_COLOR)
endif()

if (CONFIG_UBXLIB_EDM_STREAM_DEBUG_DUMP_DATA)
target_compile_definitions(app PRIVATE U_CFG_SHORT_RANGE_EDM_STREAM_DEBUG_DUMP_DATA)
target_compile_definitions(ubxlib PRIVATE U_CFG_SHORT_RANGE_EDM_STREAM_DEBUG_DUMP_DATA)
endif()


Expand Down

0 comments on commit 41e5913

Please sign in to comment.