-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Mentioning Linux/gcc because this seemed to work just fine on Windows/MSVC last time I checked. I could be wrong though
Fedora - gcc version 15.2.1 20250808 (Red Hat 15.2.1-1) (GCC)
friend inline Matrix operator*(Matrix &lhs, Matrix &rhs)
{
Matrix dest;
Matrix::Multiply(&dest, &lhs, &rhs);
return dest;
}error: cannot bind non-const lvalue reference of type ‘RSDK::Matrix&’ to an rvalue of type ‘RSDK::Matrix’
cmake_minimum_required(VERSION 3.20)
project(RSSav2)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")
endif ()
set(GAME_NAME "Source" CACHE STRING "The game directory to look into")
set(GAME_OUTPUT_NAME "Game" CACHE STRING "The name of the built library")
add_compile_definitions(GAME_CUSTOMLINKLOGIC)
option(WITH_RSDK "Whether or not to build with RSDKv5. Defaults to true" OFF) #ON)
option(GAME_STATIC "Whether or not to build the game as a static library." $<BOOL:$<IF:WITH_RSDK,ON,OFF>>)
if (NOT DEFINED GAME_STATIC)
if (WIN32)
set(GAME_STATIC OFF)
elseif (UNIX)
set(GAME_STATIC OFF)
else ()
set(GAME_STATIC ON)
endif ()
endif ()
option(ORIGINS_FIRST_RELEASE "" OFF)
if (ORIGINS_FIRST_RELEASE)
set(ORIGINS_PREPLUS ON)
else ()
option(ORIGINS_PREPLUS "" OFF)
endif ()
if (NOT ORIGINS_PREPLUS)
set(GAME_VERSION 6 CACHE STRING "The game version to use. Defaults to 6 == Last Steam release")
else ()
set(GAME_VERSION 3 CACHE STRING "The game version to use. Defaults to 3 == Last pre-plus release")
endif ()
find_path(GAMEAPI
NAMES
C
CPP
HINTS
${CMAKE_CURRENT_SOURCE_DIR}/dependencies
${CMAKE_SOURCE_DIR}/dependencies
PATHS
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/..
PATH_SUFFIXES
GameAPI
RSDKv5-GameAPI
NO_DEFAULT_PATH
NO_CMAKE_FIND_ROOT_PATH
)
if (GAMEAPI)
message(STATUS "Found GameAPI for ${GAME_NAME}: ${GAMEAPI}")
else ()
message(FATAL_ERROR "GameAPI not found for ${GAME_NAME}. Clone it in the dependencies.")
endif ()
option(GAME_INCLUDE_EDITOR "Whether or not to include editor functions. Defaults to true" ON)
option(GAME_INCREMENTAL_BUILD "Whether or not to build all objects separately (for quicker dev-->build iterations). Defaults to false." OFF)
if (GAME_INCREMENTAL_BUILD)
include(${GAME_NAME}/Objects/Objects.cmake)
set(GAME_SOURCES
${GAMEAPI}/CPP/GameAPI/Game.cpp
${GAME_NAME}/Game.cpp
${GENERATED_SOURCES}
)
else ()
set(GAME_SOURCES
${GAMEAPI}/CPP/GameAPI/Game.cpp
${GAME_NAME}/RSSav2.cxx
${GAME_NAME}/Objects/All.cpp
)
endif ()
if (GAME_STATIC)
add_library(${GAME_NAME} STATIC ${GAME_SOURCES})
else ()
add_library(${GAME_NAME} SHARED ${GAME_SOURCES})
endif ()
target_include_directories(${GAME_NAME} PRIVATE
${GAMEAPI}/CPP/
${GAME_NAME}/
${GAME_NAME}/Objects/
)
if (WIN32)
target_compile_definitions(${GAME_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS)
endif ()
if (APPLE)
set_target_properties(${GAME_NAME} PROPERTIES PREFIX "")
endif ()
set_target_properties(${GAME_NAME} PROPERTIES OUTPUT_NAME ${GAME_OUTPUT_NAME})
if (WITH_RSDK)
set(RSDK_PATH dependencies/RSDKv5 CACHE STRING "The path to look for RSDKv5 if using WITH_RSDK.")
add_subdirectory(${RSDK_PATH})
if (GAME_STATIC)
target_include_directories(RetroEngine PRIVATE ${GAME_NAME}/)
target_link_libraries(RetroEngine ${GAME_NAME})
endif ()
else ()
set(RETRO_REVISION 3 CACHE STRING "What revision to compile for. Defaults to v5U = 3")
option(RETRO_MOD_LOADER "Enables or disables the mod loader." ON)
set(RETRO_MOD_LOADER_VER 2 CACHE STRING "Sets the mod loader version. Defaults to latest")
target_compile_definitions(${GAME_NAME} PRIVATE
RETRO_REVISION=${RETRO_REVISION}
RETRO_USE_MOD_LOADER=$<BOOL:${RETRO_MOD_LOADER}>
RETRO_MOD_LOADER_VER=${RETRO_MOD_LOADER_VER}
GAME_INCLUDE_EDITOR=$<BOOL:${GAME_INCLUDE_EDITOR}>
ORIGINS_PREPLUS=$<BOOL:${ORIGINS_PREPLUS}>
ORIGINS_FIRST_RELEASE=$<BOOL:${ORIGINS_FIRST_RELEASE}>
GAME_VERSION=${GAME_VERSION}
)
endif ()
if (MSVC)
target_link_options(${GAME_NAME} PRIVATE /OPT:NOICF)
endif ()Metadata
Metadata
Assignees
Labels
No labels