Update version number to match the last number used in the firefox extension.
[odfkit:webodf.git] / CMakeLists.txt
1 # WebODF is mostly a JavaScript project. CMake needs to know about the C++ parts
2 project (WebODF C CXX)
3 # version 2.8.2 is needed to have support for zip files in external projects
4 cmake_minimum_required(VERSION 2.8.2)
5
6 # At this point, the version number that is used throughout is defined
7 set(WEBODF_VERSION 0.3.0)
8
9 # This makefile 'compiles' WebODF using various tools, instruments the code and
10 # builds and packages programs that use WebODF.
11
12 # Find installed dependencies
13 find_package(Qt4 4.7.0 COMPONENTS QtCore QtGui QtXml QtNetwork QtWebKit)
14 if (NOT QT4_FOUND)
15   message(WARNING "Qt4 with modules QtCore QtGui QtXml QtNetwork QtWebKit was not found. qtjsruntime will no be built.")
16 endif (NOT QT4_FOUND)
17
18 # java runtime is needed for Closure Compiler
19 find_package(Java COMPONENTS Runtime)
20
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)
24
25 # Tools must be obtained to work with:
26 include (ExternalProject)
27
28 if(Java_JAVA_EXECUTABLE)
29     # Closure Compiler
30     ExternalProject_Add(
31         ClosureCompiler
32         URL "http://closure-compiler.googlecode.com/files/compiler-20111114.tar.gz"
33         URL_MD5 fb176781e26b0de088777db9f88dcc05
34         CONFIGURE_COMMAND ""
35         BUILD_COMMAND ""
36         INSTALL_COMMAND ""
37     )
38     set(CLOSURE_JAR ${CMAKE_BINARY_DIR}/ClosureCompiler-prefix/src/ClosureCompiler/compiler.jar)
39 endif(Java_JAVA_EXECUTABLE)
40
41 # Rhino
42 if(Java_JAVA_EXECUTABLE)
43     ExternalProject_Add(
44         Rhino
45         URL "ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip"
46         URL_MD5 99d94103662a8d0b571e247a77432ac5
47         CONFIGURE_COMMAND ""
48         BUILD_COMMAND ""
49         INSTALL_COMMAND ""
50     )
51     set(RHINO ${CMAKE_BINARY_DIR}/Rhino-prefix/src/Rhino/js.jar)
52 endif(Java_JAVA_EXECUTABLE)
53
54 # JSDoc
55 ExternalProject_Add(
56     JsDoc
57     URL "http://jsdoc-toolkit.googlecode.com/files/jsdoc_toolkit-2.4.0.zip"
58     URL_MD5 a8f78f5ecd24b54501147b2af341a231
59     CONFIGURE_COMMAND ""
60     BUILD_COMMAND ""
61     INSTALL_COMMAND ""
62 )
63 set(JSDOCDIR ${CMAKE_BINARY_DIR}/JsDoc-prefix/src/JsDoc/jsdoc-toolkit)
64
65 # Node.JS
66 ExternalProject_Add(
67     NodeJS
68     URL "http://nodejs.org/dist/node-v0.4.12.tar.gz"
69     URL_MD5 a6375eaa43db5356bf443e25b828ae16
70     INSTALL_COMMAND ""
71 )
72 set(NODE ${CMAKE_BINARY_DIR}/NodeJS-prefix/src/NodeJS-build/default/node)
73
74 # JSCoverage
75 ExternalProject_Add(
76     JSCoverage
77     URL "http://siliconforks.com/jscoverage/download/jscoverage-0.5.1.tar.bz2"
78     URL_MD5 a70d79a6759367fbcc0bcc18d6866ff3
79     PATCH_COMMAND patch -p0 < ${CMAKE_CURRENT_SOURCE_DIR}/JSCoverage.patch
80     CONFIGURE_COMMAND "./configure"
81     BUILD_IN_SOURCE 1
82     INSTALL_COMMAND ""
83 )
84 set(JSCOVERAGE ${CMAKE_BINARY_DIR}/JSCoverage-prefix/src/JSCoverage/jscoverage)
85
86 # Android
87 find_path(ANDROID_SDK_DIR platform-tools/aapt)
88
89 add_subdirectory(webodf)
90 add_subdirectory(programs)
91 # vim:expandtab