chore: update build manual and script.
This commit is contained in:
66
COMPILE.md
66
COMPILE.md
@ -11,40 +11,64 @@ It means that it is not stable and work in progress.
|
||||
* CMake 3.23 at least.
|
||||
* The common compiler supporting C++ 23 (GCC / Clang / MSVC).
|
||||
* Iconv (Optional on Windows. Required on other systems).
|
||||
* [GoogleTest](https://github.com/google/googletest) (Required if you build test).
|
||||
* [Google Test](https://github.com/google/googletest) (Required if you build test).
|
||||
* [Google Benchmark](https://github.com/google/benchmark) (Required if you build benchmark).
|
||||
* Doxygen (Required if you build documentation).
|
||||
* Python and Astral UV (Required if you use "User Build" method)
|
||||
|
||||
If you are just want to build this project to make something works, or build other project, rather than code with it,
|
||||
you commonly do not need build test, benchmark and documentation.
|
||||
So you actually do not need Google Test, Google Benchmark and Doxygen.
|
||||
|
||||
## Preparing
|
||||
|
||||
### Compiler
|
||||
|
||||
> [!WARNING]
|
||||
> You may face some issues when building on macOS with Clang. That's not your fault.
|
||||
> Clang used libc++ library lacks some essential features used by this project.
|
||||
> You may try other solutions for compiling this project on macOS or with Clang.
|
||||
|
||||
## Preparing
|
||||
### Google Test
|
||||
|
||||
### GoogleTest
|
||||
|
||||
GoogleTest is required if you need to build test.
|
||||
Google Test is required if you need to build test.
|
||||
If you don't need this please skip this chapter.
|
||||
|
||||
We use GoogleTest v1.17.0.
|
||||
We use Google Test v1.17.0.
|
||||
It would be okey use other versions but I have not test on them.
|
||||
|
||||
> [!WARNING]
|
||||
> When building this project, you may face link error with GoogleTest, especially on Linux.
|
||||
> When building this project, you may face link error with Google Test, especially on Linux.
|
||||
> This issue is caused by that the binary provided by your package manager is built in C++17 and its ABI is incompatible with C++23.
|
||||
> See this [GitHub Issue](https://github.com/google/googletest/issues/4591) for more infomation.
|
||||
> The solution is that download GoogleTest source code and build it in C++23 on your own.
|
||||
> The solution is that download Google Test source code and build it in C++23 on your own.
|
||||
> Following content tell you how to do this.
|
||||
|
||||
There are the steps instructing you how to compile GoogleTest manually.
|
||||
There are the steps instructing you how to compile Google Test manually.
|
||||
|
||||
1. Download GoogleTest source code with given version in GitHub Release page.
|
||||
1. Download Google Test source code with given version in GitHub Release page.
|
||||
1. Extract it into a directory.
|
||||
1. Enter this directory and create 2 subdirectory `build` and `install` for CMake build and install respectively.
|
||||
1. Enter `build` directory and configure CMake with extra `-DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON` parameters.
|
||||
1. Use CMake to build GoogleTest
|
||||
1. Use CMake to install GoogleTest into previous we created `install` directory.
|
||||
1. Use CMake to build Google Test
|
||||
1. Use CMake to install Google Test into previous we created `install` directory.
|
||||
|
||||
### Google Benchmark
|
||||
|
||||
Google Benchmark is required if you need to build benchmark.
|
||||
If you don't need this please skip this chapter.
|
||||
|
||||
We use Google Benchmark v1.9.4.
|
||||
It would be okey use other versions but I have not test on them.
|
||||
|
||||
There are the steps instructing you how to compile Google Benchmark manually.
|
||||
|
||||
1. Download Google Benchmark source code with given version in GitHub Release page.
|
||||
1. Extract it into a directory.
|
||||
1. Enter this directory and create link named `googletest` to previous fetched Google Test root directory. This is instructed by official manual because Google Benchmark rely on Google Test. Link can be create by executing `mklink /D googletest <path-to-googletest-root-dir>` on Windows or `ln -s <path-to-googletest-root-dir> googletest` on POSIX-like OS.
|
||||
1. Keep stay in this directory and create 2 subdirectory `build` and `install` for CMake build and install respectively.
|
||||
1. Enter `build` directory and configure CMake with extra `-DCMAKE_CXX_STANDARD=23 -DBENCHMARK_ENABLE_TESTING=OFF` parameters.
|
||||
1. Use CMake to build Google Benchmark
|
||||
1. Use CMake to install Google Benchmark into previous we created `install` directory.
|
||||
|
||||
### Iconv
|
||||
|
||||
@ -71,33 +95,33 @@ 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 work), please choose "User Build".
|
||||
If you are the user of this project (just want this project to make something works, or build other projects), 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".
|
||||
|
||||
### User Build
|
||||
|
||||
"User Build" is basically how GitHub Action build this project.
|
||||
|
||||
We use Python 3.11 and UV 0.7.17 to manage our build script generator.
|
||||
It would be okey use other versions but I have not test on them.
|
||||
|
||||
TODO...
|
||||
Execute `.github/windows_build.bat` on Windows or `.github/linux_build.sh` on POSIX-like OS (Linux and macOS) under **the root directory** of this project. The final built artifact is under `bin/install` directory.
|
||||
|
||||
### Developer Build
|
||||
|
||||
TODO...
|
||||
|
||||
There is a list listing all variables you may configure during compiling.
|
||||
First, there is a list listing all variables you may configure during compiling.
|
||||
|
||||
* `YYCC_BUILD_TEST`: Set it to `ON` to build test. `OFF` in default.
|
||||
It is useful for the developer of this project.
|
||||
It also suit for the user who has runtime issues on their platforms to check whether this project works as expected.
|
||||
If you are debugging this project to find bug, I suggest that you build this project under Debug mode and use this test project for debugging.
|
||||
* `YYCC_BUILD_BENCHMARK`: Set it to `ON` to build benchmark. `OFF` in default.
|
||||
It is useful for the developer of this project to checking the performace for those homemade functions.
|
||||
It is highly suggested build this project with Release mode to have real benchmark result.
|
||||
* `YYCC_BUILD_DOC`: Set it to `ON` to build documentation. `OFF` in default.
|
||||
It may be useful for the developer who firstly use this project in their own projects.
|
||||
Please note that generated documentation is different in different platforms.
|
||||
* `YYCC_ENFORCE_ICONV`: Set it to `ON` to enable Iconv feature forcely. `OFF` in default.
|
||||
The usage of this option has been introduced in previous "Iconv" chapter.
|
||||
* `GTest_ROOT`: TODO
|
||||
* `benchmark_ROOT`: TODO
|
||||
* `Iconv_ROOT`: TODO
|
||||
* `CMAKE_CXX_STANDARD`: Set C++ standard version of project.
|
||||
`23` in default and this version can not be lower than C++23.
|
||||
|
Reference in New Issue
Block a user