Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add macro to check if code is built with cmake #34

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion easy_embedded/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ message(STATUS "**********************************************************")


set(FRAMEWORK_ROOT_DIR ${CMAKE_SOURCE_DIR}/easy_embedded)

option(BUILD_WITH_CMAKE "code base is built using CMake. Do not turn this OFF" ON)

# Include --------------------------------------------------------------------
# Unused
Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ target_sources(ez_app_lib
target_compile_definitions(ez_app_lib
PUBLIC
DATA_MODEL=$<BOOL:${ENABLE_DATA_MODEL}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/app/data_model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target_sources(ez_data_model_lib
target_compile_definitions(ez_data_model_lib
PUBLIC
DATA_MODEL=$<BOOL:${ENABLE_DATA_MODEL}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
5 changes: 4 additions & 1 deletion easy_embedded/app/data_model/ez_data_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (DATA_MODEL == 1U)
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (DATA_MODEL == 1U)
#include <stdbool.h>
#include <stdint.h>
#include "ez_utilities_common.h"
Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/app/ipc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target_sources(ez_ipc_lib
target_compile_definitions(ez_ipc_lib
PUBLIC
EZ_IPC_ENABLE=$<BOOL:${ENABLE_EZ_IPC}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
5 changes: 4 additions & 1 deletion easy_embedded/app/ipc/ez_ipc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_IPC_ENABLE == 1)
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_IPC_ENABLE == 1)
#include "stdint.h"
#include "stdbool.h"

Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/app/rpc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target_sources(ez_rpc_lib
target_compile_definitions(ez_rpc_lib
PUBLIC
EZ_RPC_ENABLE=$<BOOL:${ENABLE_EZ_RPC}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
4 changes: 4 additions & 0 deletions easy_embedded/app/rpc/ez_rpc.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_RPC_ENABLE == 1)
#include "stdint.h"
#include "stdbool.h"
Expand Down
1 change: 1 addition & 0 deletions easy_embedded/service/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ target_compile_definitions(ez_driver_lib
PUBLIC
EZ_DRIVER_ENABLE=$<BOOL:${ENABLE_EZ_HAL_DRIVER}>
EZ_UART_ENABLE=$<BOOL:${ENABLE_EZ_UART}>
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
4 changes: 4 additions & 0 deletions easy_embedded/service/driver/ez_driver_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_DRIVER_ENABLE == 1)
#include "stdint.h"
#include "stdbool.h"
Expand Down
4 changes: 4 additions & 0 deletions easy_embedded/service/driver/uart/ez_uart.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_UART_ENABLE == 1)
#include <stdint.h>
#include <stdbool.h>
Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/service/event_notifier/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ target_sources(ez_event_notifier_lib
target_compile_definitions(ez_event_notifier_lib
PUBLIC
EZ_EVENT_NOTIFIER=$<BOOL:${ENABLE_EZ_EVENT_NOTIFIER}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
6 changes: 5 additions & 1 deletion easy_embedded/service/event_notifier/ez_event_notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@
extern "C" {
#endif

#if(EZ_EVENT_NOTIFIER == 1U)

/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if(EZ_EVENT_NOTIFIER == 1U)
#include <stdint.h>
#include <stdbool.h>
#include "ez_linked_list.h"
Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/service/state_machine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ target_sources(ez_state_machine_lib
target_compile_definitions(ez_state_machine_lib
PUBLIC
EZ_STATE_MACHINE_ENABLE=$<BOOL:${ENABLE_EZ_STATE_MACHINE}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
8 changes: 6 additions & 2 deletions easy_embedded/service/state_machine/ez_state_machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_STATE_MACHINE_ENABLE == 1)

#include <stdint.h>
#include <stdbool.h>
#include "ez_ring_buffer.h"

#if (EZ_STATE_MACHINE_ENABLE == 1)

/*****************************************************************************
* Component Preprocessor Macros
*****************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/service/task_worker/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ target_compile_definitions(ez_task_worker_lib
EZ_TASK_WORKER_ENABLE=$<BOOL:${ENABLE_EZ_TASK_WORKER}>
EZ_THREADX_PORT_ENABLE=$<BOOL:${ENABLE_THREADX}>
EZ_FREERTOS_PORT_ENABLE=$<BOOL:${ENABLE_FREERTOS}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
7 changes: 5 additions & 2 deletions easy_embedded/service/task_worker/ez_task_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_TASK_WORKER_ENABLE == 1)
#include "ez_linked_list.h"
#include "ez_queue.h"

Expand All @@ -42,8 +47,6 @@ extern "C" {
#include "event_groups.h"
#endif

#if (EZ_TASK_WORKER_ENABLE == 1)

/*****************************************************************************
* Component Preprocessor Macros
*****************************************************************************/
Expand Down
2 changes: 2 additions & 0 deletions easy_embedded/utilities/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ target_compile_definitions(ez_utilities_lib
EZ_STATIC_ALLOC=$<BOOL:${ENABLE_EZ_STATIC_ALLOC}>
EZ_SYS_ERROR=$<BOOL:${ENABLE_EZ_SYS_ERROR}>
EZ_QUEUE=$<BOOL:${ENABLE_EZ_QUEUE}>
PRIVATE
EZ_BUILD_WITH_CMAKE=$<BOOL:${BUILD_WITH_CMAKE}>
)


Expand Down
4 changes: 3 additions & 1 deletion easy_embedded/utilities/assert/ez_assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ extern "C" {
/*******************************************************************************
* Includes
*******************************************************************************/
/*None*/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif


/******************************************************************************
Expand Down
4 changes: 4 additions & 0 deletions easy_embedded/utilities/queue/ez_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ extern "C" {
/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_QUEUE == 1U)
#include <stdint.h>
#include "ez_utilities_common.h"
Expand Down
4 changes: 4 additions & 0 deletions easy_embedded/utilities/ring_buffer/ez_ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ extern "C" {
/*******************************************************************************
* Includes
*******************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#include <stdint.h>
#include <stdbool.h>

Expand Down
7 changes: 6 additions & 1 deletion easy_embedded/utilities/static_alloc/ez_static_alloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,16 @@
extern "C" {
#endif

#if (EZ_STATIC_ALLOC == 1)

/*****************************************************************************
* Includes
*****************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_STATIC_ALLOC == 1)

#include "stdint.h"
#include "ez_linked_list.h"

Expand Down
6 changes: 5 additions & 1 deletion easy_embedded/utilities/system_error/ez_system_error.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,15 @@
extern "C" {
#endif

#if (EZ_SYS_ERROR == 1U)

/*******************************************************************************
* Includes
*******************************************************************************/
#if (EZ_BUILD_WITH_CMAKE == 0U)
#include "ez_target_config.h"
#endif

#if (EZ_SYS_ERROR == 1U)
#include <stdlib.h>
#include <stdbool.h>
#include <stdint.h>
Expand Down
Loading