1
0

refactor: change project layout

- move script as asset because they are not build script
- create new script directory for "User Compile" method because github action need to build with gtest.
- change compile manual for this change.
- modify external dependency location in github action and gitignore.
This commit is contained in:
2026-01-22 15:48:28 +08:00
parent 746d20a835
commit fe4193efa7
19 changed files with 79 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ mkdir install
cd build
# Build in Release mode
cmake -DCMAKE_BUILD_TYPE=Release ../..
cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT ../..
cmake --build .
cmake --install . --prefix=../install

View File

@@ -10,7 +10,7 @@ mkdir install
cd build
# Build in Release mode
cmake -DCMAKE_BUILD_TYPE=Release ../..
cmake -DCMAKE_BUILD_TYPE=Release -DYYCC_BUILD_TEST=ON -DGTest_ROOT=$GTest_ROOT ../..
cmake --build .
cmake --install . --prefix=../install

View File

@@ -9,7 +9,7 @@ MKDIR install
CD build
:: Build with x64 architecture in Release mode
cmake -A x64 ../..
cmake -A x64 -DYYCC_BUILD_TEST=ON -DGTest_ROOT=%GTest_ROOT% ../..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release

View File

@@ -16,8 +16,8 @@ jobs:
# - name: Setup Google Test and Google Benchmark
# run: |
# # Setup Google Test
# git clone -b v1.17.0 https://github.com/google/googletest.git external/googletest
# cd external/googletest
# git clone -b v1.17.0 https://github.com/google/googletest.git extern/googletest
# cd extern/googletest
# mkdir build install
# cd build
# cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release ..
@@ -25,8 +25,8 @@ jobs:
# cmake --install . --prefix=../install
# cd ../..
# # Setup Google Benchmark
# git clone -b v1.9.4 https://github.com/google/benchmark.git external/benchmark
# cd external/benchmark
# git clone -b v1.9.4 https://github.com/google/benchmark.git extern/benchmark
# cd extern/benchmark
# # Create symlink to googletest as required by benchmark
# ln -s ../googletest googletest
# mkdir build install

View File

@@ -12,8 +12,8 @@ jobs:
# - name: Setup Google Test and Google Benchmark
# run: |
# # Setup Google Test
# git clone -b v1.17.0 https://github.com/google/googletest.git external/googletest
# cd external/googletest
# git clone -b v1.17.0 https://github.com/google/googletest.git extern/googletest
# cd extern/googletest
# mkdir build install
# cd build
# cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release ..
@@ -21,8 +21,8 @@ jobs:
# cmake --install . --prefix=../install
# cd ../..
# # Setup Google Benchmark
# git clone -b v1.9.4 https://github.com/google/benchmark.git external/benchmark
# cd external/benchmark
# git clone -b v1.9.4 https://github.com/google/benchmark.git extern/benchmark
# cd extern/benchmark
# # Create symlink to googletest as required by benchmark
# ln -s ../googletest googletest
# mkdir build install

View File

@@ -19,8 +19,8 @@ jobs:
# - name: Setup Google Test and Google Benchmark
# run: |
# # Setup Google Test
# git clone -b v1.17.0 https://github.com/google/googletest.git external/googletest
# cd external/googletest
# git clone -b v1.17.0 https://github.com/google/googletest.git extern/googletest
# cd extern/googletest
# mkdir build install
# cd build
# cmake -DCMAKE_CXX_STANDARD=23 -Dgtest_force_shared_crt=ON -DCMAKE_BUILD_TYPE=Release ..
@@ -28,8 +28,8 @@ jobs:
# cmake --install . --prefix=../install --config Release
# cd ../..
# # Setup Google Benchmark
# git clone -b v1.9.4 https://github.com/google/benchmark.git external/benchmark
# cd external/benchmark
# git clone -b v1.9.4 https://github.com/google/benchmark.git extern/benchmark
# cd extern/benchmark
# # Create symlink to googletest as required by benchmark
# mklink /D googletest ../googletest
# mkdir build install

1
.gitignore vendored
View File

@@ -3,6 +3,7 @@
out/
build/
install/
extern/
# Ignore CMake generated stuff
src/yycc/version.hpp

View File

@@ -106,7 +106,13 @@ If you are a developer (developer of this project, or use this project as depend
"User Build" is basically how GitHub Action build this project.
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.
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

View File

19
script/linux_build.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail
# Create build directory and enter it
mkdir bin
cd bin
# Create internal build and install directory, then enter it
mkdir build
mkdir install
cd build
# Build in Release mode
cmake -DCMAKE_BUILD_TYPE=Release ../..
cmake --build .
cmake --install . --prefix=../install
# Back to root directory
cd ..
cd ..

19
script/macos_build.sh Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail
# Create build directory and enter it
mkdir bin
cd bin
# Create internal build and install directory, then enter it
mkdir build
mkdir install
cd build
# Build in Release mode
cmake -DCMAKE_BUILD_TYPE=Release ../..
cmake --build .
cmake --install . --prefix=../install
# Back to root directory
cd ..
cd ..

18
script/windows_build.bat Normal file
View File

@@ -0,0 +1,18 @@
@ECHO OFF
:: Create build directory and enter it
MKDIR bin
CD bin
:: Create internal build and install directory, then enter it
MKDIR build
MKDIR install
CD build
:: Build with x64 architecture in Release mode
cmake -A x64 ../..
cmake --build . --config Release
cmake --install . --prefix=../install --config Release
:: Back to root directory
CD ..
CD ..