Skip to content

Build ‐ Windows with MSVC

Chris edited this page May 29, 2024 · 5 revisions

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

⚠️ MSVC is not an build method "officially" supported by the project, these instructions are community driven. Patches that improve MSVC support are welcome, but MSVC builds are not guaranteed to work.

Some additional notes are available in subpage, however, they have not been fully tested.

Prerequisites

Configuring (once)

Setup.

Clone both daid/EmptyEpsilon and daid/SeriousProton. Extract the SDL2 archive somewhere.

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

# 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 libraires 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.
    • You may get "Permission Denied" errors. If this happens, try running CMake as administrator.
  7. Click Generate
  8. Click Open Project or browse to the build directory you chose and open the sln from there.

Building

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