Commit 23b11f48 authored by Philippe Coval's avatar Philippe Coval Committed by Phil Coval

build: Fix the ios build break

[srijon.sb]
iOS has been built successfully before,
but currently build fail happened due to some update in the IoTivity.
This fix resolves secure and insecure build of IoTivity for iOS

[Philippe Coval]
Rebased on renamed files and adapted,
removed cleanup changes (prefered in isolated patches)
Ported from 1.2-rel to master

Change-Id: I7599d02f1931f38a28eac90163aac5818540c5b9
Author: srijon.sb <srijon.sb@samsung.com>
Signed-off-by: default avatarsrijon.sb <srijon.sb@samsung.com>
Signed-off-by: default avatarPhilippe Coval <philippe.coval@osg.samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/14731Tested-by: default avatarjenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16879Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarKevin Kane <kkane@microsoft.com>
parent 0c3b2fd7
......@@ -11,7 +11,7 @@ sqlite_env = env.Clone()
target_os = sqlite_env.get('TARGET_OS')
src_dir = sqlite_env.get('SRC_DIR')
targets_need_sqlite = ['android', 'msys_nt', 'windows']
targets_need_sqlite = ['android', 'msys_nt', 'windows', 'ios']
sqlite_dir = src_dir + '/extlibs/sqlite3/'
sqlite_build_dir = src_dir + '/extlibs/sqlite3/sqlite-amalgamation-3081101/'
sqlite_zip_file = src_dir + '/extlibs/sqlite3/sqlite-amalgamation-3081101.zip'
......
......@@ -54,7 +54,7 @@ if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
# Build liboctbstack
SConscript('csdk/SConscript')
if target_os not in ['arduino','darwin','ios']:
if target_os not in ['arduino','darwin']:
# Build liboc_logger
SConscript('oc_logger/SConscript')
......
......@@ -66,7 +66,7 @@ else:
env.AppendUnique(CPPDEFINES = ['NO_IP_ADAPTER'])
if with_tcp == True:
if target_os in ['linux', 'tizen', 'android', 'arduino', 'windows']:
if target_os in ['linux', 'tizen', 'android', 'arduino', 'ios', 'windows']:
env.AppendUnique(CPPDEFINES = ['TCP_ADAPTER', 'WITH_TCP'])
print "CA Transport is TCP"
else:
......
......@@ -177,7 +177,7 @@ if 'BLE' in ca_transport:
if 'NFC' in ca_transport:
env.SConscript(os.path.join(ca_path, 'nfc_adapter/SConscript'))
if ca_os in ['linux', 'tizen', 'android', 'windows']:
if ca_os in ['linux', 'tizen', 'android', 'ios', 'windows']:
if with_tcp == True:
env.SConscript(os.path.join(ca_path, 'tcp_adapter/SConscript'))
env.AppendUnique(CPPDEFINES = ['WITH_TCP'])
......
......@@ -15,7 +15,7 @@ src_dir = './tcp_adapter/'
# Source files to build common for all platforms
common_files = None
if target_os in ['linux', 'tizen', 'android', 'windows']:
if target_os in ['linux', 'tizen', 'android', 'ios', 'windows']:
common_files = [
os.path.join(src_dir, 'catcpadapter.c'),
os.path.join(src_dir, 'catcpserver.c') ]
......
......@@ -52,7 +52,7 @@ provisioning_env.PrependUnique(LIBS = ['octbstack', 'oc_logger', 'connectivity_a
provisioning_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509','mbedcrypto'])
if target_os not in ['msys_nt', 'windows', 'android']:
if target_os not in ['msys_nt', 'windows', 'android', 'ios']:
provisioning_env.ParseConfig('pkg-config --libs glib-2.0')
if target_os in ['windows', 'msys_nt']:
......@@ -107,7 +107,7 @@ else:
provisioning_env.AppendUnique(CPPPATH = ['#/extlibs/sqlite3'])
provisioning_src = provisioning_src + ['#/extlibs/sqlite3/sqlite3.c' ]
if target_os in ['windows', 'msys_nt']:
if target_os in ['windows', 'msys_nt', 'ios']:
# octbstack.dll is exporting ocpmapi APIs on Windows - there is no ocpmapi.dll.
provisioningserver = provisioning_env.StaticLibrary('ocpmapi', provisioning_src)
else:
......
......@@ -52,7 +52,7 @@ if target_os not in ['darwin', 'ios', 'windows', 'msys_nt']:
oc_logger_libs = []
if target_os in ['windows', 'msys_nt']:
if target_os in ['windows', 'msys_nt','ios']:
# If oc_logger APIs have to be exported from a Windows DLL, these functions
# should be exported from octbstack.dll. Building a separate oc_logger.dll here
# would result in duplicated code and data across these two DLLs. Using just
......
......@@ -89,7 +89,7 @@ if ocprovision_env.get('WITH_TCP') == True:
]
ocprovision_env.UserInstallTargetHeader('../include/OCCloudProvisioning.hpp', 'resource', 'OCCloudProvisioning.hpp')
if target_os not in ['windows']:
if target_os not in ['ios', 'windows']:
ocprovision = ocprovision_env.SharedLibrary('ocprovision', ocprovision_src)
else:
ocprovision = ocprovision_env.StaticLibrary('ocprovision', ocprovision_src)
......
......@@ -229,7 +229,7 @@ namespace OC
((int64_t*)array)[pos] = item;
}
#if !defined(_MSC_VER)
#if !(defined(_MSC_VER) || defined(__APPLE__))
template<>
void get_payload_array::copy_to_array(std::_Bit_reference br, void* array, size_t pos)
{
......
......@@ -121,7 +121,7 @@ oclib_src = [
if with_cloud:
oclib_src = oclib_src + ['OCAccountManager.cpp']
if target_os in ['windows']:
if target_os in ['windows', 'ios']:
oclib_src = oclib_src + ['OCApi.cpp']
# TODO: Add OC_EXPORT prefixes to enable DLL generation
oclib = oclib_env.StaticLibrary('oc', oclib_src)
......@@ -163,5 +163,5 @@ if with_cloud:
oclib_env.UserInstallTargetHeader(header_dir + 'OCAccountManager.h', 'resource', 'OCAccountManager.h')
# Add Provisioning library
if target_os in ['linux', 'android', 'tizen', 'windows'] and secured == '1':
if target_os in ['linux', 'android', 'tizen', 'ios', 'windows'] and secured == '1':
SConscript('../provisioning/SConscript')
......@@ -73,6 +73,7 @@ elif target_os in ['windows']:
boost_path = os.path.join(src_dir,'extlibs','boost','boost')
lib_env.AppendUnique(CPPPATH = [boost_path])
elif target_os == 'ios':
lib_env.AppendUnique(FRAMEWORKPATH = ['#extlibs/boost/ios/framework'])
lib_env.AppendUnique(FRAMEWORKS = ['boost'])
elif target_os == 'darwin':
lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
......
......@@ -26,7 +26,7 @@ Import('env')
target_os = env.get('TARGET_OS')
if target_os not in ['arduino','darwin', 'ios', 'windows']:
if target_os not in ['arduino','darwin', 'windows']:
# Build resource-encapsulation project
SConscript('resource-encapsulation/SConscript')
......@@ -34,11 +34,11 @@ if target_os not in ['arduino','darwin', 'ios', 'windows']:
SConscript('resource-container/SConscript')
# Build scene-manager project
if target_os in ['linux']:
if target_os in ['linux', 'ios']:
SConscript('scene-manager/SConscript')
# Build notification-service project
if target_os in ['linux','android','tizen']:
if target_os in ['linux','android','tizen','ios']:
SConscript('notification/SConscript')
# Build simulator module
......@@ -50,5 +50,5 @@ if target_os not in ['arduino','darwin', 'ios', 'windows']:
SConscript('coap-http-proxy/SConscript')
# Build EasySetup module
if target_os in ['arduino', 'android', 'linux','tizen']:
if target_os in ['arduino', 'android', 'ios', 'linux','tizen']:
SConscript('easy-setup/SConscript')
......@@ -26,7 +26,7 @@ Import('env')
es_target = env.get ('TARGET_OS')
service_easy_setup_env = env.Clone()
if es_target in ['android', 'linux', 'tizen']:
if es_target in ['android', 'ios', 'linux', 'tizen']:
SConscript('mediator/SConscript')
if es_target in ['linux', 'tizen']:
......
......@@ -85,7 +85,7 @@ if target_os in ['linux','tizen']:
if env.get('SECURED') == '1':
easy_setup_env.AppendUnique(LIBS = ['ocpmapi', 'ocprovision'])
if target_os in ['android','linux','tizen']:
if target_os in ['android','ios','linux','tizen']:
easy_setup_env.PrependUnique(CPPPATH = [
env.get('SRC_DIR') + '/resource/c_common/oic_malloc/include',
env.get('SRC_DIR') + '/resource/include',
......@@ -116,7 +116,7 @@ if target_os in ['android','linux','tizen']:
if env.get('WITH_TCP') == True:
easy_setup_env.AppendUnique(LIBS = ['mbedtls', 'mbedx509', 'mbedcrypto'])
if not env.get('RELEASE'):
if not env.get('RELEASE') and target_os not in ['ios']:
easy_setup_env.PrependUnique(LIBS = ['gcov'])
easy_setup_env.AppendUnique(CCFLAGS = ['--coverage'])
......@@ -128,7 +128,7 @@ print"easysetup_path %s" % easysetup_path
es_src = None
if target_os in ['android','linux','tizen']:
if target_os in ['android','ios','linux','tizen']:
if env.get('SECURED') == '1':
env.AppendUnique(es_src = [os.path.join(easysetup_path, 'src/EnrolleeSecurity.cpp')])
......@@ -140,10 +140,12 @@ if target_os in ['android','linux','tizen']:
env.AppendUnique(es_src = es_common_src)
es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich', env.get('es_src'))
es_sdk_static = easy_setup_env.StaticLibrary('ESMediatorRich', env.get('es_src'))
easy_setup_env.InstallTarget([es_sdk_shared, es_sdk_static], 'libESMediatorRich')
easy_setup_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libESMediatorRich.so'])
easy_setup_env.InstallTarget(es_sdk_static, 'libESMediatorRich')
if target_os not in ['ios']:
es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich', env.get('es_src'))
easy_setup_env.InstallTarget(es_sdk_shared, 'libESMediatorRich')
easy_setup_env.AppendUnique(LINKFLAGS = ['-Wl,-soname,libESMediatorRich.so'])
filenames = [ 'ESException.h', 'ESRichCommon.h', 'EasySetup.hpp', 'RemoteEnrollee.h' ]
for filename in filenames:
......
......@@ -120,13 +120,13 @@ notification_provider_src = [
notification_consumer_src = [
env.Glob('src/consumer/*.c'), notification_common_obj]
providersdk = notification_provider_env.SharedLibrary('notification_provider', notification_provider_src)
notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
notification_provider_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
consumersdk = notification_consumer_env.SharedLibrary('notification_consumer', notification_consumer_src)
notification_consumer_env.InstallTarget(consumersdk, 'libnotification_consumer')
notification_consumer_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
if target_os not in ['ios']:
providersdk = notification_provider_env.SharedLibrary('notification_provider', notification_provider_src)
notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
notification_provider_env.UserInstallTargetLib(providersdk, 'libnotification_provider')
consumersdk = notification_consumer_env.SharedLibrary('notification_consumer', notification_consumer_src)
notification_consumer_env.InstallTarget(consumersdk, 'libnotification_consumer')
notification_consumer_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer')
providersdk = notification_provider_env.StaticLibrary('notification_provider', notification_provider_src)
notification_provider_env.InstallTarget(providersdk, 'libnotification_provider')
......
......@@ -70,7 +70,7 @@ if target_os == 'android':
notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
if not env.get('RELEASE'):
if not env.get('RELEASE') and target_os not in ['ios']:
notification_env.PrependUnique(LIBS = ['gcov'])
notification_env.AppendUnique(CCFLAGS = ['--coverage'])
......@@ -100,9 +100,10 @@ Import('notificationCommonSharedObjs')
notification_consumer_src = [
env.Glob('src/*.cpp'),notificationCommonSharedObjs]
consumersdk = notification_env.SharedLibrary('notification_consumer_wrapper', notification_consumer_src)
notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
if target_os not in ['ios']:
consumersdk = notification_env.SharedLibrary('notification_consumer_wrapper', notification_consumer_src)
notification_env.InstallTarget(consumersdk, 'libnotification_consumer_wrapper')
notification_env.UserInstallTargetLib(consumersdk, 'libnotification_consumer_wrapper')
notification_consumer_src = [
env.Glob('src/*.cpp'),notificationCommonStaticObjs]
......
......@@ -71,7 +71,7 @@ if target_os == 'android':
notification_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
notification_env.PrependUnique(LIBS = ['gnustl_shared', 'log'])
if not env.get('RELEASE'):
if not env.get('RELEASE') and target_os not in ['ios']:
notification_env.PrependUnique(LIBS = ['gcov'])
notification_env.AppendUnique(CCFLAGS = ['--coverage'])
......@@ -112,9 +112,10 @@ notificationCommonSharedObjs = [
notification_provider_src = [
env.Glob('src/*.cpp'),notificationCommonSharedObjs]
providersdk = notification_env.SharedLibrary('notification_provider_wrapper', notification_provider_src)
notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
if target_os not in ['ios']:
providersdk = notification_env.SharedLibrary('notification_provider_wrapper', notification_provider_src)
notification_env.InstallTarget(providersdk, 'libnotification_provider_wrapper')
notification_env.UserInstallTargetLib(providersdk, 'libnotification_provider_wrapper')
notification_provider_src = [
env.Glob('src/*.cpp'),notificationCommonStaticObjs]
......
......@@ -130,10 +130,13 @@ if int(containerJavaSupport):
res_container_src = [ Glob('src/*.cpp') ]
res_container_static = resource_container_env.StaticLibrary('rcs_container', res_container_src)
res_container_shared = resource_container_env.SharedLibrary('rcs_container', res_container_src)
resource_container_env.InstallTarget([res_container_static,res_container_shared], 'libResContainer')
resource_container_env.UserInstallTargetLib([res_container_static,res_container_shared], 'libResContainer')
if target_os not in ['ios']:
res_container_shared = resource_container_env.SharedLibrary('rcs_container', res_container_src)
resource_container_env.InstallTarget([res_container_static,res_container_shared], 'libResContainer')
resource_container_env.UserInstallTargetLib([res_container_static,res_container_shared], 'libResContainer')
else:
resource_container_env.InstallTarget([res_container_static], 'libResContainer')
resource_container_env.UserInstallTargetLib([res_container_static], 'libResContainer')
resource_container_env.UserInstallTargetHeader('include/RCSBundleInfo.h', 'service/resource-container', 'RCSBundleInfo.h')
resource_container_env.UserInstallTargetHeader('include/RCSResourceContainer.h', 'service/resource-container', 'RCSResourceContainer.h')
......@@ -228,30 +231,31 @@ if target_os in ['linux']:
######################################################################
# Build Container Sample
######################################################################
containersample_env = resource_container_env.Clone();
containersample_env.AppendUnique(LINKFLAGS=["-rdynamic"])
if target_os not in ['ios']:
containersample_env = resource_container_env.Clone();
containersample_env.AppendUnique(LINKFLAGS=["-rdynamic"])
# Copy test configuration
Command("examples/ResourceContainerConfig.xml","examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE"))
Ignore("examples/ResourceContainerConfig.xml", "examples/ResourceContainerConfig.xml")
# Copy test configuration
Command("examples/ResourceContainerConfig.xml","examples/ResourceContainerConfig.xml", Copy("$TARGET", "$SOURCE"))
Ignore("examples/ResourceContainerConfig.xml", "examples/ResourceContainerConfig.xml")
containersample_env.AppendUnique(LIBS = ['rcs_container'])
containersample_env.AppendUnique(LIBS = ['rcs_container','resource_directory'])
containersampleapp_src = ['examples/ContainerSample.cpp']
containersampleapp = containersample_env.Program('ContainerSample',containersampleapp_src)
Alias("containersample", containersampleapp)
env.AppendTarget('containersample')
containersampleapp_src = ['examples/ContainerSample.cpp']
containersampleapp = containersample_env.Program('ContainerSample',containersampleapp_src)
Alias("containersample", containersampleapp)
env.AppendTarget('containersample')
######################################################################
# Build Container Sample Client
######################################################################
containersampleclient_env = resource_container_env.Clone();
containersampleclient_env = resource_container_env.Clone();
containersample_env.AppendUnique(LIBS = ['rcs_container'])
containersampleclient_src = ['examples/ContainerSampleClient.cpp']
containersampleclientapp = containersample_env.Program('ContainerSampleClient',containersampleclient_src)
Alias("containersampleclient", containersampleclientapp)
env.AppendTarget('containersampleclient')
containersample_env.AppendUnique(LIBS = ['rcs_container'])
containersampleclient_src = ['examples/ContainerSampleClient.cpp']
containersampleclientapp = containersample_env.Program('ContainerSampleClient',containersampleclient_src)
Alias("containersampleclient", containersampleclientapp)
env.AppendTarget('containersampleclient')
######################################################################
# Build Container Java SDK
......
......@@ -96,10 +96,13 @@ client_src = [
RESOURCECLIENT_DIR + 'RCSRemoteResourceObject.cpp'
]
ResourceClientsdk_static = resourceClient_env.StaticLibrary('rcs_client', client_src)
ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
if target_os not in ['ios']:
ResourceClientsdk_shared = resourceClient_env.SharedLibrary('rcs_client', client_src)
resourceClient_env.InstallTarget([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static,ResourceClientsdk_shared], 'rcs_client')
else:
resourceClient_env.InstallTarget([ResourceClientsdk_static], 'rcs_client')
resourceClient_env.UserInstallTargetLib([ResourceClientsdk_static], 'rcs_client')
resourceClient_env.UserInstallTargetHeader('include/RCSAddress.h', 'service/resource-encapsulation', 'RCSAddress.h')
resourceClient_env.UserInstallTargetHeader('include/RCSDiscoveryManager.h', 'service/resource-encapsulation', 'RCSDiscoveryManager.h')
resourceClient_env.UserInstallTargetHeader('include/RCSRemoteResourceObject.h', 'service/resource-encapsulation', 'RCSRemoteResourceObject.h')
......
......@@ -86,9 +86,13 @@ rcs_common_src = [
]
rcs_common_static = rcs_common_env.StaticLibrary('rcs_common', rcs_common_src)
rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src)
rcs_common_env.InstallTarget([rcs_common_static,rcs_common_shared], 'rcs_common')
rcs_common_env.UserInstallTargetLib([rcs_common_static,rcs_common_shared], 'rcs_common')
if target_os not in ['ios']:
rcs_common_shared = rcs_common_env.SharedLibrary('rcs_common', rcs_common_src)
rcs_common_env.InstallTarget([rcs_common_static,rcs_common_shared], 'rcs_common')
rcs_common_env.UserInstallTargetLib([rcs_common_static,rcs_common_shared], 'rcs_common')
else:
rcs_common_env.InstallTarget([rcs_common_static], 'rcs_common')
rcs_common_env.UserInstallTargetLib([rcs_common_static], 'rcs_common')
######################################################################
# Build Test Expiry Timer and primitive Resource
......
......@@ -20,12 +20,16 @@
#include "ResourcePresence.h"
#if (defined(__APPLE__) && defined(TARGET_OS_IPHONE))
#include <atomic>
#else
#ifndef __APPLE__
#ifndef TARGET_OS_MAC
#include <bits/atomic_base.h>
#include <bits/shared_ptr_base.h>
#endif
#endif
#endif
#include <time.h>
#include <unistd.h>
#include <cstdbool>
......
......@@ -78,10 +78,13 @@ if 'CLIENT' in rd_mode or 'SERVER' in rd_mode:
server_builder_src = server_builder_env.Glob('src/*.cpp')
server_builder_static = server_builder_env.StaticLibrary('rcs_server', server_builder_src)
server_builder_shared = server_builder_env.SharedLibrary('rcs_server', server_builder_src)
server_builder_env.InstallTarget([server_builder_static, server_builder_shared], 'rcs_server')
server_builder_env.UserInstallTargetLib([server_builder_static, server_builder_shared], 'rcs_server')
if target_os not in ['ios']:
server_builder_shared = server_builder_env.SharedLibrary('rcs_server', server_builder_src)
server_builder_env.InstallTarget([server_builder_static, server_builder_shared], 'rcs_server')
server_builder_env.UserInstallTargetLib([server_builder_static, server_builder_shared], 'rcs_server')
else:
server_builder_env.InstallTarget([server_builder_static], 'rcs_server')
server_builder_env.UserInstallTargetLib([server_builder_static], 'rcs_server')
######################################################################
# Build Test
......
......@@ -74,7 +74,7 @@ if target_os == 'android':
scenemanager_env.AppendUnique(CXXFLAGS = ['-frtti', '-fexceptions'])
scenemanager_env.AppendUnique(LIBS = ['gnustl_shared','log'])
if not env.get('RELEASE'):
if not env.get('RELEASE') and target_os not in ['ios']:
scenemanager_env.PrependUnique(LIBS = ['gcov'])
scenemanager_env.AppendUnique(CXXFLAGS = ['--coverage'])
......
......@@ -91,7 +91,8 @@ if target_os == 'android':
lib_env.AppendUnique(CCFLAGS = ['-w'])
elif target_os == 'ios':
lib_env.AppendUnique(FRAMEWORKS = ['boost', 'openssl'])
lib_env.AppendUnique(FRAMEWORKPATH = ['#extlibs/boost/ios/framework'])
lib_env.AppendUnique(FRAMEWORKS = ['boost'])
elif target_os == 'darwin':
lib_env.AppendUnique(CPPPATH = ['/usr/local/include'])
lib_env.AppendUnique(LIBPATH = ['/usr/local/lib'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment