Define melonDS version in CMake

Prevents having to update multiple files (melon.rc, melon.plist, version.h) when a new version is released.
This commit is contained in:
WaluigiWare64 2021-01-19 11:39:25 +00:00
parent cd6859ef6f
commit e8f06b8ac1
7 changed files with 26 additions and 11 deletions

1
.gitignore vendored
View File

@ -6,6 +6,7 @@ obj
*.o
melon_grc.c
melon_grc.h
melon.rc
cmake-build
cmake-build-debug
.idea

View File

@ -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)

View File

@ -13,9 +13,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>0.9.1</string>
<string>${MELONDS_VERSION}</string>
<key>CFBundleShortVersionString</key>
<string>0.9.1</string>
<string>${MELONDS_VERSION}</string>
<key>NSHumanReadableCopyright</key>
<string>Licensed under GPLv3</string>
<key>NSHighResolutionCapable</key>

View File

@ -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"

View File

@ -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()

View File

@ -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