Skip to content

Commit

Permalink
feat: C++ Handlebars library
Browse files Browse the repository at this point in the history
  • Loading branch information
alandefreitas authored and vinniefalco committed Jul 8, 2023
1 parent c59ef02 commit 81a5b88
Show file tree
Hide file tree
Showing 12 changed files with 8,545 additions and 3 deletions.
31 changes: 30 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ endif ()
#
#-------------------------------------------------

file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS test/*.cpp test/*.hpp)
file(GLOB TEST_SOURCES CONFIGURE_DEPENDS test/*.cpp test/*.hpp)
add_executable(mrdox-test ${TEST_SOURCES})

target_include_directories(mrdox-test
Expand Down Expand Up @@ -269,6 +269,7 @@ if (MRDOX_BUILD_TESTS)
${CMAKE_SOURCE_DIR}/addons
${CMAKE_BINARY_DIR}/addons
BYPRODUCTS ${CMAKE_BINARY_DIR}/addons
DEPENDS ${CMAKE_SOURCE_DIR}/addons
)

file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS source/*.cpp source/*.hpp)
Expand Down Expand Up @@ -310,6 +311,34 @@ if (MRDOX_BUILD_TESTS)
--relaxng ${CMAKE_CURRENT_BINARY_DIR}/mrdox.rng ${XML_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()

add_executable(handlebars-test
test/unit/handlebars.cpp
include/mrdox/Support/Handlebars.hpp
lib/Support/Handlebars.cpp
include/mrdox/Support/Path.hpp
lib/Support/Path.cpp
include/mrdox/Support/Error.hpp
lib/Support/Error.cpp
include/mrdox/Support/Dom.hpp
lib/Support/Dom.cpp
)
target_include_directories(handlebars-test PRIVATE include)
target_compile_features(handlebars-test PRIVATE cxx_std_20)
target_link_libraries(handlebars-test PRIVATE fmt::fmt)
target_link_libraries(handlebars-test PUBLIC clangToolingInclusions)
target_include_directories(handlebars-test SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS})
target_compile_definitions(handlebars-test PRIVATE MRDOX_UNIT_TEST_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test/unit")
target_compile_definitions(handlebars-test PRIVATE MRDOX_STATIC_LINK)
target_compile_definitions(handlebars-test PUBLIC -DFMT_HEADER_ONLY)
if(MSVC)
target_compile_options(handlebars-test PRIVATE /EHsc)
endif()
if (LLVM_CONFIGURATION_TYPE STREQUAL RELWITHDEBINFO)
target_compile_definitions(handlebars-test PUBLIC -D_ITERATOR_DEBUG_LEVEL=0)
target_compile_options(handlebars-test PUBLIC /MD)
endif()
add_test(NAME handlebars-test COMMAND handlebars-test)
endif()


Expand Down
4 changes: 2 additions & 2 deletions include/mrdox/Platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ namespace mrdox {
# if defined(MRDOX_TOOL) // building library
# define MRDOX_DECL
# else
# define MRDOX_DECL __attribute__((visibility("default")))
# define MRDOX_DECL __attribute__((__visibility__("default")))
#endif
# define MRDOX_VISIBLE __attribute__((visibility("default")))
# define MRDOX_VISIBLE __attribute__((__visibility__("default")))
#else
# error unknown platform for dynamic linking
#endif
Expand Down
Loading

0 comments on commit 81a5b88

Please sign in to comment.