Skip to content

Commit

Permalink
build: integrate duktape
Browse files Browse the repository at this point in the history
close #235
  • Loading branch information
alandefreitas authored and vinniefalco committed Jun 5, 2023
1 parent 616773e commit 3b31926
Show file tree
Hide file tree
Showing 5 changed files with 5,247 additions and 2 deletions.
34 changes: 33 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,44 @@ endif()
#-------------------------------------------------

set(CMAKE_FOLDER Dependencies)

# LLVM
find_package(LLVM REQUIRED CONFIG)
find_package(Clang REQUIRED CONFIG)
list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
include(HandleLLVMOptions)
add_definitions(${LLVM_DEFINITIONS})
llvm_map_components_to_libnames(llvm_libs all)

# Duktape
if(NOT DEFINED DUKTAPE_SOURCE_ROOT)
set(DUKTAPE_SOURCE_ROOT $ENV{DUKTAPE_SOURCE_ROOT})
endif()
if (NOT DUKTAPE_SOURCE_ROOT)
include(FetchContent)
if (POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
FetchContent_Declare(
duktape
URL https://github.com/svaarala/duktape/releases/download/v2.7.0/duktape-2.7.0.tar.xz
)
FetchContent_GetProperties(duktape)
if(NOT duktape_POPULATED)
FetchContent_Populate(duktape)
set(DUKTAPE_SOURCE_ROOT ${duktape_SOURCE_DIR})
endif()
endif()
add_library(duktape ${DUKTAPE_SOURCE_ROOT}/src/duktape.c ${DUKTAPE_SOURCE_ROOT}/src/duktape.h)
target_include_directories(duktape PUBLIC ${DUKTAPE_SOURCE_ROOT}/src)
add_library(duktape::duktape ALIAS duktape)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU")
target_compile_options(duktape PRIVATE -w)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(duktape PRIVATE /w)
endif()

# fmt
unset(CMAKE_FOLDER)
find_package(fmt REQUIRED CONFIG)

Expand Down Expand Up @@ -133,7 +165,7 @@ endif()
target_include_directories(mrdox SYSTEM PUBLIC ${CLANG_INCLUDE_DIRS})

# fmt
target_link_libraries(mrdox PUBLIC fmt::fmt)
target_link_libraries(mrdox PUBLIC fmt::fmt duktape::duktape)

# Windows, Win64
if (WIN32)
Expand Down
3 changes: 2 additions & 1 deletion include/mrdox/Metadata/Interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ makeInterface(
Corpus const& corpus)
{
Interface I;
return makeInterface(I, Derived, corpus);
makeInterface(I, Derived, corpus);
return I;
}

} // mrdox
Expand Down
1 change: 1 addition & 0 deletions source/-adoc/AdocWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ struct llvm::yaml::MappingTraits<
{
auto& opt= opt_.opt;
io.mapOptional("safe-names", opt.safe_names);
io.mapOptional("template-dir", opt.template_dir);
}
};

Expand Down
1 change: 1 addition & 0 deletions source/-adoc/AdocWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class AdocWriter
struct Options
{
bool safe_names = false;
std::string template_dir;
};

struct Key;
Expand Down
Loading

0 comments on commit 3b31926

Please sign in to comment.