From: Pawel Winogrodzki Date: Mon, 3 Apr 2017 23:14:33 +0000 (-0700) Subject: IOT-1583: Fixing libcoap W4 warnings. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d3b382c901ee304d4f3466fa33758f5510fdf9d4;p=contrib%2Fiotivity.git IOT-1583: Fixing libcoap W4 warnings. This commit makes sure libcoap doesn't generate any W4 warnings when building with for Windows. In addition to that automatic libcoap updates are enabled by default for Jenkins builds and optional for regular builds. Change-Id: I676a98bd41c2aeb28fee7d5ed1283145fd306655 Signed-off-by: Pawel Winogrodzki Reviewed-on: https://gerrit.iotivity.org/gerrit/18545 Tested-by: jenkins-iotivity Reviewed-by: Dan Mihai --- diff --git a/build_common/SConscript b/build_common/SConscript index 4e0a3fc..18d818b 100755 --- a/build_common/SConscript +++ b/build_common/SConscript @@ -131,6 +131,7 @@ help_vars.Add(PathVariable('ANDROID_HOME', 'Android SDK path', None, PathVariabl help_vars.Add(PathVariable('ANDROID_GRADLE', 'Gradle binary file', None, PathVariable.PathIsFile)) help_vars.Add(EnumVariable('WITH_UPSTREAM_LIBCOAP', 'Use latest stable version of LibCoAP downloaded from github', default_with_upstream_libcoap, allowed_values=('0','1'))) help_vars.Add(BoolVariable('WITH_ENV', 'Use compiler options from environment', False)) +help_vars.Add(BoolVariable('AUTOMATIC_UPDATE', 'Makes libcoap update automatically to the required versions if needed.', False)) if target_os == 'windows': # For VS2013, MSVC_VERSION is '12.0'. For VS2015, MSVC_VERSION is '14.0'. diff --git a/extlibs/libcoap/SConscript b/extlibs/libcoap/SConscript index d4b226a..db2bdbe 100644 --- a/extlibs/libcoap/SConscript +++ b/extlibs/libcoap/SConscript @@ -49,10 +49,10 @@ libcoap_repo_url = 'https://github.com/dthaler/libcoap' # Right now this script assumes the revision is a tag, and not a branch or an arbitrary # commit. If this changes, update the check below, or else the script will always conclude # the repo is not up to date because a tag with that name doesn't exist. -libcoap_version = 'IoTivity-1.2.1c' +libcoap_version = 'IoTivity-1.2.1d' libcoap_dir = os.path.join(src_dir, 'extlibs', 'libcoap', 'libcoap') libcoap_checkout_command = 'git clone ' + libcoap_repo_url + '.git extlibs/libcoap/libcoap -b ' + libcoap_version -libcoap_update_command = 'git fetch && git checkout -f ' + libcoap_version +libcoap_update_command = 'git fetch --tags && git checkout -f ' + libcoap_version libcoap_change_dir_command = 'cd ' + libcoap_dir if with_upstream_libcoap == '1': @@ -72,12 +72,24 @@ if with_upstream_libcoap == '1': print ''' *********************************** Info: ***************************************** * Your libCoAP repo is not up to date with the latest version we require (%s). +*********************************************************************************** + ''' %(libcoap_version) + if libcoap_env.get('AUTOMATIC_UPDATE'): + print ''' +*********************************** Info: ***************************************** +* Automatically updating libcoap to version %s. +*********************************************************************************** + ''' %(libcoap_version) + subprocess.check_output(libcoap_update_command, shell = True) + else: + print ''' +*********************************** Info: ***************************************** * Please update using the following commands: * %s * %s *********************************************************************************** - ''' %(libcoap_version, libcoap_change_dir_command, libcoap_update_command) - Exit(1) + ''' %(libcoap_change_dir_command, libcoap_update_command) + Exit(1) else: print ''' @@ -273,6 +285,9 @@ else: libcoap_src_root = src_dir + '/resource/csdk/connectivity/lib/libcoap-4.1.1' libcoap_src = glob.glob(os.path.join(libcoap_src_root, '*.c')) +if libcoap_env['CC'] == 'cl': + libcoap_env.AppendUnique(CCFLAGS = ['/W4', '/WX']) + libcoap = libcoap_env.StaticLibrary('coap', libcoap_src, OBJPREFIX='libcoap_') Clean(libcoap, config_h_file_path) diff --git a/run.bat b/run.bat index 13c9b56..a44f0c2 100644 --- a/run.bat +++ b/run.bat @@ -17,6 +17,12 @@ IF /I "%1" == "msys" ( REM *** Default BUILD OPTIONS *** set TARGET_OS=windows +if "%JENKINS_HOME%" == "" ( + set AUTOMATIC_UPDATE=0 +) else ( + set AUTOMATIC_UPDATE=1 +) + if "%TARGET_ARCH%" == "" ( set TARGET_ARCH=amd64 ) @@ -88,6 +94,9 @@ IF NOT "%1"=="" ( IF /I "%1"=="-noMOT" ( set MULTIPLE_OWNER=0 ) + IF /I "%1"=="-automaticUpdate" ( + set AUTOMATIC_UPDATE=1 + ) SHIFT GOTO :processArgs @@ -106,7 +115,7 @@ IF "%BUILD_MSYS%" == "" ( set PATH=!PATH!;!BUILD_DIR!;C:\msys64\mingw64\bin ) -set BUILD_OPTIONS= TARGET_OS=%TARGET_OS% TARGET_ARCH=%TARGET_ARCH% RELEASE=%RELEASE% WITH_RA=0 TARGET_TRANSPORT=IP SECURED=%SECURED% WITH_TCP=%WITH_TCP% BUILD_SAMPLE=ON LOGGING=%LOGGING% TEST=%TEST% RD_MODE=%RD_MODE% ROUTING=%ROUTING% WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP% MULTIPLE_OWNER=%MULTIPLE_OWNER% -j %THREAD_COUNT% +set BUILD_OPTIONS= TARGET_OS=%TARGET_OS% TARGET_ARCH=%TARGET_ARCH% RELEASE=%RELEASE% WITH_RA=0 TARGET_TRANSPORT=IP SECURED=%SECURED% WITH_TCP=%WITH_TCP% BUILD_SAMPLE=ON LOGGING=%LOGGING% TEST=%TEST% RD_MODE=%RD_MODE% ROUTING=%ROUTING% WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP% MULTIPLE_OWNER=%MULTIPLE_OWNER% -j %THREAD_COUNT% AUTOMATIC_UPDATE=%AUTOMATIC_UPDATE% REM Use MSVC_VERSION=12.0 for VS2013, or MSVC_VERSION=14.0 for VS2015. REM If MSVC_VERSION has not been defined here, SCons chooses automatically a VS version. @@ -174,6 +183,7 @@ if "!RUN_ARG!"=="server" ( echo MULTIPLE_OWNER=%MULTIPLE_OWNER% echo MSVC_VERSION=%MSVC_VERSION% echo THREAD_COUNT=%THREAD_COUNT% + echo AUTOMATIC_UPDATE=%AUTOMATIC_UPDATE% echo.scons VERBOSE=1 %BUILD_OPTIONS% scons VERBOSE=1 %BUILD_OPTIONS% ) else if "!RUN_ARG!"=="clean" ( @@ -223,6 +233,9 @@ echo -noSecurity - Remove security support (results in code t echo. echo -noMOT - Remove Multiple Ownership Transfer support. echo. +echo -automaticUpdate - Automatically update libcoap to required version. +echo. +echo. echo. Usage examples: echo. echo Launch SimpleClient with debugger: