forked from commonmark/cmark
-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the use of `CMARK_INLINE` (as is being considered upstream) as this workaround is no longer needed. It was to support VS2013 which has been obsoleted for some time now. Restructure the CMake modules to match expectations for CMake. Avoid defining `likely` and `unlikely` in global scope. While doing so, prefer the modern `__has_builtin` for the check (with fallbacks for pre-GCC 4.10, clang 3.4, and MSVC). This largely shouldn't matter in practice as modern branch predictors do well without the hint. Sink the declaration into source files as the macros are not namespaced. Remove the now unnecessary `config.h`. Clean up the builds to only support a single build type which is dependent on the standard `BUILD_SHARED_LIBS`. Simplify and normalise the install rules to use the `GNUInstallDirs` parameters.
- Loading branch information
Showing
32 changed files
with
217 additions
and
393 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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 |
---|---|---|
@@ -1,85 +1,30 @@ | ||
set(LIBRARY "libcmark-gfm-extensions") | ||
set(STATICLIBRARY "libcmark-gfm-extensions_static") | ||
set(LIBRARY_SOURCES | ||
core-extensions.c | ||
table.c | ||
strikethrough.c | ||
autolink.c | ||
tagfilter.c | ||
ext_scanners.c | ||
ext_scanners.re | ||
ext_scanners.h | ||
tasklist.c | ||
) | ||
|
||
include_directories( | ||
${PROJECT_SOURCE_DIR}/src | ||
${PROJECT_BINARY_DIR}/src | ||
) | ||
|
||
include_directories(. ${CMAKE_CURRENT_BINARY_DIR}) | ||
|
||
if (CMARK_SHARED) | ||
add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES}) | ||
|
||
set_target_properties(${LIBRARY} PROPERTIES | ||
OUTPUT_NAME "cmark-gfm-extensions" | ||
DEFINE_SYMBOL "cmark-gfm" | ||
SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM} | ||
VERSION ${PROJECT_VERSION}) | ||
|
||
set_property(TARGET ${LIBRARY} | ||
APPEND PROPERTY MACOSX_RPATH true) | ||
|
||
# Avoid name clash between PROGRAM and LIBRARY pdb files. | ||
set_target_properties(${LIBRARY} PROPERTIES PDB_NAME cmark-gfm-extensions_dll) | ||
|
||
list(APPEND CMARK_INSTALL ${LIBRARY}) | ||
target_link_libraries(${LIBRARY} libcmark-gfm) | ||
|
||
endif() | ||
|
||
if (CMARK_STATIC) | ||
add_library(${STATICLIBRARY} STATIC ${LIBRARY_SOURCES}) | ||
target_compile_definitions(${STATICLIBRARY} PUBLIC | ||
CMARK_GFM_STATIC_DEFINE | ||
CMARK_GFM_EXTENSIONS_STATIC_DEFINE) | ||
set_target_properties(${STATICLIBRARY} PROPERTIES | ||
DEFINE_SYMBOL "cmark-gfm" | ||
POSITION_INDEPENDENT_CODE ON) | ||
|
||
if (MSVC) | ||
set_target_properties(${STATICLIBRARY} PROPERTIES | ||
OUTPUT_NAME "cmark-gfm-extensions_static" | ||
VERSION ${PROJECT_VERSION}) | ||
else() | ||
set_target_properties(${STATICLIBRARY} PROPERTIES | ||
OUTPUT_NAME "cmark-gfm-extensions" | ||
VERSION ${PROJECT_VERSION}) | ||
endif(MSVC) | ||
|
||
list(APPEND CMARK_INSTALL ${STATICLIBRARY}) | ||
endif() | ||
|
||
install(TARGETS ${CMARK_INSTALL} | ||
add_library(libcmark-gfm-extensions | ||
autolink.c | ||
core-extensions.c | ||
ext_scanners.c | ||
ext_scanners.h | ||
ext_scanners.re | ||
strikethrough.c | ||
table.c | ||
tagfilter.c | ||
tasklist.c) | ||
set_target_properties(libcmark-gfm-extensions PROPERTIES | ||
DEFINE_SYMBOL cmark-gfm | ||
MACOSX_RPATH TRUE | ||
OUTPUT_NAME cmark-gfm-extensions | ||
PDB_NAME libcmark-gfm-extensions | ||
SOVERSION ${PROJECT_VERSION} | ||
VERSION ${PROJECT_VERSION}) | ||
target_link_libraries(libcmark-gfm-extensions PRIVATE | ||
libcmark-gfm) | ||
|
||
|
||
install(TARGETS libcmark-gfm-extensions | ||
EXPORT cmark-gfm-extensions | ||
RUNTIME DESTINATION bin | ||
LIBRARY DESTINATION lib${LIB_SUFFIX} | ||
ARCHIVE DESTINATION lib${LIB_SUFFIX} | ||
) | ||
|
||
if (CMARK_SHARED OR CMARK_STATIC) | ||
install(FILES | ||
cmark-gfm-core-extensions.h | ||
DESTINATION include | ||
) | ||
|
||
install(EXPORT cmark-gfm-extensions DESTINATION lib${LIB_SUFFIX}/cmake-gfm-extensions) | ||
endif() | ||
|
||
# Feature tests | ||
include(CheckCSourceCompiles) | ||
|
||
CHECK_C_SOURCE_COMPILES( | ||
"int main() { __builtin_expect(0,0); return 0; }" | ||
HAVE___BUILTIN_EXPECT) | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
install(FILES cmark-gfm-core-extensions.h | ||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(EXPORT cmark-gfm-extensions | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake-gfm-extensions) |
Oops, something went wrong.