diff --git a/CMakeLists.txt b/CMakeLists.txt index cd830a052a..57400e362f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) -add_compile_definitions(MELONDS_VERSION="${melonDS_VERSION}") - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3dfd3b0d53..a34cc9683c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -52,7 +52,6 @@ add_library(core STATIC types.h Utils.cpp Utils.h - version.h Wifi.cpp WifiAP.cpp @@ -123,6 +122,12 @@ if (ENABLE_JIT) endif() endif() +set(MELONDS_VERSION_SUFFIX "$ENV{MELONDS_VERSION_SUFFIX}" CACHE STRING "Suffix to add to displayed melonDS version") + +configure_file("${CMAKE_CURRENT_SOURCE_DIR}/version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/version.h") +target_sources(core PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/version.h") +target_include_directories(core PUBLIC "${CMAKE_CURRENT_BINARY_DIR}") + add_subdirectory(teakra EXCLUDE_FROM_ALL) # Workaround for building teakra with -O0 on Windows either failing or hanging forever target_compile_options(teakra PRIVATE "$<$:-Og>") diff --git a/src/NDS.cpp b/src/NDS.cpp index 68227ea510..94a240290a 100644 --- a/src/NDS.cpp +++ b/src/NDS.cpp @@ -35,6 +35,7 @@ #include "Platform.h" #include "FreeBIOS.h" #include "Args.h" +#include "version.h" #include "DSi.h" #include "DSi_SPI_TSC.h" @@ -2839,7 +2840,7 @@ u8 NDS::ARM9IORead8(u32 addr) if(addr >= 0x04FFFA00 && addr < 0x04FFFA10) { // FIX: GBATek says this should be padded with spaces - static char const emuID[16] = "melonDS " MELONDS_VERSION; + static char const emuID[16] = "melonDS " MELONDS_VERSION_BASE; auto idx = addr - 0x04FFFA00; return (u8)(emuID[idx]); } diff --git a/src/frontend/qt_sdl/Window.cpp b/src/frontend/qt_sdl/Window.cpp index 23ba784e3c..a99546bd9f 100644 --- a/src/frontend/qt_sdl/Window.cpp +++ b/src/frontend/qt_sdl/Window.cpp @@ -72,6 +72,7 @@ #include "Platform.h" #include "Config.h" +#include "version.h" #include "Savestate.h" #include "LocalMP.h" diff --git a/src/version.h b/src/version.h.in similarity index 75% rename from src/version.h rename to src/version.h.in index 131c610d28..a3db45b322 100644 --- a/src/version.h +++ b/src/version.h.in @@ -19,7 +19,11 @@ #ifndef VERSION_H #define VERSION_H -#define MELONDS_URL "https://melonds.kuribo64.net/" +#define MELONDS_URL "${melonDS_HOMEPAGE_URL}" + +#define MELONDS_VERSION_BASE "${melonDS_VERSION}" +#define MELONDS_VERSION_SUFFIX "${MELONDS_VERSION_SUFFIX}" +#define MELONDS_VERSION MELONDS_VERSION_BASE MELONDS_VERSION_SUFFIX #endif // VERSION_H