-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
313abfb
commit 586ce9b
Showing
3 changed files
with
126 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# Copyright (c) 2024 Alan de Freitas ([email protected]) | ||
# | ||
# Official repository: https://github.com/cppalliance/mrdocs | ||
# | ||
# | ||
|
||
# | ||
# This file is derived from the CMakeLists.txt file in the Microsoft vcpkg repository: | ||
# https://github.com/microsoft/vcpkg/blob/master/ports/duktape/CMakeLists.txt | ||
# | ||
|
||
cmake_minimum_required(VERSION 3.13) | ||
|
||
set(duktape_MAJOR_VERSION 2) | ||
set(duktape_MINOR_VERSION 7) | ||
set(duktape_PATCH_VERSION 0) | ||
set(duktape_VERSION ${duktape_MAJOR_VERSION}.${duktape_MINOR_VERSION}.${duktape_PATCH_VERSION}) | ||
|
||
option(CMAKE_VERBOSE_MAKEFILE "Create verbose makefile" OFF) | ||
option(BUILD_SHARED_LIBS "Create duktape as a shared library" OFF) | ||
|
||
project(duktape VERSION ${duktape_VERSION}) | ||
|
||
file(GLOB_RECURSE DUKTAPE_SOURCES "${CMAKE_CURRENT_LIST_DIR}/src/*.c") | ||
file(GLOB_RECURSE DUKTAPE_HEADERS "${CMAKE_CURRENT_LIST_DIR}/src/*.h") | ||
|
||
add_library(duktape ${DUKTAPE_SOURCES} ${DUKTAPE_HEADERS}) | ||
target_include_directories(duktape PRIVATE "${CMAKE_CURRENT_LIST_DIR}/src") | ||
set_target_properties(duktape PROPERTIES PUBLIC_HEADER "${DUKTAPE_HEADERS}") | ||
set_target_properties(duktape PROPERTIES VERSION ${duktape_VERSION}) | ||
set_target_properties(duktape PROPERTIES SOVERSION ${duktape_MAJOR_VERSION}) | ||
|
||
if (BUILD_SHARED_LIBS) | ||
target_compile_definitions(duktape PRIVATE -DDUK_F_DLL_BUILD) | ||
endif () | ||
|
||
install(TARGETS duktape | ||
EXPORT duktapeTargets | ||
ARCHIVE DESTINATION "lib" | ||
LIBRARY DESTINATION "lib" | ||
RUNTIME DESTINATION "bin" | ||
PUBLIC_HEADER DESTINATION "include" | ||
COMPONENT dev | ||
) | ||
|
||
install(EXPORT duktapeTargets | ||
FILE duktapeTargets.cmake | ||
NAMESPACE duktape:: | ||
DESTINATION "share/duktape" | ||
) | ||
|
||
export(PACKAGE duktape) | ||
|
||
include(CMakePackageConfigHelpers) | ||
write_basic_package_version_file("${PROJECT_BINARY_DIR}/duktapeConfigVersion.cmake" | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
configure_file(duktapeConfig.cmake.in "${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/duktapeConfig.cmake" @ONLY) | ||
|
||
install(FILES | ||
"${PROJECT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/duktapeConfig.cmake" | ||
"${PROJECT_BINARY_DIR}/duktapeConfigVersion.cmake" | ||
DESTINATION "share/duktape" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# | ||
# Licensed under the Apache License v2.0 with LLVM Exceptions. | ||
# See https://llvm.org/LICENSE.txt for license information. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
# | ||
# Copyright (c) 2024 Alan de Freitas ([email protected]) | ||
# | ||
# Official repository: https://github.com/cppalliance/mrdocs | ||
# | ||
# | ||
|
||
# | ||
# This file is derived from the CMakeLists.txt file in the Microsoft vcpkg repository: | ||
# https://github.com/microsoft/vcpkg/blob/master/ports/duktape/CMakeLists.txt | ||
# | ||
|
||
# - Try to find duktape | ||
# Once done this will define | ||
# | ||
# DUKTAPE_FOUND - system has Duktape | ||
# DUKTAPE_INCLUDE_DIRS - the Duktape include directory | ||
# DUKTAPE_LIBRARIES - Link these to use DUKTAPE | ||
# DUKTAPE_DEFINITIONS - Compiler switches required for using Duktape | ||
# | ||
|
||
find_package(PkgConfig QUIET) | ||
pkg_check_modules(PC_DUK QUIET duktape libduktape) | ||
|
||
find_path(DUKTAPE_INCLUDE_DIR duktape.h | ||
HINTS ${duktape_ROOT}/include ${PC_DUK_INCLUDEDIR} ${PC_DUK_INCLUDE_DIRS} | ||
PATH_SUFFIXES duktape) | ||
|
||
find_library(DUKTAPE_LIBRARY | ||
NAMES duktape libduktape | ||
HINTS ${duktape_ROOT}/lib ${duktape_ROOT}/bin ${PC_DUK_LIBDIR} ${PC_DUK_LIBRARY_DIRS}) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(duktape REQUIRED_VARS DUKTAPE_LIBRARY DUKTAPE_INCLUDE_DIR) | ||
|
||
if (DUKTAPE_FOUND) | ||
set(DUKTAPE_LIBRARIES ${DUKTAPE_LIBRARY}) | ||
set(DUKTAPE_INCLUDE_DIRS ${DUKTAPE_INCLUDE_DIR}) | ||
endif () | ||
|
||
MARK_AS_ADVANCED( | ||
DUKTAPE_INCLUDE_DIR | ||
DUKTAPE_LIBRARY | ||
) |