diff --git a/.gitignore b/.gitignore
index a38b5a38..10cbaf5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ obj
*.o
melon_grc.c
melon_grc.h
+melon.rc
cmake-build
cmake-build-debug
.idea
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 59a3f2d0..467e7d6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -16,6 +16,21 @@ set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
+set(MELONDS_VERSION "0.9.1")
+add_compile_definitions(MELONDS_VERSION="${MELONDS_VERSION}")
+string(REPLACE "." ";" VERSION_LIST ${MELONDS_VERSION})
+# For the melon.rc file used on Windows
+list(GET VERSION_LIST 0 MELONDS_VERSION_MAJOR)
+list(GET VERSION_LIST 1 MELONDS_VERSION_MINOR)
+# Check if melonDS version is three digits or two digits
+list(LENGTH VERSION_LIST MELONDS_VER_LEN)
+if (${MELONDS_VER_LEN} GREATER 2)
+ list(GET VERSION_LIST 2 MELONDS_VERSION_PATCH)
+else()
+ set(MELONDS_VERSION_PATCH 0)
+endif()
+
+
check_library_exists(m pow "" LIBM)
if(LIBM)
link_libraries(m)
diff --git a/melonDS.icns b/melon.icns
similarity index 100%
rename from melonDS.icns
rename to melon.icns
diff --git a/melonDS.plist b/melon.plist.in
similarity index 90%
rename from melonDS.plist
rename to melon.plist.in
index 8df5bf43..1e05a3a8 100644
--- a/melonDS.plist
+++ b/melon.plist.in
@@ -13,9 +13,9 @@
CFBundlePackageType
APPL
CFBundleVersion
- 0.9.1
+ ${MELONDS_VERSION}
CFBundleShortVersionString
- 0.9.1
+ ${MELONDS_VERSION}
NSHumanReadableCopyright
Licensed under GPLv3
NSHighResolutionCapable
diff --git a/melon.rc b/melon.rc.in
similarity index 74%
rename from melon.rc
rename to melon.rc.in
index 23e3df70..717f304a 100644
--- a/melon.rc
+++ b/melon.rc.in
@@ -6,8 +6,8 @@
//include version information in .exe, modify these values to match your needs
1 VERSIONINFO
-FILEVERSION 0,9,1,0
-PRODUCTVERSION 0,9,1,0
+FILEVERSION ${MELONDS_VERSION_MAJOR},${MELONDS_VERSION_MINOR},${MELONDS_VERSION_PATCH},0
+PRODUCTVERSION ${MELONDS_VERSION_MAJOR},${MELONDS_VERSION_MINOR},${MELONDS_VERSION_PATCH},0
FILETYPE VFT_APP
{
BLOCK "StringFileInfo"
@@ -15,14 +15,14 @@ FILETYPE VFT_APP
BLOCK "040904E4"
{
VALUE "CompanyName", "Melon Factory of Kuribo64"
- VALUE "FileVersion", "0.9.1"
+ VALUE "FileVersion", "${MELONDS_VERSION}"
VALUE "FileDescription", "DS emulator, sorta. also 1st quality melon."
VALUE "InternalName", "SDnolem"
VALUE "LegalCopyright", "2016-2020 Arisotura & co."
VALUE "LegalTrademarks", ""
VALUE "OriginalFilename", "zafkflzdasd.exe"
VALUE "ProductName", "melonDS"
- VALUE "ProductVersion", "0.9.1"
+ VALUE "ProductVersion", "${MELONDS_VERSION}"
}
}
BLOCK "VarFileInfo"
diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt
index f0362e5d..72bf7c85 100644
--- a/src/frontend/qt_sdl/CMakeLists.txt
+++ b/src/frontend/qt_sdl/CMakeLists.txt
@@ -94,6 +94,7 @@ if (UNIX)
target_link_libraries(melonDS dl Qt5::Core Qt5::Gui Qt5::Widgets)
elseif (WIN32)
option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON)
+ configure_file("${CMAKE_SOURCE_DIR}/melon.rc.in" "${CMAKE_SOURCE_DIR}/melon.rc")
target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")
target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi gdi32)
@@ -111,13 +112,13 @@ endif()
if (APPLE)
set_target_properties(melonDS PROPERTIES
MACOSX_BUNDLE true
- MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/melonDS.plist
+ MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/melon.plist.in
OUTPUT_NAME melonDS
)
# Copy icon into the bundle
- target_sources(melonDS PRIVATE "${CMAKE_SOURCE_DIR}/melonDS.icns")
- set_source_files_properties("${CMAKE_SOURCE_DIR}/melonDS.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
+ target_sources(melonDS PRIVATE "${CMAKE_SOURCE_DIR}/melon.icns")
+ set_source_files_properties("${CMAKE_SOURCE_DIR}/melon.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
endif()
diff --git a/src/version.h b/src/version.h
index 54f60dfa..1298a23d 100644
--- a/src/version.h
+++ b/src/version.h
@@ -19,8 +19,6 @@
#ifndef VERSION_H
#define VERSION_H
-#define MELONDS_VERSION "0.9.1"
-
#define MELONDS_URL "http://melonds.kuribo64.net/"
#endif // VERSION_H