Conversation
Also remove _CRT_SECURE_NO_WARNINGS, fix related & 64-bit warnings
2862e57 to
4b8e448
Compare
Modules really aren't in a great place still. For cross-platform support, the simplest thing is to just not bother using modules. They *can* work but only in specific situations, and tooling is far too finicky to bother with.
Fork djb2 to Open-KO/djb2. Add automatic `git submodule sync` to `build_dependency.cmd` to ensure the URL gets updated.
We're not using modules anymore for better compatibility.
We're not using modules anymore for better compatibility.
Improve build and debugger experience in VS.
* Clarify that we're not building, we're configuring at this stage * Compile spdlog for C++23
This ensures projects that I can't explicitly target (boost, ftxui) use the correct C++ standard as well.
MSVC allows this, but not all compilers do, so we should avoid it.
This is useless. It looked like it was causing the random number generator to not start on something consistent, but it's called before srand() and logic which does just this already. So it's entirely useless and we can get rid of it.
As with the others, this shouldn't initialize anything unless we explicitly value-initialize it. Then it should be zeroed appropriately.
|
As of right now, this PR feels pretty complete. With modern clang & gcc support, our servers now support running on operating systems other than Windows (tested specifically on Linux - Ubuntu & Arch distros, but it should hopefully support things like macOS out of the box as well). CMake makes it fairly straightforward to build; we don't really do anything non-standard here, so it's just your basic 2 step configure & build process. As far as requirements goes, there are only 2 external dependencies:
All other dependencies (asio, boost, ftxui, etc, etc) are fetched automatically through CMake & git. We don't use the repo's submodules in case the user downloaded the source tree directly. Of course, this purely supports the server projects only. A lot more work needs to be done in future for native cross-platform support of the client (... not to mention the tools). As such, the preferred means of development is still through the regular VS project files, where you can build the client & tools as well. However, it does make things a bit easier for devs who aren't using Windows as their main OS. I've gone back over the PR, fixed/tweaked anything that looked out of place, so this should be tested & reviewed and then I'm happy to merge it (some repos will need to have their branches merged but for building via CMake it won't be an issue since it's all tied via tags - that can be done after this has been merged). |
Should effectively be using null not an empty string. The empty string behaves in VS, but in CLion it still creates a "folder" for it, which is not ideal.
strcpy_safe()to replacestrcpy_s()usage which mostly mimicsstrlcpy-- it's just a little bit nicer, supportingstd::string_view.memcpy(this, ...),memset(this, ...)- replaced instances these in the client as well for future-proofing.#pragma once; presumably the header being included in different ways. Better to just be safe than sorry and use both.field1,field2,field3&field[3]). It's not technically allowed by the standard for non-trivial types (std::optional<>), gcc is the only one that's strict about this.ByteBufferto - firstly - build in gcc/clang and additionally just shift implementation (and template) code into a source file to improve compilation times.sync-submodulesproject to our regular Visual Studio solutions to ensure submodules are updated correctly on rename/URL change (as was the case with db-modules etc.).Prerequisites
Ensure Git is installed and git.exe is in your system path. If you can open up a console and type
git --versionsuccessfully, then it's installed and working.ODBC headers need to be installed. For this, nanodbc requires either unixODBC or iODBC (the latter is untested).
On Debian-based distros (like Ubuntu, Linux Mint), you can obtain unixODBC like:
For connecting to ODBC, you can grab Microsoft's ODBC drivers - https://gist.github.com/hunzo/9c9ce328abc376db1b97a93d1ab38a07
You'll need a MSSQL instance as well; there's a Docker container for it under
docker/.Build steps
It's basic CMake, there's nothing really nonstandard about it.
Generate project files
From the repo's root directory, run the following to configure it:
Linux:
Expected build types are Debug, Release, RelWithDebInfo, MinSizeRel (standard CMake build types).
Note that it defaults to Debug.
On Windows you don't need to supply a build type as the solution generated will be for all types (on your default architecture, which is probably x64 -- which you can override with
-A Win32):That will configure it, generating all project files it needs for you to build it.
Build project
If you're on Windows, you can now just load up
build/OpenKO.slnxin Visual Studio and work with that as-is.Alternatively, or if you're on Linux, you can just continue to build it with CMake directly:
~/KnightOnline$ cmake --build buildOn Windows you should supply the exact build config you want to compile (so assuming your OS architecture is x64 and you didn't override it at config time, this will compile the "Debug x64" build).
~/KnightOnline$ cmake --build build --config DebugIt should build and output its binaries to
build/bin.Ensure you run the server with its working directory set to the program's directory or things may not behave correctly; it'll still (for now, at least) look for the MAP and QUESTS directories a directory above it (so
build/bin/Release/AIServer.exelooks for MAP atbuild/bin/MAP).If you're running it from VS, this will be the debugger default, so it should just run correctly.
These directories (MAP, QUESTS) are also copied into
build/bin/fromServer/bin/. Be sure that if you're changing them, you change the original - when you build the server they will get copied back over the top.Resolves #644