Skip to content

Building the Source

Matthew Ng edited this page Apr 4, 2016 · 35 revisions

Contents

Two different ways to build the entire project

  1. Easy: Must be on Windows, you can run the python script to build everything
  2. Harder: Build each part individually

Prerequisites

  1. Install Visual Studio 2015 Community Edition
  2. Install Git bash
  3. Install Node.js (5.10+)
  4. Install Python 2.7.3
  5. Install nw-gyp (nw-0.12.2+) if you plan to build the interface
  6. Install Inno Setup installer if you plan to build setup.exe

Download the source recursively

Download Git and clone the repo

git clone --recursive https://github.com/matthewn4444/Lightpack-Filter-and-API.git

  • this will also clone dlib thirdparty library
  • this will also clone directshow-sdk library

Easy: Single Build Script

You can only do this on Windows.

  1. You must open any *.sln file in Visual Studio or the next step will fail
  2. Then run the build.py script. It will fail if above didn't run. If it fails try to reboot pc and do step 1 again
  3. The setup.exe and lightpack.zip should be in the Release folder

Harder: Building Individually

To build one of the following, you must do everything above it since it will be dependent on it.

  1. Build Lightpack C++ API
  2. Build Lightpack Directshow filter
  3. Build Lightpack Node.js extension
  4. Build Application mutex Node.js extension
  5. Build the Lightpack filter interface
  6. Build the installer file

Alternatively, if the file has a build.py script, you can run it in that folder and it should build the solution. Note that you must open a *sln project in Visual Studio before running the python script.

1. Build Lightpack C++ API

Windows

  1. Go to the folder of the repo
  2. Run Lightpack.sln inside Visual Studio
  3. Build project LightpackAPI
  4. [Optional] you can build the Test project to test that Lightpack works (after plugging the USB in)

To use this in your project follow instructions here

Mac & Linux

There isn't a make file but I assume since the libraries are cross-platform, this project should compile to Linux and Mac.

2. Build Lightpack Node.js extension

Windows

  1. Change folders to nodejs/lightpack
  2. Install nw-gyp (with node), also needs Python 2.7.3 (read their instructions)
  3. Install Git-bash
  4. Run configure-win.sh (only works if you have bash installed)
  5. Change folders to vs/
  6. Open lightpack.sln in Visual Studio
  7. Change the build to Release (debug will NOT work)
  8. Build the project and lightpack.node will be inside /Release folder

Mac & Linux

  1. Change folders to nodejs/lightpack
  2. Install nw-gyp, also needs Python 2.7.3 (read their instructions)
  3. Run $ nw-gyp configure --target=0.13.0 (change target with other versions of Node-webkit)
  4. You should have a MakeFile, you will need to add dependencies to Lightpack C++ API (TODO)
  5. Run nw-gyp build to build the extension

To use this in your project follow instructions here

3. Build Lightpack Directshow filter (Windows)

  1. You must build directshow first. You must have init all submodules to have directshow sdk downloaded in directshow/directshow-sdk. Go there and open baseclasses/baseclasses.sln in Visual Studio
  2. Compile all 4 permutations of Debug + x86, Debug + x64, Release + x86 and Release + x64
  3. Open Lightpack.sln in Visual Studio from root folder of repo
  4. Change build to Release
  5. Build Lightpack-filter project and the lightpack.ax file should be in /Release
  6. Build Lightpack-filter project for x64 by selecting the platform from visual studio and the lightpack64.ax file should be in /Release

To use this in your project follow instructions here

4. Build Application mutex Node.js extension (Windows)

This uses CreateMutex("Name") (documentation here) for Node.js so that other applications can tell if a Node-webkit application is running by checking the global mutex. This only works on Windows because the API is for Windows.

  1. Open folder /nodejs/app-mutex/
  2. Install nw-gyp, also needs Python 2.7.3 (read their instructions)
  3. Run configure-win.sh
  4. Change folder to /vs
  5. Run app-mutex.sln
  6. Change the Build to Release
  7. Build the project and app-mutex.node will be in /Release

To use this in your project follow instructions here

5. Build the Lightpack filter interface (Windows)

Assuming all of the above is built correctly, you can now build the interface.

  1. Download the Node-webkit prebuild libraries here for Windows 32bit (I used version 0.13.0)
  2. Create a folder in /nodejs/ called nw-binaries and extract all the items from step 1 to this folder
  3. Make sure Node.js is installed
  4. Change folder /directshow/Lightpack-filter-gui/
  5. Run build_all.bat
  6. You can run run.bat instead to run the application
  7. Change folders to /Release to find all the files and lightpack-filter.zip file

You can run the GUI by running nw.exe.

6. Build the installer file

  1. Run build_all.bat and setup.exe will be in the /Release folder