Skip to content
Browse files

Improve setting of current SC version.

A new SCVersion.txt is included by CMake and used to set the version in all places:
- Main.sc (by classmethods from SCVersion.sc)
- About dialog in SC.app
- Version reported by Finder's "Get info"
- CPACK

(This commit was also applied to 3.5 but with correct version numbers)
  • Loading branch information...
1 parent 0d2a147 commit aa0b02bc3c642c8bf9355211f0847cb1a5334fb1 @lijon lijon committed Jan 21, 2012
View
20 CMakeLists.txt
@@ -1,6 +1,10 @@
cmake_minimum_required (VERSION 2.8)
project (SuperCollider)
+include("SCVersion.txt")
+set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH}")
+message(STATUS "SuperCollider Version: ${PROJECT_VERSION}")
+
include(CTest)
enable_testing()
@@ -27,14 +31,6 @@ CONFIGURE_FILE(
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
-if(NOT WIN32)
- ADD_CUSTOM_TARGET(setMainVersion ALL
- sh ${CMAKE_CURRENT_SOURCE_DIR}/setMainVersion.sh
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- VERBATIM
- )
-endif()
-
if(APPLE)
STRING(REGEX REPLACE "^.*MacOSX10.([0-9]+).*$" "\\1" MAC_OSX_SDK_VERSION "${CMAKE_OSX_SYSROOT}")
@@ -350,6 +346,8 @@ else()
)
endif()
+configure_file(platform/SCVersion.sc.in SCVersion.sc)
+install(FILES "${CMAKE_BINARY_DIR}/SCVersion.sc" DESTINATION "${auxresourcesdir}/SCClassLibrary")
install(DIRECTORY sounds
DESTINATION ${auxresourcesdir}
@@ -424,9 +422,9 @@ endif()
#############################################
# CPack support
-set(CPACK_PACKAGE_VERSION_MAJOR 3)
-set(CPACK_PACKAGE_VERSION_MINOR 5)
-set(CPACK_PACKAGE_VERSION_PATCH dev)
+set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
if(APPLE)
set(CPACK_GENERATOR "DragNDrop")
View
5 SCClassLibrary/Common/Core/Kernel.sc
@@ -178,6 +178,11 @@ Process {
var schedulerQueue;
var <>nowExecutingPath;
+ // SCVersion.sc overrides these for Main
+ *scVersionMajor { ^123 }
+ *scVersionMinor { ^0 }
+ *scVersionPostfix { ^"unknown" }
+
startup {
var time;
View
19 SCClassLibrary/DefaultLibrary/Main.sc
@@ -1,9 +1,4 @@
Main : Process {
- // do not change the next lines manually:
- //==== replace with new version from bash script ====
-classvar scVersionMajor=3, scVersionMinor=6, scVersionPostfix="~dev";
- //==== end replace ====
-
var <platform, argv;
var recvOSCfunc, prRecvOSCFunc;
var <customPorts;
@@ -140,21 +135,21 @@ classvar scVersionMajor=3, scVersionMinor=6, scVersionPostfix="~dev";
(class ? Object).browse;
}
- *version {^[scVersionMajor, ".", scVersionMinor, scVersionPostfix].join}
+ *version {^[this.scVersionMajor, ".", this.scVersionMinor, this.scVersionPostfix].join}
*versionAtLeast { |maj, min|
- ^if((maj==scVersionMajor) and:{min.notNil}){
- scVersionMinor >= min
+ ^if((maj==this.scVersionMajor) and:{min.notNil}){
+ this.scVersionMinor >= min
}{
- scVersionMajor >= maj
+ this.scVersionMajor >= maj
};
}
*versionAtMost { |maj, min|
- ^if((maj==scVersionMajor) and:{min.notNil}){
- scVersionMinor <= min
+ ^if((maj==this.scVersionMajor) and:{min.notNil}){
+ this.scVersionMinor <= min
}{
- scVersionMajor <= maj
+ this.scVersionMajor <= maj
};
}
View
7 SCVersion.txt
@@ -0,0 +1,7 @@
+# This file is included by CMakeLists.txt, and is the single place where SC version should be updated.
+# Note that you need to "make install" for this information to be copied into all places..
+
+set(PROJECT_VERSION_MAJOR 3)
+set(PROJECT_VERSION_MINOR 6)
+set(PROJECT_VERSION_PATCH dev)
+
View
2 VERSION
@@ -1,2 +0,0 @@
-3.6~dev-git
-classvar scVersionMajor=3, scVersionMinor=6, scVersionPostfix="~dev";
View
6 cmake_modules/MacOSXBundleInfo.plist.in
@@ -150,7 +150,11 @@
<key>CFBundleSignature</key>
<string>SCjm</string>
<key>CFBundleVersion</key>
- <string>-Unofficial Build-</string>
+ <string>${PROJECT_VERSION_PATCH}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>(C) 2001-2012 James McCartney et al.</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
View
7 platform/SCVersion.sc.in
@@ -0,0 +1,7 @@
+// Do not edit this file manually, it's configured by CMake. The version numbers are set in SCVersion.txt
++ Main {
+ *scVersionMajor { ^@PROJECT_VERSION_MAJOR@ }
+ *scVersionMinor { ^@PROJECT_VERSION_MINOR@ }
+ *scVersionPostfix { ^"@PROJECT_VERSION_PATCH@" }
+}
+
View
BIN platform/mac/Resources/English.lproj/InfoPlist.strings
Binary file not shown.
View
24 setMainVersion.sh
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-mainfile="SCClassLibrary/DefaultLibrary/Main.sc"
-
-# Double-check that there's exactly one in each!
-count1=$( grep -c "classvar" VERSION )
-count2=$( grep -c "classvar scVersion" $mainfile )
-if [ $count1 != 1 ] || [ $count2 != 1 ]; then
- echo "ERROR in setMainVersion.sh: we require exactly one 'classvar' line to be detected. Check ../VERSION and Main.sc."
- exit
-fi
-
-versionline=$( grep "classvar" VERSION )
-line=$( grep "classvar scVersion" $mainfile )
-
-echo $versionline
-echo $line
-
-# only update if they don't already match
-if [ "$versionline" != "$line" ]; then
- sed "s/$line/$versionline/" <$mainfile >tempfile
- cp tempfile $mainfile
- rm tempfile
-fi

0 comments on commit aa0b02b

Please sign in to comment.
Something went wrong with that request. Please try again.