JavaScriptCore:
[WebKit-https.git] / JavaScriptCore / CMakeLists.txt
1
2 project(kjs-unity)
3
4 MESSAGE(STATUS "Missing CMakeFiles.txt into wtf directory")
5 add_subdirectory( wtf )
6 add_subdirectory( pcre )
7
8 # Configuration checks
9 check_library_exists(pthread pthread_attr_get_np "" HAVE_PTHREAD_ATTR_GET_NP)
10 check_library_exists(pthread pthread_getattr_np "" HAVE_PTHREAD_GETATTR_NP)
11
12 include_directories(
13     ${CMAKE_CURRENT_SOURCE_DIR}/pcre
14     ${CMAKE_CURRENT_SOURCE_DIR}/bindings
15     ${CMAKE_CURRENT_SOURCE_DIR}/bindings/c
16     ${CMAKE_CURRENT_BINARY_DIR}/kjs
17     ${CMAKE_CURRENT_SOURCE_DIR}/kjs
18
19     ${QT_INCLUDES}
20 )
21
22 if(WIN32)
23   include_directories( ${KDEWIN32_INCLUDES} )
24 endif(WIN32)
25
26 set(CREATE_HASH_TABLE ${CMAKE_CURRENT_SOURCE_DIR}/kjs/create_hash_table )
27
28 macro(CREATE_LUT _srcs_LIST _in_FILE _out_FILE _dep_FILE)
29
30    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
31       COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} -i > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
32       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_dep_FILE} )
33    set( ${_srcs_LIST}  ${${_srcs_LIST}} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE})
34 endmacro(CREATE_LUT)
35
36 create_lut(kjs-unity_LIB_SRCS kjs/date_object.cpp kjs/date_object.lut.h kjs/date_object.cpp)
37 create_lut(kjs-unity_LIB_SRCS kjs/number_object.cpp kjs/number_object.lut.h kjs/number_object.cpp)
38 create_lut(kjs-unity_LIB_SRCS kjs/string_object.cpp kjs/string_object.lut.h kjs/string_object.cpp)
39 create_lut(kjs-unity_LIB_SRCS kjs/array_object.cpp kjs/array_object.lut.h kjs/array_object.cpp)
40 create_lut(kjs-unity_LIB_SRCS kjs/math_object.cpp kjs/math_object.lut.h kjs/math_object.cpp)
41 create_lut(kjs-unity_LIB_SRCS kjs/regexp_object.cpp kjs/regexp_object.lut.h kjs/regexp_object.cpp)
42 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
43 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
44
45 add_custom_command(
46   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
47   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
48
49   COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/kjs
50   COMMAND ${BISON_EXECUTABLE} -d -p kjsyy ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
51   COMMAND mv grammar.tab.c ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
52   COMMAND mv grammar.tab.h ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
53   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
54 )
55
56 ########### next target ###############
57
58 kde4_add_library(wtf-unity SHARED
59     wtf/TCSystemAlloc.cpp
60     wtf/Assertions.cpp
61     wtf/HashTable.cpp
62     wtf/FastMalloc.cpp
63 )
64
65 set(kjs-unity_LIB_SRCS
66     ${kjs-unity_LIB_SRCS}
67     wtf/unicode/qt4/UnicodeQt4.cpp
68     bindings/NP_jsobject.cpp
69     bindings/npruntime.cpp
70     bindings/runtime_array.cpp
71     bindings/runtime.cpp
72     bindings/runtime_method.cpp
73     bindings/runtime_object.cpp
74     bindings/runtime_root.cpp
75     bindings/c/c_class.cpp
76     bindings/c/c_instance.cpp
77     bindings/c/c_runtime.cpp
78     bindings/c/c_utility.cpp
79     kjs/JSWrapperObject.cpp
80         kjs/PropertyNameArray.cpp
81         kjs/array_object.cpp
82         kjs/bool_object.cpp
83         kjs/collector.cpp
84         kjs/Context.cpp
85         kjs/date_object.cpp
86         kjs/debugger.cpp
87         kjs/dtoa.cpp
88         kjs/error_object.cpp
89         kjs/fpconst.cpp
90         kjs/function.cpp
91         kjs/function_object.cpp
92     ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
93         kjs/identifier.cpp
94         kjs/internal.cpp
95         kjs/interpreter.cpp
96     kjs/JSImmediate.cpp
97         kjs/JSLock.cpp 
98         kjs/lexer.cpp
99         kjs/list.cpp
100         kjs/lookup.cpp
101         kjs/math_object.cpp
102         kjs/nodes.cpp
103         kjs/nodes2string.cpp
104         kjs/number_object.cpp
105         kjs/object.cpp
106         kjs/object_object.cpp
107         kjs/operations.cpp
108         kjs/Parser.cpp
109         kjs/property_map.cpp
110         kjs/property_slot.cpp
111         kjs/regexp.cpp
112         kjs/regexp_object.cpp
113         kjs/scope_chain.cpp
114         kjs/string_object.cpp
115         kjs/ustring.cpp
116         kjs/value.cpp
117         kjs/ExecState.cpp
118 )
119
120 kde4_add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
121
122 if(UNIX)
123    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS} m )
124 else(UNIX)
125    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS})
126 endif(UNIX)
127
128 target_link_libraries(kjs-unity wtf-unity)
129 set_target_properties(kjs-unity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
130
131 install (TARGETS wtf-unity DESTINATION ${LIB_INSTALL_DIR})
132 install (TARGETS kjs-unity DESTINATION ${LIB_INSTALL_DIR})