8058dcb4808be1b8e5d5f271406563c9decd0db6
[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/DateMath.cpp
80     kjs/JSWrapperObject.cpp
81     kjs/PropertyNameArray.cpp
82     kjs/array_object.cpp
83     kjs/bool_object.cpp
84     kjs/collector.cpp
85     kjs/Context.cpp
86     kjs/date_object.cpp
87     kjs/debugger.cpp
88     kjs/dtoa.cpp
89     kjs/error_object.cpp
90     kjs/fpconst.cpp
91     kjs/function.cpp
92     kjs/function_object.cpp
93     ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
94     kjs/identifier.cpp
95     kjs/internal.cpp
96     kjs/interpreter.cpp
97     kjs/JSImmediate.cpp
98     kjs/JSLock.cpp 
99     kjs/lexer.cpp
100     kjs/list.cpp
101     kjs/lookup.cpp
102     kjs/math_object.cpp
103     kjs/nodes.cpp
104     kjs/nodes2string.cpp
105     kjs/number_object.cpp
106     kjs/object.cpp
107     kjs/object_object.cpp
108     kjs/operations.cpp
109     kjs/Parser.cpp
110     kjs/property_map.cpp
111     kjs/property_slot.cpp
112     kjs/regexp.cpp
113     kjs/regexp_object.cpp
114     kjs/scope_chain.cpp
115     kjs/string_object.cpp
116     kjs/ustring.cpp
117     kjs/value.cpp
118     kjs/ExecState.cpp
119 )
120
121 kde4_add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
122
123 IF (WEBKIT_USE_KDE_SUPPORT)
124 if(UNIX)
125    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS} m )
126 else(UNIX)
127    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS})
128 endif(UNIX)
129 ENDIF (WEBKIT_USE_KDE_SUPPORT)
130
131 target_link_libraries(kjs-unity wtf-unity)
132 set_target_properties(kjs-unity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
133
134 install (TARGETS wtf-unity DESTINATION ${LIB_INSTALL_DIR})
135 install (TARGETS kjs-unity DESTINATION ${LIB_INSTALL_DIR})
136
137 # testkjs
138 set(testkjs_SRCS kjs/testkjs.cpp)
139 kde4_add_executable(testkjs RUN_UNINSTALLED ${testkjs_SRCS})
140 target_link_libraries(testkjs ${KDE4_KDECORE_LIBS} kjs-unity pcre-unity icuuc)