summaryrefslogtreecommitdiffstats
path: root/scilab
diff options
context:
space:
mode:
authormottelet <stephane.mottelet@utc.fr>2021-05-27 16:27:32 +0200
committerClément David <clement.david@esi-group.com>2021-06-01 14:40:21 +0200
commit92cacb451a645a49f0f8261972b3f460ffae70f2 (patch)
tree5c97c9d8931c61b3b53d4d7bd943e5d6b2f38207 /scilab
parent8e6a5b951b1abe384433221fa300ef65abc2a54b (diff)
downloadscilab-92cacb451a645a49f0f8261972b3f460ffae70f2.zip
scilab-92cacb451a645a49f0f8261972b3f460ffae70f2.tar.gz
[core] make getversion() aware of arm64 architecture
"arm64" has been selected as it is more widespread than the Linux-only "aarch64" name. Only time will tell if this choice was good. This commit also flatten the #ifdef/#endif architecture selection and clarify the possible arches on Windows or macOS/Linux. Change-Id: I207f7e80de89404d732207fcd9bcb688bf1545c3
Diffstat (limited to 'scilab')
-rw-r--r--scilab/modules/core/src/c/getversion.c37
1 files changed, 27 insertions, 10 deletions
diff --git a/scilab/modules/core/src/c/getversion.c b/scilab/modules/core/src/c/getversion.c
index a3d49b7..5e49f81 100644
--- a/scilab/modules/core/src/c/getversion.c
+++ b/scilab/modules/core/src/c/getversion.c
@@ -35,6 +35,7 @@
35#define MODELICAC_OPTION_STRING L"modelicac" 35#define MODELICAC_OPTION_STRING L"modelicac"
36#define X86_STRING L"x86" 36#define X86_STRING L"x86"
37#define X64_STRING L"x64" 37#define X64_STRING L"x64"
38#define ARM64_STRING L"arm64"
38#define ICC_STRING L"ICC" 39#define ICC_STRING L"ICC"
39#define VC_STRING L"VC++" 40#define VC_STRING L"VC++"
40#define GCC_STRING L"GCC" 41#define GCC_STRING L"GCC"
@@ -312,19 +313,35 @@ wchar_t* getCompilerUsedToBuildScilab(void)
312/*--------------------------------------------------------------------------*/ 313/*--------------------------------------------------------------------------*/
313wchar_t* getCompilerArchitecture(void) 314wchar_t* getCompilerArchitecture(void)
314{ 315{
315#ifdef _MSC_VER 316 wchar_t* arch = NULL;
316#ifdef _WIN64 317// MSVC defined, see https://docs.microsoft.com/cpp/preprocessor/predefined-macros
317 return os_wcsdup(X64_STRING); 318#ifdef _M_X64
318#else 319 arch = os_wcsdup(X64_STRING);
319 return os_wcsdup(X86_STRING);
320#endif 320#endif
321#else 321#ifdef _M_ARM64
322#ifdef _LP64 322 arch = os_wcsdup(ARM64_STRING);
323 return os_wcsdup(X64_STRING); 323#endif
324#else 324#ifdef _M_IX86
325 return os_wcsdup(X86_STRING); 325 arch = os_wcsdup(X86_STRING);
326#endif 326#endif
327
328// See https://blog.kowalczyk.info/article/j/guide-to-predefined-macros-in-c-compilers-gcc-clang-msvc-etc..html
329#ifdef __x86_64__
330 arch = os_wcsdup(X64_STRING);
331#endif
332#ifdef __arm64__
333 arch = os_wcsdup(ARM64_STRING);
334#endif
335#ifdef __aarch64__
336 arch = os_wcsdup(ARM64_STRING);
327#endif 337#endif
338#ifdef __i386__
339 arch = os_wcsdup(X86_STRING);
340#endif
341 if (arch != NULL)
342 return arch;
343 else
344 return os_wcsdup(UNKNOW_STRING);
328} 345}
329/*--------------------------------------------------------------------------*/ 346/*--------------------------------------------------------------------------*/
330BOOL with_modelica_compiler(void) 347BOOL with_modelica_compiler(void)