Skip to content

Commit

Permalink
Extensions API (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuDuponchelle authored and Yuki Izumi committed Dec 1, 2016
1 parent 4f103d1 commit c068469
Show file tree
Hide file tree
Showing 32 changed files with 2,945 additions and 114 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_
option(CMARK_TESTS "Build cmark tests and enable testing" ON)

add_subdirectory(src)
add_subdirectory(extensions)
if(CMARK_TESTS)
add_subdirectory(api_test)
endif()
Expand Down
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SRCDIR=src
EXTDIR=extensions
DATADIR=data
BUILDDIR?=build
GENERATOR?=Unix Makefiles
Expand Down Expand Up @@ -117,6 +118,19 @@ $(SRCDIR)/scanners.c: $(SRCDIR)/scanners.re
--encoding-policy substitute -o $@ $<
$(CLANG_FORMAT) $@

# We include scanners.c in the repository, so this shouldn't
# normally need to be generated.
$(EXTDIR)/ext_scanners.c: $(EXTDIR)/ext_scanners.re
@case "$$(re2c -v)" in \
*\ 0.13.*|*\ 0.14|*\ 0.14.1) \
echo "re2c >= 0.14.2 is required"; \
false; \
;; \
esac
re2c --case-insensitive -b -i --no-generation-date -8 \
--encoding-policy substitute -o $@ $<
clang-format -style llvm -i $@

# We include entities.inc in the repository, so normally this
# doesn't need to be regenerated:
$(SRCDIR)/entities.inc: tools/make_entities_inc.py
Expand Down
2 changes: 1 addition & 1 deletion api_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
)
target_link_libraries(api_test libcmark)
target_link_libraries(api_test libcmark ${CMAKE_DL_LIBS})

# Compiler flags
if(MSVC)
Expand Down
32 changes: 32 additions & 0 deletions extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 2.8)
set(LIBRARY "cmarkextensions")
set(LIBRARY_SOURCES
${PROJECT_SOURCE_DIR}/src/buffer.c
${PROJECT_SOURCE_DIR}/src/cmark_ctype.c
core-extensions.c
ext_scanners.c
ext_scanners.h
)

include_directories(
${PROJECT_SOURCE_DIR}/src
${PROJECT_BINARY_DIR}/src
)

# We make LIB_INSTALL_DIR configurable rather than
# hard-coding lib, because on some OSes different locations
# are used for different architectures (e.g. /usr/lib64 on
# 64-bit Fedora).
if(NOT LIB_INSTALL_DIR)
set(LIB_INSTALL_DIR "lib" CACHE STRING
"Set the installation directory for libraries." FORCE)
endif(NOT LIB_INSTALL_DIR)

include_directories(. ${CMAKE_CURRENT_BINARY_DIR})

set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE} -pg")
set(CMAKE_LINKER_PROFILE "${CMAKE_LINKER_FLAGS_RELEASE} -pg")

add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES})

target_link_libraries(cmarkextensions libcmark)
Loading

0 comments on commit c068469

Please sign in to comment.