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:
|
with:
|
||||||
msystem: clang64
|
msystem: clang64
|
||||||
install: >-
|
install: >-
|
||||||
mingw-w64-clang-x86_64-toolchain
|
mingw-w64-clang-x86_64-toolchain
|
||||||
mingw-w64-clang-x86_64-cmake
|
mingw-w64-clang-x86_64-cmake
|
||||||
mingw-w64-clang-x86_64-make
|
mingw-w64-clang-x86_64-ninja
|
||||||
mingw-w64-clang-x86_64-luajit
|
|
||||||
git
|
git
|
||||||
- name: Set up vcpkg
|
- name: Bootstrap vcpkg
|
||||||
shell: msys2 {0}
|
shell: msys2
|
||||||
run: |
|
run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
|
||||||
git clone https://github.com/microsoft/vcpkg.git
|
|
||||||
cd vcpkg
|
|
||||||
./bootstrap-vcpkg.bat
|
|
||||||
./vcpkg integrate install
|
|
||||||
cd ..
|
|
||||||
- name: Configure project with CMake and vcpkg
|
- name: Configure project with CMake and vcpkg
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
|
env:
|
||||||
|
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||||
run: |
|
run: |
|
||||||
export VCPKG_ROOT=./vcpkg
|
cmake --preset default-ninja-clang-windows
|
||||||
export VCPKG_DEFAULT_TRIPLET=x64-mingw-static
|
cmake --build --preset default-ninja-clang-windows --config Release
|
||||||
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
|
|
||||||
- name: Package for Windows
|
- name: Package for Windows
|
||||||
run: |
|
run: |
|
||||||
mkdir packaged
|
mkdir packaged
|
||||||
mkdir packaged/res
|
mkdir packaged/res
|
||||||
cp build/VoxelEngine.exe packaged/
|
cp build/Release/VoxelEngine.exe packaged/
|
||||||
cp build/vctest/vctest.exe packaged/
|
cp build/vctest/Release/vctest.exe packaged/
|
||||||
cp build/*.dll 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
|
mv packaged/VoxelEngine.exe packaged/VoxelCore.exe
|
||||||
- env:
|
- env:
|
||||||
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
|
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:
|
with:
|
||||||
submodules: 'true'
|
submodules: 'true'
|
||||||
|
|
||||||
- name: Set up vcpkg
|
- name: Bootstrap vcpkg
|
||||||
run: |
|
shell: pwsh
|
||||||
git clone https://github.com/microsoft/vcpkg.git
|
run: ${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
|
||||||
cd vcpkg
|
|
||||||
.\bootstrap-vcpkg.bat
|
|
||||||
.\vcpkg integrate install
|
|
||||||
cd ..
|
|
||||||
- name: Configure and build project with CMake and vcpkg
|
- name: Configure and build project with CMake and vcpkg
|
||||||
|
env:
|
||||||
|
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
cmake --preset default-vs-msvc-windows
|
||||||
cd build
|
cmake --build --preset default-vs-msvc-windows --config Release
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON -DVOXELENGINE_BUILD_TESTS=ON ..
|
|
||||||
cmake --build . --config Release
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: ctest --output-on-failure --test-dir build
|
run: ctest --output-on-failure --test-dir build
|
||||||
- name: Run engine tests
|
- name: Run engine tests
|
||||||
|
|||||||
@ -49,6 +49,7 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} VoxelEngineSrc ${CMAKE_DL_LIBS})
|
target_link_libraries(${PROJECT_NAME} VoxelEngineSrc ${CMAKE_DL_LIBS})
|
||||||
|
|
||||||
|
# Deploy res to build dir
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET ${PROJECT_NAME}
|
TARGET ${PROJECT_NAME}
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
|
|||||||
@ -2,16 +2,44 @@
|
|||||||
"version": 6,
|
"version": 6,
|
||||||
"configurePresets": [
|
"configurePresets": [
|
||||||
{
|
{
|
||||||
"name": "default-windows",
|
"name": "default-vs-msvc-windows",
|
||||||
"condition": {
|
"condition": {
|
||||||
"type": "equals",
|
"type": "equals",
|
||||||
"rhs": "${hostSystemName}",
|
"rhs": "${hostSystemName}",
|
||||||
"lhs": "Windows"
|
"lhs": "Windows"
|
||||||
},
|
},
|
||||||
|
"generator": "Visual Studio 17 2022",
|
||||||
"binaryDir": "${sourceDir}/build",
|
"binaryDir": "${sourceDir}/build",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
"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:
|
> Requirement:
|
||||||
>
|
>
|
||||||
> vcpkg, CMake, Git
|
> 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
|
```PowerShell
|
||||||
cd C:/
|
cd C:/
|
||||||
git clone https://github.com/microsoft/vcpkg.git
|
git clone https://github.com/microsoft/vcpkg.git
|
||||||
cd vcpkg
|
cd vcpkg
|
||||||
.\bootstrap-vcpkg.bat
|
.\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
|
```PowerShell
|
||||||
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
|
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
|
||||||
$env:PATH = "$env:VCPKG_ROOT;$env:PATH"
|
$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
|
```PowerShell
|
||||||
git clone --recursive https://github.com/MihailRis/VoxelEngine-Cpp.git
|
git clone --recursive https://github.com/MihailRis/VoxelEngine-Cpp.git
|
||||||
cd VoxelEngine-Cpp
|
cd VoxelEngine-Cpp
|
||||||
mkdir build
|
cmake --preset default-vs-msvc-windows
|
||||||
cd build
|
cmake --build --preset default-vs-msvc-windows
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release ..
|
|
||||||
cmake --build . --config Release
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!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
|
## Build using Docker
|
||||||
|
|
||||||
### Step 0. Install docker on your system
|
### Step 0. Install docker on your system
|
||||||
|
|||||||
@ -21,15 +21,9 @@ endif()
|
|||||||
set(LIBS "")
|
set(LIBS "")
|
||||||
|
|
||||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||||
if (MSVC)
|
set(LUA_LIBRARIES "$ENV{VCPKG_ROOT}/packages/luajit_x64-windows/lib/lua51.lib")
|
||||||
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")
|
||||||
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()
|
|
||||||
find_package(glfw3 REQUIRED)
|
find_package(glfw3 REQUIRED)
|
||||||
find_package(glm REQUIRED)
|
find_package(glm REQUIRED)
|
||||||
find_package(vorbis REQUIRED)
|
find_package(vorbis REQUIRED)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user