Permalink
Browse files

templating manifest.json file for cross-platformness, added extra bui…

…ld steps for WIN32 to produce a clean plugin after build
  • Loading branch information...
1 parent 0ccea41 commit ba72b2f56e3c253422472186024b4bc2cc01c9fe @royshil royshil committed Mar 6, 2012
View
@@ -51,14 +51,24 @@ Chrome extensions support native code, which needs to be compiled. Now under fir
To install/compile: (Refer to http://www.firebreath.org/display/documentation/Building+FireBreath+Plugins for instructions, they have tutorials and videos, and the process is rather simple)
Start by downloading Firebreath: http://www.firebreath.org/display/documentation/Download
+(you must have CMake 2.6+ installed, OpenNI and NITE)
+
+### Mac building
cd ${DEPTHJS_DIR}/firebreath-plugin/
${FIREBREATH_DIR}/prepmac.sh . # make sure you run this from the DepthJS/firebreath-plugin directory
+ cd build
make
-(you must have CMake 2.6+ installed)
+### Windows building
+ cd ${DEPTHJS_DIR}/firebreath-plugin/
+ ${FIREBREATH_DIR}/prep2010.cmd . # optionally set "-DOpenNI_INCLUDE_DIRS=<...>", "-DOpenNI_LIBS=<...>", "-DNITE_INCLUDE_DIRS=<...>" and "-DNITE_LIBS=<..>"
+ start build\FireBreath.sln # at this point Visual Studio will open and you should be able to compile the plugin
+ copy_binary_win32.bat
+
+(Visual Studio is a prerequisite)
-The chrome extension is located in chrome-extension-mac/.
-The plugin is precompiled under chrome-extension-mac/plugin/.
+The chrome extension is located in chrome-extension/.
+The plugin is precompiled under chrome-extension/plugin/.
Go on chrome://extensions and use "Load upacked extension..." to manually load DepthJS as an extension, and you should be good to go.
@@ -15,9 +15,7 @@
"permissions": ["tabs", "http://*/*", "https://*/*","notifications"],
"plugins": [
-// { "path": "plugin/depthjs.so" },
-// { "path": "plugin/depthjsplugin.plugin" }
- { "path": "plugin/npdepthjsplugin.dll" }
+ { path: plugin/npdepthjsplugin.dll }
],
"browser_action": {
@@ -44,3 +42,4 @@
"run_at": "document_end" }
]
}
+
@@ -0,0 +1,44 @@
+{
+ "version": "1.0.0",
+
+ "name": "DepthJS",
+
+ "description": "Connecting depth-aware cameras to Javascript",
+
+ "background_page": "background.html",
+
+ "icons": {
+ "16": "images/logo_16x16.png",
+ "128": "images/logo_128x128.png"
+ },
+
+ "permissions": ["tabs", "http://*/*", "https://*/*","notifications"],
+
+ "plugins": [
+ $PLUGIN_PATH
+ ],
+
+ "browser_action": {
+ "default_icon": "images/logo_128x128.png",
+ "popup": "popup.html",
+ "default_title": "DepthJS"
+ },
+
+ "content_scripts": [
+ { "matches": ["http://*/*"],
+ "css": ["third_party/vfx/zflow/zflow.css",
+ "css/selectorBox.css"],
+ "js": ["third_party/jquery-1.4.4.min.js",
+ "third_party/underscore-min.js",
+ "content_script/root.js",
+ "content_script/depthose.js",
+ "third_party/vfx/zflow/zflow.js",
+ "content_script/panner.js",
+ "content_script/selector_box.js",
+ "content_script/event_handlers.js",
+ "content_script/event_link.js",
+ "chrome.js",
+ "content_script/init.js"],
+ "run_at": "document_end" }
+ ]
+}
@@ -55,6 +55,14 @@ else()
endif()
include_directories(${NITE_INCLUDE_DIRS})
+add_executable(simple_templater simple_templater.cpp)
+set_target_properties(simple_templater
+ PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+message(STATUS "setting output directory for simple_templater to ${CMAKE_CURRENT_SOURCE_DIR}")
+
+# { "path": "plugin/depthjs.so" },
+# { "path": "plugin/depthjsplugin.plugin" }
+# { "path": "plugin/npdepthjsplugin.dll" }
# This will include Win/projectDef.cmake, X11/projectDef.cmake, Mac/projectDef
# depending on the platform
@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>depthjsplugin</string>
- <key>CFBundleGetInfoString</key>
- <string>depthjsplugin 1.0.0.0, Copyright 2012 MIT Media Lab</string>
- <key>CFBundleIdentifier</key>
- <string>com.depthjspluginLib.DepthJS Plugin</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundlePackageType</key>
- <string>BRPL</string>
- <key>CFBundleShortVersionString</key>
- <string>depthjsplugin 1.0.0.0</string>
- <key>CFBundleSignature</key>
- <string>????</string>
- <key>CFBundleVersion</key>
- <string>1.0.0.0</string>
- <key>CFPlugInDynamicRegisterFunction</key>
- <string></string>
- <key>CFPlugInDynamicRegistration</key>
- <string>NO</string>
- <key>CFPlugInFactories</key>
- <dict>
- <key>00000000-0000-0000-0000-000000000000</key>
- <string>MyFactoryFunction</string>
- </dict>
- <key>CFPlugInTypes</key>
- <dict>
- <key>00000000-0000-0000-0000-000000000000</key>
- <array>
- <string>00000000-0000-0000-0000-000000000000</string>
- </array>
- </dict>
- <key>CFPlugInUnloadFunction</key>
- <string></string>
- <key>WebPluginDescription</key>
- <string>The native plugin part of the DepthJS project</string>
- <key>WebPluginMIMETypes</key>
- <dict>
- <key>application/x-depthjsplugin</key>
- <dict>
- <key>WebPluginExtensions</key>
- <array>
- <string></string>
- </array>
- <key>WebPluginTypeDescription</key>
- <string>The native plugin part of the DepthJS project</string>
- </dict>
- </dict>
- <key>WebPluginName</key>
- <string>DepthJS Plugin</string>
-</dict>
-</plist>
@@ -1,4 +0,0 @@
-/* Localized versions of Info.plist keys */
-
-CFBundleName = "depthjsplugin.plugin";
-NSHumanReadableCopyright = "Copyright 2012 MIT Media Lab";
@@ -1,23 +0,0 @@
-<OpenNI>
- <Licenses>
- <License vendor="PrimeSense" key="insert key here"/>
- </Licenses>
- <Log writeToConsole="true" writeToFile="false">
- <!-- 0 - Verbose, 1 - Info, 2 - Warning, 3 - Error (default) -->
- <LogLevel value="3"/>
- <Masks>
- <Mask name="ALL" on="false"/>
- </Masks>
- <Dumps>
- </Dumps>
- </Log>
- <ProductionNodes>
- <Node type="Depth">
- <Configuration>
- <Mirror on="true"/>
- </Configuration>
- </Node>
- <Node type="Gesture" />
- <Node type="Hands" />
- </ProductionNodes>
-</OpenNI>
@@ -29,6 +29,12 @@ set (SOURCES
add_windows_plugin(${PROJECT_NAME} SOURCES)
+add_custom_command(TARGET ${PROJECT_NAME}
+ POST_BUILD
+ COMMAND copy_binary_win32.bat
+ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ )
+
# This is an example of how to add a build step to sign the plugin DLL before
# the WiX installer builds. The first filename (certificate.pfx) should be
# the path to your pfx file. If it requires a passphrase, the passphrase
@@ -2,3 +2,4 @@ del "..\chrome-extension\plugin"
rmdir "..\chrome-extension\plugin"
mkdir "..\chrome-extension\plugin"
copy "build\bin\depthjsplugin\Debug\npdepthjsplugin.dll" "..\chrome-extension\plugin"
+Debug\simple_templater.exe ..\chrome-extension\manifest.json.template $PLUGIN_PATH "{ "path": "plugin/npdepthjsplugin.dll" }" ..\chrome-extension\manifest.json
@@ -0,0 +1,32 @@
+#include <iostream>
+#include <fstream>
+#include <string>
+
+using namespace std;
+
+int main(int argc, char** argv) {
+ if(argc < 5) {
+ cerr << "USAGE: simple_templater <template file> <token> <replacement> <output file>" << endl;
+ return 1;
+ }
+
+ size_t token_len = strlen(argv[2]);
+
+ ifstream ifs(argv[1],fstream::in);
+ ofstream ofs(argv[4],fstream::out);
+ char line[1024];
+ while(ifs.good()) {
+ ifs.getline(line,1024);
+ string line_s(line);
+ size_t found = line_s.find(argv[2]);
+ if(found != string::npos) {
+ cout << "found token in line." << endl;
+ line_s = line_s.replace(found,token_len,argv[3]);
+ }
+ ofs << line_s << endl;
+ }
+ ifs.close();
+ ofs.close();
+
+ return 0;
+}

0 comments on commit ba72b2f

Please sign in to comment.