Commit 6d6cc89b authored by Pawel Winogrodzki's avatar Pawel Winogrodzki Committed by Dan Mihai

IOT-1749: Enabling multi-threaded builds in Windows.

I've modified the global env configuration and run.bat in order
to make parallel builds possible and generate private symbols files
at the same time.

Change-Id: I770b5a57e4fb8b437b727d7937f37a411e2f6cca
Signed-off-by: default avatarPawel Winogrodzki <pawelwi@microsoft.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/16553Tested-by: default avatarjenkins-iotivity <jenkins@iotivity.org>
Reviewed-by: default avatarDan Mihai <Daniel.Mihai@microsoft.com>
parent 8aae021c
......@@ -30,10 +30,12 @@ if env['CC'] == 'cl':
env.AppendUnique(CCFLAGS = ['/MD', '/O2', '/GF'])
env.AppendUnique(CPPDEFINES = ['NDEBUG'])
else:
env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/Zi', '/RTC1', '/Gm'])
env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/RTC1'])
env.AppendUnique(LINKFLAGS = ['/debug'])
env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
env.AppendUnique(PATH = os.environ['PATH'])
env['PDB'] = '${TARGET.base}.pdb'
env.Append(LINKFLAGS=['/PDB:${TARGET.base}.pdb'])
# Add Windows-specific libraries
env.AppendUnique(LIBS = ['bcrypt', 'ws2_32', 'advapi32', 'iphlpapi', 'crypt32', 'kernel32'])
......
......@@ -62,5 +62,6 @@ if unittests_env.get('TEST') == '1':
from tools.scons.RunTest import *
run_test(unittests_env,
'plugins_unittests.memcheck',
'plugins/unittests/piunittests')
'plugins/unittests/piunittests',
piunittests)
......@@ -92,4 +92,5 @@ if rd_test_env.get('TEST') == '1':
if target_os in ['linux']:
run_test(rd_test_env,
'resource_csdk_resource-directory_unittests_rdtests.memcheck',
'resource/csdk/resource-directory/unittests/rdtests')
'resource/csdk/resource-directory/unittests/rdtests',
rd_client_test)
......@@ -110,7 +110,8 @@ if provisiontests_env.get('TEST') == '1':
provisiontests_env.AppendENVPath('LD_LIBRARY_PATH', [out_dir])
run_test(provisiontests_env,
'resource/provisioning/unittests/provisiontests.memcheck',
'resource/provisioning/unittests/provisiontests')
'resource/provisioning/unittests/provisiontests',
unittests)
src_dir = provisiontests_env.get('SRC_DIR')
svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
......
......@@ -114,7 +114,8 @@ if unittests_env.get('TEST') == '1':
if target_os in ['linux', 'windows']:
run_test(unittests_env,
'resource_unittests_unittests.memcheck',
'resource/unittests/unittests')
'resource/unittests/unittests',
unittests)
src_dir = unittests_env.get('SRC_DIR')
svr_db_src_dir = os.path.join(src_dir, 'resource/examples/')
......
......@@ -33,6 +33,7 @@ if "%RELEASE%" == "" (
set RELEASE=0
)
set THREAD_COUNT=%NUMBER_OF_PROCESSORS%
set SECURED=1
set ROUTING=EP
set WITH_TCP=1
......@@ -51,6 +52,10 @@ IF NOT "%1"=="" (
SET TARGET_ARCH=%2
SHIFT
)
IF "%1"=="-threads" (
SET THREAD_COUNT=%2
SHIFT
)
IF "%1"=="-noTest" (
SET TEST=0
)
......@@ -81,7 +86,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=CLIENT ROUTING=%ROUTING% WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP% MULTIPLE_OWNER=%MULTIPLE_OWNER%
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=CLIENT ROUTING=%ROUTING% WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP% MULTIPLE_OWNER=%MULTIPLE_OWNER% -j %THREAD_COUNT%
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.
......@@ -148,6 +153,7 @@ if "!RUN_ARG!"=="server" (
echo WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP%
echo MULTIPLE_OWNER=%MULTIPLE_OWNER%
echo MSVC_VERSION=%MSVC_VERSION%
echo THREAD_COUNT=%THREAD_COUNT%
echo.scons VERBOSE=1 %BUILD_OPTIONS%
scons VERBOSE=1 %BUILD_OPTIONS%
) else if "!RUN_ARG!"=="clean" (
......@@ -183,15 +189,17 @@ echo. Default build settings are: debug binaries run unittests and no logging
echo.
echo. Default build parameters can be overridden using the following arguments
echo.
echo -arch [x86 ^| amd64] - Build either amd64 or x86 architecture binaries
echo -arch [x86 ^| amd64] - Build either amd64 or x86 architecture binaries
echo.
echo -noTest - Don't run the unittests after building the binaries
echo -noTest - Don't run the unittests after building the binaries
echo.
echo -logging - Enable logging while building the binaries
echo -logging - Enable logging while building the binaries
echo.
echo -debugger - Debug the requested application
echo -debugger - Debug the requested application
echo.
echo -release - Build release binaries
echo -release - Build release binaries
echo.
echo -threads [NUMBER_OF_THREADS] - Build in parallel using [NUMBER_OF_THREADS] threads. Default: %NUMBER_OF_PROCESSORS%.
echo.
echo. Usage examples:
echo Launch SimpleClient with debugger:
......@@ -215,6 +223,9 @@ echo.
echo Build amd64 release binaries with logging enabled:
echo %0 build -arch amd64 -release -logging
echo.
echo Build using only one thread:
echo %0 build -threads 1
echo.
echo Run all tests:
echo %0 test
echo.
......
......@@ -94,4 +94,5 @@ if env.get('TEST') == '1':
if target_os in []:
run_test(easysetup_enrollee_test_env,
'service_easy-setup_enrollee_unittests_easysetup_enrollee_test.memcheck',
'service/easy-setup/enrollee/unittests/easysetup_enrollee_test')
'service/easy-setup/enrollee/unittests/easysetup_enrollee_test',
easysetup_enrollee_test)
......@@ -92,4 +92,5 @@ if env.get('TEST') == '1':
run_test(easysetup_mediator_test_env,
# 'service_easy-setup_mediator_richsdk_unittests_easysetup_mediator_test.memcheck',
'',
'service/easy-setup/mediator/richsdk/unittests/easysetup_mediator_test')
'service/easy-setup/mediator/richsdk/unittests/easysetup_mediator_test',
easysetup_mediator_test)
......@@ -106,8 +106,10 @@ if env.get('TEST') == '1':
'',
# 'service_notification_cpp-wrapper_unittest_notification_consumer_wrapper_test.memcheck',
'service/notification/cpp-wrapper/unittest/notification_consumer_wrapper_test')
'service/notification/cpp-wrapper/unittest/notification_consumer_wrapper_test',
notification_consumer_wrapper_test)
run_test(notification_provider_wrapper_test_env,
'',
# 'service_notification_cpp-wrapper_unittest_notification_provider_wrapper_test.memcheck',
'service/notification/cpp-wrapper/unittest/notification_provider_wrapper_test')
'service/notification/cpp-wrapper/unittest/notification_provider_wrapper_test',
notification_provider_wrapper_test)
......@@ -100,8 +100,10 @@ if env.get('TEST') == '1':
run_test(notification_consumer_test_env,
# 'service_notification_unittest_notification_consumer_test.memcheck',
'',
'service/notification/unittest/notification_consumer_test')
'service/notification/unittest/notification_consumer_test',
notification_consumer_test)
run_test(notification_provider_test_env,
# 'service_notification_unittest_notification_provider_test.memcheck',
'',
'service/notification/unittest/notification_provider_test')
'service/notification/unittest/notification_provider_test',
notification_provider_test)
......@@ -186,4 +186,5 @@ if container_gtest_env.get('TEST') == '1':
run_test(container_gtest_env,
# 'service_resource-container_unittests_container_test.memcheck',
'',
'service/resource-container/unittests/container_test')
'service/resource-container/unittests/container_test',
container_test)
......@@ -123,4 +123,5 @@ if target_os in ['linux']:
run_test(rcs_common_test_env,
# 'service_resource-encapsulation_src_common_rcs_common_test.memcheck',
'',
'service/resource-encapsulation/src/common/rcs_common_test')
'service/resource-encapsulation/src/common/rcs_common_test',
rcs_common_test)
......@@ -89,4 +89,5 @@ if broker_test_env.get('TEST') == '1':
# TODO: fix this test on linux and remove commented lines
# 'service_resource-encapsulation_src_resourceBroker_unittest_broker_test.memcheck',
'',
'service/resource-encapsulation/src/resourceBroker/unittest/broker_test')
'service/resource-encapsulation/src/resourceBroker/unittest/broker_test',
broker_test)
......@@ -79,4 +79,5 @@ if cache_test_env.get('TEST') == '1':
from tools.scons.RunTest import run_test
run_test(cache_test_env,
'service_resource-encapsulation_src_resourceCache_unittests_cache_test.memtest',
'service/resource-encapsulation/src/resourceCache/unittests/cache_test')
'service/resource-encapsulation/src/resourceCache/unittests/cache_test',
cache_test)
......@@ -113,4 +113,5 @@ if target_os in ['linux']:
# TODO: fix this test on linux and remove commented lines
'',
# 'service_resource-encapsulation_src_serverBuilder_rcs_server_test.memcheck',
'service/resource-encapsulation/src/serverBuilder/rcs_server_test')
'service/resource-encapsulation/src/serverBuilder/rcs_server_test',
server_builder_test)
......@@ -93,4 +93,5 @@ if rcs_test_env.get('TEST') == '1':
run_test(rcs_test_env,
# 'service_resource-encapsulation_unittests_rcs_client_test.memcheck',
'',
'service/resource-encapsulation/unittests/rcs_client_test')
'service/resource-encapsulation/unittests/rcs_client_test',
rcs_client_test)
......@@ -124,4 +124,5 @@ scene_test_env.AppendTarget('remote_scene_action_test')
# from tools.scons.RunTest import *
# run_test(scene_test_env,
# '',
# 'service/scene-manager/unittest/scene_test')
# 'service/scene-manager/unittest/scene_test',
# remote_scene_action_test)
......@@ -16,7 +16,7 @@
import os
def run_test(env, xml_file, test):
def run_test(env, xml_file, test, test_targets = ['test']):
"""
Run test with the given SCons Environment, dumping Valgrind
results to the given XML file. If no Valgrind run is desired
......@@ -65,4 +65,5 @@ def run_test(env, xml_file, test):
if env.get('TARGET_OS') in ['linux']:
env.Depends('ut' + test , os.path.join(build_dir, test))
ut = env.Command('ut' + test, None, test_cmd)
env.AlwaysBuild('ut' + test)
env.Depends(ut, test_targets)
env.AlwaysBuild(ut)
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