Skip to content

Comments

Switch to Vcpkg manifest#28

Open
HexDecimal wants to merge 45 commits intormtew:masterfrom
HexDecimal:vcpkg-manifest
Open

Switch to Vcpkg manifest#28
HexDecimal wants to merge 45 commits intormtew:masterfrom
HexDecimal:vcpkg-manifest

Conversation

@HexDecimal
Copy link
Collaborator

Not perfect, it seems Visual Studio needs the vcpkg integrate install command. I've updated the README.md with Vcpkg instructions.

Vcpkg manifest includes: breakpad, libtcod, PDCurses, and SDL2. I've also setup the curses project to use Vcpkg if you want to ever start debugging that.

Pinned manifest to the current latest Vcpkg revision. Manifest mode and "builtin-baseline" is the secret ingredient to stable dependencies.

Including modern libtcod headers will fail until #22 is merged, for reasons explained in #12.

rmtew and others added 30 commits August 14, 2024 20:14
…er to get this compiling in an hour or so at most. These changes get the x64 debug build working for VS 2022 community edition.

0. Completely ignore `build.bat`.
1. Change the incursion lib project to not run modaccent or flex. modaccent x64 will crash when running, likely it might still work for x86. See Language Files folder in the project, `grammar.acc` and `tokens.lex`. Right click on each, Properties and exclude from build.
2. Download libtcod-1.7.0-x86_64-msvc binaries.
3. Extract into build\libtcod-1.7.0-x86_64-msvc.
4. Compile `exe_libtcod` project.
5. Debug the `exe_libtcod` project and observe it runs and you see the libtcod game. Exit.
6. Copy `build\libtcod-1.7.0-x86_64-msvc\libtcod.dll` to the top level source directory (for clarity this is where `build.bat` is).
7. Copy `build\libtcod-1.7.0-x86_64-msvc\SDL2.dll` to the top level source directory.
8. Copy `build\x64\Debug\exe_libtcod\Incursion.exe` to the top level source directory.
9. Open a command prompt in the top-level source directory.
10. Run `Incursion.exe -compile`. Observe the module compiles.
11. Delete `Incursion.exe` from the top-level source directory as it will get stale.
12. Now you should be able to debug and play Incursion in Visual Studio.

C:\Data\R\git\incursion-roguelike\build\x64\Debug\exe_libtcod
…heck in `flex.exe` for ease of rebuilding the resource compiler lexer and grammar. Added more build instructions.
…2/x64. Fetches libtcod 1.7.0 dependencies and extracts in correct locations.
Apply a standard format to the entire file

Update setup-msbuild action to v2

Compile and upload mod file during debug build

Upload fully packaged releases
Always initialize Rect variables

Prefer member initializer lists

Return full Rect from methods since returning a reference to an internal
static variable is a disaster waiting to happen.

Mark relevant methods and parameters as const
Update parameter and variable names
This define breaks the standard C++11 array template and must be removed.
No code relies on this macro.
Includes `<cstdint>` and updates typedefs to point to it so that I don't
need to go around the entire source and update every single type.

Replace `long` with `int` in any place where the type is used for a
plain value. This clarifies that nothing is broken here.

Generally use `int` as the "don't care" type. `int` always means `int32_t`
on modern compilers on all platforms. This is convention.

`unsigned long` becomes `uint32_t`.

`printf` function which was converting pointers to int to print them
now uses `%p` instead to print the pointer directly.

`EffectInfo::Source` is a suspicious union of pointer and enum types.
I used `intptr_t` here for comparisons to prevent truncation.

Did not touch `long` in preprocessor or tokenizer sources.
The class was causing minor warnings and on closer inspection it appears
it wasn't being used at all.

Blame doesn't go back far enough for me to investigate what this was
meant for.
Switch to standard types, replace long types
…ting a String to the embedded buffer in VS2022 where it was in VS2105.
Remove dead code: Dictionary and Parser class
Bundle mod based on architecture
Looking up the standard docs, 0x00 characters have the same results as 0x01.
I can't find any way to explain or justify these macros.
Remove modified character checking functions
…ows top-level or docs directory content to be hosted. 'website' directory was moved to a separate repo which is now hosted on incursion-roguelike.net.
Was causing assertions to fail on negative numbers.

A classic case of: that code should be safe to remove, oh it turns out it was there for a reason.

Added the functions back with new names so that they don't conflict with anything.
rmtew and others added 14 commits August 22, 2024 21:58
…event them being in turn given in the line numbers.
The default working directory is now the project root, always.
This is simpler and removes the need to copy files around.

Any older save files in `build/run` will have to be moved to the
project root folder in order to continue them.

I've noticed Incursion breaks with relative paths, otherwise I would've
used `"."` as the default directory rather than asking `_getcwd`.
No longer need to wonder if I've modified these files correctly.
The CI will now verify and fail if generated files are not committed.
The simplest solution was to add `using` to replace the macros exactly
with the C++ functions.

Platform toolset has been increased to v143.
This was probably not needed for this PR but it is needed for C++17 and libtcod.

An explicit type must be given when int constants are mixed with smaller types.

The sources which needed to be updated includes `Grammar.acc`.

Refactor Grammar.acc to use std:: namespace
Not even a using alias in the headers anymore.

Found some subtle edge cases by doing this.
Also updates min/max in unused code.

Use `define NOMINMAX` instead of `undef` to prevent Windows headers of defining min/max.
Replace min/max macros with standard C++
Current builds were assuming that generated files are already built based on their timestamps, which prevents testing newly updated generated files.

This manually deletes the generated files to be tested.
Ensure tracked generated files are rebuilt in tests
…e degress. Remove obsolete build.bat. Update Changelog for rmtew#27.
Updates README.md with Vcpkg integration instructions

Removes libtcod from custom include and library directories

Vcpkg manifest includes: breakpad, libtcod, PDCurses, and SDL2

Pinned manifest to the current latest Vcpkg revision

Add Vcpkg submodule

Install Vcpkg on CI

Bundle DLL's installed by Vcpkg

Libtcod direct download no longer needed

Cache Vcpkg build artifacts
@HexDecimal
Copy link
Collaborator Author

I'm more familiar with setting up Vcpkg for CMake than for MSBuild. The way I've set it up here makes it easy to add a CMake build later on, for cross-platform builds. I can get started on that after this PR if it's a priority.

This adds a Vcpkg submodule next to the vcpkg.json file. The Vcpkg baseline is very strict. The baseline combined with GitHub Actions shallow by default checkouts means that the baseline must match the submodule revision exactly. You will need to pull or fetch on your local Vcpkg repo to make the baseline setting happy, it wants a very exact, very recent revision.

This updates to the latest version of libtcod. I've discovered an issue where modifier keys will stick if TCOD_console_init_root is called while they're held. The current code does not respond to window exposed events.

@HexDecimal HexDecimal marked this pull request as ready for review August 27, 2024 07:58
@rmtew
Copy link
Owner

rmtew commented Aug 27, 2024

Can we get rid of the submodule? I am very anti-submodule. I have spent way too much time trying to deal with corrupt submodules.

@HexDecimal
Copy link
Collaborator Author

The Vcpkg repo needs to be cloned for CI and later on CMake, any alternative is just a submodule with extra steps which will be less supported and more error prone than a submodule.

In most cases cloning the submodule will be optional. CMake will need it for CI again, but can be configured to use a local repo instead.

I've heard some criticism of submodules before, but it's usually about how it doesn't vendor the target repo, how did you manage to get yours corrupted?

@rmtew
Copy link
Owner

rmtew commented Aug 27, 2024

I don't know. But it is very hard to fix without deleting the whole parent repo as it keeps coming back. My belief is that this is a layer of unnecessary abstraction that adds problems of it's own and replaces simple standard commands to little benefit.

@HexDecimal
Copy link
Collaborator Author

There's some abstraction, but eventually you learn that internals of Git are actually rather simple, or at least, you learn about how the abstractions work and that makes them less surprising to use.

Can I at least assure you that adding a submodule is reversible? The tracked files of submodules are only the .gitmodules file and the "abstract" file which stores the commit hash the submodule is checked out at which becomes the folder for that sub-repo.

I also really want to know what you were doing with submodules that was causing issues. I've done a lot with Git to put myself into unfixable situations, which were no longer unfixable once I became more experienced. What was your goal when you were using submodules?

@rmtew
Copy link
Owner

rmtew commented Aug 27, 2024

What is the benefit in using submodules? Surely not using them wouldn't take that much time or add that much work.

@HexDecimal
Copy link
Collaborator Author

Good locality, standard, easy to manipulate. Even if you haven't personally shared that experience I find them convenient to work with, which is why I keep asking for more information about your previous issues working with them since even I had issues of my own when I first started using submodules. I want to know because many solutions to a lot of Git issues are both simple and obscure.

Not using submodules means spreading the sub-repo info throughout the repository and adding friction to manipulating the target commit and local testing of alternative Vcpkg ports. I don't think is this worth avoiding submodules for.

@rmtew rmtew force-pushed the master branch 2 times, most recently from 66243c5 to ab1053f Compare June 28, 2025 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants