Skip to content

Commit 81a5b88

Browse files
alandefreitasvinniefalco
authored andcommitted
feat: C++ Handlebars library
1 parent c59ef02 commit 81a5b88

12 files changed

+8545
-3
lines changed

CMakeLists.txt

+30-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ endif ()
225225
#
226226
#-------------------------------------------------
227227

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

231231
target_include_directories(mrdox-test
@@ -269,6 +269,7 @@ if (MRDOX_BUILD_TESTS)
269269
${CMAKE_SOURCE_DIR}/addons
270270
${CMAKE_BINARY_DIR}/addons
271271
BYPRODUCTS ${CMAKE_BINARY_DIR}/addons
272+
DEPENDS ${CMAKE_SOURCE_DIR}/addons
272273
)
273274

274275
file(GLOB_RECURSE TEST_SOURCES CONFIGURE_DEPENDS source/*.cpp source/*.hpp)
@@ -310,6 +311,34 @@ if (MRDOX_BUILD_TESTS)
310311
--relaxng ${CMAKE_CURRENT_BINARY_DIR}/mrdox.rng ${XML_SOURCES}
311312
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
312313
endif()
314+
315+
add_executable(handlebars-test
316+
test/unit/handlebars.cpp
317+
include/mrdox/Support/Handlebars.hpp
318+
lib/Support/Handlebars.cpp
319+
include/mrdox/Support/Path.hpp
320+
lib/Support/Path.cpp
321+
include/mrdox/Support/Error.hpp
322+
lib/Support/Error.cpp
323+
include/mrdox/Support/Dom.hpp
324+
lib/Support/Dom.cpp
325+
)
326+
target_include_directories(handlebars-test PRIVATE include)
327+
target_compile_features(handlebars-test PRIVATE cxx_std_20)
328+
target_link_libraries(handlebars-test PRIVATE fmt::fmt)
329+
target_link_libraries(handlebars-test PUBLIC clangToolingInclusions)
330+
target_include_directories(handlebars-test SYSTEM PUBLIC ${LLVM_INCLUDE_DIRS})
331+
target_compile_definitions(handlebars-test PRIVATE MRDOX_UNIT_TEST_DIR="${CMAKE_CURRENT_SOURCE_DIR}/test/unit")
332+
target_compile_definitions(handlebars-test PRIVATE MRDOX_STATIC_LINK)
333+
target_compile_definitions(handlebars-test PUBLIC -DFMT_HEADER_ONLY)
334+
if(MSVC)
335+
target_compile_options(handlebars-test PRIVATE /EHsc)
336+
endif()
337+
if (LLVM_CONFIGURATION_TYPE STREQUAL RELWITHDEBINFO)
338+
target_compile_definitions(handlebars-test PUBLIC -D_ITERATOR_DEBUG_LEVEL=0)
339+
target_compile_options(handlebars-test PUBLIC /MD)
340+
endif()
341+
add_test(NAME handlebars-test COMMAND handlebars-test)
313342
endif()
314343

315344

include/mrdox/Platform.hpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ namespace mrdox {
5757
# if defined(MRDOX_TOOL) // building library
5858
# define MRDOX_DECL
5959
# else
60-
# define MRDOX_DECL __attribute__((visibility("default")))
60+
# define MRDOX_DECL __attribute__((__visibility__("default")))
6161
#endif
62-
# define MRDOX_VISIBLE __attribute__((visibility("default")))
62+
# define MRDOX_VISIBLE __attribute__((__visibility__("default")))
6363
#else
6464
# error unknown platform for dynamic linking
6565
#endif

0 commit comments

Comments
 (0)