Refactoring CmakePresets for windows github actions and refactoring README
This commit is contained in:
parent
cd4948c3d7
commit
84887d26ec
36
.github/workflows/windows-clang.yml
vendored
36
.github/workflows/windows-clang.yml
vendored
@ -27,37 +27,29 @@ jobs:
|
||||
with:
|
||||
msystem: clang64
|
||||
install: >-
|
||||
mingw-w64-clang-x86_64-toolchain
|
||||
mingw-w64-clang-x86_64-cmake
|
||||
mingw-w64-clang-x86_64-make
|
||||
mingw-w64-clang-x86_64-luajit
|
||||
mingw-w64-clang-x86_64-toolchain
|
||||
mingw-w64-clang-x86_64-cmake
|
||||
mingw-w64-clang-x86_64-ninja
|
||||
git
|
||||
- name: Set up vcpkg
|
||||
shell: msys2 {0}
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
./bootstrap-vcpkg.bat
|
||||
./vcpkg integrate install
|
||||
cd ..
|
||||
- name: Bootstrap vcpkg
|
||||
shell: msys2
|
||||
run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
|
||||
|
||||
- name: Configure project with CMake and vcpkg
|
||||
shell: msys2 {0}
|
||||
env:
|
||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||
run: |
|
||||
export VCPKG_ROOT=./vcpkg
|
||||
export VCPKG_DEFAULT_TRIPLET=x64-mingw-static
|
||||
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-static
|
||||
mkdir build
|
||||
cd build
|
||||
cmake --preset default-windows -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build . --config Release
|
||||
cmake --preset default-ninja-clang-windows
|
||||
cmake --build --preset default-ninja-clang-windows --config Release
|
||||
- name: Package for Windows
|
||||
run: |
|
||||
mkdir packaged
|
||||
mkdir packaged/res
|
||||
cp build/VoxelEngine.exe packaged/
|
||||
cp build/vctest/vctest.exe packaged/
|
||||
cp build/Release/VoxelEngine.exe packaged/
|
||||
cp build/vctest/Release/vctest.exe packaged/
|
||||
cp build/*.dll packaged/
|
||||
cp -r build/res/* packaged/res/
|
||||
cp -r build/Release/res/* packaged/res/
|
||||
mv packaged/VoxelEngine.exe packaged/VoxelCore.exe
|
||||
- env:
|
||||
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
|
||||
|
||||
19
.github/workflows/windows.yml
vendored
19
.github/workflows/windows.yml
vendored
@ -21,19 +21,16 @@ jobs:
|
||||
with:
|
||||
submodules: 'true'
|
||||
|
||||
- name: Set up vcpkg
|
||||
run: |
|
||||
git clone https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
.\bootstrap-vcpkg.bat
|
||||
.\vcpkg integrate install
|
||||
cd ..
|
||||
- name: Bootstrap vcpkg
|
||||
shell: pwsh
|
||||
run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
|
||||
|
||||
- name: Configure and build project with CMake and vcpkg
|
||||
env:
|
||||
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON -DVOXELENGINE_BUILD_TESTS=ON ..
|
||||
cmake --build . --config Release
|
||||
cmake --preset default-vs-msvc-windows
|
||||
cmake --build --preset default-vs-msvc-windows --config Release
|
||||
- name: Run tests
|
||||
run: ctest --output-on-failure --test-dir build
|
||||
- name: Run engine tests
|
||||
|
||||
@ -49,6 +49,7 @@ endif()
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} VoxelEngineSrc ${CMAKE_DL_LIBS})
|
||||
|
||||
# Deploy res to build dir
|
||||
add_custom_command(
|
||||
TARGET ${PROJECT_NAME}
|
||||
POST_BUILD
|
||||
|
||||
@ -2,16 +2,44 @@
|
||||
"version": 6,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "default-windows",
|
||||
"name": "default-vs-msvc-windows",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"rhs": "${hostSystemName}",
|
||||
"lhs": "Windows"
|
||||
},
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "default-ninja-clang-windows",
|
||||
"condition": {
|
||||
"type": "equals",
|
||||
"rhs": "${hostSystemName}",
|
||||
"lhs": "Windows"
|
||||
},
|
||||
"generator": "Ninja Multi-Config",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"CMAKE_C_COMPILER": "clang",
|
||||
"CMAKE_CXX_COMPILER": "clang"
|
||||
}
|
||||
}
|
||||
],
|
||||
"buildPresets": [
|
||||
{
|
||||
"name": "default-vs-msvc-windows",
|
||||
"configurePreset": "default-vs-msvc-windows",
|
||||
"configuration": "Debug"
|
||||
},
|
||||
{
|
||||
"name": "default-ninja-clang-windows",
|
||||
"configurePreset": "default-ninja-clang-windows",
|
||||
"configuration": "Debug"
|
||||
}
|
||||
]
|
||||
}
|
||||
25
README.md
25
README.md
@ -109,38 +109,31 @@ cmake --build .
|
||||
> Requirement:
|
||||
>
|
||||
> vcpkg, CMake, Git
|
||||
If you want use vcpkg, install vcpkg from git to you system:
|
||||
There are two options to use vcpkg:
|
||||
1. If you have Visual Studio installed, most likely the **VCPKG_ROOT** environment variable will already exist in **Developer Command Prompt for VS**
|
||||
2. If you want use **vcpkg**, install **vcpkg** from git to you system:
|
||||
```PowerShell
|
||||
cd C:/
|
||||
git clone https://github.com/microsoft/vcpkg.git
|
||||
cd vcpkg
|
||||
.\bootstrap-vcpkg.bat
|
||||
```
|
||||
After installing vcpkg, setup env variable VCPKG_ROOT and add it to PATH:
|
||||
After installing **vcpkg**, setup env variable **VCPKG_ROOT** and add it to **PATH**:
|
||||
```PowerShell
|
||||
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
|
||||
$env:PATH = "$env:VCPKG_ROOT;$env:PATH"
|
||||
```
|
||||
For troubleshooting you can read full [documentation](https://learn.microsoft.com/ru-ru/vcpkg/get_started/get-started?pivots=shell-powershell) for vcpkg
|
||||
>[!TIP]
|
||||
>For troubleshooting you can read full [documentation](https://learn.microsoft.com/ru-ru/vcpkg/get_started/get-started?pivots=shell-powershell) for **vcpkg**
|
||||
|
||||
After installing vcpkg you can build project:
|
||||
After installing **vcpkg** you can build project:
|
||||
```PowerShell
|
||||
git clone --recursive https://github.com/MihailRis/VoxelEngine-Cpp.git
|
||||
cd VoxelEngine-Cpp
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
||||
cmake --build . --config Release
|
||||
cmake --preset default-vs-msvc-windows
|
||||
cmake --build --preset default-vs-msvc-windows
|
||||
```
|
||||
|
||||
> [!TIP]
|
||||
> You can use ```rm CMakeCache.txt``` and ```rm -rf CMakeFiles``` while using Git Bash
|
||||
|
||||
> [!WARNING]
|
||||
> If you have issues during the vcpkg integration, try navigate to ```vcpkg\downloads```
|
||||
> and extract PowerShell-[version]-win-x86 to ```vcpkg\downloads\tools``` as powershell-core-[version]-windows.
|
||||
> Then rerun ```cmake -DCMAKE_BUILD_TYPE=Release ..```
|
||||
|
||||
## Build using Docker
|
||||
|
||||
### Step 0. Install docker on your system
|
||||
|
||||
@ -21,15 +21,9 @@ endif()
|
||||
set(LIBS "")
|
||||
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if (MSVC)
|
||||
set(LUA_LIBRARIES "$ENV{VCPKG_ROOT}/packages/luajit_x64-windows/lib/lua51.lib")
|
||||
set(LUA_INCLUDE_DIR "$ENV{VCPKG_ROOT}/packages/luajit_x64-windows/include/luajit")
|
||||
else()
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(OpenAL REQUIRED IMPORTED_TARGET openal)
|
||||
set(LIBS ${LIBS} luajit-5.1 wsock32 ws2_32 pthread PkgConfig::OpenAL -static-libstdc++)
|
||||
message(STATUS ${OPENAL_LIBRARY})
|
||||
endif()
|
||||
set(LUA_LIBRARIES "$ENV{VCPKG_ROOT}/packages/luajit_x64-windows/lib/lua51.lib")
|
||||
set(LUA_INCLUDE_DIR "$ENV{VCPKG_ROOT}/packages/luajit_x64-windows/include/luajit")
|
||||
|
||||
find_package(glfw3 REQUIRED)
|
||||
find_package(glm REQUIRED)
|
||||
find_package(vorbis REQUIRED)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user