Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify version-specific configuration in build scripts #5621

Merged
merged 1 commit into from Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 11 additions & 25 deletions CMakeLists.txt
Expand Up @@ -94,12 +94,19 @@ include (CreatePrecompiledHeader)
# set(CMAKE_VERBOSE_MAKEFILE ON)

set(CMAKE_AUTOMOC TRUE)
set(MSCORE_UNSTABLE TRUE) # Mark as unstable
set(MSCORE_RELEASE_CHANNEL "devel")
#set(MSCORE_RELEASE_CHANNEL "testing")
#set(MSCORE_RELEASE_CHANNEL "stable")
set(USE_SSE TRUE)

# Setup version number and general build settings
include("${CMAKE_CURRENT_LIST_DIR}/config.cmake")

if (MUSESCORE_LABEL)
SET (MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} ${MUSESCORE_LABEL}")
endif (MUSESCORE_LABEL)

if (MSCORE_UNSTABLE)
SET (MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} (${MUSESCORE_VERSION_FULL} unstable)")
endif (MSCORE_UNSTABLE)

# Disable components not supported on Windows
if (MSVC OR MINGW)
set(WIN_NOT_AVAIL "Not available on Windows")
Expand Down Expand Up @@ -293,27 +300,6 @@ set(CMAKE_INCLUDE_CURRENT_DIR TRUE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) # Call CMake with option -DCMAKE_SKIP_RPATH to not set RPATH (Debian packaging requirement)
set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)

# The MuseScore version number.
SET(MUSESCORE_NAME "MuseScore")
SET(MUSESCORE_VERSION_MAJOR "3")
SET(MUSESCORE_VERSION_MINOR "5")
SET(MUSESCORE_VERSION_PATCH "0")
SET(MUSESCORE_VERSION_LABEL "")
SET(MUSESCORE_VERSION "${MUSESCORE_VERSION_MAJOR}.${MUSESCORE_VERSION_MINOR}")
SET(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
#
# Version schema x.x.x is hardcoded in source
#
SET(MUSESCORE_VERSION_FULL "${MUSESCORE_VERSION}.${MUSESCORE_VERSION_PATCH}")

if (MUSESCORE_LABEL)
SET (MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} ${MUSESCORE_LABEL}")
endif (MUSESCORE_LABEL)

if (MSCORE_UNSTABLE)
SET (MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} (${MUSESCORE_VERSION_FULL} unstable)")
endif (MSCORE_UNSTABLE)

if (MINGW OR MSVC OR APPLE)
if(MINGW OR MSVC)
# Option for MINGW and MSVC
Expand Down
4 changes: 1 addition & 3 deletions Makefile
Expand Up @@ -17,12 +17,10 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

REVISION := `cat mscore/revision.h`
CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)

PREFIX = "/usr/local"
VERSION = "3.5b-${REVISION}"
#VERSION = 3.5.0
VERSION = `cmake -P config.cmake | grep -oP "VERSION\s+\K.*"`
BUILD_NUMBER=""

TELEMETRY_TRACK_ID=""
Expand Down
5 changes: 1 addition & 4 deletions Makefile.mingw
Expand Up @@ -17,10 +17,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================


REVISION = $(shell type mscore\revision.h)
VERSION = 3.5b-${REVISION}
#VERSION = 3.5.0
VERSION = `cmake -P config.cmake | grep -oP "VERSION\s+\K.*"`
BUILD_NUMBER=""
CPUS = %NUMBER_OF_PROCESSORS%
BUILD_FOR_WINSTORE="OFF" # Override with "ON" to enable.
Expand Down
4 changes: 1 addition & 3 deletions Makefile.osx
Expand Up @@ -17,9 +17,7 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

REVISION = `cat mscore/revision.h`
VERSION = "3.5b-${REVISION}"
#VERSION = 3.5.0
VERSION = `cmake -P config.cmake | grep -oP "VERSION\s+\K.*"`
BUILD_NUMBER = ""
PREFIX=../applebuild
TELEMETRY_TRACK_ID=""
Expand Down
6 changes: 1 addition & 5 deletions build/appveyor/after_build.bat
Expand Up @@ -4,11 +4,7 @@ ccache.exe -s
CD C:\MuseScore

REM the code is used to generate MS version for both nightly and stable releases
SET input=C:\MuseScore\CMakeLists.txt
FOR /f tokens^=2^ delims^=^" %%A IN ('findstr /C:"SET(MUSESCORE_VERSION_MAJOR" %input%') DO set VERSION_MAJOR=%%A
FOR /f tokens^=2^ delims^=^" %%A IN ('findstr /C:"SET(MUSESCORE_VERSION_MINOR" %input%') DO set VERSION_MINOR=%%A
FOR /f tokens^=2^ delims^=^" %%A IN ('findstr /C:"SET(MUSESCORE_VERSION_PATCH" %input%') DO set VERSION_PATCH=%%A
SET MUSESCORE_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%.%APPVEYOR_BUILD_NUMBER%
SET MUSESCORE_VERSION=%MUSESCORE_VERSION_FULL%.%APPVEYOR_BUILD_NUMBER%

SET DEBUG_SYMS_FILE=musescore_win%TARGET_PROCESSOR_BITS%.sym
@echo on
Expand Down
3 changes: 2 additions & 1 deletion build/appveyor/before_build.bat
Expand Up @@ -47,7 +47,8 @@ START " " /wait "7z" x -y %TOOLS_ARCHIVE% > nul
CD C:\MuseScore

:: is MuseScore stable? Check here, no grep in PATH later on
for /f "delims=" %%i in ('grep "^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)" C:\MuseScore\CMakeLists.txt') do set NIGHTLY_BUILD=%%i
for /f "delims=" %%i in ('bash -c "cmake -P config.cmake | grep -P 'MSCORE_UNSTABLE\s+TRUE'"') do set NIGHTLY_BUILD=%%i
for /f %%i in ('bash -c "cmake -P config.cmake | grep -oP 'MUSESCORE_VERSION_FULL\s+\K.*'"') do set MUSESCORE_VERSION_FULL=%%i

:: get revision number
SET "PATH=%QTDIR%\bin;%PATH%"
Expand Down
4 changes: 4 additions & 0 deletions build/appveyor/build_script.bat
@@ -1,2 +1,6 @@
IF "%NIGHTLY_BUILD%" == "" (
SET MSCORE_STABLE_BUILD="TRUE"
)

call C:\MuseScore\msvc_build.bat relwithdebinfo %TARGET_PROCESSOR_BITS% %APPVEYOR_BUILD_NUMBER%
call C:\MuseScore\msvc_build.bat installrelwithdebinfo %TARGET_PROCESSOR_BITS% %APPVEYOR_BUILD_NUMBER%
2 changes: 1 addition & 1 deletion build/appveyor/winsparkle_appcast_generator.sh
Expand Up @@ -3,7 +3,7 @@
# $3 - MuseScore version
# $4 - Revision hash

export MSCORE_RELEASE_CHANNEL=$(grep '^[[:blank:]]*set *( *MSCORE_RELEASE_CHANNEL' CMakeLists.txt | awk -F \" '{print $2}')
export MSCORE_RELEASE_CHANNEL=$(cmake -P config.cmake | grep -oP 'MSCORE_RELEASE_CHANNEL\s+\K.*')
RSS_DATE="$(LANG=C date +'%a, %d %b %Y %H:%M:%S %z')"
FILESIZE="$(wc -c $1 | awk '{print $1}')"
APPCAST_URL="https://sparkle.musescore.org/$MSCORE_RELEASE_CHANNEL/3/win/appcast.xml"
Expand Down
27 changes: 27 additions & 0 deletions build/config/dev.cmake
@@ -0,0 +1,27 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2002-2020 MuseScore BVBA and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

set(MSCORE_UNSTABLE TRUE) # Mark as unstable
set(MSCORE_RELEASE_CHANNEL "devel")

if (NOT MUSESCORE_VERSION_LABEL)
SET(MUSESCORE_VERSION_LABEL "Development")
endif (NOT MUSESCORE_VERSION_LABEL)

SET(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
23 changes: 23 additions & 0 deletions build/config/release.cmake
@@ -0,0 +1,23 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2002-2020 MuseScore BVBA and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

set(MSCORE_UNSTABLE FALSE)
set(MSCORE_RELEASE_CHANNEL "stable")

SET(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
27 changes: 27 additions & 0 deletions build/config/testing.cmake
@@ -0,0 +1,27 @@
#=============================================================================
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2002-2020 MuseScore BVBA and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

set(MSCORE_UNSTABLE FALSE)
set(MSCORE_RELEASE_CHANNEL "testing")

if (NOT MUSESCORE_VERSION_LABEL)
SET(MUSESCORE_VERSION_LABEL "Testing")
endif (NOT MUSESCORE_VERSION_LABEL)

SET(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}.${MUSESCORE_VERSION_MINOR} ${MUSESCORE_VERSION_LABEL}")
4 changes: 3 additions & 1 deletion build/package_mac
Expand Up @@ -11,7 +11,9 @@ then
else
LONG_NAME=MuseScore
LONGER_NAME="MuseScore 3"
VERSION=3.5.0

SCRIPT_DIR=$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)
VERSION=$(cmake -P "$SCRIPT_DIR/../config.cmake" | grep -oP 'VERSION\s+\K.*')
fi


Expand Down
4 changes: 2 additions & 2 deletions build/travis/job1_Tests/run_tests.sh
Expand Up @@ -52,8 +52,8 @@ cd -

cd ..
cd ..
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
then # Build is marked UNSTABLE inside CMakeLists.txt
if [ "$(cmake -P config.cmake | grep -P 'MSCORE_UNSTABLE\s+TRUE')" ]
then # Build is marked UNSTABLE
echo "Unstable version: do not upload source zip file"
else
make clean
Expand Down
4 changes: 2 additions & 2 deletions build/travis/job2_AppImage/build.sh
Expand Up @@ -43,8 +43,8 @@ function rebuild-docker-image() { # $1 is arch (e.g. x86_64)
# Set AppImage name and automated update information according to
# https://github.com/AppImage/AppImageSpec/blob/master/draft.md
# Also set a label to distinguish when running multiple builds on one machine.
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
then # Build is marked UNSTABLE inside CMakeLists.txt
if [ "$(cmake -P config.cmake | grep -P 'MSCORE_UNSTABLE\s+TRUE')" ]
then # Build is marked UNSTABLE
if [ "${BINTRAY_REPO_OWNER}" == "musescore" ]
then # This is a nightly build
makefile_overrides="PREFIX='MuseScoreNightly-$date-$branch-$revision' \
Expand Down
6 changes: 3 additions & 3 deletions build/travis/job_macos/before_install.sh
Expand Up @@ -25,12 +25,12 @@ expect << EOF
expect eof
EOF

#set NIGHTLY_BUILD variable if MSCORE_UNSTABLE is TRUE in CMakeLists.txt
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
# Set NIGHTLY_BUILD variable if MSCORE_UNSTABLE is TRUE
if [ "$(cmake -P config.cmake | grep -P 'MSCORE_UNSTABLE\s+TRUE')" ]
then
export NIGHTLY_BUILD=TRUE
fi

export MSCORE_RELEASE_CHANNEL=$(grep '^[[:blank:]]*set *( *MSCORE_RELEASE_CHANNEL' CMakeLists.txt | awk -F \" '{print $2}')
export MSCORE_RELEASE_CHANNEL=$(cmake -P config.cmake | grep -oP 'MSCORE_RELEASE_CHANNEL\s+\K.*')

fi
8 changes: 3 additions & 5 deletions build/travis/job_macos/script.sh
Expand Up @@ -35,7 +35,7 @@ mkdir -p applebuild/mscore.app/Contents/Frameworks
cp -Rf ~/Library/Frameworks/Sparkle.framework applebuild/mscore.app/Contents/Frameworks

if [[ "$NIGHTLY_BUILD" = "TRUE" ]]
then # Build is marked UNSTABLE inside CMakeLists.txt
then # Build is marked UNSTABLE
build/package_mac $BRANCH-$REVISION
PACKAGE_NAME=MuseScoreNightly
DMGFILE=applebuild/$PACKAGE_NAME-$DATE-$BRANCH-$REVISION.dmg
Expand Down Expand Up @@ -64,11 +64,9 @@ scp -C -i $SSH_INDENTITY build/travis/job_macos/web/nightly.xml musescore-nightl
ssh -i $SSH_INDENTITY musescore-nightlies@ftp-osl.osuosl.org "~/trigger-musescore-nightlies"

# send nightly update to S3
VERSION_MAJOR=$(grep 'SET(MUSESCORE_VERSION_MAJOR' CMakeLists.txt | cut -d \" -f2)
VERSION_MINOR=$(grep 'SET(MUSESCORE_VERSION_MINOR' CMakeLists.txt | cut -d \" -f2)
VERSION_PATCH=$(grep 'SET(MUSESCORE_VERSION_PATCH' CMakeLists.txt | cut -d \" -f2)
MUSESCORE_VERSION_FULL=$(cmake -P config.cmake | grep -oP 'MUSESCORE_VERSION_FULL\s+\K.*')
BUILD_NUMBER=${TRAVIS_BUILD_NUMBER}
MUSESCORE_VERSION=${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}.${BUILD_NUMBER}
MUSESCORE_VERSION=${MUSESCORE_VERSION_FULL}.${BUILD_NUMBER}
SHORT_DATE="$(date -u +%Y-%m-%d)"
#date -R is not supported !?
RSS_DATE="$(LANG=C date +'%a, %d %b %Y %H:%M:%S %z')"
Expand Down
6 changes: 3 additions & 3 deletions build/travis/job_macos_lupdate/before_install.sh
Expand Up @@ -5,10 +5,10 @@ export QT_PATH=$HOME/qt
export QT_MACOS=$QT_PATH/$QT_SHORT_VERSION/clang_64
export PATH=$PATH:$QT_MACOS/bin

#set NIGHTLY_BUILD variable if MSCORE_UNSTABLE is TRUE in CMakeLists.txt
if [ "$(grep '^[[:blank:]]*set( *MSCORE_UNSTABLE \+TRUE *)' CMakeLists.txt)" ]
# Set NIGHTLY_BUILD variable if MSCORE_UNSTABLE is TRUE
if [ "$(cmake -P config.cmake | grep -P 'MSCORE_UNSTABLE\s+TRUE')" ]
then
export NIGHTLY_BUILD=TRUE
fi

export MSCORE_RELEASE_CHANNEL=$(grep '^[[:blank:]]*set *( *MSCORE_RELEASE_CHANNEL' CMakeLists.txt | awk -F \" '{print $2}')
export MSCORE_RELEASE_CHANNEL=$(cmake -P config.cmake | grep -oP 'MSCORE_RELEASE_CHANNEL\s+\K.*')
48 changes: 48 additions & 0 deletions config.cmake
@@ -0,0 +1,48 @@
#=============================================================================
# MuseScore
# Linux Music Score Editor
#
# Copyright (C) 2002-2020 MuseScore BVBA and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================

# The MuseScore version number.
SET(MUSESCORE_NAME "MuseScore")
SET(MUSESCORE_VERSION_MAJOR "3")
SET(MUSESCORE_VERSION_MINOR "5")
SET(MUSESCORE_VERSION_PATCH "0")
SET(MUSESCORE_VERSION_LABEL "")
SET(MUSESCORE_BUILD_CONFIG "dev")
# Possible MUSESCORE_BUILD_CONFIG values:
# - dev - for development/nightly builds
# - testing - for testing versions (alpha, beta, RC)
# - release - for stable release builds

include("${CMAKE_CURRENT_LIST_DIR}/build/config/${MUSESCORE_BUILD_CONFIG}.cmake")

SET(MUSESCORE_VERSION "${MUSESCORE_VERSION_MAJOR}.${MUSESCORE_VERSION_MINOR}")
# Version schema x.x.x is hardcoded in source
SET(MUSESCORE_VERSION_FULL "${MUSESCORE_VERSION}.${MUSESCORE_VERSION_PATCH}")

# Print variables which are needed by CI build scripts.
# STATUS mode makes message() command use stdout for its output.
message(STATUS "MSCORE_UNSTABLE ${MSCORE_UNSTABLE}")
message(STATUS "MSCORE_RELEASE_CHANNEL ${MSCORE_RELEASE_CHANNEL}")
message(STATUS "MUSESCORE_VERSION_FULL ${MUSESCORE_VERSION_FULL}")
if (MSCORE_UNSTABLE)
file(READ "${CMAKE_CURRENT_LIST_DIR}/mscore/revision.h" MUSESCORE_REVISION)
message(STATUS "VERSION ${MUSESCORE_VERSION_MAJOR}.${MUSESCORE_VERSION_MINOR}b-${MUSESCORE_REVISION}")
else (MSCORE_UNSTABLE)
message(STATUS "VERSION ${MUSESCORE_VERSION_FULL}")
endif (MSCORE_UNSTABLE)
14 changes: 8 additions & 6 deletions msvc_build.bat
Expand Up @@ -123,14 +123,16 @@ IF /I "%1"=="clean" (
if not exist "%INSTALL_FOLDER%\nul" mkdir "%INSTALL_FOLDER%"
echo Building CMake configuration...

IF NOT "%CRASH_LOG_SERVER_URL%" == "" (
IF "%BUILD_FOR_WINSTORE%" == "OFF" (
SET CRASH_REPORT_URL_OPT=-DCRASH_REPORT_URL=%CRASH_LOG_SERVER_URL%
IF NOT "%MSCORE_STABLE_BUILD%" == "" (
IF NOT "%CRASH_LOG_SERVER_URL%" == "" (
IF "%BUILD_FOR_WINSTORE%" == "OFF" (
SET CRASH_REPORT_URL_OPT=-DCRASH_REPORT_URL=%CRASH_LOG_SERVER_URL% -DBUILD_CRASH_REPORTER=ON
)
)
)

IF NOT "%TELEMETRY_TRACK_ID%" == "" (
SET TELEMETRY_TRACK_ID_OPT=-DTELEMETRY_TRACK_ID=%TELEMETRY_TRACK_ID%
IF NOT "%TELEMETRY_TRACK_ID%" == "" (
SET TELEMETRY_TRACK_ID_OPT=-DTELEMETRY_TRACK_ID=%TELEMETRY_TRACK_ID%
)
)

REM -DCMAKE_BUILD_NUMBER=%BUILD_NUMBER% -DCMAKE_BUILD_AUTOUPDATE=%BUILD_AUTOUPDATE% %CRASH_REPORT_URL_OPT% are used for CI only
Expand Down