Skip to content

Instruction to web player developlement environment on Windows

Hermet Park edited this page Oct 6, 2020 · 1 revision

Instruction

This is a build instruction of rlottie and rlottie.github.io for Windows Environment.

rlottie

For Windows

  1. Go to Microsoft Store and install Windows Terminal (Windows Powershell)

  2. Then, search for Windows Terminal (Windows Powershell) and run as an Adminsitrator

  3. Type in the following commands in Windows Powershell

    > dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
    > dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestar
  4. Restart Windows Powershell

  5. Install Ubuntu from Microsoft Store

    • If installed, Ubuntu Terminal will be loaded.
    • Type in your username and password.
    • Depending on the environment, it may take 5 to 10 minutes. (If it takes longer, re-install it)
  6. At Windows Powershell, type in wsl -l and check if the default system is Ubuntu

  7. Install the latest WSL2 Linux kernel

    • Download the Linux Kernel Update Package"
  8. Type in wsl -l -v into Windows Poweshell, and see if the version has been updated 2

    Name           State         Version
    * Ubuntu         Running       2
    • If the version is stated as 1, type in the following command to update the version to 2
      • wsl --set-version Ubuntu 2
      • Make sure to reload Ubuntu if the version does not change
        • wsl -t Ubuntu
    • Note
      • If your wsl -l -v command does not work, it is recommended to upgrade your Windows to version 1904 or higher
  9. Type in wsl from Windows Powershell

  10. Install the following packages

    • sudo apt install meson
      • If this doesn't work, type in the following command: sudo apt-get update
    • sudo apt-get install pkg-config
    • sudo apt-get install libgtest-dev
    • sudo apt-get install libefl-all-dev
  11. Install meson and ninja

    • If you have python3, you can install through following command: pip3 install meson ninja
    • If not, install from the following links
      • Meson
      • Ninja
  12. meson build

  13. ninja -C build

    • If successful, you may find out similar result.

      ninja: Entering directory `build'
      [59/59] Linking target example/lottieviewer.
  14. Install cmake

    • sudo apt install cmake
  15. Type in the following commands

    cd build
    cmake ..
    
    # install in a different path. eg ~/test/usr/lib
    cmake -DCMAKE_INSTALL_PREFIX=~/test ..
    
    # static build
    cmake -DBUILD_SHARED_LIBS=OFF ..
    
  16. Run make to build rlottie

make -j 2
  1. To install rlottie library
sudo make install

Test

  1. Configure to build test

    • meson configure -Dtest=true
    meson configure -Dtest=true
    WARNING: The source directory instead of the build directory was specified.
    WARNING: Only the default values for the project are printed, and all command line parameters are ignored.
    
    Core properties:
      Source dir /mnt/c/Users/rlottie.github.io/rlottie
    
    Main project options:
    
      Core options            Default Value        Possible Values                                               Description
      ------------            -------------        ---------------                                               -----------
      auto_features           auto                 [enabled, disabled, auto]                                     Override value of all 'auto' features
      backend                 ninja                [ninja, vs, vs2010, vs2015, vs2017, vs2019, xcode]            Backend to use
      buildtype               minsize              [plain, debug, debugoptimized, release, minsize, custom]      Build type to use
      debug                   true                 [true, false]                                                 Debug
      default_library         shared               [shared, static, both]                                        Default library type
      install_umask           0022                 [preserve, 0000-0777]                                         Default umask to apply on permissions of installed files
      layout                  mirror               [mirror, flat]                                                Build directory layout
      optimization            s                    [0, g, 1, 2, 3, s]                                            Optimization level
      strip                   false                [true, false]                                                 Strip targets on install
      unity                   off                  [on, off, subprojects]                                        Unity build
      warning_level           3                    [0, 1, 2, 3]                                                  Compiler warning level to use
      werror                  true                 [true, false]                                                 Treat warnings as errors
      wrap_mode               default              [default, nofallback, nodownload, forcefallback]              Wrap mode
      cmake_prefix_path       []                                                                                 T.List of additional prefixes for cmake to search
      pkg_config_path         []                                                                                 T.List of additional paths for pkg-config to search
      build.cmake_prefix_path []                                                                                 T.List of additional prefixes for cmake to search
      build.pkg_config_path   []                                                                                 T.List of additional paths for pkg-config to search
    
      Backend options         Default Value        Possible Values                                               Description
      ---------------         -------------        ---------------                                               -----------
      backend_max_links       0                    >=0                                                           Maximum number of linker processes to run or 0 for no limit
    
      Base options            Default Value        Possible Values                                               Description
      ------------            -------------        ---------------                                               -----------
      b_asneeded              true                 [true, false]                                                 Use -Wl,--as-needed when linking
      b_colorout              always               [auto, always, never]                                         Use colored output
      b_coverage              false                [true, false]                                                 Enable coverage tracking.
      b_lto                   false                [true, false]                                                 Use link time optimization
      b_lundef                true                 [true, false]                                                 Use -Wl,--no-undefined when linking
      b_ndebug                false                [true, false, if-release]                                     Disable asserts
      b_pch                   true                 [true, false]                                                 Use precompiled headers
      b_pgo                   off                  [off, generate, use]                                          Use profile guided optimization
      b_pie                   false                [true, false]                                                 Build executables as position independent
      b_sanitize              none                 [none, address, thread, undefined, memory, address,undefined] Code sanitizer to use
      b_staticpic             true                 [true, false]                                                 Build static libraries as position independent
    
      Compiler options        Default Value        Possible Values                                               Description
      ----------------        -------------        ---------------                                               -----------
      cpp_args                []                                                                                 Extra arguments passed to the cpp compiler
      cpp_debugstl            false                [true, false]                                                 STL debug mode
      cpp_eh                  default              [none, default, a, s, sc]                                     C++ exception handling type.
      cpp_link_args           []                                                                                 Extra arguments passed to the cpp linker
      cpp_rtti                true                 [true, false]                                                 Enable RTTI
      cpp_std                 c++14                [none, c++98, c++03, c++11, c++14, c++17, c++1z, c++2a,       C++ language standard to use
                                                    gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, gnu++2a]
      build.cpp_args          []                                                                                 Extra arguments passed to the cpp compiler
      build.cpp_debugstl      false                [true, false]                                                 STL debug mode
      build.cpp_eh            default              [none, default, a, s, sc]                                     C++ exception handling type.
      build.cpp_link_args     []                                                                                 Extra arguments passed to the cpp linker
      build.cpp_rtti          true                 [true, false]                                                 Enable RTTI
      build.cpp_std           none                 [none, c++98, c++03, c++11, c++14, c++17, c++1z, c++2a,       C++ language standard to use
                                                    gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, gnu++2a]
    
      Directories             Default Value        Possible Values                                               Description
      -----------             -------------        ---------------                                               -----------
      bindir                  bin                                                                                Executable directory
      datadir                 share                                                                              Data file directory
      includedir              include                                                                            Header file directory
      infodir                 share/info                                                                         Info page directory
      libdir                  lib/x86_64-linux-gnu                                                               Library directory
      libexecdir              libexec                                                                            Library executable directory
      localedir               share/locale                                                                       Locale data directory
      localstatedir           /var/local                                                                         Localstate data directory
      mandir                  share/man                                                                          Manual page directory
      prefix                  /usr/local                                                                         Installation prefix
      sbindir                 sbin                                                                               System executable directory
      sharedstatedir          /var/local/lib                                                                     Architecture-independent data directory
      sysconfdir              etc                                                                                Sysconf data directory
    
      Testing options         Default Value        Possible Values                                               Description
      ---------------         -------------        ---------------                                               -----------
      errorlogs               true                 [true, false]                                                 Whether to print the logs from failing tests
      stdsplit                true                 [true, false]                                                 Split stdout and stderr in test logs
    
      Project options         Default Value        Possible Values                                               Description
      ---------------         -------------        ---------------                                               -----------
      cache                   true                 [true, false]                                                 Enable cache support in rlottie
      cmake                   false                [true, false]                                                 Enable Generating  CMake config files
      dumptree                false                [true, false]                                                 Enable logging the rlottie tree in rlottie
      example                 true                 [true, false]                                                 Enable building examples
      log                     false                [true, false]                                                 Enable logging in rlottie
      module                  true                 [true, false]                                                 Enable module support in rlottie
      moduledir                                                                                                  Dynamic plugins directory
      test                    false                [true, false]                                                 Enable building unit tests
      thread                  true                 [true, false]                                                 Enable threading in rlottie
    
    WARNING: The source directory instead of the build directory was specified.
    WARNING: Only the default values for the project are printed, and all command line parameters are ignored.
  2. Build test suit

  • ninja
[0/1] Regenerating build files.
The Meson build system
Version: 0.53.2
Source dir: /mnt/c/Users/rlottie.github.io/rlottie
Build dir: /mnt/c/Users/rlottie.github.io/rlottie/build
Build type: native build
Project name: rlottie
Project version: 0.1
C++ compiler for the host machine: c++ (gcc 9.3.0 "c++ (Ubuntu 9.3.0-10ubuntu2) 9.3.0")
C++ linker for the host machine: c++ ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Configuring config.h using configuration
Library dl found: YES
Dependency threads found: YES unknown (cached)
Dependency elementary found: YES 1.23.3 (cached)
Dependency gtest found: YES 1.10.0 (cached)
Message:

Summary:
    rlottie version :        0.1
    Build type      :        minsize
    Thread Support  :        true
    Module Support  :        true
    Cache  Support  :        true
    Example         :        true
    Test            :        true
    Prefix          :        /usr/local

Build targets in project: 10
  1. Run test suit
  • ninja test
[0/1] Running all tests.
1/2 Vector Testsuite                        OK       0.05 s
2/2 Animation Testsuite                     OK       0.08 s

Ok:                    2
Expected Fail:         0
Fail:                  0
Unexpected Pass:       0
Skipped:               0
Timeout:               0

Full log written to /mnt/c/Users/rlottie.github.io/rlottie/build/meson-logs/testlog.txt

  1. Setup the emscripten sdk environment - Follow Download and Install steps
# Get the emsdk repo
git clone https://github.com/emscripten-core/emsdk.git

# Enter that directory
cd emsdk
ls
# Fetch the latest version of the emsdk (not needed the first time you clone)
git pull

# Download and install the latest SDK tools.
./emsdk install latest

# Make the "latest" SDK "active" for the current user. (writes .emscripten file)
./emsdk activate latest

# Activate PATH and other environment variables in the current terminal
source ./emsdk_env.sh
  1. Clone the rlottie repo
git clone --recurse-submodules 
  1. move in to the rlottie folder
cd rlottie
  1. If builddir_wasm folder exists, erase the following folder
rm -rf builddir_wasm
  1. ../wasm_build.sh /{absolute_path}/emsdk/
  • To get absolute path, go into the emsdk directory and enter pwd
  • The result of pwd shows the current absolute path
  1. copy rlottie-wasm.* files
cp builddir_wasm/src/rlottie-wasm.* ../
  • If you get an error, make sure to erase rlottie-wasm.js and rlottie-wasm.wasm files from [rlottie.github.io/](http://rlottie.github.io/) location (folder directory)
  • Then re-type the command cp builddir_wasm/src/rlottie-wasm.* ../

Test

  1. Make sure to activate PATH and other environment variables in the current terminal

    • Move to emsdk directory
    source ./emsdk_env.sh
  2. Move to rlottie.github.io directory

  3. Edit test.sh file

    emrun --browser "absolute_path_to_your_browser" index.html
    • Type in absolute path to your browser
  4. If the above command doesn't work, type in the following command to the wsl: emrun --no_browser index.html