From e8f06b8ac11d6a2bf137ec9fad2204947e2ae5f2 Mon Sep 17 00:00:00 2001
From: WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com>
Date: Tue, 19 Jan 2021 11:39:25 +0000
Subject: Define melonDS version in CMake
Prevents having to update multiple files (melon.rc, melon.plist, version.h) when a new version is released.
---
.gitignore | 1 +
CMakeLists.txt | 15 +++++++++++++++
melon.icns | Bin 0 -> 401172 bytes
melon.plist.in | 24 ++++++++++++++++++++++++
melon.rc | 34 ----------------------------------
melon.rc.in | 34 ++++++++++++++++++++++++++++++++++
melonDS.icns | Bin 401172 -> 0 bytes
melonDS.plist | 24 ------------------------
src/frontend/qt_sdl/CMakeLists.txt | 7 ++++---
src/version.h | 2 --
10 files changed, 78 insertions(+), 63 deletions(-)
create mode 100644 melon.icns
create mode 100644 melon.plist.in
delete mode 100644 melon.rc
create mode 100644 melon.rc.in
delete mode 100644 melonDS.icns
delete mode 100644 melonDS.plist
diff --git a/.gitignore b/.gitignore
index a38b5a3..10cbaf5 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 59a3f2d..467e7d6 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/melon.icns b/melon.icns
new file mode 100644
index 0000000..b4f3733
Binary files /dev/null and b/melon.icns differ
diff --git a/melon.plist.in b/melon.plist.in
new file mode 100644
index 0000000..1e05a3a
--- /dev/null
+++ b/melon.plist.in
@@ -0,0 +1,24 @@
+
+
+
+
+ CFBundleExecutable
+ melonDS
+ CFBundleIconFile
+ melonDS.icns
+ CFBundleIdentifier
+ net.kuribo64.melonDS
+ CFBundleDevelopmentRegion
+ English
+ CFBundlePackageType
+ APPL
+ CFBundleVersion
+ ${MELONDS_VERSION}
+ CFBundleShortVersionString
+ ${MELONDS_VERSION}
+ NSHumanReadableCopyright
+ Licensed under GPLv3
+ NSHighResolutionCapable
+
+
+
diff --git a/melon.rc b/melon.rc
deleted file mode 100644
index 23e3df7..0000000
--- a/melon.rc
+++ /dev/null
@@ -1,34 +0,0 @@
-#define VOS_NT_WINDOWS32 0x00040004L
-#define VFT_APP 0x00000001L
-
-//this will set your .exe icon
-100 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "melon.ico"
-
-//include version information in .exe, modify these values to match your needs
-1 VERSIONINFO
-FILEVERSION 0,9,1,0
-PRODUCTVERSION 0,9,1,0
-FILETYPE VFT_APP
-{
- BLOCK "StringFileInfo"
- {
- BLOCK "040904E4"
- {
- VALUE "CompanyName", "Melon Factory of Kuribo64"
- VALUE "FileVersion", "0.9.1"
- 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"
- }
- }
- BLOCK "VarFileInfo"
- {
- VALUE "Translation", 0x0409, 1252 //language codes
- }
-}
-
-1 24 "xp.manifest"
diff --git a/melon.rc.in b/melon.rc.in
new file mode 100644
index 0000000..717f304
--- /dev/null
+++ b/melon.rc.in
@@ -0,0 +1,34 @@
+#define VOS_NT_WINDOWS32 0x00040004L
+#define VFT_APP 0x00000001L
+
+//this will set your .exe icon
+100 ICON MOVEABLE PURE LOADONCALL DISCARDABLE "melon.ico"
+
+//include version information in .exe, modify these values to match your needs
+1 VERSIONINFO
+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"
+ {
+ BLOCK "040904E4"
+ {
+ VALUE "CompanyName", "Melon Factory of Kuribo64"
+ 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", "${MELONDS_VERSION}"
+ }
+ }
+ BLOCK "VarFileInfo"
+ {
+ VALUE "Translation", 0x0409, 1252 //language codes
+ }
+}
+
+1 24 "xp.manifest"
diff --git a/melonDS.icns b/melonDS.icns
deleted file mode 100644
index b4f3733..0000000
Binary files a/melonDS.icns and /dev/null differ
diff --git a/melonDS.plist b/melonDS.plist
deleted file mode 100644
index 8df5bf4..0000000
--- a/melonDS.plist
+++ /dev/null
@@ -1,24 +0,0 @@
-
-
-
-
- CFBundleExecutable
- melonDS
- CFBundleIconFile
- melonDS.icns
- CFBundleIdentifier
- net.kuribo64.melonDS
- CFBundleDevelopmentRegion
- English
- CFBundlePackageType
- APPL
- CFBundleVersion
- 0.9.1
- CFBundleShortVersionString
- 0.9.1
- NSHumanReadableCopyright
- Licensed under GPLv3
- NSHighResolutionCapable
-
-
-
diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt
index f0362e5..72bf7c8 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 54f60df..1298a23 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
--
cgit v1.2.3