From 03a5d0d376fec979017df0f42c26bc5db3a28b55 Mon Sep 17 00:00:00 2001 From: Dan Rosser Date: Fri, 16 Oct 2026 15:55:26 +1300 Subject: [PATCH] macOS make: APP_VERSION and APP_BUILD for the app's Info.plist Set APP_VERSION (CFBundleShortVersionString, shown in the About window) and APP_BUILD (CFBundleVersion) in a project's config.make or on the make command line; defaults 1.0 and 1. The version was hardcoded to 1.0, and CFBundleVersion was left as the literal ${CURRENT_PROJECT_VERSION}. Based on #3394. Co-authored-by: Vincent Donnefort --- .../project/macos/config.macos.default.mk | 8 +++++++- .../project/osx/config.osx.default.mk | 8 +++++++- scripts/templates/macos/config.make | 11 +++++++++++ scripts/templates/osx/config.make | 11 +++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/libs/openFrameworksCompiled/project/macos/config.macos.default.mk b/libs/openFrameworksCompiled/project/macos/config.macos.default.mk index e3177e4d516..9fffdca4dfb 100644 --- a/libs/openFrameworksCompiled/project/macos/config.macos.default.mk +++ b/libs/openFrameworksCompiled/project/macos/config.macos.default.mk @@ -415,6 +415,11 @@ PLATFORM_FRAMEWORKS_SEARCH_PATHS = /System/Library/Frameworks ################################################################################ #PLATFORM_CC= +# app version (CFBundleShortVersionString, shown in the About window) and build +# number (CFBundleVersion); set APP_VERSION / APP_BUILD in the project's config.make +APP_VERSION ?= 1.0 +APP_BUILD ?= 1 + afterplatform: $(TARGET_NAME) @rm -rf bin/$(BIN_NAME).app @mkdir -p bin/$(BIN_NAME).app @@ -439,7 +444,8 @@ afterplatform: $(TARGET_NAME) @sed -i '' 's/\$${EXECUTABLE_NAME}/$(BIN_NAME)/g' bin/$(BIN_NAME).app/Contents/Info.plist @sed -i '' 's/\$${TARGET_NAME}/$(BIN_NAME)/g' bin/$(BIN_NAME).app/Contents/Info.plist @sed -i '' 's/\$${PRODUCT_BUNDLE_IDENTIFIER}/cc.openFrameworks.$(BIN_NAME)/g' bin/$(BIN_NAME).app/Contents/Info.plist - @sed -i '' 's/\$${MARKETING_VERSION}/1.0/g' bin/$(BIN_NAME).app/Contents/Info.plist + @sed -i '' 's/\$${MARKETING_VERSION}/$(APP_VERSION)/g' bin/$(BIN_NAME).app/Contents/Info.plist + @sed -i '' 's/\$${CURRENT_PROJECT_VERSION}/$(APP_BUILD)/g' bin/$(BIN_NAME).app/Contents/Info.plist @echo TARGET=$(TARGET) @mv $(TARGET) bin/$(BIN_NAME).app/Contents/MacOS diff --git a/libs/openFrameworksCompiled/project/osx/config.osx.default.mk b/libs/openFrameworksCompiled/project/osx/config.osx.default.mk index bff4844e2ee..2c93c547e1a 100644 --- a/libs/openFrameworksCompiled/project/osx/config.osx.default.mk +++ b/libs/openFrameworksCompiled/project/osx/config.osx.default.mk @@ -417,6 +417,11 @@ PLATFORM_FRAMEWORKS_SEARCH_PATHS = /System/Library/Frameworks ################################################################################ #PLATFORM_CC= +# app version (CFBundleShortVersionString, shown in the About window) and build +# number (CFBundleVersion); set APP_VERSION / APP_BUILD in the project's config.make +APP_VERSION ?= 1.0 +APP_BUILD ?= 1 + afterplatform: $(TARGET_NAME) @rm -rf bin/$(BIN_NAME).app @mkdir -p bin/$(BIN_NAME).app @@ -441,7 +446,8 @@ afterplatform: $(TARGET_NAME) @sed -i '' 's/\$${EXECUTABLE_NAME}/$(BIN_NAME)/g' bin/$(BIN_NAME).app/Contents/Info.plist @sed -i '' 's/\$${TARGET_NAME}/$(BIN_NAME)/g' bin/$(BIN_NAME).app/Contents/Info.plist @sed -i '' 's/\$${PRODUCT_BUNDLE_IDENTIFIER}/cc.openFrameworks.$(BIN_NAME)/g' bin/$(BIN_NAME).app/Contents/Info.plist - @sed -i '' 's/\$${MARKETING_VERSION}/1.0/g' bin/$(BIN_NAME).app/Contents/Info.plist + @sed -i '' 's/\$${MARKETING_VERSION}/$(APP_VERSION)/g' bin/$(BIN_NAME).app/Contents/Info.plist + @sed -i '' 's/\$${CURRENT_PROJECT_VERSION}/$(APP_BUILD)/g' bin/$(BIN_NAME).app/Contents/Info.plist @echo TARGET=$(TARGET) @mv $(TARGET) bin/$(BIN_NAME).app/Contents/MacOS diff --git a/scripts/templates/macos/config.make b/scripts/templates/macos/config.make index d71d6bb97e3..691148c602e 100644 --- a/scripts/templates/macos/config.make +++ b/scripts/templates/macos/config.make @@ -10,6 +10,17 @@ ################################################################################ # OF_ROOT = ../../.. +################################################################################ +# APP VERSION +# The app's version, shown in the macOS About window (CFBundleShortVersionString), +# and its build number (CFBundleVersion). +# +# (default) APP_VERSION = 1.0 +# (default) APP_BUILD = 1 +################################################################################ +# APP_VERSION = 1.0 +# APP_BUILD = 1 + ################################################################################ # PROJECT ROOT # The location of the project - a starting place for searching for files diff --git a/scripts/templates/osx/config.make b/scripts/templates/osx/config.make index c9bf32e83af..48f8dc53e9f 100644 --- a/scripts/templates/osx/config.make +++ b/scripts/templates/osx/config.make @@ -10,6 +10,17 @@ ################################################################################ # OF_ROOT = ../../.. +################################################################################ +# APP VERSION +# The app's version, shown in the macOS About window (CFBundleShortVersionString), +# and its build number (CFBundleVersion). +# +# (default) APP_VERSION = 1.0 +# (default) APP_BUILD = 1 +################################################################################ +# APP_VERSION = 1.0 +# APP_BUILD = 1 + ################################################################################ # PROJECT ROOT # The location of the project - a starting place for searching for files