mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +02:00
Define Audacity version constants in CMake not Audacity.h
This commit is contained in:
parent
d9b868334b
commit
d51f505cd9
@ -11,6 +11,33 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND
|
||||
message(FATAL_ERROR "Audacity requires at least GCC 4.9")
|
||||
endif ()
|
||||
|
||||
# We only do alpha builds, beta builds, and release versions.
|
||||
# Most of the time we're in development, so AUDACITY_BUILD_LEVEL should be
|
||||
# defined to 0.
|
||||
# Its value may be more than 0 for pre-release "Beta" builds that differ only
|
||||
# in the welcome screen, and hiding of some development menu commands, but
|
||||
# still link to the alpha manual online.
|
||||
|
||||
# Set this value to 0 for alpha, 1 for beta, 2 for release builds
|
||||
set( AUDACITY_BUILD_LEVEL 0 )
|
||||
|
||||
# The Audacity version
|
||||
# Increment as appropriate after release of a new version, and set back
|
||||
# AUDACITY_BUILD_LEVEL to 0
|
||||
set( AUDACITY_VERSION 3 )
|
||||
set( AUDACITY_RELEASE 0 )
|
||||
set( AUDACITY_REVISION 3 )
|
||||
set( AUDACITY_MODLEVEL 0 )
|
||||
|
||||
string( TIMESTAMP __TDATE__ "%Y%m%d" )
|
||||
if( AUDACITY_BUILD_LEVEL EQUAL 0 )
|
||||
set( AUDACITY_SUFFIX "-alpha-${__TDATE__}" )
|
||||
elseif( AUDACITY_BUILD_LEVEL EQUAL 1 )
|
||||
set( AUDACITY_SUFFIX "-beta-${__TDATE__}" )
|
||||
else()
|
||||
set( AUDACITY_SUFFIX "" )
|
||||
endif()
|
||||
|
||||
# Don't allow in-source builds...no real reason, just
|
||||
# keeping those source trees nice and tidy. :-)
|
||||
# (This can be removed if it becomes an issue.)
|
||||
@ -385,36 +412,10 @@ else()
|
||||
set( AUDACITY_NAME "audacity" )
|
||||
endif()
|
||||
|
||||
# Extract the Audacity version information
|
||||
file(
|
||||
STRINGS
|
||||
${topdir}/src/Audacity.h output
|
||||
REGEX
|
||||
"^#define +AUDACITY_(VERSION|RELEASE|REVISION|MODLEVEL|BUILD_LEVEL) +"
|
||||
)
|
||||
|
||||
# And store as variables
|
||||
foreach( line ${output} )
|
||||
string( REGEX MATCHALL "[A-Za-z0-9_]+" line "${line}" )
|
||||
list( GET line 1 name )
|
||||
list( GET line 2 value )
|
||||
set( ${name} ${value} )
|
||||
endforeach()
|
||||
|
||||
# Create short and full version strings
|
||||
set( AUDACITY_DIST_VERSION ${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION} )
|
||||
set( AUDACITY_INFO_VERSION ${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION}.${AUDACITY_MODLEVEL} )
|
||||
|
||||
# Define the version suffix (duplicates what happens in src/Audacity.h)
|
||||
string( TIMESTAMP __TDATE__ "%Y%m%d" )
|
||||
if( AUDACITY_BUILD_LEVEL EQUAL 0 )
|
||||
set( AUDACITY_SUFFIX "-alpha-${__TDATE__}" )
|
||||
elseif( AUDACITY_BUILD_LEVEL EQUAL 1 )
|
||||
set( AUDACITY_SUFFIX "-beta-${__TDATE__}" )
|
||||
else()
|
||||
set( AUDACITY_SUFFIX "" )
|
||||
endif()
|
||||
|
||||
# Python is used for the manual and (possibly) message catalogs
|
||||
find_package( Python3 )
|
||||
if( Python3_FOUND )
|
||||
|
@ -214,6 +214,17 @@ function( audacity_append_common_compiler_options var )
|
||||
$<$<PLATFORM_ID:Darwin>:-include ${CMAKE_BINARY_DIR}/src/private/configmac.h>
|
||||
$<$<NOT:$<PLATFORM_ID:Windows,Darwin>>:-include ${CMAKE_BINARY_DIR}/src/private/configunix.h>
|
||||
|
||||
-DAUDACITY_VERSION=${AUDACITY_VERSION}
|
||||
-DAUDACITY_RELEASE=${AUDACITY_RELEASE}
|
||||
-DAUDACITY_REVISION=${AUDACITY_REVISION}
|
||||
-DAUDACITY_MODLEVEL=${AUDACITY_MODLEVEL}
|
||||
|
||||
# Version string for visual display
|
||||
-DAUDACITY_VERSION_STRING=L"${AUDACITY_VERSION}.${AUDACITY_RELEASE}.${AUDACITY_REVISION}${AUDACITY_SUFFIX}"
|
||||
|
||||
# This value is used in the resource compiler for Windows
|
||||
-DAUDACITY_FILE_VERSION=L"${AUDACITY_VERSION},${AUDACITY_RELEASE},${AUDACITY_REVISION},${AUDACITY_MODLEVEL}"
|
||||
|
||||
# This renames a good use of this C++ keyword that we don't need
|
||||
# to review when hunting for leaks because of naked new and delete.
|
||||
-DPROHIBITED==delete
|
||||
@ -241,6 +252,15 @@ function( audacity_append_common_compiler_options var )
|
||||
# Yes, -U to /U too as needed for Windows:
|
||||
$<IF:$<CONFIG:Release>,-U_DEBUG,-D_DEBUG=1>
|
||||
)
|
||||
# Definitions controlled by the AUDACITY_BUILD_LEVEL switch
|
||||
if( AUDACITY_BUILD_LEVEL EQUAL 0 )
|
||||
list( APPEND ${var} -DIS_ALPHA -DUSE_ALPHA_MANUAL )
|
||||
elseif( AUDACITY_BUILD_LEVEL EQUAL 1 )
|
||||
list( APPEND ${var} -DIS_BETA -DUSE_ALPHA_MANUAL )
|
||||
else()
|
||||
list( APPEND ${var} -DIS_RELEASE )
|
||||
endif()
|
||||
|
||||
set( ${var} "${${var}}" PARENT_SCOPE )
|
||||
endfunction()
|
||||
|
||||
|
@ -23,60 +23,4 @@
|
||||
|
||||
#ifndef __AUDACITY_H__
|
||||
#define __AUDACITY_H__
|
||||
|
||||
// We only do alpha builds, beta builds, and release versions.
|
||||
// Most of the time we're in development, so AUDACITY_BUILD_LEVEL should be
|
||||
// defined to 0.
|
||||
// Its value may be more than 0 for pre-release "Beta" builds that differ only
|
||||
// in the welcome screen, and hiding of some development menu commands, but
|
||||
// still link to the alpha manual online.
|
||||
#define AUDACITY_BUILD_LEVEL 0
|
||||
|
||||
// used #ifdef not #if for IS_ALPHA, IS_BETA, IS_RELEASE, USE_ALPHA_MANUAL
|
||||
#undef IS_ALPHA
|
||||
#undef IS_BETA
|
||||
#undef IS_RELEASE
|
||||
#undef USE_ALPHA_MANUAL
|
||||
|
||||
#if AUDACITY_BUILD_LEVEL == 0
|
||||
#define IS_ALPHA
|
||||
#define USE_ALPHA_MANUAL
|
||||
#elif AUDACITY_BUILD_LEVEL == 1
|
||||
#define IS_BETA
|
||||
#define USE_ALPHA_MANUAL
|
||||
#else
|
||||
#define IS_RELEASE
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Increment as appropriate every time we release a NEW version.
|
||||
#define AUDACITY_VERSION 3
|
||||
#define AUDACITY_RELEASE 0
|
||||
#define AUDACITY_REVISION 3
|
||||
#define AUDACITY_MODLEVEL 0
|
||||
|
||||
#if defined(IS_BETA)
|
||||
#define AUDACITY_SUFFIX wxT("-beta-") __TDATE__
|
||||
#elif defined(IS_ALPHA)
|
||||
#define AUDACITY_SUFFIX wxT("-alpha-") __TDATE__
|
||||
#else
|
||||
#define AUDACITY_SUFFIX wxT("") // for a stable release
|
||||
//#define AUDACITY_SUFFIX wxT("x ") __TDATE__
|
||||
#endif
|
||||
|
||||
#define AUDACITY_MAKESTR( x ) #x
|
||||
#define AUDACITY_QUOTE( x ) AUDACITY_MAKESTR( x )
|
||||
|
||||
// Version string for visual display
|
||||
#define AUDACITY_VERSION_STRING wxT( AUDACITY_QUOTE( AUDACITY_VERSION ) ) wxT(".") \
|
||||
wxT( AUDACITY_QUOTE( AUDACITY_RELEASE ) ) wxT(".") \
|
||||
wxT( AUDACITY_QUOTE( AUDACITY_REVISION ) ) \
|
||||
AUDACITY_SUFFIX
|
||||
|
||||
#define AUDACITY_FILE_VERSION AUDACITY_QUOTE( AUDACITY_VERSION ) "," \
|
||||
AUDACITY_QUOTE( AUDACITY_RELEASE ) "," \
|
||||
AUDACITY_QUOTE( AUDACITY_REVISION ) "," \
|
||||
AUDACITY_QUOTE( AUDACITY_MODLEVEL )
|
||||
|
||||
#endif // __AUDACITY_H__
|
||||
|
Loading…
x
Reference in New Issue
Block a user