Skip to content

Commit

Permalink
[ocf] Fixed iotivity-constrained build
Browse files Browse the repository at this point in the history
The problem is that all the required preprocessor defines added
to iotivity-constrained using -include doesn't work with CMake,
so instead, we should pass those definitions to cmake using
add_definitions().

Fixes intel#1707

Signed-off-by: Jimmy Huang <jimmy.huang@intel.com>
  • Loading branch information
jimmy-huang committed Jan 23, 2018
1 parent ba69d2a commit 555fb40
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 42 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ analyze: $(JS)
fi
@mkdir -p $(OUT)/$(BOARD)/
@mkdir -p $(OUT)/include
@# create an config.h file to needed for iotivity-constrained
@cp -p src/zjs_ocf_config.h $(OUT)/include/config.h

./scripts/analyze V=$(V) \
SCRIPT=$(JS) \
Expand Down
10 changes: 9 additions & 1 deletion cmake/zjs_linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ if(NOT APPLE)
${IOTC_BASE}/util
)

add_definitions(-DOC_SERVER -DOC_CLIENT -DBUILD_MODULE_OCF -DZJS_GPIO_MOCK)
add_definitions(
-DOC_SERVER
-DOC_CLIENT
-DOC_DYNAMIC_ALLOCATION
-DOC_CLOCK_CONF_TICKS_PER_SECOND=1000
-DMAX_APP_DATA_SIZE=1024
-DBUILD_MODULE_OCF
-DZJS_GPIO_MOCK
)

# these flags are needed to get rid of warnings in iotivity-constrained
list(APPEND APP_COMPILE_OPTIONS -Wno-pointer-sign)
Expand Down
70 changes: 35 additions & 35 deletions src/zjs_iotivity_constrained.json
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
{
"module": "iotivity_constrained",
"src": [
"${IOTC_BASE}/deps/tinycbor/src/cborencoder.c",
"${IOTC_BASE}/deps/tinycbor/src/cborencoder_close_container_checked.c",
"${IOTC_BASE}/deps/tinycbor/src/cborparser.c",
"${IOTC_BASE}/api/oc_buffer.c",
"${IOTC_BASE}/api/oc_client_api.c",
"${IOTC_BASE}/api/oc_core_res.c",
"${IOTC_BASE}/api/oc_discovery.c",
"${IOTC_BASE}/api/oc_endpoint.c",
"${IOTC_BASE}/api/oc_helpers.c",
"${IOTC_BASE}/api/oc_introspection.c",
"${IOTC_BASE}/api/oc_main.c",
"${IOTC_BASE}/api/oc_network_events.c",
"${IOTC_BASE}/api/oc_rep.c",
"${IOTC_BASE}/api/oc_ri.c",
"${IOTC_BASE}/api/oc_server_api.c",
"${IOTC_BASE}/api/oc_uuid.c",
"${IOTC_BASE}/messaging/coap/coap.c",
"${IOTC_BASE}/messaging/coap/engine.c",
"${IOTC_BASE}/messaging/coap/observe.c",
"${IOTC_BASE}/messaging/coap/separate.c",
"${IOTC_BASE}/messaging/coap/transactions.c",
"${IOTC_BASE}/port/zephyr/src/abort.c",
"${IOTC_BASE}/port/zephyr/src/clock.c",
"${IOTC_BASE}/port/zephyr/src/ipadapter.c",
"${IOTC_BASE}/port/zephyr/src/random.c",
"${IOTC_BASE}/port/zephyr/src/storage.c",
"${IOTC_BASE}/util/oc_etimer.c",
"${IOTC_BASE}/util/oc_list.c",
"${IOTC_BASE}/util/oc_memb.c",
"${IOTC_BASE}/util/oc_mmem.c",
"${IOTC_BASE}/util/oc_process.c",
"${IOTC_BASE}/util/oc_timer.c"
"${IOTC_BASE}/deps/tinycbor/src/cborencoder.c",
"${IOTC_BASE}/deps/tinycbor/src/cborencoder_close_container_checked.c",
"${IOTC_BASE}/deps/tinycbor/src/cborparser.c",
"${IOTC_BASE}/api/oc_buffer.c",
"${IOTC_BASE}/api/oc_client_api.c",
"${IOTC_BASE}/api/oc_core_res.c",
"${IOTC_BASE}/api/oc_discovery.c",
"${IOTC_BASE}/api/oc_endpoint.c",
"${IOTC_BASE}/api/oc_helpers.c",
"${IOTC_BASE}/api/oc_introspection.c",
"${IOTC_BASE}/api/oc_main.c",
"${IOTC_BASE}/api/oc_network_events.c",
"${IOTC_BASE}/api/oc_rep.c",
"${IOTC_BASE}/api/oc_ri.c",
"${IOTC_BASE}/api/oc_server_api.c",
"${IOTC_BASE}/api/oc_uuid.c",
"${IOTC_BASE}/messaging/coap/coap.c",
"${IOTC_BASE}/messaging/coap/engine.c",
"${IOTC_BASE}/messaging/coap/observe.c",
"${IOTC_BASE}/messaging/coap/separate.c",
"${IOTC_BASE}/messaging/coap/transactions.c",
"${IOTC_BASE}/port/zephyr/src/abort.c",
"${IOTC_BASE}/port/zephyr/src/clock.c",
"${IOTC_BASE}/port/zephyr/src/ipadapter.c",
"${IOTC_BASE}/port/zephyr/src/random.c",
"${IOTC_BASE}/port/zephyr/src/storage.c",
"${IOTC_BASE}/util/oc_etimer.c",
"${IOTC_BASE}/util/oc_list.c",
"${IOTC_BASE}/util/oc_memb.c",
"${IOTC_BASE}/util/oc_mmem.c",
"${IOTC_BASE}/util/oc_process.c",
"${IOTC_BASE}/util/oc_timer.c"
],
"zjs_config": [
"-I${IOTC_BASE}",
"-I${IOTC_BASE}/deps/mbeddtls",
"-I${IOTC_BASE}/include",
"-I${IOTC_BASE}/port/zephyr/src",
"-I${ZEPHYR_BASE}/include/random",
"-I${ZEPHYR_BASE}/samples/bluetooth",
"-I${ZEPHYR_BASE}/subsys/net/ip",
"-include $(ZJS_BASE)/src/zjs_ocf_config.h",
"-include $(ZJS_BASE)/$(OCF_ROOT)/port/zephyr/src/config.h",
"-DWITH_OCF",
"-DOC_CLOCK_CONF_TICKS_PER_SECOND=1000",
"-DOC_DYNAMIC_ALLOCATION",
"-DMAX_APP_DATA_SIZE=1024",
"-DNDEBUG"
]
}
7 changes: 1 addition & 6 deletions src/zjs_ocf_config.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017, Intel Corporation.
// Copyright (c) 2017-2018, Intel Corporation.

#ifndef CONFIG_H
#define CONFIG_H
Expand All @@ -9,10 +9,5 @@ typedef uint64_t oc_clock_time_t;
#ifndef ZJS_LINUX_BUILD
#include <zephyr.h>
#endif
#define OC_CLOCK_CONF_TICKS_PER_SECOND (1000)

#define OC_DYNAMIC_ALLOCATION

#define MAX_APP_DATA_SIZE 1024

#endif

0 comments on commit 555fb40

Please sign in to comment.