From 9e43a4496b0418a31b93e45643df4975a8ca4619 Mon Sep 17 00:00:00 2001 From: Daedong Park Date: Thu, 18 Apr 2019 10:11:39 +0900 Subject: [PATCH] Fix build error on gcc version 7.x - Add missing standard library header - Rebuild google test 1.7.0 https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/5434c42da3c3d0deec5104aa022fce51e86660f1 (cherry picked from 5434c42da3c3d0deec5104aa022fce51e86660f1) Change-Id: Ia416aedec5c338088066b75667cec80f745969dc Signed-off-by: Daedong Park Signed-off-by: DoHyun Pyun --- extlibs/gtest/SConscript | 23 ++++++++++++++++++++++- resource/include/OCUtilities.h | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/extlibs/gtest/SConscript b/extlibs/gtest/SConscript index d127ccf..df306f4 100644 --- a/extlibs/gtest/SConscript +++ b/extlibs/gtest/SConscript @@ -6,6 +6,7 @@ ## import os +import shutil Import('env') @@ -22,7 +23,26 @@ gtest_url = 'http://pkgs.fedoraproject.org/repo/pkgs/gtest/gtest-1.7.0.zip/2d6ec if target_os in targets_need_gtest: print '*** Checking for installation of google unit test 1.7.0 ***' - if not os.path.exists(os.path.join(gtest_dir, 'configure')): + env_lib_path = env.get('LIBPATH') + if gtest_lib_dir in env_lib_path: + print '*** Found google unit test, set environments ***' + gtest_env.AppendUnique(LIBPATH = [gtest_dotlib_dir]) + gtest_env.PrependUnique(CPPPATH = [os.path.join(gtest_dir, 'include')]) + gtest_env.AppendENVPath('LD_LIBRARY_PATH', gtest_dotlib_dir) + if 'g++' in gtest_env.get('CXX'): + gtest_env.AppendUnique(CXXFLAGS = ['-std=c++0x']) + gtest_env.AppendUnique(CXXFLAGS = ['-Wall']) + if target_os not in ['android']: + gtest_env.AppendUnique(CXXFLAGS = ['-pthread']) + gtest_env.PrependUnique(LIBS = ['pthread']) + gtest_env.PrependUnique(LIBS = ['gtest', 'gtest_main']) + if target_os in ['windows']: + gtest_env.AppendUnique(LINKFLAGS = ['/subsystem:CONSOLE']) + Return('gtest_env') + else: + print '*** Prepare to build google unit test 1.7.0 ***' + if os.path.exists(gtest_dir): + shutil.rmtree(gtest_dir) # If the gtest zip file is not already present, download it if not os.path.exists(gtest_zip_file): gtest_zip = gtest_env.Download(gtest_zip_file, gtest_url) @@ -74,6 +94,7 @@ elif target_os in ['linux']: # Run make on gtest print 'Making google unit test' gtest_env.Configure(gtest_dir, 'make') + env.AppendUnique(LIBPATH = [gtest_lib_dir]) elif target_os == 'msys_nt': if os.path.exists(gtest_dir): diff --git a/resource/include/OCUtilities.h b/resource/include/OCUtilities.h index 85039d0..2339be2 100644 --- a/resource/include/OCUtilities.h +++ b/resource/include/OCUtilities.h @@ -21,6 +21,7 @@ #ifndef OC_UTILITIES_H_ #define OC_UTILITIES_H_ +#include #include #include #include -- 2.7.4