Skip to content
Merged
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
43 changes: 43 additions & 0 deletions .clangd
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
If:
PathMatch: .*\.in

CompileFlags:
Remove:
- -Wall
- -Wextra
- -Wpedantic

Diagnostics:
Suppress:
- "*"

---

CompileFlags:
Add:
- -Wall
- -Wextra
- -Wpedantic

# The empty compile_flags.txt in the root directory causes clangd to treat
# these paths as relative to the root of the project when compile_commands.json
# is not present.
- -Ibuild/.dep-cache/utpp-repo-src/include/.
- -Iinclude/.
- -Itests/.

- -xc++ # Force .h files to be treated as C++
# - -std=gnu++17
- -std=c++20
- --target=x86_64-pc-windows-msvc
- -DUNICODE
- -D_UNICODE
- -D_DEBUG
- -D_DLL
- -D_MT
- -Xclang
- --dependent-lib=msvcrtd
- -g
- -Xclang
- -gcodeview
- -fno-char8_t
50 changes: 50 additions & 0 deletions .cspell.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"version": "0.2",
"ignorePaths": [
".cspell.jsonc",
".git/**",
"*.code-workspace",
".local-gitignore",
"data/UnicodeData.txt"
],
"dictionaryDefinitions": [
{
"name": "project-words",
"path": ".vscode/ltex.dictionary.en-US.txt",
"addWords": true
}
],
"dictionaries": [
"bash",
"win32",
"scientific-terms-us",
"project-words"
],
"ignoreWords": [
"ăâățî",
"ĂÂȚÎ",
"BCDEFGH",
"MIRCEANEACȘUĂÂȚÎ",
"ȚEPUȘ",
"αλφάβητο",
"αξία",
"αρχείο",
"ελληνικό",
"ΚΛΕΙΔΙ",
"Հայերեն",
"पंजाबी",
"ᓀᐦᐃᔭᐍᐏᐣ",
"Ελληνικός",
"العربي",
"اللغة",
"ܐܪܡܝܐ"
],
"ignoreRegExpList": [
"/-W.*/",
"/-D.*/",
"/-X.*/",
"/-I.*/"
],
"allowCompoundWords": true,
"words": []
}
35 changes: 26 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,42 @@ permissions:
jobs:
build:
runs-on: windows-latest

steps:

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Get CPM
uses: neacsum/configurator@v0.0.11
with:
name: cpm.exe
url: https://github.com/neacsum/cpm/releases/latest/download/cpm.exe

- name: Build libraries
run: cpm -v --proto https -u https://github.com/neacsum/utf8.git -r $HOME utf8


- name: Create dependencies directory
shell: cmd
run: |
if not exist "build\.dep-cache" mkdir "build\.dep-cache"

- name: Download dependencies
run: cpm -v -f --proto https -r build\.dep-cache

- name: Copy utpp directory
shell: cmd
run: |
xcopy /E /I build\.dep-cache\utpp build\.dep-cache\utpp-repo-src

- name: Build library (local version, not from CPM)
shell: cmd
run: |
build.bat lib

- name: Build and run tests
shell: cmd
run: |
%USERPROFILE%\utf8\build.bat tests
build.bat tests

- name: Save tests result
uses: actions/upload-artifact@v4
with:
name: test_results
path: ~/utf8/build/exe/x64/debug/utf8_tests.xml

path: build/exe/x64/debug/utf8_tests.xml
4 changes: 2 additions & 2 deletions .github/workflows/doxygen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ jobs:

- name: Generate Doxygen documentation
run: doxygen tools/doxygen/Doxyfile

- name: Upload pages
uses: actions/upload-pages-artifact@v3
with:
path: docs

- name: Deploy pages
uses: actions/deploy-pages@v4
4 changes: 2 additions & 2 deletions .github/workflows/purge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
days:
description: 'Number of days.'
required: true
default: 30
default: '30'
minimum_runs:
description: 'The minimum runs to keep for each workflow.'
required: true
default: 6
default: '6'
delete_workflow_pattern:
description: 'The name or filename of the workflow. if not set then it will target all workflows.'
required: false
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

/build
/.vs*
!/.vscode/
/.vscode/*
!/.vscode/ltex.dictionary.en-US.txt
!/.vscode/ltex.hiddenFalsePositives.en-US.txt
/lib
/.editorconfig
/utf8.cppcheck
/docs
/.DS_Store
.cache/
/compile_commands.json
.dep-cache/
64 changes: 64 additions & 0 deletions .vscode/ltex.dictionary.en-US.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
asmx
basecvt
casecvt
clangd
codept
cppcheck
endl
exetest
fdat
gclef
gcodeview
icompare
ifndef
ifstream
ipch
IWYU
ized
Kaspersky
keyxx
lfont
ltex
Mattraks
mfcribbon
msbuild
msvc
msvcrtd
NDEBUG
Neacsu
neacșu
neacsum
ofstream
opensdf
resx
sectionxx
stdcpp
SYMED
usebackq
utpp
vect
vsmsbuildcmd
VSWHERE
wcmd
wdat
wdata
wdir
wdrive
wemoji
wfile
wfname
wfull
winutf
wnam
wnew
wpath
wpfx
wptr
wrel
wrhs
wsmiley
wsubkey
wval
wvalue
wvar
xcopy
2 changes: 2 additions & 0 deletions .vscode/ltex.hiddenFalsePositives.en-US.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{"rule":"ADD_AN_ADDITIONAL","sentence":"^\\QThe C++20 standard has added an additional type \\E(?:Dummy|Ina|Jimmy-|Dummy-|Maniquí-|Maniquíes-)[0-9]+\\Q, designed to keep UTF-8 encoded characters, and a string type \\E(?:Dummy|Ina|Jimmy-|Dummy-|Maniquí-|Maniquíes-)[0-9]+\\Q.\\E$"}
{"rule":"UPPERCASE_SENTENCE_START","sentence":"^\\Qwith the implied assumption that all \\E(?:Dummy|Ina|Jimmy-|Dummy-|Maniquí-|Maniquíes-)[0-9]+\\Q strings are UTF-8 encoded character strings.\\E$"}
2 changes: 1 addition & 1 deletion BUILD.bat
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ echo Visual studio installation folder is: %VSInstallDir%
call "%VSInstallDir%\common7\tools\vsmsbuildcmd.bat"

rem
rem Build tragets. Valid targets are "lib" and "tests"
rem Build targets. Valid targets are "lib" and "tests"
rem Default is to build all
rem
if "%~1"=="" (msbuild "%~dp0build.proj") else (msbuild -target:%1 "%~dp0build.proj")
33 changes: 29 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 4.0)
project(utf8)

if (WIN32)
Expand All @@ -7,17 +7,42 @@ else()
set(pfx "")
endif()

add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
add_definitions(-DUNICODE -D_UNICODE)
add_compile_definitions(_UNICODE UNICODE)
if(MSVC)
add_compile_options(/utf-8)
endif()

# https://wg21.link/p2513
if(MSVC)
add_compile_options(/Zc:char8_t-)
else()
add_compile_options(-fno-char8_t)
endif()

## configure CMake module search paths that depend on the project
## proj src dir is location of this file
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
include(ConfigFetchContent)
include(CompileCommands)
# include dependencies
include(utpp)

add_subdirectory(tools/gen_casetab)

add_library(${PROJECT_NAME})
set_target_properties(${PROJECT_NAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib/${pfx}/$<CONFIG>
CXX_STANDARD 17
)
add_subdirectory(src)
add_subdirectory(include)

set(BUILD_TESTS FALSE CACHE BOOL "Build tests")
if (BUILD_TESTS)
add_subdirectory(tests)
endif ()

set(BUILD_EXAMPLES FALSE CACHE BOOL "Build examples")
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif ()
Loading
Loading