From 2f59e16590c3260732218fbf2a447260d3fb5772 Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Fri, 30 Jan 2026 15:23:01 +0800 Subject: [PATCH] feat: change project layout for new added project --- .github/scripts/linux.sh | 0 .github/scripts/macos.sh | 0 .github/scripts/windows.bat | 18 ++++ .github/scripts/yycc-linux.sh | 0 .github/scripts/yycc-macos.sh | 0 .github/scripts/yycc-windows.bat | 0 .github/scripts/zlib-linux.sh | 0 .github/scripts/zlib-macos.sh | 0 .github/scripts/zlib-windows.bat | 0 .github/workflows/linux.yml | 0 .github/workflows/macos.yml | 0 .github/workflows/windows.yml | 87 ++++++++++++++++++++ .gitignore | 10 +-- Assets/BMapBindings/BMapSharp/BMapSharp.sln | 28 ------- Assets/BMapBindings/BMapSharp/BMapSharp.slnx | 4 + {BMap => Ballance/BMap}/BMap/BMExports.cpp | 0 {BMap => Ballance/BMap}/BMap/BMExports.hpp | 0 {BMap => Ballance/BMap}/BMap/BMap.cpp | 0 {BMap => Ballance/BMap}/BMap/BMap.hpp | 0 {BMap => Ballance/BMap}/CMakeLists.txt | 2 +- Ballance/BMapInspector/BMapInspector.cpp | 4 + Ballance/BMapInspector/CMakeLists.txt | 32 +++++++ Ballance/BMapInspector/Rule.hpp | 0 Ballance/BMapInspector/Rulesets.hpp | 0 Ballance/BMapInspector/Utils.cpp | 0 Ballance/BMapInspector/Utils.hpp | 0 Ballance/CMakeLists.txt | 6 ++ CMakeLists.txt | 6 +- 28 files changed, 161 insertions(+), 36 deletions(-) create mode 100644 .github/scripts/linux.sh create mode 100644 .github/scripts/macos.sh create mode 100644 .github/scripts/windows.bat create mode 100644 .github/scripts/yycc-linux.sh create mode 100644 .github/scripts/yycc-macos.sh create mode 100644 .github/scripts/yycc-windows.bat create mode 100644 .github/scripts/zlib-linux.sh create mode 100644 .github/scripts/zlib-macos.sh create mode 100644 .github/scripts/zlib-windows.bat create mode 100644 .github/workflows/linux.yml create mode 100644 .github/workflows/macos.yml create mode 100644 .github/workflows/windows.yml delete mode 100644 Assets/BMapBindings/BMapSharp/BMapSharp.sln create mode 100644 Assets/BMapBindings/BMapSharp/BMapSharp.slnx rename {BMap => Ballance/BMap}/BMap/BMExports.cpp (100%) rename {BMap => Ballance/BMap}/BMap/BMExports.hpp (100%) rename {BMap => Ballance/BMap}/BMap/BMap.cpp (100%) rename {BMap => Ballance/BMap}/BMap/BMap.hpp (100%) rename {BMap => Ballance/BMap}/CMakeLists.txt (96%) create mode 100644 Ballance/BMapInspector/BMapInspector.cpp create mode 100644 Ballance/BMapInspector/CMakeLists.txt create mode 100644 Ballance/BMapInspector/Rule.hpp create mode 100644 Ballance/BMapInspector/Rulesets.hpp create mode 100644 Ballance/BMapInspector/Utils.cpp create mode 100644 Ballance/BMapInspector/Utils.hpp create mode 100644 Ballance/CMakeLists.txt diff --git a/.github/scripts/linux.sh b/.github/scripts/linux.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/macos.sh b/.github/scripts/macos.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/windows.bat b/.github/scripts/windows.bat new file mode 100644 index 0000000..e89058d --- /dev/null +++ b/.github/scripts/windows.bat @@ -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 -DYYCC_BUILD_TEST=ON -DGTest_ROOT=%GTest_ROOT% -DYYCC_BUILD_BENCHMARK=ON -Dbenchmark_ROOT=%benchmark_ROOT% ../.. +cmake --build . --config Release +cmake --install . --prefix=../install --config Release + +:: Back to root directory +CD .. +CD .. diff --git a/.github/scripts/yycc-linux.sh b/.github/scripts/yycc-linux.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/yycc-macos.sh b/.github/scripts/yycc-macos.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/yycc-windows.bat b/.github/scripts/yycc-windows.bat new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/zlib-linux.sh b/.github/scripts/zlib-linux.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/zlib-macos.sh b/.github/scripts/zlib-macos.sh new file mode 100644 index 0000000..e69de29 diff --git a/.github/scripts/zlib-windows.bat b/.github/scripts/zlib-windows.bat new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..bbe0c7b --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,87 @@ +name: YYCC Windows Build + +on: [workflow_dispatch] + +jobs: + windows-build: + + strategy: + matrix: + include: + - vs: '2022' + msvc_arch: 'x64' + + runs-on: windows-2022 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + - name: Fetch YYCCommonplace + uses: actions/checkout@v4 + with: + repository: 'yyc12345/YYCCommonplace' + ref: 'master' + path: 'extern/YYCCommonplace' + - name: Build YYCCommonplace + shell: cmd + run: | + :: Enter directory + cd extern/YYCCommonplace + :: Build library + ..\..\.github\scripts\yycc-windows.bat + :: Fetch install directory + cd install + echo set YYCCommonplace_ROOT=%CD% > ../../envs.bat + cd .. + cd ../.. + - name: Fetch ZLIB + uses: actions/checkout@v4 + with: + repository: 'madler/zlib' + ref: 'v1.3.1' + path: 'extern/zlib' + - name: Build ZLIB + shell: cmd + run: | + :: Enter directory + cd extern/zlib + :: Build library + ..\..\.github\scripts\zlib-windows.bat + :: Fetch install directory + cd install + echo set ZLIB_ROOT=%CD% >> ../../envs.bat + cd .. + cd ../.. + - name: Fetch STB + uses: actions/checkout@v4 + with: + repository: 'nothings/stb' + ref: '2e2bef463a5b53ddf8bb788e25da6b8506314c08' + path: 'extern/stb' + - name: Build STB + shell: cmd + run: | + :: Enter directory + cd extern/stb + :: Fetch install directory + echo set STB_ROOT=%CD% >> ../envs.bat + cd ../.. + - name: Build LibCmo + shell: cmd + run: | + :: Prepare Visual Studio + set VS=${{ matrix.vs }} + set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" + if not exist %VCVARS% set VCVARS="C:\Program Files\Microsoft Visual Studio\%VS%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" + call %VCVARS% ${{ matrix.msvc_arch }} + :: Extract saved environment variables + call .\extern\envs.bat + :: Build Project + .\.github\script\windows.bat + - name: Upload Built Artifact + uses: actions/upload-artifact@v4 + with: + name: LibCmo-windows-build + path: bin/install/* + retention-days: 30 + \ No newline at end of file diff --git a/.gitignore b/.gitignore index 6de863c..8002407 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ ## ======== Personal ======== # Ignore build resources -out/ -build/ -install/ -extern/ -temp/ +[Oo]ut/ +[Bb]uild/ +[Ii]nstall/ +[Ee]xtern/ +[Tt]emp/ # Ignore all possible test used Virtools files *.nmo diff --git a/Assets/BMapBindings/BMapSharp/BMapSharp.sln b/Assets/BMapBindings/BMapSharp/BMapSharp.sln deleted file mode 100644 index 10b1071..0000000 --- a/Assets/BMapBindings/BMapSharp/BMapSharp.sln +++ /dev/null @@ -1,28 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMapSharp", "BMapSharp\BMapSharp.csproj", "{604F426A-EC91-4E17-BE58-74565B24946C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BMapSharpTestbench", "BMapSharpTestbench\BMapSharpTestbench.csproj", "{3490D77F-119B-48EF-AA0B-E715EBE80DAA}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {604F426A-EC91-4E17-BE58-74565B24946C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {604F426A-EC91-4E17-BE58-74565B24946C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {604F426A-EC91-4E17-BE58-74565B24946C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {604F426A-EC91-4E17-BE58-74565B24946C}.Release|Any CPU.Build.0 = Release|Any CPU - {3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3490D77F-119B-48EF-AA0B-E715EBE80DAA}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/Assets/BMapBindings/BMapSharp/BMapSharp.slnx b/Assets/BMapBindings/BMapSharp/BMapSharp.slnx new file mode 100644 index 0000000..2b97a88 --- /dev/null +++ b/Assets/BMapBindings/BMapSharp/BMapSharp.slnx @@ -0,0 +1,4 @@ + + + + diff --git a/BMap/BMap/BMExports.cpp b/Ballance/BMap/BMap/BMExports.cpp similarity index 100% rename from BMap/BMap/BMExports.cpp rename to Ballance/BMap/BMap/BMExports.cpp diff --git a/BMap/BMap/BMExports.hpp b/Ballance/BMap/BMap/BMExports.hpp similarity index 100% rename from BMap/BMap/BMExports.hpp rename to Ballance/BMap/BMap/BMExports.hpp diff --git a/BMap/BMap/BMap.cpp b/Ballance/BMap/BMap/BMap.cpp similarity index 100% rename from BMap/BMap/BMap.cpp rename to Ballance/BMap/BMap/BMap.cpp diff --git a/BMap/BMap/BMap.hpp b/Ballance/BMap/BMap/BMap.hpp similarity index 100% rename from BMap/BMap/BMap.hpp rename to Ballance/BMap/BMap/BMap.hpp diff --git a/BMap/CMakeLists.txt b/Ballance/BMap/CMakeLists.txt similarity index 96% rename from BMap/CMakeLists.txt rename to Ballance/BMap/CMakeLists.txt index 920b3a5..1392960 100644 --- a/BMap/CMakeLists.txt +++ b/Ballance/BMap/CMakeLists.txt @@ -53,7 +53,7 @@ write_basic_package_version_file( COMPATIBILITY SameMinorVersion ) configure_package_config_file( - ${CMAKE_CURRENT_LIST_DIR}/../CMake/BMapConfig.cmake.in + ${CMAKE_CURRENT_LIST_DIR}/../../CMake/BMapConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/BMapConfig.cmake" INSTALL_DESTINATION ${NEMO_INSTALL_LIB_PATH}/cmake/BMap ) diff --git a/Ballance/BMapInspector/BMapInspector.cpp b/Ballance/BMapInspector/BMapInspector.cpp new file mode 100644 index 0000000..bcb9efe --- /dev/null +++ b/Ballance/BMapInspector/BMapInspector.cpp @@ -0,0 +1,4 @@ + +int main(int argc, char *argv[]) { + return 0; +} diff --git a/Ballance/BMapInspector/CMakeLists.txt b/Ballance/BMapInspector/CMakeLists.txt new file mode 100644 index 0000000..6fe9b68 --- /dev/null +++ b/Ballance/BMapInspector/CMakeLists.txt @@ -0,0 +1,32 @@ +# Create executable +add_executable(BMapInspector "") +# Setup sources +target_sources(BMapInspector +PRIVATE + BMapInspector.cpp + Utils.cpp +) +# Setup headers +target_sources(BMapInspector +PRIVATE +FILE_SET HEADERS +FILES + Utils.hpp + Rule.hpp +) +# Setup header infomation +target_include_directories(BMapInspector +PRIVATE + "${CMAKE_CURRENT_LIST_DIR}" +) +# Setup linked library infomation +target_link_libraries(BMapInspector +PRIVATE + YYCC::YYCCommonplace + LibCmo +) + +# Install BMapInspector +install(TARGETS BMapInspector + RUNTIME DESTINATION ${YYCC_INSTALL_BIN_PATH} +) diff --git a/Ballance/BMapInspector/Rule.hpp b/Ballance/BMapInspector/Rule.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Ballance/BMapInspector/Rulesets.hpp b/Ballance/BMapInspector/Rulesets.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Ballance/BMapInspector/Utils.cpp b/Ballance/BMapInspector/Utils.cpp new file mode 100644 index 0000000..e69de29 diff --git a/Ballance/BMapInspector/Utils.hpp b/Ballance/BMapInspector/Utils.hpp new file mode 100644 index 0000000..e69de29 diff --git a/Ballance/CMakeLists.txt b/Ballance/CMakeLists.txt new file mode 100644 index 0000000..70544d6 --- /dev/null +++ b/Ballance/CMakeLists.txt @@ -0,0 +1,6 @@ +if (NEMO_BUILD_BMAP) + add_subdirectory(BMap) +endif () +if (NEMO_BUILD_BMAPINSPECTOR) + add_subdirectory(BMapInspector) +endif () diff --git a/CMakeLists.txt b/CMakeLists.txt index f770c95..f7e8a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,9 @@ project(NeMo # Provide options option(NEMO_BUILD_UNVIRT "Build Unvirt, the console interface operator of LibCmo." ON) +option(NEMO_BUILD_BALLANCE "Build Ballance stuff, including BMap and BMapInspector." OFF) option(NEMO_BUILD_BMAP "Build BMap, the example use of LibCmo which can read and write Ballance game map." OFF) +option(NEMO_BUILD_BMAPINSPECTOR "Build BMapInspector, the example use of LibCmo which can validate Ballance game map." OFF) option(NEMO_BUILD_DOC "Build document of LibCmo and all related stuff." OFF) # Set C++ standards @@ -54,8 +56,8 @@ add_subdirectory(LibCmo) if (NEMO_BUILD_UNVIRT) add_subdirectory(Unvirt) endif () -if (NEMO_BUILD_BMAP) - add_subdirectory(BMap) +if (NEMO_BUILD_BALLANCE) + add_subdirectory(Ballance) endif () if (NEMO_BUILD_DOC) add_subdirectory(Documents)