aboutsummaryrefslogtreecommitdiff
path: root/jerry-ext/CMakeLists.txt
blob: e83b81472941fa5768733f88e573860e0e8072b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright JS Foundation and other contributors, http://js.foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required (VERSION 2.8.12)
set(JERRY_EXT_NAME jerry-ext)
project (${JERRY_EXT_NAME} C)

# Optional features
set(FEATURE_INIT_FINI OFF CACHE BOOL "Enable library constructor/destructor support?")

# Status messages
message(STATUS "FEATURE_INIT_FINI              " ${FEATURE_INIT_FINI})

# Include directories
set(INCLUDE_EXT_PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include")
set(INCLUDE_EXT_PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/common")

set(INCLUDE_EXT_PUBLIC ${INCLUDE_EXT_PUBLIC} PARENT_SCOPE) # for jerry-port

if(FEATURE_INIT_FINI)
  set(DEFINES_EXT ${DEFINES_EXT} ENABLE_INIT_FINI)
endif()

# Source directories
set(SOURCE_EXT
  arg/arg-js-iterator-helper.c
  arg/arg-transform-functions.c
  arg/arg.c
  debugger/debugger-common.c
  debugger/debugger-rp.c
  debugger/debugger-serial.c
  debugger/debugger-sha1.c
  debugger/debugger-tcp.c
  debugger/debugger-ws.c
  handle-scope/handle-scope-allocator.c
  handle-scope/handle-scope.c
  handler/handler-assert.c
  handler/handler-gc.c
  handler/handler-print.c
  handler/handler-register.c
  handler/handler-resource-name.c
  module/module.c
)

add_library(${JERRY_EXT_NAME} ${SOURCE_EXT})

target_include_directories(${JERRY_EXT_NAME} PUBLIC ${INCLUDE_EXT_PUBLIC})
target_include_directories(${JERRY_EXT_NAME} PRIVATE ${INCLUDE_EXT_PRIVATE})
target_compile_definitions(${JERRY_EXT_NAME} PUBLIC ${DEFINES_EXT})
target_link_libraries(${JERRY_EXT_NAME} jerry-core)

set(JERRY_EXT_PKGCONFIG_LIBS)

if("${PLATFORM}" STREQUAL "WINDOWS" AND JERRY_DEBUGGER)
  target_link_libraries(${JERRY_EXT_NAME} ws2_32)
  set(JERRY_EXT_PKGCONFIG_LIBS -lws2_32)
endif()

configure_file(libjerry-ext.pc.in libjerry-ext.pc @ONLY)

install(TARGETS ${JERRY_EXT_NAME} DESTINATION lib)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-ext.pc DESTINATION lib/pkgconfig)
install(DIRECTORY ${INCLUDE_EXT_PUBLIC}/ DESTINATION include)