-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CMake: Small organizing of the build
- Loading branch information
Showing
4 changed files
with
199 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# =================Library ABI version======================= | ||
|
||
# Calculate a libtool-like version number | ||
math(EXPR BINARY_AGE "${SDLMixerX_VERSION_MINOR} * 100 + ${SDLMixerX_VERSION_PATCH}") | ||
if(MINOR_VERSION MATCHES "[02468]$") | ||
# Stable branch, 2.6.1 -> libSDL2_mixer_ext-2.0.so.0.600.1 | ||
set(INTERFACE_AGE ${SDLMixerX_VERSION_PATCH}) | ||
else() | ||
# Development branch, 2.5.1 -> libSDL2_mixer_ext-2.0.so.0.501.0 | ||
set(INTERFACE_AGE 0) | ||
endif() | ||
|
||
# Increment this if there is an incompatible change - but if that happens, | ||
# we should rename the library from SDL2 to SDL3, at which point this would | ||
# reset to 0 anyway. | ||
set(LT_MAJOR "0") | ||
|
||
math(EXPR LT_AGE "${BINARY_AGE} - ${INTERFACE_AGE}") | ||
math(EXPR LT_CURRENT "${LT_MAJOR} + ${LT_AGE}") | ||
set(LT_REVISION "${INTERFACE_AGE}") | ||
# For historical reasons, the library name redundantly includes the major | ||
# version twice: libSDL2_mixer-2.0.so.0. | ||
# TODO: in SDL 3, set the OUTPUT_NAME to plain SDL3_mixer, which will simplify | ||
# it to libSDL3_mixer.so.0 | ||
set(LT_RELEASE "2.0") | ||
set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}") | ||
|
||
# The following should match the versions in the Xcode project file. | ||
# Each version is 1 higher than you might expect, for compatibility | ||
# with libtool: macOS ABI versioning is 1-based, unlike other platforms | ||
# which are normally 0-based. | ||
math(EXPR DYLIB_CURRENT_VERSION_MAJOR "${LT_MAJOR} + ${LT_AGE} + 1") | ||
math(EXPR DYLIB_CURRENT_VERSION_MINOR "${LT_REVISION}") | ||
math(EXPR DYLIB_COMPAT_VERSION_MAJOR "${LT_MAJOR} + 1") | ||
set(DYLIB_CURRENT_VERSION "${DYLIB_CURRENT_VERSION_MAJOR}.${DYLIB_CURRENT_VERSION_MINOR}.0") | ||
# For historical reasons this is 3.0.0 rather than the expected 1.0.0 | ||
set(DYLIB_COMPATIBILITY_VERSION "3.0.0") | ||
|
||
# For the static assertions in mixer.c | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MAJOR_VERSION=${SDLMixerX_VERSION_MAJOR}") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MINOR_VERSION=${SDLMixerX_VERSION_MINOR}") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DSDL_BUILD_MICRO_VERSION=${SDLMixerX_VERSION_PATCH}") | ||
|
||
# =========================================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
macro(mixer_add_warning_flag WARNINGFLAG WARNING_VAR) | ||
check_c_compiler_flag("${WARNINGFLAG}" HAVE_W_C_${WARNING_VAR}) | ||
if(HAVE_W_C_${WARNING_VAR}) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNINGFLAG}") | ||
endif() | ||
|
||
check_cxx_compiler_flag("${WARNINGFLAG}" HAVE_W_CXX_${WARNING_VAR}) | ||
if(HAVE_W_CXX_${WARNING_VAR}) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGFLAG}") | ||
endif() | ||
endmacro() | ||
|
||
macro(mixer_disable_warning_flag WARNINGFLAG WARNING_VAR) | ||
check_c_compiler_flag("-W${WARNINGFLAG}" HAVE_W_C_${WARNING_VAR}) | ||
if(HAVE_W_C_${WARNING_VAR}) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-${WARNINGFLAG}") | ||
endif() | ||
|
||
check_cxx_compiler_flag("-W${WARNINGFLAG}" HAVE_W_CXX_${WARNING_VAR}) | ||
if(HAVE_W_CXX_${WARNING_VAR}) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-${WARNINGFLAG}") | ||
endif() | ||
endmacro() | ||
|
||
# Add compiler argument(s) | ||
macro(mixer_add_opt_flag OPTFLAG OPT_VAR) | ||
check_c_compiler_flag("${OPTFLAG}" HAVE_M_C_${OPT_VAR}) | ||
if(HAVE_M_C_${OPT_VAR}) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OPTFLAG}") | ||
endif() | ||
|
||
check_cxx_compiler_flag("${OPTFLAG}" HAVE_M_CXX_${OPT_VAR}) | ||
if(HAVE_M_CXX_${OPT_VAR}) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPTFLAG}") | ||
endif() | ||
endmacro() | ||
|
||
macro(mixer_add_c_compiler_flag COMPILERFLAG COMPILERFLAG_VAR) | ||
check_c_compiler_flag("${COMPILERFLAG}" HAVE_C_${COMPILERFLAG_VAR}) | ||
if(HAVE_C_${COMPILERFLAG_VAR}) | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COMPILERFLAG}") | ||
endif() | ||
endmacro() | ||
|
||
macro(mixer_add_cxx_compiler_flag COMPILERFLAG COMPILERFLAG_VAR) | ||
check_cxx_compiler_flag("${COMPILERFLAG}" HAVE_CXX_${COMPILERFLAG_VAR}) | ||
if(HAVE_CXX_${COMPILERFLAG_VAR}) | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMPILERFLAG}") | ||
endif() | ||
endmacro() |
Oops, something went wrong.