Skip to content
This repository has been archived by the owner on Nov 11, 2024. It is now read-only.

Commit

Permalink
Fix for users with no C++ support in their toolchain.
Browse files Browse the repository at this point in the history
The U_CFG_GEOFENCE feature introduced a C++ file (common/geofence/src/u_geofence_geodesic.cpp) into the system, which does nothing if U_CFG_GEOFENCE is not defined, and even then only does something useful if geodesic is included in UBXLIB_FEATURES.  This causes a problem for customers who don't have C++ support in their toolchain; those who aren't interested in U_CFG_GEOFENCE or those who are but don't need the geodesic support (which is where C++ comes in).

With this commit the existing dummy file, common/geofence/src/dummy/u_geofence_geodesic.c (used for those who only have make, not CMake) is brought in if the geodesic feature is not included; this fixes things for both cases.
  • Loading branch information
RobMeades committed Jan 22, 2024
1 parent 15010e6 commit c778e9c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/geofence/src/dummy/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Why This File Is Here
This file is here solely to allow those who only have a `make` (rather than `CMake`) based platform, and so are unable to use the third-party GeographicLib integration, to still compile and use the `ubxlib` GNSS geofence feature with a simple spherical earth model. See the comments at the top of [u_geofence_geodesic.h](/common/geofence/api/u_geofence_geodesic.h) for more information.
This file is here solely to allow those who only have a `make` (rather than `CMake`) based platform, or do not have a C++ compiler, and so are unable to use the third-party GeographicLib integration, to still compile and use the `ubxlib` GNSS geofence feature with a simple spherical earth model. See the comments at the top of [u_geofence_geodesic.h](/common/geofence/api/u_geofence_geodesic.h) for more information.
12 changes: 10 additions & 2 deletions port/ubxlib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,15 @@ list(APPEND UBXLIB_INC ${UBXLIB_BASE}/common/device/api)
list(APPEND UBXLIB_PRIVATE_INC ${UBXLIB_BASE}/common/device/src)

# CPP file required for geofencing
list(APPEND UBXLIB_SRC ${UBXLIB_BASE}/common/geofence/src/u_geofence_geodesic.cpp)
# Note: bringing the .c version of this file in if geodesic is not present is not
# strictly necessary (since the file includes dummy implementations anyway); it
# is done in order to allow those who don't have C++ support in their toolchain
# to still compile/use the geofence feature in non-geodesic mode.
if (geodesic IN_LIST UBXLIB_FEATURES)
list(APPEND UBXLIB_SRC ${UBXLIB_BASE}/common/geofence/src/u_geofence_geodesic.cpp)
else()
list(APPEND UBXLIB_SRC ${UBXLIB_BASE}/common/geofence/src/dummy/u_geofence_geodesic.c)
endif()

# Default malloc()/free() implementation
list(APPEND UBXLIB_SRC ${UBXLIB_BASE}/port/u_port_heap.c)
Expand Down Expand Up @@ -227,7 +235,7 @@ u_add_test_source_dir(base ${UBXLIB_BASE}/example/utilities/c030_module_fw_updat
# cause any extra libraries to be linked and
# UBXLIB_COMPILE_OPTIONS, which can be added to
# target_compile_definitions(). HOWEVER, it doesn't
# work for ESP-IDF, which has a "helful" component
# work for ESP-IDF, which has a "helpful" component
# system of its own stuck on top, hence BE AWARE
# THAT that ESP-IDF doesn't use the bit below...
#
Expand Down

0 comments on commit c778e9c

Please sign in to comment.