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
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
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
mkdir bin
cd bin

View File

@@ -1,10 +1,6 @@
#!/bin/bash
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
mkdir 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
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 --install . --prefix=../install
cd ..
# Record install directory
cd install
set YYCCommonplace_ROOT=$(pwd)
export YYCCommonplace_ROOT=$(pwd)
cd ..
# Back to root directory

View File

@@ -10,14 +10,14 @@ mkdir install
# Build in Release mode
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 --install . --prefix=../install
cd ..
# Record install directory
cd install
set YYCCommonplace_ROOT=$(pwd)
export YYCCommonplace_ROOT=$(pwd)
cd ..
# Back to root directory

View File

@@ -7,15 +7,12 @@ mkdir install
# Record install directory first because build step require it
cd install
set ZLIB_ROOT=$(pwd)
export ZLIB_ROOT=$(pwd)
cd ..
# Build in Release mode
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 --install .
cd ..
# Back to root directory
cd ..

View File

@@ -7,15 +7,12 @@ mkdir install
# Record install directory first because build step require it
cd install
set ZLIB_ROOT=$(pwd)
export ZLIB_ROOT=$(pwd)
cd ..
# Build in Release mode
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 --install .
cd ..
# Back to root directory
cd ..

View File

@@ -11,10 +11,7 @@ CD ..
:: Build with x64 architecture in Release mode
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 --install . --config Release
CD ..
:: Back to root directory
CD ..

View File

@@ -24,8 +24,7 @@ jobs:
shell: bash
run: |
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"
cd ../..
- name: Fetch ZLIB
@@ -38,8 +37,7 @@ jobs:
shell: bash
run: |
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"
cd ../..
- name: Fetch STB
@@ -52,18 +50,22 @@ jobs:
shell: bash
run: |
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"
cd ../..
- name: Build LibCmo
shell: bash
run: |
chmod +x ./.github/scripts/linux.sh
./.github/scripts/linux.sh
source ./.github/scripts/linux.sh
- name: Upload Built Artifact
uses: actions/upload-artifact@v4
with:
name: LibCmo-linux-build
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

View File

@@ -19,8 +19,7 @@ jobs:
shell: bash
run: |
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"
cd ../..
- name: Fetch ZLIB
@@ -33,8 +32,7 @@ jobs:
shell: bash
run: |
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"
cd ../..
- name: Fetch STB
@@ -47,18 +45,22 @@ jobs:
shell: bash
run: |
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"
cd ../..
- name: Build LibCmo
shell: bash
run: |
chmod +x ./.github/scripts/macos.sh
./.github/scripts/macos.sh
source ./.github/scripts/macos.sh
- name: Upload Built Artifact
uses: actions/upload-artifact@v4
with:
name: LibCmo-macos-build
path: bin/install/*
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
shell: cmd
run: |
cd extern/YYCCommonplace
call ..\..\.github\scripts\yycc-windows.bat
echo set YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ../envs.bat
cd ../..
CD extern\YYCCommonplace
CALL ..\..\.github\scripts\yycc\windows.bat
ECHO SET YYCCommonplace_ROOT=%YYCCommonplace_ROOT% > ..\envs.bat
CD ..\..
- name: Fetch ZLIB
uses: actions/checkout@v4
with:
@@ -38,10 +38,10 @@ jobs:
- name: Build ZLIB
shell: cmd
run: |
cd extern/zlib
..\..\.github\scripts\zlib-windows.bat
echo set ZLIB_ROOT=%ZLIB_ROOT% >> ../envs.bat
cd ../..
CD extern\zlib
CALL ..\..\.github\scripts\zlib\windows.bat
ECHO SET ZLIB_ROOT=%ZLIB_ROOT% >> ..\envs.bat
CD ..\..
- name: Fetch STB
uses: actions/checkout@v4
with:
@@ -51,10 +51,10 @@ jobs:
- name: Build STB
shell: cmd
run: |
cd extern/stb
..\..\.github\scripts\stb-windows.bat
echo set STB_ROOT=%STB_ROOT% >> ../envs.bat
cd ../..
CD extern\stb
CALL ..\..\.github\scripts\stb\windows.bat
ECHO SET STB_ROOT=%STB_ROOT% >> ..\envs.bat
CD ..\..
- name: Build LibCmo
shell: cmd
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"
call %VCVARS% ${{ matrix.msvc_arch }}
:: Extract saved environment variables
call .\extern\envs.bat
CALL .\extern\envs.bat
:: Build Project
.\.github\scripts\windows.bat
CALL .\.github\scripts\windows.bat
- name: Upload Built Artifact
uses: actions/upload-artifact@v4
with:
name: LibCmo-windows-build
path: bin/install/*
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 <yycc.hpp>
#include <yycc/carton/ironpad.hpp>
#include <set>
#include <type_traits>
#include <memory>
@@ -59,8 +60,8 @@ bool BMInit() {
if (CheckInited()) return false;
// register exception handler if we are in Windows.
#if defined(LIBCMO_BUILD_RELEASE) && (YYCC_OS == YYCC_OS_WINDOWS)
YYCC::ExceptionHelper::Register();
#if defined(LIBCMO_BUILD_RELEASE) && defined(YYCC_OS_WINDOWS)
yycc::carton::ironpad::startup();
#endif
// and startup CK environment
@@ -93,8 +94,8 @@ bool BMDispose() {
LibCmo::CK2::CKShutdown();
// unregister exception handler if we are in Windows
#if defined(LIBCMO_BUILD_RELEASE) && (YYCC_OS == YYCC_OS_WINDOWS)
YYCC::ExceptionHelper::Unregister();
#if defined(LIBCMO_BUILD_RELEASE) && defined(YYCC_OS_WINDOWS)
yycc::carton::ironpad::shutdown();
#endif
return true;

View File

@@ -12,9 +12,9 @@
if (NOT DEFINED STB_ROOT)
set(STB_FOUND FALSE)
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
NAMES STB_image.h
NAMES stb_image.h
HINTS ${STB_ROOT}
NO_DEFAULT_PATH
)
@@ -46,7 +46,7 @@ if (STB_FOUND)
)
else ()
# If it is required, show infomations.
if (std_FIND_REQUIRED)
if (STB_FIND_REQUIRED)
message(FATAL_ERROR "Fail to find STB library.")
endif ()
endif ()

View File

@@ -45,7 +45,7 @@ include(CMakePackageConfigHelpers)
# 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.
# 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_C_VISIBILITY_PRESET hidden)
set(CMAKE_POSITION_INDEPENDENT_CODE True)

View File

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

View File

@@ -1,10 +1,22 @@
#include "UnvirtContext.hpp"
#include <yycc.hpp>
#include <yycc/carton/ironpad.hpp>
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
Unvirt::Context::UnvirtContext ctx;
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;
}

View File

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

View File

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