-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is meant to support building swift-markdown for re-use in the toolchain build. It does not follow best practices (opting for a single file approach rather than a CMakeLists.txt per directory) and currently needs some refinement for integrating an existing CMark build, but provides the skeleton for further experimentation.
- Loading branch information
Showing
5 changed files
with
162 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#[[ | ||
This source file is part of the Swift System open source project | ||
|
||
Copyright (c) 2020 Apple Inc. and the Swift System project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
cmake_minimum_required(VERSION 3.19.0) | ||
|
||
if(POLICY CMP0077) | ||
cmake_policy(SET CMP0077 NEW) | ||
endif() | ||
|
||
project(SwiftMarkdown | ||
LANGUAGES C Swift) | ||
|
||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
set(CMAKE_Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/swift) | ||
|
||
include(FetchContent) | ||
|
||
set(_SM_VENDOR_DEPENDENCIES) | ||
|
||
set(BUILD_EXAMPLES NO) | ||
set(BUILD_TESTING NO) | ||
|
||
find_package(ArgumentParser CONFIG) | ||
if(NOT ArgumentParser_FOUND) | ||
FetchContent_Declare(ArgumentParser | ||
GIT_REPOSITORY https://github.com/apple/swift-argument-parser | ||
GIT_TAG 1.2.3) | ||
list(APPEND _SM_VENDOR_DEPENDENCIES ArgumentParser) | ||
endif() | ||
|
||
find_package(cmark-gfm CONFIG) | ||
if(NOT cmark-gfm_FOUND) | ||
FetchContent_Declare(cmark-gfm | ||
GIT_REPOSITORY https://github.com/apple/swift-cmark | ||
GIT_TAG gfm) | ||
list(APPEND _SM_VENDOR_DEPENDENCIES cmark-gfm) | ||
endif() | ||
|
||
if(_SM_VENDOR_DEPENDENCIES) | ||
FetchContent_MakeAvailable(${_SM_VENDOR_DEPENDENCIES}) | ||
endif() | ||
|
||
add_subdirectory(Sources) | ||
|
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#[[ | ||
This source file is part of the Swift System open source project | ||
|
||
Copyright (c) 2020 Apple Inc. and the Swift System project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
add_library(CAtomic STATIC | ||
CAtomic.c) | ||
target_include_directories(CAtomic PUBLIC | ||
include) |
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module CAtomic { | ||
header "CAtomic.h" | ||
export * | ||
} |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#[[ | ||
This source file is part of the Swift System open source project | ||
|
||
Copyright (c) 2020 Apple Inc. and the Swift System project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
add_subdirectory(CAtomic) | ||
add_subdirectory(Markdown) |
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 |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#[[ | ||
This source file is part of the Swift System open source project | ||
|
||
Copyright (c) 2020 Apple Inc. and the Swift System project authors | ||
Licensed under Apache License v2.0 with Runtime Library Exception | ||
|
||
See https://swift.org/LICENSE.txt for license information | ||
#]] | ||
|
||
add_library(Markdown | ||
Base/ChildIndexPath.swift | ||
Base/DirectiveArgument.swift | ||
Base/Document.swift | ||
Base/LiteralMarkup.swift | ||
Base/Markup.swift | ||
Base/MarkupChildren.swift | ||
Base/MarkupData.swift | ||
Base/PlainTextConvertibleMarkup.swift | ||
Base/RawMarkup.swift | ||
"Block Nodes/Block Container Blocks/Doxygen Commands/DoxygenParameter.swift" | ||
"Block Nodes/Block Container Blocks/Doxygen Commands/DoxygenReturns.swift" | ||
"Block Nodes/Block Container Blocks/BlockDirective.swift" | ||
"Block Nodes/Block Container Blocks/BlockQuote.swift" | ||
"Block Nodes/Block Container Blocks/CustomBlock.swift" | ||
"Block Nodes/Block Container Blocks/ListItem.swift" | ||
"Block Nodes/Block Container Blocks/OrderedList.swift" | ||
"Block Nodes/Block Container Blocks/UnorderedList.swift" | ||
"Block Nodes/Inline Container Blocks/Paragraph.swift" | ||
"Block Nodes/Leaf Blocks/CodeBlock.swift" | ||
"Block Nodes/Leaf Blocks/Heading.swift" | ||
"Block Nodes/Leaf Blocks/HTMLBlock.swift" | ||
"Block Nodes/Leaf Blocks/ThematicBreak.swift" | ||
"Block Nodes/Tables/Table.swift" | ||
"Block Nodes/Tables/TableBody.swift" | ||
"Block Nodes/Tables/TableCell.swift" | ||
"Block Nodes/Tables/TableCellContainer.swift" | ||
"Block Nodes/Tables/TableHead.swift" | ||
"Block Nodes/Tables/TableRow.swift" | ||
Infrastructure/Replacement.swift | ||
Infrastructure/SourceLocation.swift | ||
"Inline Nodes/Inline Containers/Emphasis.swift" | ||
"Inline Nodes/Inline Containers/Image.swift" | ||
"Inline Nodes/Inline Containers/InlineAttributes.swift" | ||
"Inline Nodes/Inline Containers/Link.swift" | ||
"Inline Nodes/Inline Containers/Strikethrough.swift" | ||
"Inline Nodes/Inline Containers/Strong.swift" | ||
"Inline Nodes/Inline Leaves/CustomInline.swift" | ||
"Inline Nodes/Inline Leaves/InlineCode.swift" | ||
"Inline Nodes/Inline Leaves/InlineHTML.swift" | ||
"Inline Nodes/Inline Leaves/LineBreak.swift" | ||
"Inline Nodes/Inline Leaves/SoftBreak.swift" | ||
"Inline Nodes/Inline Leaves/SymbolLink.swift" | ||
"Inline Nodes/Inline Leaves/Text.swift" | ||
"Interpretive Nodes/Aside.swift" | ||
Parser/BlockDirectiveParser.swift | ||
Parser/CommonMarkConverter.swift | ||
Parser/LazySplitLines.swift | ||
Parser/ParseOptions.swift | ||
Parser/RangeAdjuster.swift | ||
Parser/RangerTracker.swift | ||
Rewriter/MarkupRewriter.swift | ||
"Structural Restrictions/BasicBlockContainer.swift" | ||
"Structural Restrictions/BasicInlineContainer.swift" | ||
"Structural Restrictions/BlockContainer.swift" | ||
"Structural Restrictions/BlockMarkup.swift" | ||
"Structural Restrictions/InlineContainer.swift" | ||
"Structural Restrictions/InlineMarkup.swift" | ||
"Structural Restrictions/ListItemContainer.swift" | ||
Utility/AtomicCounter.swift | ||
Utility/CharacterExtensions.swift | ||
Utility/CollectionExtensions.swift | ||
Utility/StringExtensions.swift | ||
Visitor/MarkupVisitor.swift | ||
Walker/MarkupWalker.swift | ||
Walker/Walkers/MarkupFormatter.swift | ||
Walker/Walkers/MarkupTreeDumper.swift) | ||
target_link_libraries(Markdown PRIVATE | ||
ArgumentParser | ||
libcmark-gfm | ||
CAtomic) |