Compare commits
3
Commits
ff2600c8fb
...
43984685bc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43984685bc | ||
|
|
c2dafab217 | ||
|
|
34de35dd31 |
No files matched your search
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+5
-21
@@ -73,25 +73,9 @@ So before compiling, you must make sure `doxygen` are presented in your environm
|
||||
|
||||
## Build and Install
|
||||
|
||||
There are 2 different ways to build this project.
|
||||
If you are the user of this project (just want this project to make something works), please choose "User Build".
|
||||
If you are a developer (developer of this project, or use this project as dependency to develop your project), please choose "Developer Build".
|
||||
Using CMake is the only viable way to build and install this repository.
|
||||
|
||||
### User Build
|
||||
|
||||
"User Build" is basically how GitHub Action build this project.
|
||||
|
||||
Under **the root directory** of this project, execute:
|
||||
|
||||
- `Script/windows_build.bat` on Windows
|
||||
- or `Script/linux_build.sh` on Linux
|
||||
- or `Script/macos_build.sh` on macOS
|
||||
|
||||
The final built artifact is under `Bin/install` directory.
|
||||
|
||||
### Developer Build
|
||||
|
||||
#### Configurable Variables
|
||||
### Configurable Variables
|
||||
|
||||
First, there is a list listing all variables you may configure during compiling.
|
||||
|
||||
@@ -109,7 +93,7 @@ Please note that generated documentation is different in different platforms.
|
||||
* `ZLIB_ROOT`: Set to the install path of zlib.
|
||||
If you are using zlib which is not build by your own, you usually do not need specify this variable.
|
||||
|
||||
#### Configure CMake
|
||||
### Configure CMake
|
||||
|
||||
When configure CMake, you may use different options on different platforms.
|
||||
Following list may help you.
|
||||
@@ -124,7 +108,7 @@ Additionally, you can attach any variables introduced above with `-D` option dur
|
||||
> [!NOTE]
|
||||
> Position independent code flag is automatically added if you enable `BMap` so you don't need manually specify it. You just need to make sure that all dependencies enable this.
|
||||
|
||||
#### Build with CMake
|
||||
### Build with CMake
|
||||
|
||||
After configuration, you can use `cmake --build .` to build project,
|
||||
with additional options on different platforms.
|
||||
@@ -135,7 +119,7 @@ Following list may help you.
|
||||
- On Linux or other POSIX systems:
|
||||
* None
|
||||
|
||||
#### Install with CMake
|
||||
### Install with CMake
|
||||
|
||||
After building, you can use `cmake --install . --prefix <path-to-prefix>`
|
||||
to install project into given path, with additional options on different platforms.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# Result
|
||||
*.cpp
|
||||
@@ -1,98 +0,0 @@
|
||||
Encoding Alias Code Page Iconv Identifier
|
||||
ascii 646, us-ascii 437 ASCII
|
||||
big5 big5-tw, csbig5 950 BIG5
|
||||
big5hkscs big5-hkscs, hkscs BIG5-HKSCS
|
||||
cp037 IBM037, IBM039 037
|
||||
cp273 273, IBM273, csIBM273
|
||||
cp424 EBCDIC-CP-HE, IBM424
|
||||
cp437 437, IBM437 437
|
||||
cp500 EBCDIC-CP-BE, EBCDIC-CP-CH, IBM500 500
|
||||
cp720 720
|
||||
cp737 737
|
||||
cp775 IBM775 775
|
||||
cp850 850, IBM850 850 CP850
|
||||
cp852 852, IBM852 852
|
||||
cp855 855, IBM855 855
|
||||
cp856
|
||||
cp857 857, IBM857 857
|
||||
cp858 858, IBM858 858
|
||||
cp860 860, IBM860 860
|
||||
cp861 861, CP-IS, IBM861 861
|
||||
cp862 862, IBM862 862 CP862
|
||||
cp863 863, IBM863 863
|
||||
cp864 IBM864 864
|
||||
cp865 865, IBM865 865
|
||||
cp866 866, IBM866 866 CP866
|
||||
cp869 869, CP-GR, IBM869 869
|
||||
cp874 874 CP874
|
||||
cp875 875
|
||||
cp932 932, ms932, mskanji, ms-kanji, windows-31j 932 CP932
|
||||
cp949 949, ms949, uhc 949 CP949
|
||||
cp950 950, ms950 950 CP950
|
||||
cp1006
|
||||
cp1026 ibm1026 1026
|
||||
cp1125 1125, ibm1125, cp866u, ruscii
|
||||
cp1140 ibm1140 1140
|
||||
cp1250 windows-1250 1250 CP1250
|
||||
cp1251 windows-1251 1251 CP1251
|
||||
cp1252 windows-1252 1252 CP1252
|
||||
cp1253 windows-1253 1253 CP1253
|
||||
cp1254 windows-1254 1254 CP1254
|
||||
cp1255 windows-1255 1255 CP1255
|
||||
cp1256 windows-1256 1256 CP1256
|
||||
cp1257 windows-1257 1257 CP1257
|
||||
cp1258 windows-1258 1258 CP1258
|
||||
euc_jp eucjp, ujis, u-jis 20932 EUC-JP
|
||||
euc_jis_2004 jisx0213, eucjis2004
|
||||
euc_jisx0213 eucjisx0213
|
||||
euc_kr euckr, korean, ksc5601, ks_c-5601, ks_c-5601-1987, ksx1001, ks_x-1001 51949 EUC-KR
|
||||
gb2312 chinese, csiso58gb231280, euc-cn, euccn, eucgb2312-cn, gb2312-1980, gb2312-80, iso-ir-58 936 CP936
|
||||
gbk 936, cp936, ms936 936 GBK
|
||||
gb18030 gb18030-2000 54936 GB18030
|
||||
hz hzgb, hz-gb, hz-gb-2312 52936 HZ
|
||||
iso2022_jp csiso2022jp, iso2022jp, iso-2022-jp 50220 ISO-2022-JP
|
||||
iso2022_jp_1 iso2022jp-1, iso-2022-jp-1 ISO-2022-JP-1
|
||||
iso2022_jp_2 iso2022jp-2, iso-2022-jp-2 ISO-2022-JP-2
|
||||
iso2022_jp_2004 iso2022jp-2004, iso-2022-jp-2004
|
||||
iso2022_jp_3 iso2022jp-3, iso-2022-jp-3
|
||||
iso2022_jp_ext iso2022jp-ext, iso-2022-jp-ext
|
||||
iso2022_kr csiso2022kr, iso2022kr, iso-2022-kr 50225 ISO-2022-KR
|
||||
latin_1 iso-8859-1, iso8859-1, 8859, cp819, latin, latin1, L1 28591 ISO-8859-1
|
||||
iso8859_2 iso-8859-2, latin2, L2 28592 ISO-8859-2
|
||||
iso8859_3 iso-8859-3, latin3, L3 28593 ISO-8859-3
|
||||
iso8859_4 iso-8859-4, latin4, L4 28594 ISO-8859-4
|
||||
iso8859_5 iso-8859-5, cyrillic 28595 ISO-8859-5
|
||||
iso8859_6 iso-8859-6, arabic 28596 ISO-8859-6
|
||||
iso8859_7 iso-8859-7, greek, greek8 28597 ISO-8859-7
|
||||
iso8859_8 iso-8859-8, hebrew 28598 ISO-8859-8
|
||||
iso8859_9 iso-8859-9, latin5, L5 28599 ISO-8859-9
|
||||
iso8859_10 iso-8859-10, latin6, L6 ISO-8859-10
|
||||
iso8859_11 iso-8859-11, thai ISO-8859-11
|
||||
iso8859_13 iso-8859-13, latin7, L7 28603 ISO-8859-13
|
||||
iso8859_14 iso-8859-14, latin8, L8 ISO-8859-14
|
||||
iso8859_15 iso-8859-15, latin9, L9 28605 ISO-8859-15
|
||||
iso8859_16 iso-8859-16, latin10, L10 ISO-8859-16
|
||||
johab cp1361, ms1361 1361 JOHAB
|
||||
koi8_r
|
||||
koi8_t KOI8-T
|
||||
koi8_u
|
||||
kz1048 kz_1048, strk1048_2002, rk1048
|
||||
mac_cyrillic maccyrillic 10007 MacCyrillic
|
||||
mac_greek macgreek 10006 MacGreek
|
||||
mac_iceland maciceland 10079 MacIceland
|
||||
mac_latin2 maclatin2, maccentraleurope, mac_centeuro
|
||||
mac_roman macroman, macintosh MacRoman
|
||||
mac_turkish macturkish 10081 MacTurkish
|
||||
ptcp154 csptcp154, pt154, cp154, cyrillic-asian PT154
|
||||
shift_jis csshiftjis, shiftjis, sjis, s_jis 932 SHIFT_JIS
|
||||
shift_jis_2004 shiftjis2004, sjis_2004, sjis2004
|
||||
shift_jisx0213 shiftjisx0213, sjisx0213, s_jisx0213
|
||||
utf_32 U32, utf32 UTF-32
|
||||
utf_32_be UTF-32BE UTF-32BE
|
||||
utf_32_le UTF-32LE UTF-32LE
|
||||
utf_16 U16, utf16 UTF16
|
||||
utf_16_be UTF-16BE UTF-16BE
|
||||
utf_16_le UTF-16LE UTF-16LE
|
||||
utf_7 U7, unicode-1-1-utf-7 65000 UTF-7
|
||||
utf_8 U8, UTF, utf8, utf-8, cp65001 65001 UTF-8
|
||||
utf_8_sig
|
||||
|
@@ -1,63 +0,0 @@
|
||||
import typing
|
||||
import io
|
||||
import os
|
||||
|
||||
class LanguageToken:
|
||||
m_Name: str
|
||||
m_Alias: tuple[str, ...]
|
||||
m_CodePage: str | None
|
||||
m_IconvCode: str | None
|
||||
|
||||
def __init__(self, name: str, alias: typing.Iterator[str], code_page: str, iconv_code: str):
|
||||
self.m_Name = name.lower()
|
||||
self.m_Alias = tuple(map(lambda x: x.lower(), alias))
|
||||
self.m_CodePage = None if code_page == '' else code_page
|
||||
self.m_IconvCode = None if iconv_code == '' else iconv_code
|
||||
|
||||
def extract_data(fs: io.TextIOWrapper) -> tuple[str, ...]:
|
||||
# remove first line to remove table header
|
||||
return fs.readlines()[1:]
|
||||
|
||||
def extract_token(csv_data: tuple[str, ...]) -> tuple[LanguageToken, ...]:
|
||||
ret: list[LanguageToken] = []
|
||||
for line in csv_data:
|
||||
line = line.strip('\n')
|
||||
line_sp = line.split('\t')
|
||||
alias_sp = filter(lambda x: x != '', map(lambda x: x.strip(), line_sp[1].split(',')))
|
||||
ret.append(LanguageToken(line_sp[0], alias_sp, line_sp[2], line_sp[3]))
|
||||
return tuple(ret)
|
||||
|
||||
def write_alias_map(fs: io.TextIOWrapper, data: tuple[LanguageToken, ...]) -> None:
|
||||
fs.write('static const std::map<std::u8string, std::u8string> c_AliasMap {\n')
|
||||
for i in data:
|
||||
for j in i.m_Alias:
|
||||
fs.write(f'\t{{ u8"{j}", u8"{i.m_Name}" }},\n')
|
||||
fs.write('};\n')
|
||||
|
||||
def write_win_cp_map(fs: io.TextIOWrapper, data: tuple[LanguageToken, ...]) -> None:
|
||||
fs.write('static const std::map<std::u8string, UINT> c_WinCPMap {\n')
|
||||
for i in data:
|
||||
if i.m_CodePage is not None:
|
||||
fs.write(f'\t{{ u8"{i.m_Name}", static_cast<UINT>({i.m_CodePage}u) }},\n')
|
||||
fs.write('};\n')
|
||||
|
||||
def write_iconv_map(fs: io.TextIOWrapper, data: tuple[LanguageToken, ...]) -> None:
|
||||
fs.write('static const std::map<std::u8string, std::string> c_IconvMap {\n')
|
||||
for i in data:
|
||||
if i.m_IconvCode is not None:
|
||||
fs.write(f'\t{{ u8"{i.m_Name}", "{i.m_IconvCode}" }},\n')
|
||||
fs.write('};\n')
|
||||
|
||||
if __name__ == '__main__':
|
||||
# get file path
|
||||
self_path: str = os.path.dirname(__file__)
|
||||
csv_file: str = os.path.join(self_path, 'EncodingTable.csv')
|
||||
cpp_file: str = os.path.join(self_path, 'EncodingTable.cpp')
|
||||
# process files
|
||||
with open(csv_file, 'r', encoding='utf-8') as fr:
|
||||
with open(cpp_file, 'w', encoding='utf-8') as fw:
|
||||
data = extract_data(fr)
|
||||
token = extract_token(data)
|
||||
write_alias_map(fw, token)
|
||||
write_win_cp_map(fw, token)
|
||||
write_iconv_map(fw, token)
|
||||
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2022-2024 yyc12345
|
||||
Copyright (c) 2022-2026 yyc12345
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@@ -40,11 +40,11 @@ namespace LibCmo::XContainer {
|
||||
ba[n] = false;
|
||||
}
|
||||
|
||||
template<bool _Cond>
|
||||
template<bool BCondition>
|
||||
static bool GeneralGetBitPosition(const XBitArray& ba, CKDWORD n, CKDWORD& got) {
|
||||
CKDWORD counter = 0;
|
||||
for (size_t i = 0; i < ba.size(); ++i) {
|
||||
if (ba[i] == _Cond) {
|
||||
if (ba[i] == BCondition) {
|
||||
if (counter == n) {
|
||||
got = static_cast<CKDWORD>(i);
|
||||
return true;
|
||||
@@ -81,18 +81,14 @@ namespace LibCmo::XContainer {
|
||||
|
||||
}
|
||||
|
||||
template<class _Ty>
|
||||
static constexpr bool GeneralXArrayCheck_TypeCheck() {
|
||||
return std::is_same_v<_Ty, CK2::CK_ID> || std::is_same_v<_Ty, CK2::ObjImpls::CKObject*>;
|
||||
}
|
||||
template<class _Ty, bool _IsPre>
|
||||
static bool GeneralXArrayCheck_ItemCheck(const _Ty& item, CK2::CKContext* ctx) {
|
||||
static_assert(GeneralXArrayCheck_TypeCheck<_Ty>());
|
||||
template<class T, bool BIsPre>
|
||||
requires (std::is_same_v<T, CK2::CK_ID> || std::is_same_v<T, CK2::ObjImpls::CKObject*>)
|
||||
static bool GeneralXArrayCheck_ItemCheck(const T& item, CK2::CKContext* ctx) {
|
||||
if (ctx == nullptr) return false;
|
||||
|
||||
if constexpr (_IsPre) {
|
||||
if constexpr (BIsPre) {
|
||||
CK2::ObjImpls::CKObject* obj = nullptr;
|
||||
if constexpr (std::is_same_v<_Ty, CK2::CK_ID>) {
|
||||
if constexpr (std::is_same_v<T, CK2::CK_ID>) {
|
||||
obj = ctx->GetObject(item);
|
||||
if (obj == nullptr) return false;
|
||||
} else {
|
||||
@@ -101,7 +97,7 @@ namespace LibCmo::XContainer {
|
||||
if (obj->IsToBeDeleted()) return false;
|
||||
} else {
|
||||
CK2::MgrImpls::CKObjectManager* objmgr = ctx->GetObjectManager();
|
||||
if constexpr (std::is_same_v<_Ty, CK2::CK_ID>) {
|
||||
if constexpr (std::is_same_v<T, CK2::CK_ID>) {
|
||||
if (!objmgr->IsObjectSafe(item)) return false;
|
||||
} else {
|
||||
if (!objmgr->IsObjectPointerSafe(item)) return false;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# Disable all file and folder
|
||||
/*
|
||||
/*/
|
||||
|
||||
# Only upload specific files
|
||||
!/.gitignore
|
||||
!/README.md
|
||||
@@ -1,43 +0,0 @@
|
||||
# LibCmo21 Redist
|
||||
|
||||
This folder is served for LibCmo21 distribution and this page will introduce how to distribute a LibCmo21.
|
||||
|
||||
In this article, I assume:
|
||||
* This distribution is served for Windows user.
|
||||
* All Linux will use this project by compiling it on themselves.
|
||||
* You are using Visual Studio under Windows, not CMake.
|
||||
* User will only need x64 architecture, not Win32 (x86).
|
||||
|
||||
## Common
|
||||
|
||||
1. Copy project `LICENSE` into folder.
|
||||
|
||||
## Unvirt
|
||||
|
||||
1. Compile project with `x64 | Release` profile.
|
||||
1. Create folder `Unvirt` and enter it.
|
||||
1. Copy generated `Unvirt.exe` and `Unvirt.pdb` into folder.
|
||||
1. Copy zlib binary `zlibwapi.dll` into folder.
|
||||
|
||||
## BMap
|
||||
|
||||
1. Compile project with `x64 | Release` profile.
|
||||
1. Create folder `BMap` and enter it.
|
||||
1. Copy generated `BMap.dll` and `BMap.pdb` into folder.
|
||||
1. Copy zlib binary `zlibwapi.dll` into folder.
|
||||
|
||||
## PyBMap
|
||||
|
||||
1. Compile project with `x64 | Release` profile.
|
||||
1. Create folder `PyBMap` and enter it.
|
||||
1. Copy all files ending with `.py` and located in folder `BMapBindings/PyBMap/PyBMap` into folder.
|
||||
1. Copy generated `BMap.dll` and `BMap.pdb` into folder.
|
||||
1. Copy zlib binary `zlibwapi.dll` into folder.
|
||||
|
||||
## BMapSharp
|
||||
|
||||
This project is not ready for release.
|
||||
|
||||
## Ending
|
||||
|
||||
1. Pack all files and folders except `.gitignore` and `README.md` in this folder.
|
||||
@@ -1,3 +0,0 @@
|
||||
# Disable output
|
||||
win_build.bat
|
||||
linux_build.sh
|
||||
@@ -1,67 +0,0 @@
|
||||
import os
|
||||
import argparse
|
||||
import jinja2
|
||||
|
||||
def get_root_directory() -> str:
|
||||
return os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
class ScriptSettings:
|
||||
m_BuildDoc: bool
|
||||
|
||||
def __init__(self, build_doc: bool):
|
||||
self.m_BuildDoc = build_doc
|
||||
|
||||
class TemplateRender:
|
||||
m_Loader: jinja2.BaseLoader
|
||||
m_Environment: jinja2.Environment
|
||||
|
||||
m_WinTemplate: jinja2.Template
|
||||
m_LinuxTemplate: jinja2.Template
|
||||
|
||||
m_Settings: ScriptSettings
|
||||
|
||||
def __init__(self, settings: ScriptSettings) -> None:
|
||||
self.m_Loader = jinja2.FileSystemLoader(self.__get_dir())
|
||||
self.m_Environment = jinja2.Environment(loader=self.m_Loader)
|
||||
|
||||
self.m_WinTemplate = self.m_Environment.get_template('win_build.template.bat')
|
||||
self.m_LinuxTemplate = self.m_Environment.get_template('linux_build.template.sh')
|
||||
|
||||
self.m_Settings = settings
|
||||
|
||||
def __get_dir(self) -> str:
|
||||
return os.path.dirname(__file__)
|
||||
|
||||
def __render(self, template: jinja2.Template, dest_file: str, is_win: bool) -> None:
|
||||
with open(os.path.join(self.__get_dir(), dest_file), 'w', encoding='utf-8') as f:
|
||||
f.write(template.render(
|
||||
repo_root_dir = os.path.dirname(self.__get_dir()),
|
||||
build_doc = self.m_Settings.m_BuildDoc
|
||||
))
|
||||
|
||||
def render_win_script(self) -> None:
|
||||
self.__render(self.m_WinTemplate, 'win_build.bat', True)
|
||||
|
||||
def render_linux_script(self) -> None:
|
||||
self.__render(self.m_LinuxTemplate, 'linux_build.sh', False)
|
||||
|
||||
if __name__ == '__main__':
|
||||
# parse argument
|
||||
parser = argparse.ArgumentParser(
|
||||
prog='LibCmo Windows Build Script',
|
||||
description='LibCmo Windows Build Script'
|
||||
)
|
||||
parser.add_argument(
|
||||
'-d', '--build-doc',
|
||||
action='store_true', dest='build_doc',
|
||||
help='Build LibCmo without documentation.'
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
# build settings
|
||||
settings = ScriptSettings(args.build_doc)
|
||||
# build template render and render result
|
||||
render = TemplateRender(settings)
|
||||
render.render_win_script()
|
||||
render.render_linux_script()
|
||||
|
||||
Whitespace-only changes.
@@ -1,24 +0,0 @@
|
||||
@ECHO OFF
|
||||
:: Navigate to root directory
|
||||
CD /d {{ repo_root_dir }}
|
||||
|
||||
:: Create main binary directory
|
||||
MKDIR bin
|
||||
CD bin
|
||||
:: Create build and install folder
|
||||
MKDIR build
|
||||
MKDIR install
|
||||
|
||||
:: Build project
|
||||
CD build
|
||||
cmake -A x64 -DNEMO_BUILD_UNVIRT=ON -DNEMO_BUILD_BMAP=ON {{ '-DNEMO_BUILD_DOC=ON' if build_doc }} -DSTB_IMAGE_PATH="D:\CppLib\stb" -DYYCC_PATH="J:\YYCCommonplace\bin\cpp20\install\x64_Release" -DZLIB_HEADER_PATH="D:\zlib" -DZLIB_BINARY_PATH="D:\zlib\contrib\vstudio\vc14\x64\ZlibDllRelease" ../..
|
||||
cmake --build . --config RelWithDebInfo
|
||||
{% if build_doc %}
|
||||
cmake --build . --target NeMoDocuments
|
||||
{% endif %}
|
||||
cmake --install . --prefix=../install --config RelWithDebInfo
|
||||
CD ..
|
||||
|
||||
:: Exit to original path
|
||||
CD ..
|
||||
ECHO Windows CMake Build Done
|
||||
Reference in new issue
Block a user