diff options
author | Shauren <shauren.trinity@gmail.com> | 2024-09-03 12:06:16 +0200 |
---|---|---|
committer | Ovahlord <dreadkiller@gmx.de> | 2024-09-03 19:56:38 +0200 |
commit | fdd44f70dd0abe5a4b1052a97a004a10de336824 (patch) | |
tree | a0a6afd34449f683848b10f2a97336a4c0134138 /cmake | |
parent | 2592a08df667c6988a79dbc39be11346755b8d11 (diff) |
Core/Misc: CompilerDefs/GitRevision improvements
* Removed INTEL as a separate platform (it does not belong there)
* Removed BORLAND from known compilers list (it was never supported)
* Simplified TRINITY_PLATFORM_WINDOWS detection (_WIN32 is always defined)
* Rename revision_data.h macros that begin with a underscore
* Added processor architecture to --version string
* Added Linux distribution name to .server debug
* Fixed some revision_data.h macros missing/wrong values when regenerated during compilation
* Removed manual adding of _WIN64 macro from cmake (it is predefined internally by compiler)
(cherry picked from commit e8740fb2e125b308493aeab49ddd7b0cc6a53c97)
# Conflicts:
# revision_data.h.in.cmake
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/compiler/msvc/settings.cmake | 12 | ||||
-rw-r--r-- | cmake/genrev.cmake | 32 |
2 files changed, 25 insertions, 19 deletions
diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake index 50dac95f123..54bc6fa63ce 100644 --- a/cmake/compiler/msvc/settings.cmake +++ b/cmake/compiler/msvc/settings.cmake @@ -28,17 +28,7 @@ target_compile_options(trinity-compile-option-interface INTERFACE /permissive-) -if(PLATFORM EQUAL 64) - # This definition is necessary to work around a bug with Intellisense described - # here: http://tinyurl.com/2cb428. Syntax highlighting is important for proper - # debugger functionality. - target_compile_definitions(trinity-compile-option-interface - INTERFACE - _WIN64) - - message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter") - -else() +if(PLATFORM EQUAL 32) # mark 32 bit executables large address aware so they can use > 2GB address space set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE") message(STATUS "MSVC: Enabled large address awareness") diff --git a/cmake/genrev.cmake b/cmake/genrev.cmake index 1dd313be3b3..8ecd7ec4a7d 100644 --- a/cmake/genrev.cmake +++ b/cmake/genrev.cmake @@ -12,7 +12,7 @@ # This is done EACH compile so they can be alerted about the consequences. if(NOT BUILDDIR) - # Workaround for funny MSVC behaviour - this segment is only used when using cmake gui + # Workaround for cmake script mode set(BUILDDIR ${CMAKE_BINARY_DIR}) endif() @@ -122,12 +122,28 @@ set(rev_month ${CMAKE_MATCH_2}) set(rev_day ${CMAKE_MATCH_3}) # Create the actual revision_data.h file from the above params -if(NOT "${rev_hash_cached}" STREQUAL "${rev_hash}" OR NOT "${rev_branch_cached}" STREQUAL "${rev_branch}" OR NOT EXISTS "${BUILDDIR}/revision_data.h") - configure_file( - "${CMAKE_SOURCE_DIR}/revision_data.h.in.cmake" - "${BUILDDIR}/revision_data.h" - @ONLY +cmake_host_system_information(RESULT TRINITY_BUILD_HOST_SYSTEM QUERY OS_NAME) +cmake_host_system_information(RESULT TRINITY_BUILD_HOST_DISTRO QUERY DISTRIB_INFO) +cmake_host_system_information(RESULT TRINITY_BUILD_HOST_SYSTEM_RELEASE QUERY OS_RELEASE) +# on windows OS_RELEASE contains sub-type string tag like "Professional" instead of a version number and OS_VERSION has only build number +# so we grab that from cmd "ver" command +if(WIN32) + execute_process( + COMMAND cmd /c ver + OUTPUT_VARIABLE TRINITY_BUILD_HOST_SYSTEM_RELEASE ) - set(rev_hash_cached "${rev_hash}" CACHE INTERNAL "Cached commit-hash") - set(rev_branch_cached "${rev_branch}" CACHE INTERNAL "Cached branch name") + string(STRIP ${TRINITY_BUILD_HOST_SYSTEM_RELEASE} TRINITY_BUILD_HOST_SYSTEM_RELEASE) + string(REGEX MATCH "[0-9]+[.][0-9]+[.][0-9]+" TRINITY_BUILD_HOST_SYSTEM_RELEASE ${TRINITY_BUILD_HOST_SYSTEM_RELEASE}) endif() + +if(CMAKE_SCRIPT_MODE_FILE) + # hack for CMAKE_SYSTEM_PROCESSOR missing in script mode + set(CMAKE_PLATFORM_INFO_DIR ${BUILDDIR}${CMAKE_FILES_DIRECTORY}) + include(${CMAKE_ROOT}/Modules/CMakeDetermineSystem.cmake) +endif() + +configure_file( + "${CMAKE_SOURCE_DIR}/revision_data.h.in.cmake" + "${BUILDDIR}/revision_data.h" + @ONLY +) |