11cea4a33566803550586758b24fa79f1026d277
[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_BINARY_DIR}/kjs
15     ${CMAKE_CURRENT_SOURCE_DIR}/kjs
16
17     ${QT_INCLUDES}
18 )
19
20 if(WIN32)
21   include_directories( ${KDEWIN32_INCLUDES} )
22 endif(WIN32)
23
24 set(CREATE_HASH_TABLE ${CMAKE_CURRENT_SOURCE_DIR}/kjs/create_hash_table )
25
26 macro(CREATE_LUT _srcs_LIST _in_FILE _out_FILE _dep_FILE)
27
28    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
29       COMMAND ${PERL_EXECUTABLE} ${CREATE_HASH_TABLE} ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} -i > ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE}
30       DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${_in_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/${_dep_FILE} )
31    set( ${_srcs_LIST}  ${${_srcs_LIST}} ${CMAKE_CURRENT_BINARY_DIR}/${_out_FILE})
32 endmacro(CREATE_LUT)
33
34 create_lut(kjs-unity_LIB_SRCS kjs/date_object.cpp kjs/date_object.lut.h kjs/date_object.cpp)
35 create_lut(kjs-unity_LIB_SRCS kjs/number_object.cpp kjs/number_object.lut.h kjs/number_object.cpp)
36 create_lut(kjs-unity_LIB_SRCS kjs/string_object.cpp kjs/string_object.lut.h kjs/string_object.cpp)
37 create_lut(kjs-unity_LIB_SRCS kjs/array_object.cpp kjs/array_object.lut.h kjs/array_object.cpp)
38 create_lut(kjs-unity_LIB_SRCS kjs/math_object.cpp kjs/math_object.lut.h kjs/math_object.cpp)
39 create_lut(kjs-unity_LIB_SRCS kjs/regexp_object.cpp kjs/regexp_object.lut.h kjs/regexp_object.cpp)
40 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
41 create_lut(kjs-unity_LIB_SRCS kjs/keywords.table kjs/lexer.lut.h kjs/lexer.cpp)
42
43 add_custom_command(
44   OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
45   WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
46
47   COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/kjs
48   COMMAND ${BISON_EXECUTABLE} -d -p kjsyy ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
49   COMMAND mv grammar.tab.c ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
50   COMMAND mv grammar.tab.h ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.h
51   DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/kjs/grammar.y
52 )
53
54 ########### next target ###############
55
56 kde4_add_library(wtf-unity SHARED
57     wtf/TCSystemAlloc.cpp
58     wtf/Assertions.cpp
59     wtf/HashTable.cpp
60     wtf/FastMalloc.cpp
61 )
62
63 set(kjs-unity_LIB_SRCS
64     ${kjs-unity_LIB_SRCS}
65     wtf/unicode/qt4/UnicodeQt4.cpp
66     kjs/JSWrapperObject.cpp
67         kjs/PropertyNameArray.cpp
68         kjs/array_object.cpp
69         kjs/bool_object.cpp
70         kjs/collector.cpp
71         kjs/Context.cpp
72         kjs/date_object.cpp
73         kjs/debugger.cpp
74         kjs/dtoa.cpp
75         kjs/error_object.cpp
76         kjs/fpconst.cpp
77         kjs/function.cpp
78         kjs/function_object.cpp
79     ${CMAKE_CURRENT_BINARY_DIR}/kjs/grammar.cpp
80         kjs/identifier.cpp
81         kjs/internal.cpp
82         kjs/interpreter.cpp
83     kjs/JSImmediate.cpp
84         kjs/JSLock.cpp 
85         kjs/lexer.cpp
86         kjs/list.cpp
87         kjs/lookup.cpp
88         kjs/math_object.cpp
89         kjs/nodes.cpp
90         kjs/nodes2string.cpp
91         kjs/number_object.cpp
92         kjs/object.cpp
93         kjs/object_object.cpp
94         kjs/operations.cpp
95         kjs/Parser.cpp
96         kjs/property_map.cpp
97         kjs/property_slot.cpp
98         kjs/regexp.cpp
99         kjs/regexp_object.cpp
100         kjs/scope_chain.cpp
101         kjs/string_object.cpp
102         kjs/ustring.cpp
103         kjs/value.cpp
104         kjs/ExecState.cpp
105 )
106
107 kde4_add_library(kjs-unity STATIC ${kjs-unity_LIB_SRCS})
108
109 if(UNIX)
110    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS} m )
111 else(UNIX)
112    target_link_libraries(kjs-unity  ${KDE4_KDECORE_LIBS})
113 endif(UNIX)
114
115 target_link_libraries(kjs-unity wtf-unity)
116 set_target_properties(kjs-unity PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} )
117 install(TARGETS kjs-unity  DESTINATION ${LIB_INSTALL_DIR} )