Repository navigation
Add OPENCC_DICT_FORMAT CMake option to select dictionary output format - #1396
Merged
Merged
Conversation
Adds an OPENCC_DICT_FORMAT cache variable (ocd2 / text / ocd) so CMake builds can
produce compiled .ocd2 dictionaries (default), plain .txt dictionaries, or legacy
Darts .ocd dictionaries, with config JSON files rewritten to match the chosen format;
mirrors the text-backed resource package already produced by the Bazel
opencc_resources_zip target.
Detailed Changes:
- **CMakeLists.txt**:
- Add `OPENCC_DICT_FORMAT` cache variable accepting `ocd2`, `text`, or `ocd`;
selecting `ocd` without `ENABLE_DARTS=ON` fails configure with a clear error.
- **data/CMakeLists.txt**:
- `text`: copies raw `.txt` dictionaries into the build tree (the four bootstrap
dictionaries still compile to `.ocd2` on demand for the phrase generator); rewrites
and installs config JSON files via the conversion script.
- `ocd`: adds a per-dictionary `.ocd` build loop running `opencc_dict --to ocd`.
- Both non-default formats pass the target format to the config-conversion script.
- **data/scripts/convert_config_dict_format.py** (new, replaces `convert_config_to_text.py`):
- Rewrites `type`/`file` dict references in config JSON to the given target format
(`text` or `ocd`); includes a matching Bazel `py_binary` target.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an OPENCC_DICT_FORMAT cache variable (ocd2 / text / ocd) so CMake builds can produce compiled .ocd2 dictionaries (default), plain .txt dictionaries, or legacy Darts .ocd dictionaries, with config JSON files rewritten to match the chosen format; mirrors the text-backed resource package already produced by the Bazel opencc_resources_zip target.
Detailed Changes:
OPENCC_DICT_FORMATcache variable acceptingocd2,text, orocd; selectingocdwithoutENABLE_DARTS=ONfails configure with a clear error.text: copies raw.txtdictionaries into the build tree (the four bootstrap dictionaries still compile to.ocd2on demand for the phrase generator); rewrites and installs config JSON files via the conversion script.ocd: adds a per-dictionary.ocdbuild loop runningopencc_dict --to ocd.convert_config_to_text.py):type/filedict references in config JSON to the given target format (textorocd); includes a matching Bazelpy_binarytarget.