Files
systeminformer/cmake/platform.cmake
dmex 2521ec49d6 CustomBuildTool: Add CMake SDK linking, vcvars fix, and -cmake flag
CMake: set ARCHIVE_OUTPUT_DIRECTORY for targets and add SDK/thirdparty linking for plugin targets; expose SI_PLATFORM_SDK_LIB for platform-specific SDK lib paths. Tools: pass a -cmake flag from si_sdkbuild and handle -cmake in CustomBuildTool. CustomBuildTool: only show build stats when verbose and improve ExecuteCMakeCommand vcvarsall detection by preferring VCINSTALLDIR, falling back to a VS instance, and returning an error if vcvarsall is not found. Zip: simplify compression column output and mark the file parameter as unused.
2026-02-23 16:59:44 +11:00

55 lines
1.8 KiB
CMake

#
# Copyright (c) 2022 Winsider Seminars & Solutions, Inc. All rights reserved.
#
# This file is part of System Informer.
#
if(MSVC AND CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(MSVC_CLANG ON)
else()
set(MSVC_CLANG OFF)
endif()
if (MSVC AND NOT CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(MSVC_NOT_CLANG ON)
else()
set(MSVC_NOT_CLANG OFF)
endif()
if(CMAKE_VS_PLATFORM_NAME)
set(SI_PLATFORM "${CMAKE_VS_PLATFORM_NAME}")
elseif(CMAKE_GENERATOR_PLATFORM)
if(CMAKE_GENERATOR_PLATFORM MATCHES "x64|AMD64|x86_64")
set(SI_PLATFORM "x64")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "ARM64|aarch64")
set(SI_PLATFORM "ARM64")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "i[3-6]86|[xX]86|Win32")
set(SI_PLATFORM "Win32")
else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_GENERATOR_PLATFORM}")
endif()
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID)
if(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "x64|AMD64|x86_64")
set(SI_PLATFORM "x64")
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "ARM64|aarch64")
set(SI_PLATFORM "ARM64")
elseif(CMAKE_C_COMPILER_ARCHITECTURE_ID MATCHES "i[3-6]86|[xX]86|Win32")
set(SI_PLATFORM "Win32")
else()
message(FATAL_ERROR "Unsupported platform: ${CMAKE_C_COMPILER_ARCHITECTURE_ID}")
endif()
else()
message(FATAL_ERROR "Unable to detect target platform.")
endif()
if(SI_PLATFORM STREQUAL "x64")
set(SI_PLATFORM_SHORT "64")
set(SI_PLATFORM_SDK_LIB "amd64")
elseif(SI_PLATFORM STREQUAL "ARM64")
set(SI_PLATFORM_SHORT "ARM64")
set(SI_PLATFORM_SDK_LIB "arm64")
elseif(SI_PLATFORM STREQUAL "Win32")
set(SI_PLATFORM_SHORT "32")
set(SI_PLATFORM_SDK_LIB "i386")
else()
message(FATAL_ERROR "Unexpected platform: ${SI_PLATFORM}")
endif()