Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless mode #402

Merged
merged 281 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
281 commits
Select commit Hold shift + click to select a range
a036c5e
fix base:bazalt durability
MihailRis Dec 8, 2024
5fe5c6b
fix player tick rate
MihailRis Dec 8, 2024
5ffc054
refactor
MihailRis Dec 8, 2024
8f37704
fix libworld docs
MihailRis Dec 10, 2024
9b4dd8f
refactor & add test.new_world
MihailRis Dec 10, 2024
d3f74b5
add test.close_world(bool)
MihailRis Dec 10, 2024
9e18dcc
enable verbose engine tests output
MihailRis Dec 10, 2024
3c2eb30
add test.reconfig_packs & fix world.get_total_time() & enable level c…
MihailRis Dec 10, 2024
c67f158
remove default player from headless mode
MihailRis Dec 10, 2024
b05c2fc
fix 'timeit' in headless mode
MihailRis Dec 11, 2024
cfc1667
add test.open_world
MihailRis Dec 11, 2024
91fa283
reduce 'corrupted block detected ...' spam if chunk data is corrupted
MihailRis Dec 11, 2024
436bfd2
update ChunksStorage
MihailRis Dec 11, 2024
60f2303
Merge branch 'main' into headless-mode
MihailRis Dec 11, 2024
0d071ab
fix camera-related bugs
MihailRis Dec 11, 2024
c1a7b75
change components on_render call timing
MihailRis Dec 11, 2024
9adaf6d
update workflows
MihailRis Dec 11, 2024
863146c
move PlayerController to LevelScreen
MihailRis Dec 11, 2024
7e92a16
fix weak_ptr leak
MihailRis Dec 11, 2024
8a5042f
fix msvc build
MihailRis Dec 11, 2024
9ec8788
add player.create, test.set_setting, test.sleep_until, world.count_ch…
MihailRis Dec 12, 2024
8e6fb1d
update libworld docs
MihailRis Dec 12, 2024
913f942
add platform::get_process_id
MihailRis Dec 12, 2024
086c20c
cache block.index, block.name, item.index, item.name
MihailRis Dec 12, 2024
53cc8d3
add core.blank
MihailRis Dec 12, 2024
e0b3425
migrate blocks interaction (scripting) to global chunks storage (WIP)
MihailRis Dec 13, 2024
bf43fd7
update libblock
MihailRis Dec 13, 2024
251aca7
test
MihailRis Dec 13, 2024
76559cc
Revert "test"
MihailRis Dec 13, 2024
12c10d1
Add Windows build with Clang (#411)
MihailRis Dec 14, 2024
59978f4
rename workflows
MihailRis Dec 14, 2024
5e025b5
update test
MihailRis Dec 14, 2024
323acb2
static link libstdc++ (mingw)
MihailRis Dec 14, 2024
e713412
rename ChunksStorage to GlobalChunks
MihailRis Dec 14, 2024
92f11dd
Merge branch 'main' into headless-mode
MihailRis Dec 14, 2024
ea23ed2
add cmake presets
Dec 14, 2024
dccda99
Fix usage vcpkg for windows and fix readme, remove vcpkg usage flag f…
Dec 14, 2024
7547152
Fix resources linking
Dec 14, 2024
326630e
Check config working
Dec 14, 2024
9c53cd3
undo
Dec 14, 2024
dd09e3f
Cleanup
Dec 14, 2024
5bf56d1
update workflows
MihailRis Dec 15, 2024
6157f81
add blocks_agent templates & remove block.get_slow
MihailRis Dec 16, 2024
87c19d6
move block set logic to the blocks_agent
MihailRis Dec 16, 2024
c7c2fe2
move seekOrigin logic to the blocks_agent
MihailRis Dec 16, 2024
fb3f201
move setRotation, checkReplaceability, raycast logic to the blocks_a…
MihailRis Dec 16, 2024
5030a65
add docs to some blocks_agent functions
MihailRis Dec 16, 2024
6ed0bc3
add docs to some blocks_agent functions
MihailRis Dec 16, 2024
7ca9102
add docs to remaining public blocks_agent functions
MihailRis Dec 16, 2024
c5049d0
performance test again
MihailRis Dec 16, 2024
b7664b4
move Lighting instance to ChunksController
MihailRis Dec 17, 2024
1c18c02
move Chunks from Level to Player
MihailRis Dec 17, 2024
49dd866
update Chunks::configure
MihailRis Dec 17, 2024
b1fc666
fix
MihailRis Dec 17, 2024
09e641f
advanced chunks loading test
MihailRis Dec 17, 2024
7037090
two players test
MihailRis Dec 17, 2024
48d9403
rename Level.chunksStorage to Level.chunks
MihailRis Dec 17, 2024
fa1646a
add '--script', '--version' command line arguments
MihailRis Dec 17, 2024
5e55e20
add test.quit, test.reopen_world
MihailRis Dec 17, 2024
d745a34
refactor
MihailRis Dec 18, 2024
a144dd7
update vctest & add new test
MihailRis Dec 18, 2024
8e7dfe3
Merge branch 'main' into headless-mode
MihailRis Dec 18, 2024
1cd85b6
implement player ticks in headless mode & prevent on_player_tick call…
MihailRis Dec 18, 2024
8eda26f
Merge branch 'main' into headless-mode
MihailRis Dec 18, 2024
8a4f1e1
refactor PlayerController
MihailRis Dec 18, 2024
008e11b
fix ServerMainloop timer
MihailRis Dec 18, 2024
3c6ca01
fix
MihailRis Dec 18, 2024
3d7a9fd
Merge branch 'main' into headless-mode
MihailRis Dec 19, 2024
3d6c118
add logger.print
MihailRis Dec 19, 2024
1aca495
fix
MihailRis Dec 19, 2024
75f5a47
Merge branch 'MihailRis:main' into Fix-usage-vcpkg-for-windows-and-ad…
Ygrik2003 Dec 20, 2024
3b96c13
Merge branch 'headless-mode' into Fix-usage-vcpkg-for-windows-and-add…
Dec 20, 2024
cd4948c
Merge branch 'Fix-usage-vcpkg-for-windows-and-add-cmake-preset-for-vs…
Dec 20, 2024
84887d2
Refactoring CmakePresets for windows github actions and refactoring R…
Dec 20, 2024
c8c5b45
Try fix builds on agents
Dec 20, 2024
6863282
Fix ctests
Dec 20, 2024
9fe3f9a
HACK: use dot for get path to vcpkg on MSYS2
Dec 20, 2024
dc93cac
add 'script' entry point
MihailRis Dec 20, 2024
ba0610d
Merge branch 'main' into headless-mode
MihailRis Dec 21, 2024
6155d6f
fix triplet for windows
Ygrik2003 Dec 21, 2024
8c4d0dc
Fix ctests
Ygrik2003 Dec 21, 2024
f49feeb
refactor
MihailRis Dec 21, 2024
cdb6f2a
Merge branch 'main' into headless-mode
MihailRis Dec 21, 2024
b16c77c
Fix vcpkg for msys2 again
Ygrik2003 Dec 21, 2024
b81dab3
Fix luajit linking for clang
Ygrik2003 Dec 21, 2024
fdcc5b6
Remove relative path
Ygrik2003 Dec 21, 2024
8854389
Fix resources
Ygrik2003 Dec 21, 2024
79f5ffc
Merge branch 'main' into headless-mode
MihailRis Dec 21, 2024
17161e5
fix: on_player_tick not called
MihailRis Dec 21, 2024
c3f22c6
rename
MihailRis Dec 21, 2024
4363883
add 'on_breaking', 'on_block_breaking' events
MihailRis Dec 21, 2024
2229cd5
Fix ctest
Dec 21, 2024
d0e8f43
Fix lua linking
Dec 21, 2024
e34a7bb
Fik lib ext for clang
Dec 21, 2024
1149d58
Merge branch 'main' into headless-mode
MihailRis Dec 21, 2024
b458df4
Fik lib luajit
Dec 22, 2024
d699764
Refactoring and try move to pwsh for clang
Dec 22, 2024
5eab58f
Fix comment
Dec 22, 2024
d889b79
Try remove maybe unused code
Dec 22, 2024
a14e7c1
Refactoring
Dec 22, 2024
fa1d450
Return latest ninja and cmake installing
Dec 22, 2024
0e02451
Review fixes: Fix path loading to artifactory
Dec 22, 2024
a0a32ce
Fix res folder deploy
Dec 22, 2024
22d207b
add player.set_selected_slot, inventory.find_by_item
MihailRis Dec 23, 2024
9164edf
move 'player.pick' binding handler to Lua
MihailRis Dec 23, 2024
3d33de5
move 'player.noclip' and 'player.flight' handlers to Lua
MihailRis Dec 23, 2024
6a8afe2
fix
MihailRis Dec 23, 2024
0960923
add 'graphics.chunk-max-vertices-dense' setting
MihailRis Dec 23, 2024
0da25f0
Merge branch 'main' into headless-mode
MihailRis Dec 23, 2024
ecbdb09
Merge branch 'main' into headless-mode
MihailRis Dec 24, 2024
d55d02a
add dev/tests/filesystem.lua
MihailRis Dec 24, 2024
bc4aea6
add file.is_writeable
MihailRis Dec 24, 2024
272e41d
disable writing to read-only entry points
MihailRis Dec 24, 2024
0940e89
Merge branch 'main' into headless-mode
MihailRis Dec 24, 2024
e153e1f
add player.is_loading_chunks, .set_loading_chunks
MihailRis Dec 24, 2024
b4abecc
refactor
MihailRis Dec 24, 2024
ba7fd7c
Try do all libs as static for clang windows build
Dec 24, 2024
f73bc1b
Merge branch 'headless-mode' into Fix-usage-vcpkg-for-windows-and-add…
Dec 24, 2024
c3e16f2
Merge branch 'main' into headless-mode
MihailRis Dec 24, 2024
5dbfd5b
Try add static libs
Dec 24, 2024
e7d36ef
Fix static compilation
Dec 24, 2024
7792ecf
Fix msvc build
Dec 25, 2024
231f761
Remove unused copy
Dec 25, 2024
17460be
Fix builds
Dec 25, 2024
deb85ba
Merge branch 'main' into headless-mode
MihailRis Dec 25, 2024
ad6a666
rename test library to app & rename app.name to app.script
MihailRis Dec 25, 2024
686ace3
fix: app.sleep_until max_ticks ignored
MihailRis Dec 25, 2024
be0945b
add app.get_version, app.get_setting_info
MihailRis Dec 25, 2024
8179b9c
add app.get_setting
MihailRis Dec 25, 2024
36bfa21
add app library docs
MihailRis Dec 25, 2024
b927c19
Merge branch 'main' into headless-mode
MihailRis Dec 25, 2024
e98132f
update doc/en/scripting/builtins/libapp.md
MihailRis Dec 25, 2024
357e4f8
refactor: extract post-runnables to a separate class
MihailRis Dec 25, 2024
5e76cdf
rename engine.hpp/cpp to Engine.hpp/cpp & move Engine, Time and mainl…
MihailRis Dec 25, 2024
96577ee
add input.add_callback("key:...") support
MihailRis Dec 25, 2024
9b0d1fd
Merge branch 'headless-mode' into Fix-usage-vcpkg-for-windows-and-add…
Dec 25, 2024
ed7dc1f
feat: add app.save_world() function and update documentation
MihailRis Dec 25, 2024
cb5d191
add performance test
MihailRis Dec 25, 2024
c17c6b6
Merge branch 'headless-mode' into Fix-usage-vcpkg-for-windows-and-add…
Dec 25, 2024
ef2c0b2
update doc/*/scripting/user-input.md
MihailRis Dec 25, 2024
54c51b5
Check msys2 perf
Dec 25, 2024
b902b2d
Fix problem
Dec 25, 2024
3b65c39
Fix typo
Dec 25, 2024
c6a8972
idk
Dec 25, 2024
3982066
Try Fix
Dec 25, 2024
c18c210
Return old behavior
Dec 25, 2024
5993394
Add comment
Dec 25, 2024
f8225ef
Try refactor
Dec 25, 2024
c1b311f
refactor: change pointer parameters to references for Level and Conte…
MihailRis Dec 25, 2024
ffd7473
Revert "Try refactor"
Dec 25, 2024
6fec970
Delete clang preset besause need cmake compatibility with msys2
Dec 25, 2024
13c36f4
feat: player.delete() function and update documentation
MihailRis Dec 26, 2024
f8c0862
fix: console not opening
MihailRis Dec 26, 2024
773d144
feat: add base:loot property (WIP)
MihailRis Dec 26, 2024
ef77754
fix
MihailRis Dec 26, 2024
8aa55cf
add 'do-loot-non-player' rule to base pack
MihailRis Dec 26, 2024
6cb0d31
Merge pull request #414 from Ygrik2003/Fix-usage-vcpkg-for-windows-an…
MihailRis Dec 26, 2024
ba1d4ab
Merge branch 'headless-mode' into base-loot-property
MihailRis Dec 26, 2024
d73c0b2
fix cmake in linux
MihailRis Dec 27, 2024
857bdd7
update cmake lists
MihailRis Dec 27, 2024
651b67c
remove an extra step in windows-clang workflow
MihailRis Dec 27, 2024
83d8254
set minimum required cmake version to 3.26
MihailRis Dec 27, 2024
cca153b
add byteutil library
MihailRis Dec 27, 2024
5eb739f
Merge branch 'main' into headless-mode
MihailRis Dec 27, 2024
ad12f3a
Merge branch 'headless-mode' into base-loot-property
MihailRis Dec 27, 2024
0af0e8a
update byteutil
MihailRis Dec 27, 2024
bb2cff5
add byteutil docs
MihailRis Dec 27, 2024
ee26b2a
update doc/*/scripting.md
MihailRis Dec 27, 2024
7239418
add unpack function documentation
MihailRis Dec 27, 2024
a5a0a27
fix docs
MihailRis Dec 27, 2024
84ae5a8
Merge branch 'headless-mode' into base-loot-property
MihailRis Dec 27, 2024
3c41c41
Merge branch 'main' into headless-mode
MihailRis Dec 29, 2024
d57e462
Merge branch 'headless-mode' into base-loot-property
MihailRis Dec 29, 2024
ebea9af
add '...@append' method to block properties
MihailRis Dec 29, 2024
f744c87
add loot count 'min' and 'max'
MihailRis Dec 29, 2024
7044c12
update doc/*/block-properties.md
MihailRis Dec 29, 2024
7132bb0
Merge pull request #422 from MihailRis/base-loot-property
MihailRis Dec 29, 2024
97eef3e
fix content stats
MihailRis Dec 29, 2024
45807fd
fix on_block_common
MihailRis Dec 29, 2024
9a190ac
add 'states' parameter to base:falling_block
MihailRis Dec 29, 2024
ab5a62c
add new block.get_AXIS functions overloads & add rotation support to …
MihailRis Dec 29, 2024
e278f59
fix incorrect matrix in some rotations
MihailRis Dec 29, 2024
c33a92a
fix block.set in headless mode & fix: vctest does not cleanup worlds
MihailRis Dec 29, 2024
4d1f44a
add core:tests_util module & add base_entities test
MihailRis Dec 29, 2024
9be9665
fix base_entities test
MihailRis Dec 29, 2024
aad0ea8
convert tabs to spaces
MihailRis Dec 30, 2024
9490d1f
change default byte order in bit_converter to BE and fix byte manipul…
MihailRis Dec 30, 2024
d576dc3
test smth
MihailRis Dec 30, 2024
19bef1a
revert "test smth"
MihailRis Dec 30, 2024
10f0bd0
refactor
MihailRis Dec 30, 2024
cb9690e
add 'cursor' ui property
MihailRis Dec 30, 2024
3304bf2
Merge pull request #427 from MihailRis/ui-cursor-property
MihailRis Dec 30, 2024
03a3062
fix error handling in events and runnables
MihailRis Dec 31, 2024
0694352
fix
MihailRis Dec 31, 2024
1f47f38
feat: 'CTRL + Up/Down' in multiline textbox
MihailRis Dec 31, 2024
81a7914
fix: post-runnables not called in headless mode
MihailRis Dec 31, 2024
727d578
fix vctest help screen
MihailRis Jan 1, 2025
4c23dc6
feat: simple valgrind integration in vctest & AppImage workflow: chan…
MihailRis Jan 1, 2025
17dcbe9
fix clang-check warnings
MihailRis Jan 1, 2025
4a66891
update vctest
MihailRis Jan 1, 2025
30a8ddf
fix app.* functions & update 'world' test
MihailRis Jan 1, 2025
3384ccb
Merge branch 'main' into headless-mode
MihailRis Jan 1, 2025
c135b04
remove perftest
MihailRis Jan 1, 2025
7039ddd
test vctest upgrade (must fail)
MihailRis Jan 1, 2025
c427501
revert failing test
MihailRis Jan 1, 2025
af592b6
add pack.get_info(table) overload
MihailRis Jan 1, 2025
9ef7e8e
optimize content-packs related pages
MihailRis Jan 2, 2025
e976b20
fix pack.get_info in headless mode
MihailRis Jan 2, 2025
e2f6c26
update pack.get_info
MihailRis Jan 2, 2025
7fce735
add gui.confirm(...)
MihailRis Jan 2, 2025
b9ff1db
feat: key pressed event interception & 'owner' input.add_callback thi…
MihailRis Jan 2, 2025
a3d35cd
add gui.alert & critical fixes
MihailRis Jan 2, 2025
4d0b9f0
fix small dumb legacy memory leak
MihailRis Jan 2, 2025
7a67beb
add valgrind suppressions file
MihailRis Jan 2, 2025
9d7816a
fix grass lighting
MihailRis Jan 3, 2025
3187243
minor refactor
MihailRis Jan 3, 2025
bd9018d
add pack.assemble(...), app.config_packs(...)
MihailRis Jan 3, 2025
c19656a
update libapp docs
MihailRis Jan 3, 2025
0d1c7f1
fix Engine::resetContent in headless mode
MihailRis Jan 3, 2025
88de024
Merge branch 'main' into headless-mode
MihailRis Jan 3, 2025
490cae7
Merge branch 'main' into headless-mode
MihailRis Jan 4, 2025
f62fc5a
fix errors handling in event handlers
MihailRis Jan 5, 2025
c51a7e0
improve logging
MihailRis Jan 5, 2025
136c355
add file.name(), file.stem() & add 'path' to pack info & add start_co…
MihailRis Jan 5, 2025
48aad8d
add 'Scripts' menu page
MihailRis Jan 5, 2025
435a829
fix temporary pages
MihailRis Jan 5, 2025
5a34e8d
update gui.confirm
MihailRis Jan 5, 2025
b5a266e
enable GL debug output
MihailRis Jan 6, 2025
da471bd
add refresh button to scripts page
MihailRis Jan 6, 2025
0a1a162
move menu pages loader to Lua & add gui.load_document, file.ext(), fi…
MihailRis Jan 6, 2025
ab24187
fix windows build
MihailRis Jan 6, 2025
d65da96
add app.load_content
MihailRis Jan 6, 2025
550f3c4
fix
MihailRis Jan 6, 2025
e2bc168
add app.reset_content()
MihailRis Jan 6, 2025
e94b70f
fix
MihailRis Jan 7, 2025
13de581
add socket:available() --> int
MihailRis Jan 7, 2025
e755544
fix lua stack manipulations
MihailRis Jan 7, 2025
df9c301
update input.add_callback(...)
MihailRis Jan 7, 2025
0d17396
update doc/*/scripting/user-input.md
MihailRis Jan 7, 2025
e5a3178
move 'input' library docs to a separate page
MihailRis Jan 7, 2025
dbf366e
fixes
MihailRis Jan 7, 2025
5b6ad81
fix
MihailRis Jan 7, 2025
96b904e
add network.post
MihailRis Jan 8, 2025
93b2040
update doc/*/scripting/builtins/libnetwork.md
MihailRis Jan 8, 2025
010ed78
Merge pull request #432 from MihailRis/http-post
MihailRis Jan 8, 2025
e0440b2
fix world deletion & fix segfault on attempt to reset content when wo…
MihailRis Jan 8, 2025
adc287b
fix
MihailRis Jan 8, 2025
2a1684c
fix page request arguments
MihailRis Jan 8, 2025
c2a3801
cleanup workflows
MihailRis Jan 9, 2025
620316c
remove `--output-always` key from workflows
MihailRis Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/appimage.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: C/C++ AppImage
name: x86-64 AppImage

on:
push:
Expand All @@ -20,24 +20,33 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- name: install dependencies
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libglfw3-dev libglfw3 libglew-dev \
libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev libcurl4-openssl-dev cmake squashfs-tools
libglm-dev libpng-dev libopenal-dev libluajit-5.1-dev libvorbis-dev \
libcurl4-openssl-dev libgtest-dev cmake squashfs-tools valgrind
# fix luajit paths
sudo ln -s /usr/lib/x86_64-linux-gnu/libluajit-5.1.a /usr/lib/x86_64-linux-gnu/liblua5.1.a
sudo ln -s /usr/include/luajit-2.1 /usr/include/lua
# install EnTT
git clone https://github.com/skypjack/entt.git
cd entt/build
cmake -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
sudo make install
cd ../..
- name: configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_APPDIR=1
- name: build
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DVOXELENGINE_BUILD_APPDIR=1 -DVOXELENGINE_BUILD_TESTS=ON
- name: Build
run: cmake --build build -t install
- name: Run tests
run: ctest --test-dir build
- name: Run engine tests
timeout-minutes: 1
run: |
chmod +x build/VoxelEngine
chmod +x AppDir/usr/bin/vctest
AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build
- name: Build AppImage
uses: AppImageCrafters/build-appimage-action@fe2205a4d6056be47051f7b1b3811106e9814910
env:
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ jobs:
- name: Run tests
run: ctest --output-on-failure --test-dir build

- name: Run engine tests
timeout-minutes: 1
run: |
chmod +x build/VoxelEngine
chmod +x AppDir/usr/bin/vctest
AppDir/usr/bin/vctest -e build/VoxelEngine -d dev/tests -u build
- name: Create DMG
run: |
mkdir VoxelEngineDmgContent
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/windows-clang.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Windows Build (CLang)

on:
push:
branches: [ "main", "release-**"]
pull_request:
branches: [ "main" ]

jobs:
build-windows:

strategy:
matrix:
include:
- os: windows-latest
compiler: clang

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: msys2/setup-msys2@v2
id: msys2
name: Setup MSYS2
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
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: Configure project with CMake and vcpkg
shell: msys2 {0}
run: |
export VCPKG_DEFAULT_TRIPLET=x64-mingw-static
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-static
export VCPKG_ROOT=./vcpkg
mkdir build
cd build
cmake -G "MinGW Makefiles" -DVCPKG_TARGET_TRIPLET=x64-mingw-static -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=./vcpkg/scripts/buildsystems/vcpkg.cmake ..
cmake --build . --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/*.dll packaged/
cp -r build/res/* packaged/res/
mv packaged/VoxelEngine.exe packaged/VoxelCore.exe
- uses: actions/upload-artifact@v4
with:
name: Windows-Build
path: 'packaged/*'
- name: Run engine tests
shell: msys2 {0}
working-directory: ${{ github.workspace }}
run: |
packaged/vctest.exe -e packaged/VoxelCore.exe -d dev/tests -u build
36 changes: 20 additions & 16 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows Build
name: MSVC Build

on:
push:
Expand All @@ -21,29 +21,33 @@ jobs:
with:
submodules: 'true'

- name: Set up vcpkg
- name: Bootstrap vcpkg
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install
cd ..
${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat

- name: Configure and build project with CMake and vcpkg
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: |
cmake --preset default-vs-msvc-windows
cmake --build --preset default-vs-msvc-windows --config Release
- name: Run tests
run: ctest --preset default-vs-msvc-windows
- name: Run engine tests
run: |
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON -DVOXELENGINE_BUILD_TESTS=ON ..
cmake --build . --config Release
build/vctest/Release/vctest.exe -e build/Release/VoxelEngine.exe -d dev/tests -u build
timeout-minutes: 1
- name: Package for Windows
run: |
mkdir packaged
cp -r build/* packaged/
cp C:/Windows/System32/msvcp140.dll packaged/Release/msvcp140.dll
mv packaged/Release/VoxelEngine.exe packaged/Release/VoxelCore.exe
cp -r build/Release/* packaged/
cp build/vctest/Release/vctest.exe packaged/
cp C:/Windows/System32/msvcp140.dll packaged/msvcp140.dll
mv packaged/VoxelEngine.exe packaged/VoxelCore.exe
working-directory: ${{ github.workspace }}
- name: Run tests
run: ctest --output-on-failure --test-dir build
- uses: actions/upload-artifact@v4
with:
name: Windows-Build
path: 'packaged/Release/*'
path: 'packaged/*'
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ Debug/voxel_engine
AppDir
appimage-build/

# for vcpkg
/vcpkg/
.gitmodules

# macOS folder attributes
*.DS_Store

Expand Down
64 changes: 28 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
option(VOXELENGINE_BUILD_WINDOWS_VCPKG ON)
if(VOXELENGINE_BUILD_WINDOWS_VCPKG AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake")
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
endif()

cmake_minimum_required(VERSION 3.15)
cmake_minimum_required(VERSION 3.26)
project(VoxelEngine)

option(VOXELENGINE_BUILD_APPDIR OFF)
option(VOXELENGINE_BUILD_TESTS OFF)
option(VOXELENGINE_BUILD_APPDIR "" OFF)
option(VOXELENGINE_BUILD_TESTS "" OFF)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
# We use two types linking: for clang build is static (vcpkg triplet x64-windows-static)
# and for msvc build is dynamic linking (vcpkg triplet x64-windows)
# By default CMAKE_MSVC_RUNTIME_LIBRARY set by MultiThreaded$<$<CONFIG:Debug>:Debug>DLL
if (VCPKG_TARGET_TRIPLET MATCHES "static")
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()

add_subdirectory(src)
add_executable(${PROJECT_NAME} src/voxel_engine.cpp)
add_executable(${PROJECT_NAME} src/main.cpp)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

if(VOXELENGINE_BUILD_APPDIR)
Expand All @@ -24,7 +30,6 @@ if(MSVC)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()
if((CMAKE_BUILD_TYPE EQUAL "Release") OR (CMAKE_BUILD_TYPE EQUAL "RelWithDebInfo"))
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /MT /O2)
else()
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
Expand All @@ -39,31 +44,9 @@ else()
if (CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_options(${PROJECT_NAME} PRIVATE -Og)
endif()
endif()

if(VOXELENGINE_BUILD_WINDOWS_VCPKG AND WIN32)
if(NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/.git")
find_package(Git QUIET)
if(GIT_FOUND)
message(STATUS "Adding vcpkg as a git submodule...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule add https://github.com/microsoft/vcpkg.git vcpkg WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
else()
message(FATAL_ERROR "Git not found, cannot add vcpkg submodule.")
endif()
endif()

if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/.git")
message(STATUS "Initializing and updating vcpkg submodule...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND ${CMAKE_COMMAND} -E chdir vcpkg ./bootstrap-vcpkg.bat WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
endif()

foreach(CONFIG_TYPE ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${CONFIG_TYPE} CONFIG_TYPE_UPPER)
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/res ${CMAKE_BINARY_DIR}/${CONFIG_TYPE_UPPER}/res)
endforeach()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
Expand All @@ -76,9 +59,18 @@ endif()

target_link_libraries(${PROJECT_NAME} VoxelEngineSrc ${CMAKE_DL_LIBS})

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/res DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
# Deploy res to build dir
add_custom_command(
TARGET ${PROJECT_NAME}
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different
${CMAKE_CURRENT_SOURCE_DIR}/res
$<TARGET_FILE_DIR:${PROJECT_NAME}>/res
)

if (VOXELENGINE_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
endif()
endif()

add_subdirectory(vctest)
35 changes: 35 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": 6,
"configurePresets": [
{
"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",
"VOXELENGINE_BUILD_TESTS": "ON"
}
}
],
"buildPresets": [
{
"name": "default-vs-msvc-windows",
"configurePreset": "default-vs-msvc-windows",
"configuration": "Debug"
}
],
"testPresets": [
{
"name": "default-vs-msvc-windows",
"configurePreset": "default-vs-msvc-windows",
"output": {
"outputOnFailure": true
}
}
]
}
38 changes: 21 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,32 @@ cmake --build .
>[!NOTE]
> Requirement:
>
> vcpkg, CMake
> vcpkg, CMake, Git
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**:
```PowerShell
$env:VCPKG_ROOT = "C:\path\to\vcpkg"
$env:PATH = "$env:VCPKG_ROOT;$env:PATH"
```
>[!TIP]
>For troubleshooting you can read full [documentation](https://learn.microsoft.com/ru-ru/vcpkg/get_started/get-started?pivots=shell-powershell) for **vcpkg**

```sh
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 -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON ..
del CMakeCache.txt
rmdir /s /q CMakeFiles
cmake -DCMAKE_BUILD_TYPE=Release -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON ..
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 -DVOXELENGINE_BUILD_WINDOWS_VCPKG=ON ..```

## Build using Docker

### Step 0. Install docker on your system
Expand Down
Loading
Loading