Skip to content

Commit

Permalink
Merge branch 'release/4.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
Aetf committed Oct 9, 2018
2 parents 9fd0a6f + 5b27124 commit f70e379
Show file tree
Hide file tree
Showing 56 changed files with 3,697 additions and 778 deletions.
121 changes: 121 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 110
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- Q_FOREVER
- BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: 'tensorflow_headers\.h'
Priority: -1
- Regex: '^"'
Priority: 3
- Regex: '^(<|")(tensorflow|third_party)/'
Priority: 5
- Regex: '^<boost/'
Priority: 7
- Regex: '^<.+\.'
Priority: 6
- Regex: '^<'
Priority: 10
IncludeIsMainRegex: '(_test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Single
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000
PenaltyReturnTypeOnItsOwnLine: 10000
PointerAlignment: Right
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: ForContinuationAndIndentation
...

32 changes: 3 additions & 29 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
*.la
*.lo
build
*.log
*.memlog
*.o
*.swp
*.tar.xz
*.trs
.deps/
.dirstamp
.libs/
Makefile
Makefile.in
aclocal.m4
autom4te.cache/
build-aux/
config.h
config.h.in
config.h.in~
config.log
config.status
configure
/gtktsm
libtool
m4/
src/tsm/libtsm.pc
stamp-h1
test-suite.log
test_htable
test_symbol
test_valgrind
*.kdev4
build
*~
.idea
25 changes: 25 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
language: cpp

dist: trusty
sudo: false

addons:
apt:
packages:
- valgrind
- libgtk-3-dev
- libpango1.0-dev
- check
- pkg-config

compiler:
- gcc
- clang

script:
- ctest -VV -S ./ci.ctest

# blocklist
branches:
except:
- /^feature.*$/
182 changes: 182 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
cmake_minimum_required(VERSION 3.5)

project(libtsm
LANGUAGES C
VERSION 4.0.1
)

# Some meta data
## TODO: merge into project above after we require cmake 3.12
set(PROJECT_HOMEPAGE_URL "https://github.com/Aetf/libtsm")
## TODO: merge into project above after we require cmake 3.10
set(PROJECT_DESCRIPTION "terminal-emulator state machine")

#---------------------------------------------------------------------------------------
# Initial setups
#---------------------------------------------------------------------------------------
# Ensure out-of-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "Usage: mkdir build; cmake ..")
endif()

# Include utilities
include(cmake/Utilities.cmake)
# For feature_summary
include(FeatureSummary)

# Extra build types
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug")
endif()
include(cmake/BuildTypes.cmake)

#---------------------------------------------------------------------------------------
# Options
#---------------------------------------------------------------------------------------
option(BUILD_SHARED_LIBS "Build as shared libraries" ON)
add_feature_info(BUILD_SHARED_LIBS BUILD_SHARED_LIBS "build as shared libraries")

option(BUILD_TESTING "Whether to build test suite in default target" OFF)
add_feature_info(BUILD_TESTING BUILD_TESTING "build unit tests")

# We enable a lot of debug options by default, so this option is really only for
# extended developer debug modes.
option(ENABLE_EXTRA_DEBUG "Whether to enable several non-standard debug options." OFF)
add_feature_info(ENABLE_EXTRA_DEBUG ENABLE_EXTRA_DEBUG "enable additional non-standard debug options")

# Whether to our gtktsm example. This is linux-only as it uses epoll and friends.
# Therefore, it's disabled by default.
option(BUILD_GTKTSM "Whether to build the gtktsm example" OFF)
add_feature_info(BUILD_GTKTSM BUILD_GTKTSM "build the gtktsm example, it requires gtk+-3 and friends and is linux-only.")

#---------------------------------------------------------------------------------------
# Find packages
#---------------------------------------------------------------------------------------
# Additional find modules
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/gnome-cmake/modules)

# GNU filesystem layout
include(GNUInstallDirs)

# We need xkbcommon for keysym definitions. If it's not found, we use our own
# private copy of xkbcommon-keysyms.h.
find_package(XKBCommon COMPONENTS KeySyms)
set_package_properties(XKBCommon PROPERTIES
TYPE OPTIONAL
PURPOSE "Needed for keysym definitions. Will use private copy if not found."
)

# Optionally, look for gtk+-3 and friends for gtktsm
if(BUILD_GTKTSM)
find_package(GTK3)
set_package_properties(GTK3 PROPERTIES
TYPE REQUIRED
PURPOSE "For gtktsm example"
)

find_package(Cairo)
set_package_properties(Cairo PROPERTIES
TYPE REQUIRED
PURPOSE "For gtktsm example"
)

find_package(Pango)
set_package_properties(Pango PROPERTIES
TYPE REQUIRED
PURPOSE "For gtktsm example"
)

find_package(PangoCairo)
set_package_properties(PangoCairo PROPERTIES
TYPE REQUIRED
PURPOSE "For gtktsm example"
)

find_package(XKBCommon COMPONENTS XKBCommon)
set_package_properties(XKBCommon PROPERTIES
TYPE REQUIRED
PURPOSE "For gtktsm example"
)
endif()

if(BUILD_TESTING)
enable_testing()
find_package(Check)
set_package_properties(Check PROPERTIES
TYPE REQUIRED
PURPOSE "For testing"
)
endif()

feature_summary(INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES WHAT ALL)

#---------------------------------------------------------------------------------------
# Set compiler options and features
#---------------------------------------------------------------------------------------
# Only set compile options after any inclusion of third party code
include(cmake/CompileOptions.cmake)

# Pass infomation to config header
if(XKBCommon_KeySyms_FOUND)
set(BUILD_HAVE_XKBCOMMON ON)
endif()
if(ENABLE_EXTRA_DEBUG)
set(BUILD_ENABLE_DEBUG ON)
endif(ENABLE_EXTRA_DEBUG)
configure_file(src/config.h.in ${CMAKE_BINARY_DIR}/config.h)
include_directories(${CMAKE_BINARY_DIR})

#---------------------------------------------------------------------------------------
# Put code together
#---------------------------------------------------------------------------------------
# Venderoized external code
add_subdirectory(external)

add_subdirectory(src)

if(BUILD_TESTING)
add_subdirectory(test)
endif(BUILD_TESTING)

#---------------------------------------------------------------------------------------
# Installation of other files
#---------------------------------------------------------------------------------------
# pkgconfig file for backward compatibility
configure_file(etc/libtsm.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libtsm.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libtsm.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

#Export the targets to a script
set(INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/libtsm)
install(EXPORT tsm-targets
FILE
libtsm-targets.cmake
NAMESPACE
libtsm::
DESTINATION
${INSTALL_CMAKEDIR}
)

#Create a ConfigVersion.cmake file
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/libtsm-config-version.cmake
COMPATIBILITY SameMajorVersion
)

configure_package_config_file(
${CMAKE_SOURCE_DIR}/etc/libtsm-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/libtsm-config.cmake
PATH_VARS
INSTALL_CMAKEDIR
INSTALL_DESTINATION
${INSTALL_CMAKEDIR}
NO_CHECK_REQUIRED_COMPONENTS_MACRO
)

#Install the config, configversion and custom find modules
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libtsm-config-version.cmake
${CMAKE_CURRENT_BINARY_DIR}/libtsm-config.cmake
DESTINATION ${INSTALL_CMAKEDIR}
)
4 changes: 4 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
= Authors =

This software was written by:
Aetf <[email protected]>
David Herrmann <[email protected]>
Ran Benita <[email protected]>

Expand All @@ -12,6 +13,7 @@ source file for the related copyright notice and license.
If a file does not contain a copright notice, the following license shall
apply:

Copyright (c) 2017-2018 Aetf <[email protected]>
Copyright (c) 2011-2013 David Herrmann <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -34,6 +36,8 @@ apply:
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

== Third-Party Source ==
Various cmake find modules in cmake/modules/gnome-cmake is from
https://github.com/nemequ/gnome-cmake, see cmake/modules/gnome-cmake/COPYING

The hash-table implementation in src/shared/shl-htable.* uses internally the
htable from CCAN, see LICENSE_htable.
Expand Down
Loading

0 comments on commit f70e379

Please sign in to comment.