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
58 IF "%1"=="-debugger" (
59 set DEBUG="%ProgramFiles(x86)%\Windows Kits\10\Debuggers\x64\cdb.exe" -2 -c "g"
73 REM We need to append the "PATH" so the octbstack.dll can be found by executables
74 IF "%BUILD_MSYS%" == "" (
75 set BUILD_DIR=out\windows\%TARGET_ARCH%\%BINDIR%
76 set PATH=!PATH!;!IOTIVITY_DIR!!BUILD_DIR!;
78 set BUILD_DIR=out\msys_nt\x86_64\%BINDIR%
79 set PATH=!PATH!;!BUILD_DIR!;C:\msys64\mingw64\bin
82 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%
84 REM Use MSVC_VERSION=12.0 for VS2013, or MSVC_VERSION=14.0 for VS2015.
85 REM If MSVC_VERSION has not been defined here, SCons chooses automatically a VS version.
86 IF NOT "%MSVC_VERSION%" == "" (
87 set BUILD_OPTIONS=%BUILD_OPTIONS% MSVC_VERSION=%MSVC_VERSION%
90 REM *** BUILD OPTIONS ***
92 if "!RUN_ARG!"=="server" (
93 cd %BUILD_DIR%\resource\examples
94 %DEBUG% simpleserver.exe
95 ) else if "!RUN_ARG!"=="client" (
96 cd %BUILD_DIR%\resource\examples
97 %DEBUG% simpleclient.exe
98 ) else if "!RUN_ARG!"=="serverhq" (
99 cd %BUILD_DIR%\resource\examples
100 %DEBUG% simpleserverHQ.exe
101 ) else if "!RUN_ARG!"=="clienthq" (
102 cd %BUILD_DIR%\resource\examples
103 %DEBUG% simpleclientHQ.exe
104 ) else if "!RUN_ARG!"=="mediaclient" (
105 cd %BUILD_DIR%\resource\examples
106 %DEBUG% mediaclient.exe
107 ) else if "!RUN_ARG!"=="mediaserver" (
108 cd %BUILD_DIR%\resource\examples
109 %DEBUG% mediaserver.exe
110 ) else if "!RUN_ARG!"=="winuiclient" (
111 cd %BUILD_DIR%\resource\examples
112 %DEBUG% winuiclient.exe
113 ) else if "!RUN_ARG!"=="occlient" (
114 cd %BUILD_DIR%\resource\csdk\stack\samples\linux\SimpleClientServer
115 %DEBUG% occlientbasicops.exe -u 0 -t 3 -c 1
116 ) else if "!RUN_ARG!"=="ocserver" (
117 cd %BUILD_DIR%\resource\csdk\stack\samples\linux\SimpleClientServer
118 %DEBUG% ocserverbasicops.exe
119 ) else if "!RUN_ARG!"=="provclient" (
120 cd %BUILD_DIR%\resource\csdk\security\provisioning\sample
121 %DEBUG% provisioningclient.exe
122 ) else if "!RUN_ARG!"=="justworks" (
123 cd %BUILD_DIR%\resource\csdk\security\provisioning\sample
124 %DEBUG% sampleserver_justworks.exe
125 ) else if "!RUN_ARG!"=="test" (
126 %DEBUG% %BUILD_DIR%\resource\csdk\connectivity\test\catests.exe
127 %DEBUG% %BUILD_DIR%\resource\csdk\stack\test\stacktests.exe
128 %DEBUG% %BUILD_DIR%\resource\csdk\stack\test\cbortests.exe
129 %DEBUG% %BUILD_DIR%\resource\csdk\security\unittest\unittest.exe
130 %DEBUG% %BUILD_DIR%\resource\csdk\security\provisioning\unittest\unittest.exe
131 %DEBUG% %BUILD_DIR%\resource\c_common\ocrandom\test\randomtests.exe
132 %DEBUG% %BUILD_DIR%\resource\c_common\oic_malloc\test\malloctests.exe
133 %DEBUG% %BUILD_DIR%\resource\c_common\oic_string\test\stringtests.exe
134 %DEBUG% %BUILD_DIR%\resource\c_common\oic_time\test\timetests.exe
135 %DEBUG% %BUILD_DIR%\resource\unittests\unittests.exe
136 ) else if "!RUN_ARG!"=="build" (
137 echo Starting IoTivity build with these options:
138 echo TARGET_OS=%TARGET_OS%
139 echo TARGET_ARCH=%TARGET_ARCH%
140 echo SECURED=%SECURED%
141 echo RELEASE=%RELEASE%
143 echo LOGGING=%LOGGING%
144 echo ROUTING=%ROUTING%
145 echo WITH_UPSTREAM_LIBCOAP=%WITH_UPSTREAM_LIBCOAP%
146 echo MSVC_VERSION=%MSVC_VERSION%
147 echo.scons VERBOSE=1 %BUILD_OPTIONS%
148 scons VERBOSE=1 %BUILD_OPTIONS%
149 ) else if "!RUN_ARG!"=="clean" (
150 scons VERBOSE=1 %BUILD_OPTIONS% -c clean
153 del extlibs\gtest\gtest*.lib
154 del extlibs\gtest\gtest-1.7.0\src\gtest*.obj
156 erase resource\c_common\iotivity_config.h
157 erase extlibs\libcoap\coap.lib
158 erase extlibs\libcoap\libcoap\include\coap\coap_config.h
159 erase extlibs\mbedtls\mbed*.lib
160 ) else if "!RUN_ARG!"=="cleangtest" (
161 rd /s /q extlibs\gtest\gtest-1.7.0
162 del extlibs\gtest\gtest-1.7.0.zip
164 echo.%0 - Script requires a valid argument!
175 echo %0 - Helper to build/test iotivity. Requires an argument.
176 echo Installation: Drop this into your iotivity root directory to use it.
178 echo. Default build settings are: debug binaries run unittests and no logging
180 echo. Default build parameters can be overridden using the following arguments
182 echo -arch [x86 ^| amd64] - Build either amd64 or x86 architecture binaries
184 echo -noTest - Don't run the unittests after building the binaries
186 echo -logging - Enable logging while building the binaries
188 echo -debugger - Debug the requested application
190 echo -release - Build release binaries
192 echo. Usage examples:
193 echo Launch SimpleClient with debugger:
194 echo %0 client -debugger
196 echo Launch SimpleServer:
199 echo Launch WinUIClient built in msys:
200 echo %0 msys winuiclient
202 echo Build amd64 debug binaries and run unit tests:
205 echo Build amd64 release binaries w/o running tests:
206 echo %0 build -arch amd64 -noTest -release
208 echo Build x86 debug binaries and run unit tests:
209 echo %0 build -arch x86
211 echo Build amd64 release binaries with logging enabled:
212 echo %0 build -arch amd64 -release -logging