@@ -160,29 +160,60 @@ if (NOT CMAKE_C_COMPILER_ID)
160160 message (FATAL_ERROR "CMAKE_C_COMPILER_ID is not set.\n note: Please include aui.boot AFTER project() call." )
161161endif ()
162162
163- if (ANDROID_ABI)
164- set (AUI_TARGET_ARCH_NAME "android-${ANDROID_ABI} " )
165- set (AUI_TARGET_ABI "${AUI_TARGET_ARCH_NAME} " CACHE INTERNAL "COMPILER-PROCESSOR pair" )
163+ if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)" )
164+ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
165+ set (_aui_target_arch "x86_64" )
166+ elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
167+ set (_aui_target_arch "x86" )
168+ endif ()
169+ else ()
170+ string (TOLOWER "${CMAKE_SYSTEM_PROCESSOR} " _aui_target_arch)
171+ endif ()
172+
173+ if (ANDROID)
174+ set (_aui_target_os "android" )
166175elseif (IOS)
167- set (AUI_TARGET_ARCH_NAME "ios-${CMAKE_SYSTEM_PROCESSOR} " )
168- set (AUI_TARGET_ABI "${AUI_TARGET_ARCH_NAME} " CACHE INTERNAL "COMPILER-PROCESSOR pair" )
176+ set (_aui_target_os "ios" )
177+ elseif (LINUX)
178+ set (_aui_target_os "linux" )
179+ elseif (APPLE )
180+ set (_aui_target_os "macos" )
181+ elseif (WIN32 )
182+ set (_aui_target_os "windows" )
169183else ()
170- if (NOT CMAKE_SYSTEM_PROCESSOR )
171- message (FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR is not set" )
172- endif ()
173- if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86)|(X86)|(amd64)|(AMD64)" )
174- if (CMAKE_SIZEOF_VOID_P EQUAL 8)
175- set (AUI_TARGET_ARCH_NAME "x86_64" )
176- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
177- set (AUI_TARGET_ARCH_NAME "x86" )
178- endif ()
179- else ()
180- set (AUI_TARGET_ARCH_NAME ${CMAKE_SYSTEM_PROCESSOR} )
184+ string (TOLOWER "${CMAKE_SYSTEM_NAME} " _aui_target_os)
185+ endif ()
186+
187+ if (ANDROID)
188+ set (_aui_target_abi "android" )
189+ elseif (IOS)
190+ set (_aui_target_abi "apple" )
191+ elseif (WIN32 )
192+ if (MSVC )
193+ set (_aui_target_abi "msvc" )
194+ else ()
195+ set (_aui_target_abi "gnu" )
181196 endif ()
182- string (TOLOWER "${CMAKE_C_COMPILER_ID} -${AUI_TARGET_ARCH_NAME} " _tmp)
183- set (AUI_TARGET_ABI "${_tmp} " CACHE INTERNAL "COMPILER-PROCESSOR pair" )
197+ elseif (APPLE )
198+ set (_aui_target_abi "apple" )
199+ else ()
200+ set (_aui_target_abi "gnu" )
184201endif ()
185202
203+ if (CMAKE_C_COMPILER_ID STREQUAL "Clang" )
204+ set (_aui_target_compiler "clang" )
205+ elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" )
206+ set (_aui_target_compiler "gcc" )
207+ elseif (MSVC )
208+ set (_aui_target_compiler "msvc" )
209+ else ()
210+ string (TOLOWER "${CMAKE_C_COMPILER_ID} " _aui_target_compiler)
211+ endif ()
212+
213+ set (AUI_TARGET_ARCH_NAME "${_aui_target_arch} " )
214+ set (AUI_TARGET_TRIPLET "${_aui_target_arch} -${_aui_target_os} -${_aui_target_abi} -${_aui_target_compiler} "
215+ CACHE INTERNAL "ARCH-OS-ABI-COMPILER" )
216+
186217# checking if custom cache dir is set for the system
187218if (DEFINED ENV{AUIB_CACHE_DIR})
188219 string (REPLACE "\\ " "/" _tmp $ENV{AUIB_CACHE_DIR} ) # little hack to handle Windows paths
@@ -196,7 +227,7 @@ endif()
196227
197228set (AUIB_CACHE_DIR ${_tmp} CACHE PATH "Path to AUI.Boot cache" )
198229message (STATUS "AUI.Boot cache: ${AUIB_CACHE_DIR} " )
199- message (STATUS "AUI.Boot target ABI : ${AUI_TARGET_ABI } " )
230+ message (STATUS "AUI.Boot target triplet : ${AUI_TARGET_TRIPLET } " )
200231
201232
202233
@@ -371,7 +402,7 @@ function(_auib_precompiled_archive_name _output_var _project_name)
371402 else ()
372403 set (SHARED_OR_STATIC static )
373404 endif ()
374- set (_tmp "${_project_name} _ ${CMAKE_SYSTEM_NAME} -${AUI_TARGET_ABI } -${SHARED_OR_STATIC} -${CMAKE_BUILD_TYPE} " )
405+ set (_tmp "${_project_name} -${AUI_TARGET_TRIPLET } -${SHARED_OR_STATIC} -${CMAKE_BUILD_TYPE} " )
375406 string (TOLOWER ${_tmp} _tmp)
376407 set (${_output_var} ${_tmp} PARENT_SCOPE)
377408endfunction ()
@@ -668,7 +699,7 @@ function(auib_import AUI_MODULE_NAME URL)
668699 endif ()
669700
670701 # [[BUILD_SPECIFIER]]
671- set (BUILD_SPECIFIER "${TAG_OR_HASH} /${AUI_TARGET_ABI } -${CMAKE_BUILD_TYPE} -${SHARED_OR_STATIC} /${CMAKE_GENERATOR} /${AUIB_IMPORT_CMAKE_ARGS} " )
702+ set (BUILD_SPECIFIER "${TAG_OR_HASH} /${AUI_TARGET_TRIPLET } -${CMAKE_BUILD_TYPE} -${SHARED_OR_STATIC} /${CMAKE_GENERATOR} /${AUIB_IMPORT_CMAKE_ARGS} " )
672703 string (REPLACE ";" " " BUILD_SPECIFIER "${BUILD_SPECIFIER} " )
673704
674705 # convert BUILD_SPECIFIER to hash; on windows msvc path length restricted by 260 chars
0 commit comments