Author's note:
- To simplify the build process,
vcpkg
was used. These steps worked for me, and this documentation should be updated as new/updated methods are discovered/refined. - Feel free to use a different installation path for
kq-fork
andvcpkg
to fit your environment. - I chose to use Git Bash, which uses Linux notation for paths (using
/
forward slashes instead of\
backslashes between directories) and other Linux/Unix-centric features.
-
cmake
will need to be in your PATH.-
My version was older than the CMakeLists.txt file required, so I had to install an updated version to
C:\Program Files\CMake
and add itsbin
directory to my PATH:~$ # Change 'to_add' below as necessary; this special notation only appends to PATH if not already there: ~$ to_add="/c/Program Files/CMake/bin" ; [[ :"$PATH": =~ :"$to_add": ]] || PATH="$PATH:$to_add"
-
-
Clone the vcpkg repo and install it according to its Getting Started page.
- The steps below followed the instructions for using vcpkg with Visual Studio.
- I installed mine to
/c/Users/user/soure/repos/vcpkg/
:~$ mkdir -p "$HOME/source/repos/" ~$ cd "$HOME/source/repos/" ~/source/repos$ git clone https://github.com/Microsoft/vcpkg.git ~/source/repos$ to_add="$HOME/source/repos/vcpkg" ; [[ :"$PATH": =~ :"$to_add": ]] || PATH="$PATH:$to_add" ~/source/repos$ ./vcpkg/bootstrap-vcpkg.bat -disableMetrics # the '-disableMetrics' flag is optional
-
Install the necessary libraries:
libpng
,lua
,sdl2-mixer
,sdl2
,tinyxml2
,zlib
:-
The
sdl2-mixer
package should include support for, at a minimum,libmodplug
. -
I'm on 64-bit Windows, so I used the
--triplet x64-windows
flag; adjust as needed.$ vcpkg install --triplet x64-windows libpng lua sdl2 sdl2-mixer[libmodplug,nativemidi] tinyxml2 zlib $ vcpkg integrate install # Without this step, I get "not found" errors for the SDL2, Lua, etc. packages within Visual Studio later
-
-
Clone
kq-fork
.$ git clone https://github.com/OnlineCop/kq-fork
-
Within the
kq-fork/
directory, usecmake
to generate the files under thebuild/
directory:$ cd kq-fork $ cmake -S . -B build -DCMAKE_TOOLCHAIN_FILE="../vcpkg/scripts/buildsystems/vcpkg.cmake" # or the path where vcpkg installed its 'vcpkg.cmake' file
- NOTE: Visual Studio uses the CMake-generated files from
kq-fork/build/
to generate its solution, but it builds into thekq-fork/out/
directory. - If
CMakeLists.txt
has theKQ_DATADIR
value set to"."
(current directory), the project will build but will halt during execution because it can't locate the resources relative to thekq-fork.exe
executable. - During development, I changed this value to the project root so VS2022 could find its resources:
#set(KQ_DATADIR "." CACHE STRING "Where the data dirs are going to be installed") set(KQ_DATADIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE PATH "Where the data dirs are going to be installed")
- NOTE: Visual Studio uses the CMake-generated files from
-
You should now be able to open Visual Studio and open the entire
kq-fork
directory.- I opened VS2022 to
C:\Users\kqlives\source\repos\kq-fork
.
- I opened VS2022 to
-
At the top of Visual Studio is a dropdown that initially says "Select Startup Item..." Selecting
kq-fork.exe
within the dropdown allows you to build and debug the executable.
- If Visual Studio complains about packages that you installed using
vcpkg
not being found, run its integration script:vcpkg.exe integrate install
to make them discoverable by IntelliSense.