chore: update build system
- use configuration-arch-based path in MSVC to make sure generated package can be used by native MSVC project. - add github action and corresponding build script. but not tested. - fix some testbench code.
This commit is contained in:
parent
3fa05b43d9
commit
bb17bb6a1f
1
.gitattributes
vendored
1
.gitattributes
vendored
|
@ -1 +1,2 @@
|
||||||
Doxyfile.in eol=lf
|
Doxyfile.in eol=lf
|
||||||
|
*.bat eol=crlf
|
35
.github/workflows/nightly.yml
vendored
Normal file
35
.github/workflows/nightly.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
name: YYCC Nightly Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
msvc-build:
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
vs: ['2019']
|
||||||
|
msvc_arch: ['x86']
|
||||||
|
|
||||||
|
runs-on: windows-2019
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Fetching Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
- name: Building YYCC
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
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 }}
|
||||||
|
.\script\build.bat
|
||||||
|
- name: Uploading Nightly Build
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: YYCC-windows-nightly
|
||||||
|
path: bin/install/*
|
||||||
|
retention-days: 30
|
|
@ -8,6 +8,18 @@ project(YYCC
|
||||||
option(YYCC_BUILD_TESTBENCH "Build testbench of YYCCommonplace." OFF)
|
option(YYCC_BUILD_TESTBENCH "Build testbench of YYCCommonplace." OFF)
|
||||||
option(YYCC_BUILD_DOC "Build document of YYCCommonplace." OFF)
|
option(YYCC_BUILD_DOC "Build document of YYCCommonplace." OFF)
|
||||||
|
|
||||||
|
# Detect MSVC IDE environment.
|
||||||
|
# If we in it, we should add configuration and build type in install path.
|
||||||
|
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||||
|
# Do Visual Studio specific
|
||||||
|
set(YYCC_INSTALL_PATH_LIB lib/${CMAKE_VS_PLATFORM_NAME}/$<CONFIG>)
|
||||||
|
set(YYCC_INSTALL_PATH_BIN bin/${CMAKE_VS_PLATFORM_NAME})
|
||||||
|
else()
|
||||||
|
# Other stuff
|
||||||
|
set(YYCC_INSTALL_PATH_LIB lib)
|
||||||
|
set(YYCC_INSTALL_PATH_BIN bin)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Import 2 build targets
|
# Import 2 build targets
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
if (YYCC_BUILD_TESTBENCH)
|
if (YYCC_BUILD_TESTBENCH)
|
||||||
|
|
35
script/build.bat
Normal file
35
script/build.bat
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
@ECHO OFF
|
||||||
|
SET README_PATH=%CD%\README.md
|
||||||
|
IF EXIST %README_PATH% (
|
||||||
|
REM DO NOTHING
|
||||||
|
) ELSE (
|
||||||
|
ECHO Error: You must run this script at the root folder of this project!
|
||||||
|
EXIT /b
|
||||||
|
)
|
||||||
|
|
||||||
|
:: Create essential folder
|
||||||
|
MKDIR bin
|
||||||
|
CD bin
|
||||||
|
MKDIR Win32
|
||||||
|
MKDIR x64
|
||||||
|
MKDIR install
|
||||||
|
|
||||||
|
:: Build for Win32
|
||||||
|
CD Win32
|
||||||
|
cmake -G "Visual Studio 16 2019" -A Win32 -DYYCC_BUILD_TESTBENCH=ON ../..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
cmake --install . --prefix=../install --config Debug
|
||||||
|
cmake --build . --config Release
|
||||||
|
cmake --install . --prefix=../install --config Release
|
||||||
|
CD ..
|
||||||
|
|
||||||
|
:: Build for x64
|
||||||
|
CD x64
|
||||||
|
cmake -G "Visual Studio 16 2019" -A x64 -DYYCC_BUILD_TESTBENCH=ON ../..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
cmake --install . --prefix=../install --config Debug
|
||||||
|
cmake --build . --config Release
|
||||||
|
cmake --install . --prefix=../install --config Release
|
||||||
|
CD ..
|
||||||
|
|
||||||
|
ECHO DONE
|
|
@ -67,13 +67,11 @@ PRIVATE
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install project
|
# Install binary and headers
|
||||||
# Install binary
|
|
||||||
install(TARGETS YYCCommonplace
|
install(TARGETS YYCCommonplace
|
||||||
EXPORT YYCCommonplaceTargets
|
EXPORT YYCCommonplaceTargets
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION ${YYCC_INSTALL_PATH_LIB}
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION ${YYCC_INSTALL_PATH_LIB}
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
INCLUDES DESTINATION include
|
INCLUDES DESTINATION include
|
||||||
FILE_SET HEADERS DESTINATION include
|
FILE_SET HEADERS DESTINATION include
|
||||||
)
|
)
|
||||||
|
|
|
@ -33,11 +33,9 @@ PRIVATE
|
||||||
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
$<$<CXX_COMPILER_ID:MSVC>:/utf-8>
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install binary
|
# Install testbench only on Release mode
|
||||||
install(TARGETS YYCCTestbench
|
install(TARGETS YYCCTestbench
|
||||||
EXPORT YYCCTestbenchTargets
|
EXPORT YYCCTestbenchTargets
|
||||||
LIBRARY DESTINATION lib
|
CONFIGURATIONS Release
|
||||||
ARCHIVE DESTINATION lib
|
RUNTIME DESTINATION ${YYCC_INSTALL_PATH_BIN}
|
||||||
RUNTIME DESTINATION bin
|
|
||||||
INCLUDES DESTINATION include
|
|
||||||
)
|
)
|
||||||
|
|
|
@ -352,7 +352,9 @@ namespace YYCCTestbench {
|
||||||
static void WinFctTestbench() {
|
static void WinFctTestbench() {
|
||||||
#if YYCC_OS == YYCC_OS_WINDOWS
|
#if YYCC_OS == YYCC_OS_WINDOWS
|
||||||
|
|
||||||
Console::FormatLine("Current Module HANDLE: 0x%" PRI_XPTR_LEFT_PADDING PRIXPTR, YYCC::WinFctHelper::GetCurrentModule());
|
HMODULE test_current_module;
|
||||||
|
Assert((test_current_module = YYCC::WinFctHelper::GetCurrentModule()) != nullptr, "YYCC::WinFctHelper::GetCurrentModule");
|
||||||
|
Console::FormatLine("Current Module HANDLE: 0x%" PRI_XPTR_LEFT_PADDING PRIXPTR, test_current_module);
|
||||||
|
|
||||||
std::string test_temp;
|
std::string test_temp;
|
||||||
Assert(YYCC::WinFctHelper::GetTempDirectory(test_temp), "YYCC::WinFctHelper::GetTempDirectory");
|
Assert(YYCC::WinFctHelper::GetTempDirectory(test_temp), "YYCC::WinFctHelper::GetTempDirectory");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user