Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
---
Language: Cpp
# BasedOnStyle: WebKit
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
#AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllConstructorInitializersOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: TopLevelDefinitions
#AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: All
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: WebKit
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 0
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 8
#ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: true
#ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: false
#ReflowComments: true
ShortNamespaceLines: 1
SortIncludes: false
#SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME
...

61 changes: 61 additions & 0 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: C/C++ CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "*" ]

jobs:
check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: check-format
run: |
echo "Checking format of sourcecode..."
find . -type f \( -name '*.c' -o -name '*.h' \) -print0 | xargs -r0 clang-format -i
git diff --color # --exit-code

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: install dependencies
run: sudo apt install autopoint check intltool libexpat1-dev pkg-config
- name: configure
run: |
test -f config.rpath || touch config.rpath
sh ./autogen.sh
./configure
- name: make
run: make
- name: make check
run: make check
- name: make distcheck
run: make distcheck

build-windows:
env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release

runs-on: windows-latest

steps:
- uses: actions/checkout@v3

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1.0.2

- name: Restore NuGet packages
working-directory: ${{env.GITHUB_WORKSPACE}}
run: nuget restore ${{env.SOLUTION_FILE_PATH}}

- name: Build
working-directory: ${{env.GITHUB_WORKSPACE}}
run: |
msbuild /m /p:platform=x64 /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
msbuild /m /p:platform=x86 /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ option(ENABLE_UNIT_TEST
include(CTest)

include(GNUInstallDirs)
include(CheckIncludeFiles)
set(LIBHANGUL_INCLUDE_DIR "${CMAKE_INSTALL_INCLUDEDIR}/hangul-1.0")
set(LIBHANGUL_LIBRARY_DIR "${CMAKE_INSTALL_LIBDIR}")

Expand All @@ -56,6 +57,12 @@ if(BUILD_TESTING)
add_subdirectory(test EXCLUDE_FROM_ALL)
endif()

check_include_files(glob.h HAVE_GLOB_H)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/config.h"
)

include(CMakePackageConfigHelpers)
configure_package_config_file(hangul-config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/hangul-config.cmake"
Expand Down
35 changes: 35 additions & 0 deletions Libhangul.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.960
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2DA4F60C-0EED-4AE9-823D-C8BC15FA46ED}") = "Libhangul", "libhangul.vcxproj", "{83381EEE-8813-47E6-BDCB-4F9882E81882}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Debug|x64.ActiveCfg = Debug|x64
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Debug|x64.Build.0 = Debug|x64
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Debug|x64.Deploy.0 = Debug|x64
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Debug|x86.ActiveCfg = Debug|Win32
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Debug|x86.Build.0 = Debug|Win32
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Debug|x86.Deploy.0 = Debug|Win32
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Release|x64.ActiveCfg = Release|x64
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Release|x64.Build.0 = Release|x64
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Release|x64.Deploy.0 = Release|x64
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Release|x86.ActiveCfg = Release|Win32
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Release|x86.Build.0 = Release|Win32
{83381EEE-8813-47E6-BDCB-4F9882E81882}.Release|x86.Deploy.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3DA4F60C-0EED-4AE9-823D-C8BC15FA46ED}
EndGlobalSection
EndGlobal
1 change: 1 addition & 0 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#cmakedefine HAVE_GLOB_H 1
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ AC_PROG_INSTALL
AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h limits.h])
AC_CHECK_HEADERS([langinfo.h])
AC_CHECK_HEADERS([glob.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
Expand Down
5 changes: 5 additions & 0 deletions hangul/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ add_library(hangul
)

target_compile_definitions(hangul
PRIVATE -DHAVE_CONFIG_H
PRIVATE -DLOCALEDIR=\"${CMAKE_INSTALL_FULL_LOCALEDIR}\"
PRIVATE -DLIBHANGUL_DEFAULT_HANJA_DIC=\"${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}/hanja/hanja.txt\"
PRIVATE -DLIBHANGUL_DATA_DIR=\"${CMAKE_INSTALL_FULL_DATADIR}/${CMAKE_PROJECT_NAME}\"
PRIVATE -DTOP_SRCDIR=\"${CMAKE_SOURCE_DIR}\"
)

target_include_directories(hangul
PRIVATE "${CMAKE_BINARY_DIR}"
)

if(ENABLE_EXTERNAL_KEYBOARDS)
target_compile_definitions(hangul
PRIVATE -DENABLE_EXTERNAL_KEYBOARDS=1
Expand Down
Loading