Fix building ultramodern (#2)

* gitignore

* Add rt64 paths to ultramodern cmake

* It builds

* 4 spaces

* Commented out warnings

* Remove Xrandr

* what

* Remove sdl2 dll copy
This commit is contained in:
Anghelo Carvajal 2024-05-20 12:38:13 -04:00 committed by GitHub
parent 7f55d26948
commit 2430c82cbd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 107 additions and 16 deletions

9
.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
build/
temp/
.vscode/
*.o
*.elf
*.z64
*.n64
*.v64

View file

@ -1,8 +1,9 @@
cmake_minimum_required(VERSION 3.20)
project(N64ModernRuntime)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_subdirectory(librecomp)
add_subdirectory(ultramodern)
add_subdirectory(librecomp)

View file

@ -1,6 +1,6 @@
# N64 Modern Runtime
> Note
> Note
This repo is a WIP as files are moved out of Zelda64Recomp and genericized. It cannot be used directly in its current state.
This repo contains two libraries: Ultramodern and Librecomp.

View file

@ -1,18 +1,83 @@
cmake_minimum_required(VERSION 3.20)
project(ultramodern)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_EXTENSIONS OFF)
# Warnings
# TODO: uncoment this when we fix the warnings
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
if(UNIX AND NOT APPLE)
set(LINUX TRUE)
endif()
add_library(ultramodern STATIC
"${CMAKE_CURRENT_SOURCE_DIR}/src/audio.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/events.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/mesgqueue.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/misc_ultra.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rt64_layer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/scheduling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/task_win32.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/threadqueue.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/threads.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/timer.cpp")
"${CMAKE_CURRENT_SOURCE_DIR}/src/audio.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/events.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/mesgqueue.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/misc_ultra.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/rt64_layer.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/scheduling.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/task_win32.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/threadqueue.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/threads.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/timer.cpp"
)
target_include_directories(ultramodern PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/include"
"${CMAKE_SOURCE_DIR}/thirdparty/concurrentqueue")
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/include/ultramodern" # FIXME: remove redundant path
"${CMAKE_SOURCE_DIR}/thirdparty/concurrentqueue"
)
# TODO: remove when rt64 is no longer a hard dependency
target_include_directories(ultramodern PRIVATE
"${CMAKE_SOURCE_DIR}/rt64/src"
"${CMAKE_SOURCE_DIR}/rt64/src/contrib"
"${CMAKE_SOURCE_DIR}/rt64/src/contrib/hlslpp/include"
"${CMAKE_SOURCE_DIR}/rt64/src/contrib/dxc/inc"
"${CMAKE_SOURCE_DIR}/rt64/src/rhi"
"${CMAKE_SOURCE_DIR}/rt64/src/render"
"${CMAKE_SOURCE_DIR}/rt64/src/contrib/nativefiledialog-extended/src/include"
)
# TODO: remove when librecomp is untangled from ultramodern
target_include_directories(ultramodern PRIVATE
"${CMAKE_SOURCE_DIR}/librecomp/include"
)
if (WIN32)
include(FetchContent)
# Fetch SDL2 on windows
FetchContent_Declare(
sdl2
URL https://github.com/libsdl-org/SDL/releases/download/release-2.28.5/SDL2-devel-2.28.5-VC.zip
URL_HASH MD5=d8173db078e54040c666f411c5a6afff
)
FetchContent_MakeAvailable(sdl2)
target_include_directories(ultramodern PRIVATE
${sdl2_SOURCE_DIR}/include
)
target_link_directories(ultramodern PRIVATE
${sdl2_SOURCE_DIR}/lib/x64
)
endif()
if (LINUX)
find_package(SDL2 REQUIRED)
find_package(X11 REQUIRED)
message(STATUS "SDL2_FOUND = ${SDL2_FOUND}")
message(STATUS "SDL2_INCLUDE_DIRS = ${SDL2_INCLUDE_DIRS}")
target_include_directories(ultramodern PRIVATE ${SDL2_INCLUDE_DIRS})
message(STATUS "X11_FOUND = ${X11_FOUND}")
message(STATUS "X11_INCLUDE_DIR = ${X11_INCLUDE_DIR}")
message(STATUS "X11_LIBRARIES = ${X11_LIBRARIES}")
target_include_directories(ultramodern PRIVATE ${X11_INCLUDE_DIR})
target_link_libraries(ultramodern PRIVATE ${X11_LIBRARIES})
endif()

View file

@ -0,0 +1,12 @@
#ifndef __ULTRAMODERN_RECOMP_UI__
#define __ULTRAMODERN_RECOMP_UI__
namespace recomp {
// Currently those functions are expected to be provided by the consumer of this library.
// TODO: Change these functions to a callback registering system
void destroy_ui();
void update_supported_options();
}
#endif

View file

@ -17,7 +17,7 @@
#include "rt64_layer.h"
#include "recomp.h"
#include "recomp_game.h"
#include "recomp_ui.h"
#include "ultramodern/recomp_ui.h"
#include "recomp_input.h"
#include "rsp.h"
@ -325,7 +325,7 @@ void gfx_thread_func(uint8_t* rdram, moodycamel::LightweightSemaphore* thread_re
// TODO move recomp code out of ultramodern.
recomp::update_supported_options();
rsp_constants_init();
// Notify the caller thread that this thread is ready.

View file

@ -110,6 +110,10 @@ ultramodern::RT64SetupResult map_setup_result(RT64::Application::SetupResult rt6
case RT64::Application::SetupResult::GraphicsDeviceNotFound:
return ultramodern::RT64SetupResult::GraphicsDeviceNotFound;
}
fprintf(stderr, "Unhandled `RT64::Application::SetupResult` ?\n");
assert(false);
std::exit(EXIT_FAILURE);
}
ultramodern::RT64Context::RT64Context(uint8_t* rdram, ultramodern::WindowHandle window_handle, bool debug) {