Skip to content

Build ‐ Windows with MSVS ‐ Additional Notes

Parracodea edited this page Mar 30, 2024 · 2 revisions

⚠️ This is a branch of the original "Build with Visual Studio" page with some extra notes, however these steps have not been fully tested.


⚠️ This guide assume some knowledge of Visual Studio and Git under windows.

Prerequisites

Configuring (once)

Setup.

Clone both daid/EmptyEpsilon and daid/SeriousProton.

Extract the SDL2 archive somewhere.

Set up Visual Studio

Install Visual Studio. When prompted, select and install Desktop development with C++

If CMAKE could not find any instance of Visual Studio

If you already have Visual Studio installed, open Visual Studio and go to: Tools > Get Tools and Features > Workloads tab > Desktop & Mobile section > Select Desktop development with C++. In the bottom right, click Modify, and Visual Studio will begin installing.

Set up CMake

Create a sdl2-config.cmake at the root of where you extracted the SDL2 archive. Add the following contents:

# Tweak these to fit your need.
set(_SDL2_version 2.0.16)
# Assumes the sdl2-config.cmake is located at the root
# of where the development libraries were extracted:
# - <root>/
# | - sdl2-config.cmake
# | - SDL2-2.0.16/
#   | - (include, docs, lib...)
#    
set(_SDL2_prefix "${CMAKE_CURRENT_LIST_DIR}/SDL2-${_SDL2_version}")

set(flavor x86)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
    set(flavor x64)
endif()

add_library(SDL2::SDL2main STATIC IMPORTED)
set_target_properties(SDL2::SDL2main PROPERTIES
    IMPORTED_LOCATION "${_SDL2_prefix}/lib/${flavor}/SDL2main.lib"
)
add_library(SDL2::SDL2 SHARED IMPORTED)
set_target_properties(SDL2::SDL2 PROPERTIES
    IMPORTED_LOCATION "${_SDL2_prefix}/lib/${flavor}/SDL2.dll"
    IMPORTED_IMPLIB "${_SDL2_prefix}/lib/${flavor}/SDL2.lib"
    INTERFACE_INCLUDE_DIRECTORIES "${_SDL2_prefix}/include"
)
target_link_libraries(SDL2::SDL2 INTERFACE SDL2::SDL2main)
  1. Run the CMake GUI (cmake-gui)
  2. Click Browse source... and browse to your cloned daid/EmptyEpsilon
  3. click Browse build... and select an appropriate location.
  4. Click Add Entry...:
    • Name: SERIOUS_PROTON_DIR
    • Type: PATH
    • Value: Browse to your cloned daid/SeriousProton
  5. Click Add Entry... (again):
    • Name: SDL2_DIR
    • Type: PATH
    • Value: Browse to where you created the sdl2-config.cmakefile.
  6. Click Configure
    • Select your appropriate project versions and compiler arch. The defaults are a good choice.
    • If you get an error similar to CMake Error at CMakeLists.txt ... could not find any instance of Visual Studio., ensure that you have the correct version of Visual Studio selected, and you installed Visual Studio's Desktop development with C++. See the section above for more details.
  7. Click Generate
  8. Open Visual Studio via one of the following methods:
    • Click Open Project
    • Browse to the build directory you chose and open the EmptyEpsilon.sln.
  9. Close CMake GUI

Building

In the Solution Explorer (right), right-click EmptyEpsilon and set it as the "Start Up Project"/

As simple as building the project under Visual Studio, using build solution or right clicking the project.

Updates should get auto-picked up!

Clone this wiki locally