1 # WebODF is mostly a JavaScript project. CMake needs to know about the C++ parts
3 # version 2.8.2 is needed to have support for zip files in external projects
4 cmake_minimum_required(VERSION 2.8.2)
6 # At this point, the version number that is used throughout is defined
7 set(WEBODF_VERSION 0.3.0)
9 # This makefile 'compiles' WebODF using various tools, instruments the code and
10 # builds and packages programs that use WebODF.
12 # Find installed dependencies
13 find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtWebKit)
15 message(WARNING "Qt4 with modules QtCore QtGui QtXml QtNetwork QtWebKit was not found. qtjsruntime will no be built.")
18 # java runtime is needed for Closure Compiler
19 find_package(Java COMPONENTS Runtime)
21 if (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
22 message(FATAL_ERROR "Compiling in the source directortory is not supported. Use for example 'mkdir build; cd build; cmake ..'.")
23 endif (CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
25 # Tools must be obtained to work with:
26 include (ExternalProject)
28 if(Java_JAVA_EXECUTABLE)
32 URL "http://closure-compiler.googlecode.com/files/compiler-20120430.zip"
33 URL_MD5 352d51842e7fae5e8d190475da5086f3
38 set(CLOSURE_JAR ${CMAKE_CURRENT_BINARY_DIR}/ClosureCompiler-prefix/src/ClosureCompiler/compiler.jar)
39 endif(Java_JAVA_EXECUTABLE)
42 if(Java_JAVA_EXECUTABLE)
45 URL "http://ftp.mozilla.org/pub/js/rhino1_7R3.zip"
46 URL_MD5 99d94103662a8d0b571e247a77432ac5
51 set(RHINO ${CMAKE_CURRENT_BINARY_DIR}/Rhino-prefix/src/Rhino/js.jar)
52 endif(Java_JAVA_EXECUTABLE)
57 URL "http://jsdoc-toolkit.googlecode.com/files/jsdoc_toolkit-2.4.0.zip"
58 URL_MD5 a8f78f5ecd24b54501147b2af341a231
63 set(JSDOCDIR ${CMAKE_CURRENT_BINARY_DIR}/JsDoc-prefix/src/JsDoc/jsdoc-toolkit)
68 URL "http://nodejs.org/dist/v0.6.15/node-v0.6.15.tar.gz"
69 URL_MD5 852cfb1ed8125a4cdba456446d869d19
70 CONFIGURE_COMMAND "./configure"
74 set(NODE ${CMAKE_CURRENT_BINARY_DIR}/NodeJS-prefix/src/NodeJS/out/Release/node)
79 URL "http://siliconforks.com/jscoverage/download/jscoverage-0.5.1.tar.bz2"
80 URL_MD5 a70d79a6759367fbcc0bcc18d6866ff3
81 PATCH_COMMAND patch -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/JSCoverage.patch
82 CONFIGURE_COMMAND "./configure"
86 set(JSCOVERAGE ${CMAKE_CURRENT_BINARY_DIR}/JSCoverage-prefix/src/JSCoverage/jscoverage)
89 if (NOT ANDROID_SDK_DIR)
90 find_path(ANDROID_SDK_DIR platform-tools/aapt)
91 endif(NOT ANDROID_SDK_DIR)
93 find_file(ANT NAMES ant ant.exe /usr/bin /usr/local/bin)
98 set(LIBJSFILES lib/packages.js lib/runtime.js lib/core/Base64.js
99 lib/core/RawDeflate.js lib/core/ByteArray.js
100 lib/core/ByteArrayWriter.js lib/core/RawInflate.js
101 lib/core/Cursor.js lib/core/UnitTester.js
102 lib/core/PointWalker.js lib/core/Async.js
105 lib/xmldom/LSSerializerFilter.js lib/xmldom/LSSerializer.js
106 lib/xmldom/RelaxNGParser.js lib/xmldom/RelaxNG.js
107 lib/xmldom/RelaxNG2.js lib/xmldom/OperationalTransformInterface.js
108 lib/xmldom/OperationalTransformDOM.js
111 lib/odf/StyleInfo.js lib/odf/Style2CSS.js
112 lib/odf/FontLoader.js lib/odf/OdfContainer.js
113 lib/odf/Formatting.js lib/odf/OdfCanvas.js
115 lib/gui/PresenterUI.js lib/gui/Caret.js
116 lib/gui/SelectionMover.js lib/gui/XMLEdit.js
122 app/app.js app/controller/Files.js app/model/FileSystem.js
123 app/views/FileDetail.js app/views/FilesList.js app/views/OdfView.js
124 app/views/Viewport.js sencha-touch.css sencha-touch.js
125 app/store/FileStore.js
126 ZoomOut.png ZoomIn.png go-previous.png go-next.png
127 zoom-fit-width.png zoom-fit-best.png zoom-fit-height.png
130 add_subdirectory(webodf)
131 add_subdirectory(programs)
134 set(WEBODFZIP webodf-${WEBODF_VERSION}.zip)
136 ${CMAKE_CURRENT_BINARY_DIR}/webodf/webodf-debug.js
137 ${CMAKE_CURRENT_BINARY_DIR}/webodf/webodf.js
138 ${CMAKE_CURRENT_SOURCE_DIR}/webodf/webodf.css
142 # zip using javascript code running in node.js
143 COMMAND ${NODE} ARGS webodf/lib/runtime.js packwebodf.js
144 ${CMAKE_CURRENT_BINARY_DIR}/${WEBODFZIP}
156 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
158 add_custom_target(zip ALL DEPENDS ${WEBODFZIP})