build: Generate iotivity_config.h in build_dir 89/21989/8
authorPhilippe Coval <philippe.coval@osg.samsung.com>
Thu, 17 Aug 2017 13:48:20 +0000 (15:48 +0200)
committerC.J. Collier <cjcollier@linuxfoundation.org>
Tue, 14 Nov 2017 17:40:38 +0000 (17:40 +0000)
The file from "out" dir will be also installed to system include path
using scons install (to /usr/include/ on linux)

Bug: https://jira.iotivity.org/browse/IOT-2599
Change-Id: Icddfb9354f47fd40ba998fe336b4963be7ade871
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
Origin: https://gerrit.iotivity.org/gerrit/#/c/21989/

resource/c_common/SConscript
resource/csdk/stack/samples/tizen/build/packaging/com.oic.ri.spec
service/easy-setup/mediator/richsdk/android/EasySetupCore/src/main/jni/Android.mk
service/notification/android/notification-service/src/main/jni/Android.mk
service/resource-container/android/resource-container/src/main/jni/Android.mk
service/resource-encapsulation/android/service/src/main/jni/Android.mk

index 00cafd5..7f8955d 100644 (file)
@@ -25,12 +25,13 @@ import datetime
 target_os = env.get('TARGET_OS')
 target_arch = env.get('TARGET_ARCH')
 src_dir = env.get('SRC_DIR')
+cur_dir = Dir('.').abspath
 
 ######################################################################
 # Generate iotivity_config.h using presence of headers
 ######################################################################
-config_h_file_path = os.path.join(src_dir, 'resource', 'c_common',
-                                  'iotivity_config.h')
+
+config_h_file_path = os.path.join(cur_dir, 'iotivity_config.h')
 
 if (os.path.exists(config_h_file_path)) and (env.GetOption('clean')):
     os.remove(config_h_file_path)
@@ -117,29 +118,31 @@ if not os.path.isfile(config_h_file_path) and env.GetOption not in ('clean', 'he
             config_h_body += "#define %s 1\n\n" % get_define_from_string(
                 function_name)
     conf.Finish()
-
     # Autoconf feature doesn't work with Jenkins' arduino toolchain, so hardcode it here.
     if target_os == 'arduino':
         config_h_body += "#define HAVE_ARDUINO_TIME_H\n\n"
 
     # Generate the file
+    if not os.path.exists(cur_dir):
+        os.makedirs(cur_dir)
     if os.path.exists(config_h_file_path):
         os.remove(config_h_file_path)
     config_h_file = open(config_h_file_path, "w")
     config_h_file.write(config_h_header + config_h_body + config_h_footer)
     config_h_file.close()
 
+
 # Sanity check to ensure that the above block created the file.
 if (not os.path.exists(config_h_file_path)) and (not env.GetOption('clean')):
     msg = "Error: iotivity_config.h file not created!"
     Exit(msg)
 
-# iotivity_config.h should be copied to the build dir
+# iotivity_config.h should be copied to installation dir
 env.UserInstallTargetHeader(
     config_h_file_path, 'c_common', 'iotivity_config.h')
 
 # Use the generated file internally
-env.AppendUnique(CPPPATH=[os.path.join(src_dir, 'resource', 'c_common')])
+env.AppendUnique(CPPPATH=[cur_dir])
 
 ######################################################################
 
index 1ef7681..759f2e5 100644 (file)
@@ -118,7 +118,7 @@ cp resource/oc_logger/include/targets/oc_ostream_logger.h %{DEST_INC_DIR}
 cp resource/csdk/stack/include/ocpresence.h %{DEST_INC_DIR}
 cp resource/csdk/stack/include/ocpayload.h %{DEST_INC_DIR}
 cp resource/c_common/platform_features.h %{DEST_INC_DIR}
-cp resource/c_common/iotivity_config.h %{DEST_INC_DIR}
+cp %{BUILD_DIR}/resource/c_common/iotivity_config.h %{DEST_INC_DIR}
 cp resource/c_common/*/include/*.h %{DEST_INC_DIR}
 cp resource/c_common/experimental/*.h* %{DEST_INC_DIR}/experimental/
 cp resource/csdk/stack/include/experimental/payload_logging.h %{DEST_INC_DIR}/experimental/
index ebda176..41c2e32 100755 (executable)
@@ -48,6 +48,7 @@ LOCAL_SRC_FILES := $(OIC_LIB_PATH)/libocstack-jni.so
 include $(PREBUILT_SHARED_LIBRARY)
 
 include $(CLEAR_VARS)
+OIC_OUT_PATH := ../../../../../../../../out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
 
 LOCAL_MODULE    := easysetup-jni
 
@@ -73,6 +74,7 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) \
                                        $(LOCAL_PATH)/../../../../../../../../../resource/c_common/oic_string/include \
                                        $(LOCAL_PATH)/../../../../../../../../../resource/include \
                                        $(LOCAL_PATH)/../../../../../../../../../resource/c_common \
+                                       $(OIC_OUT_PATH)/resource/c_common \
                                        $(LOCAL_PATH)/../../../../../../../../../resource/oc_logger/include \
                                        $(LOCAL_PATH)/../../../../../../../../../resource/c_common/oic_malloc/include \
                                        $(LOCAL_PATH)/../../../../../../../../../resource/csdk/connectivity/api \
index 8ba5ecc..861f094 100755 (executable)
@@ -1,7 +1,7 @@
 LOCAL_PATH := $(call my-dir)
-
 ROOT_PATH := ../../../../../../..
 OIC_SRC_DIR := ../../../../../..
+OIC_OUT_PATH := $(OIC_SRC_DIR)/out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
 
 include $(CLEAR_VARS)
 OIC_LIB_PATH := $(ROOT_PATH)/out/android/$(TARGET_ARCH_ABI)/$(APP_OPTIM)
@@ -56,6 +56,7 @@ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/stack/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
+LOCAL_C_INCLUDES += $(OIC_OUT_PATH)/resource/c_common
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common/oic_string/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/oc_logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0
@@ -109,6 +110,7 @@ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/stack/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
+LOCAL_C_INCLUDES += $(OIC_OUT_PATH)/resource/c_common
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common/oic_string/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/oc_logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0
index 5317f88..f368dbb 100644 (file)
@@ -38,6 +38,7 @@ LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/stack/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/oc_logger/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
+LOCAL_C_INCLUDES += $(IOTIVITY_LIB_PATH)/resource/c_common
 
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/
 
index 5b21c70..37dbe4b 100644 (file)
@@ -30,6 +30,7 @@ LOCAL_MODULE := rcs_jni
 LOCAL_C_INCLUDES := $(LOCAL_PATH)/util
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/c_common
+LOCAL_C_INCLUDES += $(IOTIVITY_LIB_PATH)/resource/c_common
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/resource/csdk/stack/include
 LOCAL_C_INCLUDES += $(OIC_SRC_DIR)/extlibs/boost/boost_1_58_0