mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-28 09:13:10 -04:00
767ba3bb14
* launch.json cwd * bodge to load gci for testing * stub card stat * gameplay bodges * viewport, ub fixes * add release with debug info cmake variant * be fixes, sound stub * viewport h * d_msg_flow BE * be fopAcM_createItemFromEnemyID * update launch configuration to use iso * more audio stubs * Attempt to set viewport and get messages for brightness check * skip opening scene again, fixed JMessage::TResourceContainer::TCResource::Do_destroy * add guards for viewport changes * moar endian swapping to get Link sitting in PROC_OPENING_SCENE and for dialogues * BE d_msg_class i_data * stub bgm start * fix div by 0 error (for now) * TEMP_BROKEN in d_menu_ring * REQUIRES_GX_LINES * properly stub renderingAmap::draw with REQUIRES_GX_LINES * better stubbing outside of stubs * fix event data getting swapped multiple times * evil draw vp fix * Stub log imgui This redirects all spammy logs to an imgui window that is cleared per frame. This fixes the serious performance dip of the logging, and makes the regular log readable. * Oops move those optimization changes I accidentally committed behind a flag DUSK_SELECTED_OPT * gx_line macro in map * fix audio stubbing * switch to CARD API aurora impl * remove kabufuda from link libs * refactor imgui stuff and add input viewer * merge stub log with refactor * accidentally committed a metaforce header shh * basic map loader * ImGuiConsole: Add missing <thread> include * you may now play as luigi (you may now load stages with bridges) * bloom fix * bloom leak fix * cloud shadow fix * add soft reset button to imgui menu * if it broke dont not fix it * i swear i committed this * BE swap indMtx in JPAResource::setPTev * wnark ct fix * frsqrte implementation from kinoko * Fix Clang compile error in JAISeq::prepare_getSeqData_ * Add endian conversions to dMsgFlow_c::getInitNodeIndex This fixes a freeze when Fado tries to stop you from leaving the starting area. * Add RAII GXTexObj wrapper; fix almost all leaks * Update aurora for indirect texturing * Update aurora for CARD fix * Fix Clang build * More d_msg_flow endian fixes Fixes softlock when trying to talk to Fado and possibly other NPCs. * no frame limiter * get pause menu working * proper frame limiting * particle pointer size fix * improve map loader a bit --------- Co-authored-by: Jasper St. Pierre <jstpierre@mecheye.net> Co-authored-by: TakaRikka <takarikka@outlook.com> Co-authored-by: CraftyBoss <talibabdulmaalik@gmail.com> Co-authored-by: Luke Street <luke@street.dev> Co-authored-by: Lurs <2795933+Lurs@users.noreply.github.com> Co-authored-by: PJB3005 <pieterjan.briers+git@gmail.com> Co-authored-by: tgsm <doodrabbit@hotmail.com> Co-authored-by: Max Roncace <me@caseif.net> Co-authored-by: Phillip Stephens <antidote.crk@gmail.com>
124 lines
5.0 KiB
CMake
124 lines
5.0 KiB
CMake
cmake_minimum_required(VERSION 3.13)
|
|
if (APPLE)
|
|
project(dusk LANGUAGES C CXX OBJC OBJCXX)
|
|
else ()
|
|
project(dusk LANGUAGES C CXX)
|
|
endif ()
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
set(DAWN_USE_WAYLAND ON CACHE BOOL "Enable support for Wayland surface" FORCE)
|
|
endif ()
|
|
set(AURORA_ENABLE_DVD ON CACHE BOOL "Enable DVD API support" FORCE)
|
|
set(AURORA_ENABLE_CARD ON CACHE BOOL "Enable CARD API support" FORCE)
|
|
add_subdirectory(extern/aurora EXCLUDE_FROM_ALL)
|
|
|
|
option(DUSK_BUILD_WARNINGS "If off, compiler warnings will be suppressed")
|
|
option(DUSK_SELECTED_OPT "If on, selected parts of the project will be compiled with optimizations on Debug, intending to make the game run at 30 FPS. Note for MSVC: you will need to remove '/RTC1' from your debug flags in CMake.")
|
|
|
|
if (CMAKE_SYSTEM_NAME STREQUAL Linux)
|
|
# -Wno-multichar: Multi-character constants ('ABCD') are implementation-defined but all compilers
|
|
# (CW, GCC, Clang, MSVC) encode them identically in big-endian order.
|
|
# For >4-char literals (which GCC/Clang truncate to int), use the MULTI_CHAR() macro.
|
|
# -Wwrite-strings: Game code relies on implicit const char* -> char* conversions
|
|
# -Wdeprecated-declarations: JSystem uses std::iterator, deprecated in C++17
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar -Wno-write-strings")
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-multichar -Wno-write-strings -Wno-trigraphs -Wno-deprecated-declarations")
|
|
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
|
set(CMAKE_BUILD_RPATH "$ORIGIN")
|
|
elseif (APPLE)
|
|
add_compile_options(-Wno-declaration-after-statement -Wno-non-pod-varargs)
|
|
set(CMAKE_INSTALL_RPATH "$ORIGIN")
|
|
set(CMAKE_BUILD_RPATH "$ORIGIN")
|
|
elseif (MSVC)
|
|
add_compile_options(/bigobj)
|
|
add_compile_options(/Zc:strictStrings-)
|
|
add_compile_options(/MP)
|
|
if (NOT DUSK_BUILD_WARNINGS)
|
|
add_compile_options(/W0)
|
|
else ()
|
|
# Disable warnings
|
|
add_compile_options(/wd4068) # unknown pragma
|
|
add_compile_options(/wd4291) # no matching delete operator, leaks if exception thrown
|
|
# Only show warnings once
|
|
add_compile_options(/wo4244) # narrowing conversion, possible data loss
|
|
endif ()
|
|
add_compile_options(/utf-8)
|
|
endif ()
|
|
|
|
|
|
include(FetchContent)
|
|
|
|
message(STATUS "dusk: Fetching cxxopts")
|
|
FetchContent_Declare(
|
|
cxxopts
|
|
GIT_REPOSITORY https://github.com/jarro2783/cxxopts.git
|
|
GIT_TAG v3.3.1
|
|
)
|
|
|
|
FetchContent_MakeAvailable(cxxopts)
|
|
|
|
|
|
include(files.cmake)
|
|
|
|
# TODO: version handling for res includes
|
|
|
|
set(DUSK_GAME_NAME "GZ2E")
|
|
set(DUSK_GAME_VERSION "01")
|
|
|
|
set(DUSK_TP_VERSION ${DUSK_GAME_NAME}${DUSK_GAME_VERSION})
|
|
|
|
message(STATUS "dusk: Game Name: ${DUSK_GAME_NAME}")
|
|
message(STATUS "dusk: Game Version: ${DUSK_GAME_VERSION}")
|
|
message(STATUS "dusk: TP Version: ${DUSK_TP_VERSION}")
|
|
|
|
source_group("dolzel" FILES ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${JSYSTEM_FILES} ${JSYSTEM_DEBUG_FILES} ${REL_FILES})
|
|
source_group("dusk" FILES ${DUSK_FILES})
|
|
|
|
# game_debug is for game code files that we know work when compiled with DEBUG=1
|
|
# Of course, if building a release build, this distinction is irrelevant
|
|
add_library(game_debug STATIC ${JSYSTEM_DEBUG_FILES} ${SSYSTEM_FILES})
|
|
target_compile_definitions(game_debug PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 $<$<CONFIG:Debug>:DEBUG=1>)
|
|
|
|
# Make these properties PUBLIC so that the regular game target also sees them.
|
|
target_include_directories(game_debug PUBLIC
|
|
include
|
|
src
|
|
assets/${DUSK_TP_VERSION}
|
|
libs/JSystem/include
|
|
extern/aurora/include/dolphin
|
|
extern
|
|
${CMAKE_SOURCE_DIR}/build/${DUSK_TP_VERSION}/include
|
|
build/${DUSK_TP_VERSION}/include)
|
|
target_link_libraries(game_debug PUBLIC aurora::core aurora::gx aurora::gd aurora::si aurora::vi aurora::pad aurora::mtx aurora::os aurora::dvd aurora::card)
|
|
|
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
|
add_library(game SHARED ${DOLZEL_FILES} ${Z2AUDIOLIB_FILES} ${SSYSTEM_FILES} ${JSYSTEM_FILES} ${REL_FILES} ${DUSK_FILES} ${DOLPHIN_FILES}
|
|
src/dusk/imgui/ImGuiStubLog.cpp)
|
|
|
|
target_link_libraries(game PRIVATE game_debug cxxopts::cxxopts)
|
|
target_compile_definitions(game PRIVATE TARGET_PC AVOID_UB=1 VERSION=0 NDEBUG=1 NDEBUG_DEFINED=1 DEBUG_DEFINED=0
|
|
DUSK_TP_VERSION="${DUSK_TP_VERSION}" DUSK_GAME_NAME="${DUSK_GAME_NAME}" DUSK_GAME_VERSION="${DUSK_GAME_VERSION}")
|
|
add_executable(dusk src/dusk/main.cpp)
|
|
target_compile_definitions(dusk PRIVATE TARGET_PC AVOID_UB=1 VERSION=0)
|
|
target_include_directories(dusk PRIVATE include)
|
|
target_link_libraries(dusk PRIVATE game aurora::main)
|
|
|
|
include(extern/aurora/cmake/AuroraCopyRuntimeDLLs.cmake)
|
|
aurora_copy_runtime_dlls(dusk game)
|
|
|
|
if (DUSK_SELECTED_OPT)
|
|
if (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
|
|
set(_opt_flags /O2 /Ob2)
|
|
elseif (CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU")
|
|
set(_opt_flags -O2)
|
|
endif ()
|
|
|
|
target_compile_options(xxhash PRIVATE ${_opt_flags})
|
|
target_compile_options(aurora_gx PRIVATE ${_opt_flags})
|
|
endif ()
|