1
0

Compare commits

4 Commits

Author SHA1 Message Date
4985c6d3d0 fix: fix github action build error 2026-02-03 19:21:18 +08:00
37904fd5a4 fix: fix github action build error 2026-02-03 16:11:11 +08:00
a654370b82 chore: add lost PIC flag 2026-02-03 15:56:01 +08:00
90fe7ddcaf chore: use new github action build layout 2026-02-03 15:49:47 +08:00
24 changed files with 89 additions and 70 deletions

View File

@@ -1,3 +1,4 @@
# GitHub Scripts # GitHub Scripts
These scripts should be executed at the root directory of each project respectively. These script files should be only used by GitHub Action.
These script files should be executed at the root directory of each project respectively.

View File

@@ -1,10 +1,6 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
YYCCommonplace_ROOT="${YYCCommonplace_ROOT:?YYCCommonplace_ROOT must be set}"
STB_ROOT="${STB_ROOT:?STB_ROOT must be set}"
ZLIB_ROOT="${ZLIB_ROOT:?ZLIB_ROOT must be set}"
# Create build directory and enter it # Create build directory and enter it
mkdir bin mkdir bin
cd bin cd bin

View File

@@ -1,10 +1,6 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
YYCCommonplace_ROOT="${YYCCommonplace_ROOT:?YYCCommonplace_ROOT must be set}"
STB_ROOT="${STB_ROOT:?STB_ROOT must be set}"
ZLIB_ROOT="${ZLIB_ROOT:?ZLIB_ROOT must be set}"
# Create build directory and enter it # Create build directory and enter it
mkdir bin mkdir bin
cd bin cd bin

View File

@@ -1,2 +0,0 @@
# Just directly record self as root directory
set STB_ROOT=$(pwd)

View File

@@ -1,2 +0,0 @@
# Just directly record self as root directory
set STB_ROOT=$(pwd)

5
.github/scripts/stb/linux.sh vendored Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail
# Just directly record self as root directory
export STB_ROOT=$(pwd)

5
.github/scripts/stb/macos.sh vendored Normal file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail
# Just directly record self as root directory
export STB_ROOT=$(pwd)

View File

@@ -10,14 +10,14 @@ mkdir install
# Build in Release mode # Build in Release mode
cd build cd build
cmake -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release ../.. cmake -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=True ../..
cmake --build . cmake --build .
cmake --install . --prefix=../install cmake --install . --prefix=../install
cd .. cd ..
# Record install directory # Record install directory
cd install cd install
set YYCCommonplace_ROOT=$(pwd) export YYCCommonplace_ROOT=$(pwd)
cd .. cd ..
# Back to root directory # Back to root directory

View File

@@ -10,14 +10,14 @@ mkdir install
# Build in Release mode # Build in Release mode
cd build cd build
cmake -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release ../.. cmake -DCMAKE_CXX_STANDARD=23 -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=True ../..
cmake --build . cmake --build .
cmake --install . --prefix=../install cmake --install . --prefix=../install
cd .. cd ..
# Record install directory # Record install directory
cd install cd install
set YYCCommonplace_ROOT=$(pwd) export YYCCommonplace_ROOT=$(pwd)
cd .. cd ..
# Back to root directory # Back to root directory

View File

@@ -7,15 +7,12 @@ mkdir install
# Record install directory first because build step require it # Record install directory first because build step require it
cd install cd install
set ZLIB_ROOT=$(pwd) export ZLIB_ROOT=$(pwd)
cd .. cd ..
# Build in Release mode # Build in Release mode
cd build cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$ZLIB_ROOT ../.. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$ZLIB_ROOT ..
cmake --build . cmake --build .
cmake --install . cmake --install .
cd .. cd ..
# Back to root directory
cd ..

View File

@@ -7,15 +7,12 @@ mkdir install
# Record install directory first because build step require it # Record install directory first because build step require it
cd install cd install
set ZLIB_ROOT=$(pwd) export ZLIB_ROOT=$(pwd)
cd .. cd ..
# Build in Release mode # Build in Release mode
cd build cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$ZLIB_ROOT ../.. cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=$ZLIB_ROOT ..
cmake --build . cmake --build .
cmake --install . cmake --install .
cd .. cd ..
# Back to root directory
cd ..

View File

@@ -11,10 +11,7 @@ CD ..
:: Build with x64 architecture in Release mode :: Build with x64 architecture in Release mode
CD build CD build
cmake -A x64 -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=%ZLIB_ROOT% ../.. cmake -A x64 -DCMAKE_CXX_STANDARD=23 -DZLIB_BUILD_EXAMPLES=OFF -DCMAKE_INSTALL_PREFIX=%ZLIB_ROOT% ..
cmake --build . --config Release cmake --build . --config Release
cmake --install . --config Release cmake --install . --config Release
CD .. CD ..
:: Back to root directory
CD ..

View File

@@ -24,8 +24,7 @@ jobs:
shell: bash shell: bash
run: | run: |
cd extern/YYCCommonplace cd extern/YYCCommonplace
chmod +x ../../.github/scripts/yycc-linux.sh source ../../.github/scripts/yycc/linux.sh
source ../../.github/scripts/yycc-linux.sh
echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV" echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Fetch ZLIB - name: Fetch ZLIB
@@ -38,8 +37,7 @@ jobs:
shell: bash shell: bash
run: | run: |
cd extern/zlib cd extern/zlib
chmod +x ../../.github/scripts/zlib-linux.sh source ../../.github/scripts/zlib/linux.sh
source ../../.github/scripts/zlib-linux.sh
echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV" echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Fetch STB - name: Fetch STB
@@ -52,18 +50,22 @@ jobs:
shell: bash shell: bash
run: | run: |
cd extern/stb cd extern/stb
chmod +x ../../.github/scripts/stb-linux.sh source ../../.github/scripts/stb/linux.sh
source ../../.github/scripts/stb-linux.sh
echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV" echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Build LibCmo - name: Build LibCmo
shell: bash shell: bash
run: | run: |
chmod +x ./.github/scripts/linux.sh source ./.github/scripts/linux.sh
./.github/scripts/linux.sh
- name: Upload Built Artifact - name: Upload Built Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: LibCmo-linux-build name: LibCmo-linux-build
path: bin/install/* path: bin/install/*
retention-days: 30
- name: Upload Built Dependencies
uses: actions/upload-artifact@v4
with:
name: LibCmo-linux-dep
path: extern/zlib/install/*
retention-days: 30 retention-days: 30

View File

@@ -19,8 +19,7 @@ jobs:
shell: bash shell: bash
run: | run: |
cd extern/YYCCommonplace cd extern/YYCCommonplace
chmod +x ../../.github/scripts/yycc-macos.sh source ../../.github/scripts/yycc/macos.sh
source ../../.github/scripts/yycc-macos.sh
echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV" echo "YYCCommonplace_ROOT=$YYCCommonplace_ROOT" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Fetch ZLIB - name: Fetch ZLIB
@@ -33,8 +32,7 @@ jobs:
shell: bash shell: bash
run: | run: |
cd extern/zlib cd extern/zlib
chmod +x ../../.github/scripts/zlib-macos.sh source ../../.github/scripts/zlib/macos.sh
source ../../.github/scripts/zlib-macos.sh
echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV" echo "ZLIB_ROOT=$ZLIB_ROOT" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Fetch STB - name: Fetch STB
@@ -47,18 +45,22 @@ jobs:
shell: bash shell: bash
run: | run: |
cd extern/stb cd extern/stb
chmod +x ../../.github/scripts/stb-macos.sh source ../../.github/scripts/stb/macos.sh
source ../../.github/scripts/stb-macos.sh
echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV" echo "STB_ROOT=$STB_ROOT" >> "$GITHUB_ENV"
cd ../.. cd ../..
- name: Build LibCmo - name: Build LibCmo
shell: bash shell: bash
run: | run: |
chmod +x ./.github/scripts/macos.sh source ./.github/scripts/macos.sh
./.github/scripts/macos.sh
- name: Upload Built Artifact - name: Upload Built Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: LibCmo-macos-build name: LibCmo-macos-build
path: bin/install/* path: bin/install/*
retention-days: 30 retention-days: 30
- name: Upload Built Dependencies
uses: actions/upload-artifact@v4
with:
name: LibCmo-macos-dep
path: extern/zlib/install/*
retention-days: 30

View File

@@ -25,10 +25,10 @@ jobs:
- name: Build YYCCommonplace - name: Build YYCCommonplace
shell: cmd shell: cmd
run: | run: |
cd extern/YYCCommonplace CD extern\YYCCommonplace
call ..\..\.github\scripts\yycc-windows.bat CALL ..\..\.github\scripts\yycc\windows.bat
echo set YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ../envs.bat ECHO SET YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ..\envs.bat
cd ../.. CD ..\..
- name: Fetch ZLIB - name: Fetch ZLIB
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@@ -38,10 +38,10 @@ jobs:
- name: Build ZLIB - name: Build ZLIB
shell: cmd shell: cmd
run: | run: |
cd extern/zlib CD extern\zlib
..\..\.github\scripts\zlib-windows.bat CALL ..\..\.github\scripts\zlib\windows.bat
echo set ZLIB_ROOT=%ZLIB_ROOT% >> ../envs.bat ECHO SET ZLIB_ROOT=%ZLIB_ROOT% >> ..\envs.bat
cd ../.. CD ..\..
- name: Fetch STB - name: Fetch STB
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
@@ -51,10 +51,10 @@ jobs:
- name: Build STB - name: Build STB
shell: cmd shell: cmd
run: | run: |
cd extern/stb CD extern\stb
..\..\.github\scripts\stb-windows.bat CALL ..\..\.github\scripts\stb\windows.bat
echo set STB_ROOT=%STB_ROOT% >> ../envs.bat ECHO SET STB_ROOT=%STB_ROOT% >> ..\envs.bat
cd ../.. CD ..\..
- name: Build LibCmo - name: Build LibCmo
shell: cmd shell: cmd
run: | run: |
@@ -64,13 +64,19 @@ jobs:
if not exist %VCVARS% set VCVARS="C:\Program Files\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 }} call %VCVARS% ${{ matrix.msvc_arch }}
:: Extract saved environment variables :: Extract saved environment variables
call .\extern\envs.bat CALL .\extern\envs.bat
:: Build Project :: Build Project
.\.github\scripts\windows.bat CALL .\.github\scripts\windows.bat
- name: Upload Built Artifact - name: Upload Built Artifact
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: LibCmo-windows-build name: LibCmo-windows-build
path: bin/install/* path: bin/install/*
retention-days: 30 retention-days: 30
- name: Upload Built Dependencies
uses: actions/upload-artifact@v4
with:
name: LibCmo-windows-dep
path: extern/zlib/install/*
retention-days: 30

View File

@@ -1,5 +1,6 @@
#include "BMExports.hpp" #include "BMExports.hpp"
#include <yycc.hpp> #include <yycc.hpp>
#include <yycc/carton/ironpad.hpp>
#include <set> #include <set>
#include <type_traits> #include <type_traits>
#include <memory> #include <memory>
@@ -59,8 +60,8 @@ bool BMInit() {
if (CheckInited()) return false; if (CheckInited()) return false;
// register exception handler if we are in Windows. // register exception handler if we are in Windows.
#if defined(LIBCMO_BUILD_RELEASE) && (YYCC_OS == YYCC_OS_WINDOWS) #if defined(LIBCMO_BUILD_RELEASE) && defined(YYCC_OS_WINDOWS)
YYCC::ExceptionHelper::Register(); yycc::carton::ironpad::startup();
#endif #endif
// and startup CK environment // and startup CK environment
@@ -93,8 +94,8 @@ bool BMDispose() {
LibCmo::CK2::CKShutdown(); LibCmo::CK2::CKShutdown();
// unregister exception handler if we are in Windows // unregister exception handler if we are in Windows
#if defined(LIBCMO_BUILD_RELEASE) && (YYCC_OS == YYCC_OS_WINDOWS) #if defined(LIBCMO_BUILD_RELEASE) && defined(YYCC_OS_WINDOWS)
YYCC::ExceptionHelper::Unregister(); yycc::carton::ironpad::shutdown();
#endif #endif
return true; return true;

View File

@@ -12,9 +12,9 @@
if (NOT DEFINED STB_ROOT) if (NOT DEFINED STB_ROOT)
set(STB_FOUND FALSE) set(STB_FOUND FALSE)
else () else ()
# Look for STB_image.h in the specified STB_ROOT directory # Look for stb_image.h in the specified STB_ROOT directory
find_path(STB_INCLUDE_DIR find_path(STB_INCLUDE_DIR
NAMES STB_image.h NAMES stb_image.h
HINTS ${STB_ROOT} HINTS ${STB_ROOT}
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )
@@ -46,7 +46,7 @@ if (STB_FOUND)
) )
else () else ()
# If it is required, show infomations. # If it is required, show infomations.
if (std_FIND_REQUIRED) if (STB_FIND_REQUIRED)
message(FATAL_ERROR "Fail to find STB library.") message(FATAL_ERROR "Fail to find STB library.")
endif () endif ()
endif () endif ()

View File

@@ -45,7 +45,7 @@ include(CMakePackageConfigHelpers)
# we should enable PIC (position independent code), otherwise build process will fail. # we should enable PIC (position independent code), otherwise build process will fail.
# Also we should let all symbols in final dll be hidden (not exported) in default. # Also we should let all symbols in final dll be hidden (not exported) in default.
# Because we only want export functions we ordered. # Because we only want export functions we ordered.
if ((NOT WIN32) AND NEMO_BUILD_BMAP) if ((NOT WIN32) AND (NEMO_BUILD_BALLANCE AND NEMO_BUILD_BMAP))
set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_C_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE True) set(CMAKE_POSITION_INDEPENDENT_CODE True)

View File

@@ -11,6 +11,9 @@
#include <yycc/string/reinterpret.hpp> #include <yycc/string/reinterpret.hpp>
#include <algorithm> #include <algorithm>
#include <initializer_list> #include <initializer_list>
#include <limits>
#include <cctype>
#include <cstring>
// Import implementations. // Import implementations.
#include "ObjImpls/CKObject.hpp" #include "ObjImpls/CKObject.hpp"

View File

@@ -1,10 +1,22 @@
#include "UnvirtContext.hpp" #include "UnvirtContext.hpp"
#include <yycc.hpp>
#include <yycc/carton/ironpad.hpp>
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
// register exception handler if we are in Windows.
#if defined(LIBCMO_BUILD_RELEASE) && defined(YYCC_OS_WINDOWS)
yycc::carton::ironpad::startup();
#endif
// run core // run core
Unvirt::Context::UnvirtContext ctx; Unvirt::Context::UnvirtContext ctx;
ctx.Run(); ctx.Run();
// unregister exception handler if we are in Windows
#if defined(LIBCMO_BUILD_RELEASE) && defined(YYCC_OS_WINDOWS)
yycc::carton::ironpad::shutdown();
#endif
return 0; return 0;
} }

View File

@@ -1,6 +1,7 @@
#include "Utils.hpp" #include "Utils.hpp"
#include <yycc/num/op.hpp> #include <yycc/num/op.hpp>
#include <stdexcept> #include <stdexcept>
#include <algorithm>
namespace Unvirt::Utils { namespace Unvirt::Utils {

View File

@@ -1,5 +1,7 @@
#pragma once #pragma once
#include <yycc.hpp>
#include <yycc/macro/class_copy_move.hpp> #include <yycc/macro/class_copy_move.hpp>
#include <cstddef>
namespace Unvirt::Utils { namespace Unvirt::Utils {