2 REM Helper script to build and run IoTivity on Windows
3 SETLOCAL ENABLEDELAYEDEXPANSION
17 REM *** Default BUILD OPTIONS ***
20 if "%TARGET_ARCH%" == "" (
28 if "%LOGGING%" == "" (
32 if "%RELEASE%" == "" (
38 set WITH_UPSTREAM_LIBCOAP=1
57 IF "%1"=="-debugger" (
58 set DEBUG="%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x64\cdb.exe" -2 -c "g"
68 REM We need to append the "PATH" so the octbstack.dll can be found by executables
69 IF "%BUILD_MSYS%" == "" (
70 set BUILD_DIR=out\windows\%TARGET_ARCH%\debug
71 set PATH=!PATH!;!IOTIVITY_DIR!!BUILD_DIR!;
73 set BUILD_DIR=out\msys_nt\x86_64\debug
74 set PATH=!PATH!;!BUILD_DIR!;C:\msys64\mingw64\bin
77 set BUILD_OPTIONS= TARGET_OS=%TARGET_OS% TARGET_ARCH=%TARGET_ARCH% RELEASE=%RELEASE% WITH_RA=0 TARGET_TRANSPORT=IP SECURED=%SECURED% WITH_TCP=0 BUILD_SAMPLE=ON LOGGING=%LOGGING% TEST=%TEST% RD_MODE=CLIENT ROUTING=%ROUTING% WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP%
79 REM Use MSVC_VERSION=12.0 for VS2013, or MSVC_VERSION=14.0 for VS2015.
80 REM If MSVC_VERSION has not been defined here, SCons chooses automatically a VS version.
81 IF NOT "%MSVC_VERSION%" == "" (
82 set BUILD_OPTIONS=%BUILD_OPTIONS% MSVC_VERSION=%MSVC_VERSION%
85 REM *** BUILD OPTIONS ***
87 if "!RUN_ARG!"=="server" (
88 cd %BUILD_DIR%\resource\examples
89 %DEBUG% simpleserver.exe
90 ) else if "!RUN_ARG!"=="client" (
91 cd %BUILD_DIR%\resource\examples
92 %DEBUG% simpleclient.exe
93 ) else if "!RUN_ARG!"=="serverhq" (
94 cd %BUILD_DIR%\resource\examples
95 %DEBUG% simpleserverHQ.exe
96 ) else if "!RUN_ARG!"=="clienthq" (
97 cd %BUILD_DIR%\resource\examples
98 %DEBUG% simpleclientHQ.exe
99 ) else if "!RUN_ARG!"=="mediaclient" (
100 cd %BUILD_DIR%\resource\examples
101 %DEBUG% mediaclient.exe
102 ) else if "!RUN_ARG!"=="mediaserver" (
103 cd %BUILD_DIR%\resource\examples
104 %DEBUG% mediaserver.exe
105 ) else if "!RUN_ARG!"=="winuiclient" (
106 cd %BUILD_DIR%\resource\examples
107 %DEBUG% winuiclient.exe
108 ) else if "!RUN_ARG!"=="occlient" (
109 cd %BUILD_DIR%\resource\csdk\stack\samples\linux\SimpleClientServer
110 %DEBUG% occlientbasicops.exe -u 0 -t 3 -c 1
111 ) else if "!RUN_ARG!"=="ocserver" (
112 cd %BUILD_DIR%\resource\csdk\stack\samples\linux\SimpleClientServer
113 %DEBUG% ocserverbasicops.exe
114 ) else if "!RUN_ARG!"=="provclient" (
115 cd %BUILD_DIR%\resource\csdk\security\provisioning\sample
116 %DEBUG% provisioningclient.exe
117 ) else if "!RUN_ARG!"=="justworks" (
118 cd %BUILD_DIR%\resource\csdk\security\provisioning\sample
119 %DEBUG% sampleserver_justworks.exe
120 ) else if "!RUN_ARG!"=="test" (
121 %DEBUG% %BUILD_DIR%\resource\csdk\connectivity\test\catests.exe
122 %DEBUG% %BUILD_DIR%\resource\csdk\stack\test\stacktests.exe
123 %DEBUG% %BUILD_DIR%\resource\csdk\stack\test\cbortests.exe
124 %DEBUG% %BUILD_DIR%\resource\csdk\security\unittest\unittest.exe
125 %DEBUG% %BUILD_DIR%\resource\csdk\security\provisioning\unittest\unittest.exe
126 %DEBUG% %BUILD_DIR%\resource\c_common\ocrandom\test\randomtests.exe
127 %DEBUG% %BUILD_DIR%\resource\c_common\oic_malloc\test\malloctests.exe
128 %DEBUG% %BUILD_DIR%\resource\c_common\oic_string\test\stringtests.exe
129 %DEBUG% %BUILD_DIR%\resource\c_common\oic_time\test\timetests.exe
130 %DEBUG% %BUILD_DIR%\resource\unittests\unittests.exe
131 ) else if "!RUN_ARG!"=="build" (
132 echo Starting IoTivity build with these options:
133 echo TARGET_OS=%TARGET_OS%
134 echo TARGET_ARCH=%TARGET_ARCH%
135 echo SECURED=%SECURED%
136 echo RELEASE=%RELEASE%
138 echo LOGGING=%LOGGING%
139 echo ROUTING=%ROUTING%
140 echo WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP%
141 echo MSVC_VERSION=%MSVC_VERSION%
142 echo.scons VERBOSE=1 %BUILD_OPTIONS%
143 scons VERBOSE=1 %BUILD_OPTIONS%
144 ) else if "!RUN_ARG!"=="clean" (
145 scons VERBOSE=1 %BUILD_OPTIONS% -c clean
148 del extlibs\gtest\gtest*.lib
149 del extlibs\gtest\gtest-1.7.0\src\gtest*.obj
151 erase resource\c_common\iotivity_config.h
152 erase extlibs\libcoap\coap.lib
153 erase extlibs\libcoap\libcoap\include\coap\coap_config.h
154 erase extlibs\mbedtls\mbed*.lib
155 ) else if "!RUN_ARG!"=="cleangtest" (
156 rd /s /q extlibs\gtest\gtest-1.7.0
157 del extlibs\gtest\gtest-1.7.0.zip
159 echo.%0 - Script requires a valid argument!
170 echo %0 - Helper to build/test iotivity. Requires an argument.
171 echo Installation: Drop this into your iotivity root directory to use it.
173 echo. Default build settings are: debug binaries run unittests and no logging
175 echo. Default build parameters can be overridden using the following arguments
177 echo -arch [x86 ^| amd64] - Build either amd64 or x86 architecture binaries
179 echo -noTest - Don't run the unittests after building the binaries
181 echo -logging - Enable logging while building the binaries
183 echo -debugger - Debug the requested application
185 echo -release - Build release binaries
187 echo. Usage examples:
188 echo Launch SimpleClient with debugger:
189 echo %0 client -debugger
191 echo Launch SimpleServer:
194 echo Launch WinUIClient built in msys:
195 echo %0 msys winuiclient
197 echo Build amd64 debug binaries and run unit tests:
200 echo Build amd64 release binaries w/o running tests:
201 echo %0 build -arch amd64 -noTest -release
203 echo Build x86 debug binaries and run unit tests:
204 echo %0 build -arch x86
206 echo Build amd64 release binaries with logging enabled:
207 echo %0 build -arch amd64 -release -logging