diff --git a/CMakeLists.txt b/CMakeLists.txt index 7fd90faf..92d75962 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -316,6 +316,9 @@ set(TOOLS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/webodf/tools) set(RUNTIMEJS ${CMAKE_CURRENT_SOURCE_DIR}/webodf/lib/runtime.js) set(LIBJSLICENSEFILE ${CMAKE_CURRENT_SOURCE_DIR}/AGPL-3.0.txt) +set(WEBODFJS_DIR ${CMAKE_CURRENT_BINARY_DIR}/webodf.js-${WEBODF_VERSION}) +set(WEBODFJS_ZIP webodf.js-${WEBODF_VERSION}.zip) + set(VIEWERBUILDDIR ${CMAKE_CURRENT_BINARY_DIR}/viewer) set(FIREFOX_EXTENSION_ODFVIEWER_DIR ${CMAKE_CURRENT_BINARY_DIR}/firefox-extension-odfviewer-${WEBODF_VERSION}) @@ -332,11 +335,8 @@ add_subdirectory(webodf) # the programs/components add_subdirectory(programs) - -############ -## Package -############ - +# old target used by the CI, with no user for the actual content +# to be removed after CI switched to build products directly set(WEBODFZIP webodf-${WEBODF_VERSION}.zip) set(WEBODFZIPDIR ${CMAKE_CURRENT_BINARY_DIR}/webodf-${WEBODF_VERSION}) add_custom_command( @@ -366,7 +366,7 @@ add_custom_command( editor-compiled.js-target html-benchmark viewer-minimized.js-target - firefoxextension-target + product-firefoxextension WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) add_custom_target(zip DEPENDS ${WEBODFZIP}) diff --git a/README-Building.md b/README-Building.md index 9e7afbd5..f3a8bb3a 100644 --- a/README-Building.md +++ b/README-Building.md @@ -78,3 +78,33 @@ Qt5 can be installed via homebrew, but will not be linked by default. CMake must specifying the Qt5 location in CMAKE_PATH_PREFIX environment variable: cmake -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.2.1 ../webodf + + +## Products + +There are several products that can be created during build. + +### webodf.js library with API documentation + +After you have prepared the buildsystem as described above, you execute this command: + + make product-library + +This creates a file "webodf.js-x.y.z.zip", which can be copied and used on a system where you want to develop using the webodf.js library +and have the documentation of the classes' API as HTML pages. + +### Firefox Add-on ODF Viewer + +After you have prepared the buildsystem as described above, you execute this command: + + make product-firefoxextension + +This creates a file "firefox-extension-odfviewer-x.y.z.xpi", which can be directly installed as add-on in Firefox browsers, so ODF files can be viewed directly in Firefox. + +### ViewerJS Plugin + +This is currently only called automatically during the build of [ViewerJS](http://viewerjs.org), you will not do this yourself. + + make product-viewerjsdir + +It creates a folder "viewer", which is then further processed in the build of ViewerJS. diff --git a/programs/firefoxextension/CMakeLists.txt b/programs/firefoxextension/CMakeLists.txt index 620e6cd0..696d921d 100644 --- a/programs/firefoxextension/CMakeLists.txt +++ b/programs/firefoxextension/CMakeLists.txt @@ -35,4 +35,4 @@ add_custom_command( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} ) -add_custom_target(firefoxextension-target DEPENDS ${FIREFOX_EXTENSION_ODFVIEWER}) +add_custom_target(product-firefoxextension DEPENDS ${FIREFOX_EXTENSION_ODFVIEWER}) diff --git a/programs/viewer/CMakeLists.txt b/programs/viewer/CMakeLists.txt index da3b61d8..5331d8da 100644 --- a/programs/viewer/CMakeLists.txt +++ b/programs/viewer/CMakeLists.txt @@ -67,4 +67,5 @@ add_custom_command( webodf.js-target viewer-minimized.js-target ) -add_custom_target(viewerbuilddir-target DEPENDS ${VIEWERBUILDDIR}) +add_custom_target(viewerbuilddir-target DEPENDS ${VIEWERBUILDDIR}) # remove once ViewerJS build uses product-viewerjsdir as target +add_custom_target(product-viewerjsdir DEPENDS viewerbuilddir-target) diff --git a/webodf/CMakeLists.txt b/webodf/CMakeLists.txt index 89a48a38..edbaee33 100644 --- a/webodf/CMakeLists.txt +++ b/webodf/CMakeLists.txt @@ -208,6 +208,35 @@ if (NOT APPLE) add_custom_target(instrumented DEPENDS instrumented/index.html) endif(NOT APPLE) + +add_custom_command( + OUTPUT ${WEBODFJS_DIR} + + # clear working dir + COMMAND ${CMAKE_COMMAND} -E remove_directory ${WEBODFJS_DIR} + COMMAND ${CMAKE_COMMAND} -E make_directory ${WEBODFJS_DIR} + + # API docs + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/docs ${WEBODFJS_DIR}/docs + # webodf.js + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/webodf.js ${WEBODFJS_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/webodf-debug.js ${WEBODFJS_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${LIBJSLICENSEFILE} ${WEBODFJS_DIR} + + # zip using javascript code running in Node.js + COMMAND ${NODE} ARGS ${RUNTIMEJS} ${TOOLS_DIR}/zipdir.js + ${WEBODFJS_DIR} + ${CMAKE_BINARY_DIR}/${WEBODFJS_ZIP} + + DEPENDS + ${TOOLS_DIR}/zipdir.js + doc + webodf.js-target + webodf-debug.js-target + ${LIBJSLICENSEFILE} +) +add_custom_target(product-library DEPENDS ${WEBODFJS_DIR}) + add_subdirectory(tests) # vim:expandtab