Skip to content

Commit

Permalink
First library commit 馃帀馃帀!
Browse files Browse the repository at this point in the history
With basic documentation, and then some!
  • Loading branch information
ShepherdSoasis authored and ThePhD committed Feb 12, 2021
0 parents commit 835820d
Show file tree
Hide file tree
Showing 283 changed files with 33,320 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
BasedOnStyle: WebKit
IndentWidth: 5
TabWidth: 5
ContinuationIndentWidth: 5
UseTab: ForIndentation

# Namespaces
NamespaceIndentation: All
CompactNamespaces: true
FixNamespaceComments: true

# Overall Alignment
ColumnLimit: 120
AlignAfterOpenBracket: DontAlign # uses ContinuationIndentWidth for this instead
AccessModifierOffset: -5 # do not push public: or private: around
AlignConsecutiveAssignments: true # affects more than what's expected: do not use
#AlignConsecutiveDeclarations: true # affects more than what's expected: do not use

# Type Alignment
DerivePointerAlignment: false
PointerAlignment: Left
AlwaysBreakTemplateDeclarations: true
AlwaysBreakBeforeMultilineStrings: true

# Comments
AlignTrailingComments: true
ReflowComments: true

# Macros
AlignEscapedNewlines: Left
#IndentPPDirectives: None

# Functions
AllowShortFunctionsOnASingleLine: None
AlwaysBreakAfterReturnType: None
BreakConstructorInitializers: BeforeComma
ConstructorInitializerIndentWidth: 0
ConstructorInitializerAllOnOneLineOrOnePerLine: true
BinPackArguments: true
BinPackParameters: true

# Classes
BreakBeforeInheritanceComma: false

# Braces
Cpp11BracedListStyle: false
BreakBeforeBraces: Custom
BraceWrapping:
AfterEnum: false
AfterStruct: false
AfterControlStatement: false
AfterClass: false
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeElse: true
BeforeCatch: true
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: true

# Control Statements
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
IndentCaseLabels: false

# Spaces
SpaceAfterCStyleCast: false
SpacesInCStyleCastParentheses: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInAngles: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
MaxEmptyLinesToKeep: 3

# Prevent OCD
SortIncludes: false

---
Language: Cpp
Standard: Cpp11
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
build/
.vscode/
.mypy_cache/
/main.cpp
.vs
CMakeSettings.json
20 changes: 20 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# .readthedocs.yml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: documentation/source/conf.py

# Optionally build your docs in additional formats such as PDF
formats:
- pdf

# Optionally set the version of Python and requirements required to build your docs
python:
version: 3.7
install:
- requirements: documentation/requirements.txt
45 changes: 45 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# =============================================================================
#
# ztd.text
# Copyright 漏 2021 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC
# Contact: opensource@soasis.org
#
# Commercial License Usage
# Licensees holding valid commercial ztd.text licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and Shepherd's Oasis, LLC.
# For licensing terms and conditions see your agreement. For
# further information contact opensource@soasis.org.
#
# Apache License Version 2 Usage
# Alternatively, this file may be used under the terms of Apache License
# Version 2.0 (the "License") for non-commercial use; you may not use this
# file except in compliance with the License. You may obtain a copy of the
# License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# =============================================================================

[style]
based_on_style = pep8
use_tabs = true
indent_width = 5

spaces_before_comment = 1
spaces_around_power_operator = true
space_between_ending_comma_and_closing_bracket = true

continuation_align_style = SPACE
split_before_first_argument = false
split_complex_comprehension = true
dedent_closing_brackets = false
coalesce_brackets = true
align_closing_bracket_with_visual_indent = false
181 changes: 181 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
# =============================================================================
#
# ztd.text
# Copyright 漏 2021 JeanHeyd "ThePhD" Meneide and Shepherd's Oasis, LLC
# Contact: opensource@soasis.org
#
# Commercial License Usage
# Licensees holding valid commercial ztd.text licenses may use this file in
# accordance with the commercial license agreement provided with the
# Software or, alternatively, in accordance with the terms contained in
# a written agreement between you and Shepherd's Oasis, LLC.
# For licensing terms and conditions see your agreement. For
# further information contact opensource@soasis.org.
#
# Apache License Version 2 Usage
# Alternatively, this file may be used under the terms of Apache License
# Version 2.0 (the "License") for non-commercial use; you may not use this
# file except in compliance with the License. You may obtain a copy of the
# License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# =============================================================================

cmake_minimum_required(VERSION 3.13.0)

# # Project declaration
# informs about the project, gives a description, version and MOST IMPORTANTLY
# the languages the project is going to use. Required.
set(ZTD_TEXT_PROJECT_NAME ztd.text)
set(ZTD_TEXT_PROJECT_VERSION 0.0.0)
set(ZTD_TEXT_PROJECT_DESCRIPTION "A spicy text library.")
project(${ZTD_TEXT_PROJECT_NAME} VERSION ${ZTD_TEXT_PROJECT_VERSION} DESCRIPTION ${ZTD_TEXT_PROJECT_DESCRIPTION} LANGUAGES C CXX)

# # Modules
# Include modules useful to the project, whether locally made in our own cmake DIRECTORY
# our from the standard cmake libraries
# Add home-rolled modules path to front of module path list
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")

# # # Top-Level Directories
# Check if this is the top-level project or not
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
set(ZTD_TEXT_IS_TOP_LEVEL_PROJECT true)
else()
set(ZTD_TEXT_IS_TOP_LEVEL_PROJECT false)
endif()

# Modify bad flags / change defaults if we are the top level
if (ZTD_TEXT_IS_TOP_LEVEL_PROJECT)
if (CMAKE_SIZEOF_VOID_P EQUAL 4)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/${CMAKE_BUILD_TYPE}/${CFG_INT_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/${CMAKE_BUILD_TYPE}/${CFG_INT_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x86/${CMAKE_BUILD_TYPE}/${CFG_INT_DIR}/bin")
else()
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/${CFG_INT_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/${CFG_INT_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/x64/${CMAKE_BUILD_TYPE}/${CFG_INT_DIR}/bin")
endif()

if (MSVC)
string(REGEX REPLACE "/W[0-4]" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
endif()

# # Include standard modules
include(CMakeDependentOption)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)

# # Options
option(ZTD_TEXT_CI "Whether or not we are in continuous integration mode" OFF)
option(ZTD_TEXT_TESTS "Enable build of tests" OFF)
option(ZTD_TEXT_DOCUMENTATION "Enable build of documentation" OFF)
option(ZTD_TEXT_DOCUMENTATION_NO_SPHINX "Turn off Sphinx usage (useful for ReadTheDocs builds)" OFF)
option(ZTD_TEXT_EXAMPLES "Enable build of examples" OFF)
option(ZTD_TEXT_BENCHMARKS "Enable build of benchmarks" OFF)
option(ZTD_TEXT_GENERATE_SINGLE "Enable generation of a single header and its target" OFF)
option(ZTD_TEXT_USE_CUNEICODE "Enable generation of a single header and its target" OFF)

# # Dependencies
# # Dependencies (test-specific)
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vendor/Catch2)
set(ztd_text_has_catch2 ON)
add_subdirectory(vendor/Catch2)
else()
set(ztd_text_has_catch2 OFF)
endif()
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/vendor/cuneicode)
set(ztd_text_has_cuneicode ON)
add_subdirectory(vendor/cuneicode)
else()
set(ztd_text_has_cuneicode OFF)
endif()

file(GLOB ztd.text.includes CONFIGURE_DEPENDS include/*.hpp)

add_library(ztd.text INTERFACE)
add_library(ztd::text ALIAS ztd.text)
# Not quite yet
# target_link_libraries(ztd.text INTERFACE ztd::cuneicode)
target_include_directories(ztd.text INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
if (ZTD_TEXT_IS_TOP_LEVEL_PROJECT)
if (MSVC)
target_compile_options(ztd.text INTERFACE
/std:c++latest
/permissive-
)
else()
target_compile_options(ztd.text INTERFACE
-std=c++2a
)
endif()
endif()
target_sources(ztd.text INTERFACE ${ztd.text.includes})
#set_target_properties(ztd.text
# PROPERTIES
# EXPORT_NAME ztd::text
#)

if (ZTD_TEXT_GENERATE_SINGLE)
add_subdirectory(single)
endif(ZTD_TEXT_GENERATE_SINGLE)

if (ZTD_TEXT_SCRATCH)
add_executable(scratch main.cpp)
target_link_libraries(scratch PRIVATE ztd::text)
if (MSVC)
target_compile_options(scratch
PUBLIC
/std:c++latest
/permissive-
)
else()
target_compile_options(scratch
PUBLIC
-std=c++2a -Wall -Werror -Wpedantic
)
endif()
endif()

# # Benchmarks, Tests, Examples
if (ZTD_TEXT_TESTS)
enable_testing()
endif()
if (ZTD_TEXT_TESTS AND ztd_text_has_catch2)
add_subdirectory(tests)
endif()
if (ZTD_TEXT_DOCUMENTATION)
add_subdirectory(documentation)
endif()
if (ZTD_TEXT_BENCHMARKS)
add_subdirectory(benchmarks)
endif()
if (ZTD_TEXT_EXAMPLES)
add_subdirectory(examples)
endif()

# # Config / Version packaging
# Version configurations
#configure_package_config_file(
# cmake/ztd-config.cmake.in
# "${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.text/ztd.text-config.cmake"
# INSTALL_DESTINATION lib/cmake/ztd.text
# NO_CHECK_REQUIRED_COMPONENTS_MACRO)

#write_basic_package_version_file(
# "${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.text/ztd.text-config-version.cmake"
# COMPATIBILITY AnyNewerVersion)

#export(TARGETS ztd.text FILE "${CMAKE_CURRENT_BINARY_DIR}/cmake/ztd.text/ztd.text-targets.cmake")

0 comments on commit 835820d

Please sign in to comment.