1# Copyright JS Foundation and other contributors, http://js.foundation 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15cmake_minimum_required (VERSION 2.8.12) 16set(JERRY_EXT_NAME jerry-ext) 17project (${JERRY_EXT_NAME} C) 18 19# Optional features 20set(FEATURE_INIT_FINI OFF CACHE BOOL "Enable library constructor/destructor support?") 21 22# Status messages 23message(STATUS "FEATURE_INIT_FINI " ${FEATURE_INIT_FINI}) 24 25# Include directories 26set(INCLUDE_EXT_PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") 27set(INCLUDE_EXT_PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/common") 28 29set(INCLUDE_EXT_PUBLIC ${INCLUDE_EXT_PUBLIC} PARENT_SCOPE) # for jerry-port 30 31if(FEATURE_INIT_FINI) 32 set(DEFINES_EXT ${DEFINES_EXT} ENABLE_INIT_FINI) 33endif() 34 35# Source directories 36file(GLOB SOURCE_EXT 37 arg/*.c 38 common/*.c 39 debugger/*.c 40 handle-scope/*.c 41 handler/*.c 42 module/*.c) 43 44add_library(${JERRY_EXT_NAME} ${SOURCE_EXT}) 45 46target_include_directories(${JERRY_EXT_NAME} PUBLIC ${INCLUDE_EXT_PUBLIC}) 47target_include_directories(${JERRY_EXT_NAME} PRIVATE ${INCLUDE_EXT_PRIVATE}) 48target_compile_definitions(${JERRY_EXT_NAME} PUBLIC ${DEFINES_EXT}) 49target_link_libraries(${JERRY_EXT_NAME} jerry-core) 50 51set(JERRY_EXT_PKGCONFIG_LIBS) 52 53if(USING_MSVC AND JERRY_DEBUGGER) 54 target_link_libraries(${JERRY_EXT_NAME} ws2_32) 55 set(JERRY_EXT_PKGCONFIG_LIBS -lws2_32) 56endif() 57 58configure_file(libjerry-ext.pc.in libjerry-ext.pc @ONLY) 59 60install(TARGETS ${JERRY_EXT_NAME} DESTINATION lib) 61install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libjerry-ext.pc DESTINATION lib/pkgconfig) 62install(DIRECTORY ${INCLUDE_EXT_PUBLIC}/ DESTINATION include) 63