Rubberstamped by Kevin Decker
[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}
14     ${CMAKE_CURRENT_SOURCE_DIR}/pcre
15     ${CMAKE_CURRENT_SOURCE_DIR}/bindings
16     ${CMAKE_CURRENT_SOURCE_DIR}/bindings/c
17     ${CMAKE_CURRENT_BINARY_DIR}/kjs
18     ${CMAKE_CURRENT_SOURCE_DIR}/kjs
19     ${CMAKE_CURRENT_SOURCE_DIR}/wtf
20
21     ${QT_INCLUDES}
22 )
23
24 if(WIN32)
25   include_directories( ${KDEWIN32_INCLUDES} )
26 endif(WIN32)
27
28 set(CREATE_HASH_TABLE ${CMAKE_CURRENT_SOURCE_DIR}/kjs/create_hash_table )
29
30 macro(CREATE_LUT _srcs_LIST _in_FILE _out_FILE _dep_FILE)
31
32    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
33       COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} -i > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
34       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_dep_FILE} )
35    set( ${_srcs_LIST}  ${${_srcs_LIST}} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE})
36 endmacro(CREATE_LUT)
37
38 create_lut(kjs-unity_LIB_SRCS kjs/date_object.cpp kjs/date_object.lut.h kjs/date_object.cpp)
39 create_lut(kjs-unity_LIB_SRCS kjs/number_object.cpp kjs/number_object.lut.h kjs/number_object.cpp)
40 create_lut(kjs-unity_LIB_SRCS kjs/string_object.cpp kjs/string_object.lut.h kjs/string_object.cpp)
41 create_lut(kjs-unity_LIB_SRCS kjs/array_object.cpp kjs/array_object.lut.h kjs/array_object.cpp)
42 create_lut(kjs-unity_LIB_SRCS kjs/math_object.cpp kjs/math_object.lut.h kjs/math_object.cpp)
43 create_lut(kjs-unity_LIB_SRCS kjs/regexp_object.cpp kjs/regexp_object.lut.h kjs/regexp_object.cpp)
44 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
45 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
46
47 add_custom_command(
48   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
49   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
50
51   COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/kjs
52   COMMAND ${BISON_EXECUTABLE} -d -p kjsyy ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
53   COMMAND mv grammar.tab.c ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
54   COMMAND mv grammar.tab.h ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
55   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
56 )
57
58 ########### next target ###############
59
60 IF (WEBKIT_USE_KDE_SUPPORT)
61     kde4_add_library(wtf-unity SHARED
62         wtf/TCSystemAlloc.cpp
63         wtf/Assertions.cpp
64         wtf/HashTable.cpp
65         wtf/FastMalloc.cpp
66     )
67 ELSE (WEBKIT_USE_KDE_SUPPORT)
68     add_library(wtf-unity SHARED
69         wtf/TCSystemAlloc.cpp
70         wtf/Assertions.cpp
71         wtf/HashTable.cpp
72         wtf/FastMalloc.cpp
73     )
74 ENDIF (WEBKIT_USE_KDE_SUPPORT)
75
76 set(kjs-unity_LIB_SRCS
77     ${kjs-unity_LIB_SRCS}
78     bindings/NP_jsobject.cpp
79     bindings/npruntime.cpp
80     bindings/runtime_array.cpp
81     bindings/runtime.cpp
82     bindings/runtime_method.cpp
83     bindings/runtime_object.cpp
84     bindings/runtime_root.cpp
85     bindings/c/c_class.cpp
86     bindings/c/c_instance.cpp
87     bindings/c/c_runtime.cpp
88     bindings/c/c_utility.cpp
89     kjs/DateMath.cpp
90     kjs/JSWrapperObject.cpp
91     kjs/PropertyNameArray.cpp
92     kjs/array_object.cpp
93     kjs/bool_object.cpp
94     kjs/collector.cpp
95     kjs/Context.cpp
96     kjs/date_object.cpp
97     kjs/debugger.cpp
98     kjs/dtoa.cpp
99     kjs/error_object.cpp
100     kjs/fpconst.cpp
101     kjs/function.cpp
102     kjs/function_object.cpp
103     ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
104     kjs/identifier.cpp
105     kjs/internal.cpp
106     kjs/interpreter.cpp
107     kjs/JSImmediate.cpp
108     kjs/JSLock.cpp 
109     kjs/lexer.cpp
110     kjs/list.cpp
111     kjs/lookup.cpp
112     kjs/math_object.cpp
113     kjs/nodes.cpp
114     kjs/nodes2string.cpp
115     kjs/number_object.cpp
116     kjs/object.cpp
117     kjs/object_object.cpp
118     kjs/operations.cpp
119     kjs/Parser.cpp
120     kjs/property_map.cpp
121     kjs/property_slot.cpp
122     kjs/regexp.cpp
123     kjs/regexp_object.cpp
124     kjs/scope_chain.cpp
125     kjs/string_object.cpp
126     kjs/ustring.cpp
127     kjs/value.cpp
128     kjs/ExecState.cpp
129 )
130
131
132 IF (WEBKIT_USE_KDE_SUPPORT)
133 if(UNIX)
134    kde4_add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
135    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS} m )
136 else(UNIX)
137    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS})
138 endif(UNIX)
139 ELSE (WEBKIT_USE_KDE_SUPPORT)
140    add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
141 ENDIF (WEBKIT_USE_KDE_SUPPORT)
142
143 target_link_libraries(kjs-unity wtf-unity)
144 set_target_properties(kjs-unity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
145
146 IF (WEBKIT_USE_KDE_SUPPORT)
147     install (TARGETS wtf-unity DESTINATION ${LIB_INSTALL_DIR})
148     install (TARGETS kjs-unity DESTINATION ${LIB_INSTALL_DIR})
149 ENDIF (WEBKIT_USE_KDE_SUPPORT)
150
151 # testkjs
152 IF (WEBKIT_USE_KDE_SUPPORT)
153     set(testkjs_SRCS kjs/testkjs.cpp)
154     kde4_add_executable(testkjs RUN_UNINSTALLED ${testkjs_SRCS})
155     target_link_libraries(testkjs ${KDE4_KDECORE_LIBS} kjs-unity pcre-unity icuuc)
156 ENDIF (WEBKIT_USE_KDE_SUPPORT)