This topic describes how to build a sample application with Tizen Studio. The sample application uses Tizen Sockets Extension APIs and is based on the url2file cURL demo.
Before you can build the sample application:
To build a sample application based on url2file cURL demo with Tizen Studio:
Launch Tizen Studio.
Create a project in Tizen Studio:
Add the http://tizen.org/privilege/internet privilege to your application. For more information, see Configuring Web Applications.
http://tizen.org/privilege/internet
Add a new WebAssembly module to your project:
stdout
Either replace the contents of src/empty.cpp file in the created WebAssembly module with the contents of url2file_side_thread.cpp or just copy the "url2file_side_thread.cpp" file to the src/ directory and delete the src/empty.cpp file.
src/empty.cpp
src/
Download CA certificates extracted from Mozilla and save them in the main directory of the WebAssembly module project.
Add necessary compiler flag to your WebAssembly module:
Right-click on your WebAssembly module project.
Select "Properties" from the context menu.
Select "C/C++ Build > Settings".
On the "Tool Settings" tab, select "Emscripten C++ compiler > "Miscellaneous".
Append the following flag to the "Other flags" field:
-s USE_CURL=1
The-s USE_CURL=1 flag is required here and in the linker flags below. As a compiler flag it is required to make cURL include directories populated and provided to compilation stage (using the -I switch). Also, putting this flag here allows the indexer to see cURL-included directories and properly resolve cURL includes.
-I
Add necessary linker flags to your WebAssembly module:
On the "Tool Settings" tab, select "Emscripten C++ linker > "Miscellaneous".
Append the following flags to the "Linker flags" field:
-s ENVIRONMENT_MAY_BE_TIZEN -s USE_CURL=1 --preload-file ../cacert.pem@/cacert.pem -pthread -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=2
-s ENVIRONMENT_MAY_BE_TIZEN
--preload-file ../cacert.pem@/cacert.pem
fopen(./cacert.pem)
CurrentBin
cacert.pem
/cacert.pem
@/cacert.pem
-pthread -s USE_PTHREADS=1 -s PTHREAD_POOL_SIZE=2
Table 1: Linker flags
Build your WebAssembly module project.
Apply the following workarounds:
data
wasm_modules/scripts/wasm_tools.js
print()
locateFile: ( () => { return (path, prefix) => { if (prefix == '') { prefix = this.path.substring(0, this.path.lastIndexOf('/')) | ''; prefix = prefix + '/'; } return prefix + path; }; })(),
Build a signed package.
Now you are done and can run your application on the device.