diff --git a/ports/blas/vcpkg.json b/ports/blas/vcpkg.json index aca4cf894e418c..58ef317ce8a26a 100644 --- a/ports/blas/vcpkg.json +++ b/ports/blas/vcpkg.json @@ -1,8 +1,8 @@ { "name": "blas", - "version-string": "1", - "port-version": 1, + "version-date": "2022-04-10", "description": "Metapackage for packages which provide BLAS", + "license": null, "dependencies": [ "openblas" ] diff --git a/ports/flang-fortran-runtime/1163.diff b/ports/flang-fortran-runtime/1163.diff new file mode 100644 index 00000000000000..6f2cccf0a46f4f --- /dev/null +++ b/ports/flang-fortran-runtime/1163.diff @@ -0,0 +1,1928 @@ +diff --git a/runtime/flang/access3f.c b/runtime/flang/access3f.c +index f330b57b18e..62a78edd0b5 100644 +--- a/runtime/flang/access3f.c ++++ b/runtime/flang/access3f.c +@@ -10,7 +10,7 @@ + /* access3f.c - Implements LIB3F access subroutine. */ + + /* must include ent3f.h AFTER io3f.h */ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + +diff --git a/runtime/flang/alarm3f.c b/runtime/flang/alarm3f.c +index bf65ac96c01..e81f8f49cee 100644 +--- a/runtime/flang/alarm3f.c ++++ b/runtime/flang/alarm3f.c +@@ -9,7 +9,7 @@ + + /* alarm3f.c - Implements LIB3F alarm subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + #include + #include "ent3f.h" + +diff --git a/runtime/flang/alias.c b/runtime/flang/alias.c +index 58c582abe03..6f5e06223fb 100644 +--- a/runtime/flang/alias.c ++++ b/runtime/flang/alias.c +@@ -5,7 +5,7 @@ + * + */ + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "omp.h" + + extern void omp_set_num_threads_(int num_threads) +diff --git a/runtime/flang/allo.c b/runtime/flang/allo.c +index f9c1db5289f..b383bf44339 100644 +--- a/runtime/flang/allo.c ++++ b/runtime/flang/allo.c +@@ -239,7 +239,7 @@ I8(__fort_alloc)(__INT_T nelem, dtype kind, size_t len, __STAT_T *stat, + char msg[80]; + char *p_env; + +-#if (defined(WIN64) || defined(WIN32)) ++#if (defined(_WIN64)) + #define ALN_LARGE + #else + #undef ALN_LARGE +@@ -398,7 +398,7 @@ I8(__alloc04)(__NELEM_T nelem, dtype kind, size_t len, + MP_V_STDIO; + } + +-#if (defined(WIN64) || defined(WIN32)) ++#if (defined(_WIN64)) + #define ALN_LARGE + #else + #undef ALN_LARGE +diff --git a/runtime/flang/backspace.c b/runtime/flang/backspace.c +index ef27003d94a..0ee3b837636 100644 +--- a/runtime/flang/backspace.c ++++ b/runtime/flang/backspace.c +@@ -64,7 +64,7 @@ _f90io_backspace(__INT_T *unit, __INT_T *bitv, __INT_T *iostat, int swap_bytes) + + if (f->nonadvance) { + f->nonadvance = FALSE; +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +diff --git a/runtime/flang/besj03f.c b/runtime/flang/besj03f.c +index de01cd8ce1e..9c6ea374d95 100644 +--- a/runtime/flang/besj03f.c ++++ b/runtime/flang/besj03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j0 _j0 + #endif + +diff --git a/runtime/flang/besj13f.c b/runtime/flang/besj13f.c +index edf45a4dbc7..1ec34afc157 100644 +--- a/runtime/flang/besj13f.c ++++ b/runtime/flang/besj13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j1 _j1 + #endif + +diff --git a/runtime/flang/besjn3f.c b/runtime/flang/besjn3f.c +index 77dc92b923c..6f39867b9b7 100644 +--- a/runtime/flang/besjn3f.c ++++ b/runtime/flang/besjn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define jn _jn + #endif + +diff --git a/runtime/flang/besy03f.c b/runtime/flang/besy03f.c +index 7fa4aea96c8..634661382f7 100644 +--- a/runtime/flang/besy03f.c ++++ b/runtime/flang/besy03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y0 _y0 + #endif + +diff --git a/runtime/flang/besy13f.c b/runtime/flang/besy13f.c +index 98167989af7..ba661fe6efe 100644 +--- a/runtime/flang/besy13f.c ++++ b/runtime/flang/besy13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y1 _y1 + #endif + +diff --git a/runtime/flang/besyn3f.c b/runtime/flang/besyn3f.c +index 3c271de14ae..cb4a8ef950f 100644 +--- a/runtime/flang/besyn3f.c ++++ b/runtime/flang/besyn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define yn _yn + #endif + +diff --git a/runtime/flang/buffer.c b/runtime/flang/buffer.c +index d6061056918..c55817f0822 100644 +--- a/runtime/flang/buffer.c ++++ b/runtime/flang/buffer.c +@@ -12,7 +12,7 @@ + #include "stdioInterf.h" + #include "fioMacros.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #define creat _creat + #define close _close +diff --git a/runtime/flang/chdir3f.c b/runtime/flang/chdir3f.c +index c64d313840e..9947c6a19c9 100644 +--- a/runtime/flang/chdir3f.c ++++ b/runtime/flang/chdir3f.c +@@ -10,7 +10,7 @@ + /* chdir3f.c - Implements LIB3F chdir subprogram. */ + + /* must include ent3f.h AFTER io3f.h */ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #else + #include +@@ -18,7 +18,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define chdir _chdir + #endif + +diff --git a/runtime/flang/chmod3f.c b/runtime/flang/chmod3f.c +index 58dbd8c250f..8a7a88e2e69 100644 +--- a/runtime/flang/chmod3f.c ++++ b/runtime/flang/chmod3f.c +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define chmod _chmod + #endif + +diff --git a/runtime/flang/close.c b/runtime/flang/close.c +index 628b8e83dcc..a66ce2428e4 100644 +--- a/runtime/flang/close.c ++++ b/runtime/flang/close.c +@@ -13,12 +13,12 @@ + + #include + #include "global.h" +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + #include "stdioInterf.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define unlink _unlink + #define access _access + #endif +@@ -38,7 +38,7 @@ __fortio_close(FIO_FCB *f, int flag) + + if (f->nonadvance) { + f->nonadvance = FALSE; +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +@@ -61,7 +61,7 @@ __fortio_close(FIO_FCB *f, int flag) + else + __fort_unlink(f->name); + } +-#ifdef WINNT ++#if defined(_WIN64) + else if (f->status == FIO_SCRATCH) + unlink(f->name); + #endif +diff --git a/runtime/flang/cnfg.c b/runtime/flang/cnfg.c +index 020fa06c0ec..800d2549078 100644 +--- a/runtime/flang/cnfg.c ++++ b/runtime/flang/cnfg.c +@@ -77,7 +77,7 @@ __fortio_scratch_name(char *filename, int unit) + extern char *__io_tempnam(); + char *nm; + +-#if defined(WINNT) ++#if defined(_WIN64) + if (getenv("TMP") == 0) + nm = __io_tempnam("C:\\", "FTN"); + else +@@ -85,13 +85,13 @@ __fortio_scratch_name(char *filename, int unit) + strcpy(filename, nm); + if (nm) + free(nm); +-#else /*WINNT*/ ++#else /*_WIN64*/ + + nm = __io_tempnam((char *)0, "FTN"); + strcpy(filename, nm); + if (nm) + free(nm); + +-#endif /*WINNT*/ ++#endif /*_WIN64*/ + + } +diff --git a/runtime/flang/cnfg.h b/runtime/flang/cnfg.h +index 37571b94877..4f30164d440 100644 +--- a/runtime/flang/cnfg.h ++++ b/runtime/flang/cnfg.h +@@ -17,7 +17,7 @@ typedef struct { + int ftn_true; /* -1 ==> VAX; 1 => unix */ + } FIO_CNFG; + +-#ifdef WINNT ++#if defined(_WIN64) + + extern const char *__get_fio_cnfg_default_name(void); + extern int __get_fio_cnfg_true_mask(void); +diff --git a/runtime/flang/const.c b/runtime/flang/const.c +index e0fb057b976..fff4c3d999d 100644 +--- a/runtime/flang/const.c ++++ b/runtime/flang/const.c +@@ -125,14 +125,6 @@ __INT_T ENTCOMN(TYPE, type)[] = { + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43}; + +-#if defined(WINNT) && !defined(WIN64) && !defined(WIN32) +-char * +-__get_fort_type_addr(void) +-{ +- return (char *)ENTCOMN(TYPE, type); +-} +-#endif +- + /* universal constants */ + + long long int __fort_one[4] = {~0, ~0, ~0, ~0}; +@@ -422,7 +414,7 @@ __get_size_of(int* idx) + return __fort_size_of[*idx]; + } + +-#ifdef WINNT ++#if defined(_WIN64) + + /* pg access routines for data shared between windows dlls */ + +@@ -657,7 +649,7 @@ __get_fort_zed(void) + return __fort_zed; + } + +-#endif /* WINNT */ ++#endif /* _WIN64 */ + + void + __fort_init_consts() +@@ -765,7 +757,7 @@ __fort_init_consts() + /* + * Always emit the comms for non-windows systems. + */ +-#ifdef WINNT ++#if defined(_WIN64) + /* + * Emit the comms for win if pg.dll is not used -- PGDLL is defined + * if we need to revert to pg.dll. +diff --git a/runtime/flang/cplxf.c b/runtime/flang/cplxf.c +index 3b5103b9c4e..721ba755ba5 100644 +--- a/runtime/flang/cplxf.c ++++ b/runtime/flang/cplxf.c +@@ -10,7 +10,7 @@ + #include "stdioInterf.h" + #include "fioMacros.h" + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif +diff --git a/runtime/flang/curdir.c b/runtime/flang/curdir.c +index 4f6bebf8ac5..2c8dc429138 100644 +--- a/runtime/flang/curdir.c ++++ b/runtime/flang/curdir.c +@@ -6,7 +6,7 @@ + */ + + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif +@@ -18,7 +18,7 @@ + #define MAXPATHLEN 1024 + #endif + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define getcwd _getcwd + #endif + +@@ -89,7 +89,7 @@ void __fort_getdir(curdir) char *curdir; + + void __fort_gethostname(host) char *host; + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct utsname un; + #endif + const char *p; +@@ -97,7 +97,7 @@ void __fort_gethostname(host) char *host; + + p = __fort_getopt("-curhost"); + if (p == NULL) { +-#ifndef _WIN64 ++#if !defined(_WIN64) + s = uname(&un); /* get hostname */ + if (s == -1) { + __fort_abortp("uname"); +diff --git a/runtime/flang/dbesj03f.c b/runtime/flang/dbesj03f.c +index a2575abfe35..1c6daf31e13 100644 +--- a/runtime/flang/dbesj03f.c ++++ b/runtime/flang/dbesj03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j0 _j0 + #endif + +diff --git a/runtime/flang/dbesj13f.c b/runtime/flang/dbesj13f.c +index b4546ca9741..a2754cad4a3 100644 +--- a/runtime/flang/dbesj13f.c ++++ b/runtime/flang/dbesj13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j1 _j1 + #endif + +diff --git a/runtime/flang/dbesjn3f.c b/runtime/flang/dbesjn3f.c +index 0161cbb2115..b629455a72e 100644 +--- a/runtime/flang/dbesjn3f.c ++++ b/runtime/flang/dbesjn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define jn _jn + #endif + +diff --git a/runtime/flang/dbesy03f.c b/runtime/flang/dbesy03f.c +index 92bf37e4d72..5d83efd4c4a 100644 +--- a/runtime/flang/dbesy03f.c ++++ b/runtime/flang/dbesy03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y0 _y0 + #endif + +diff --git a/runtime/flang/dbesy13f.c b/runtime/flang/dbesy13f.c +index 778724c5bf5..19e6fcfc723 100644 +--- a/runtime/flang/dbesy13f.c ++++ b/runtime/flang/dbesy13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y1 _y1 + #endif + +diff --git a/runtime/flang/dbesyn3f.c b/runtime/flang/dbesyn3f.c +index 0e5f7495779..7ac77bb636b 100644 +--- a/runtime/flang/dbesyn3f.c ++++ b/runtime/flang/dbesyn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define yn _yn + #endif + +diff --git a/runtime/flang/delfilesqq3f.c b/runtime/flang/delfilesqq3f.c +index 9263df52976..2411d6c6d5b 100644 +--- a/runtime/flang/delfilesqq3f.c ++++ b/runtime/flang/delfilesqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* delfilesqq3f.c - Implements DFLIB delfilesqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + int ENT3F(DELFILESQQ, delfilesqq)(DCHAR(ffiles) DCLEN(ffiles)) + { +diff --git a/runtime/flang/descIntrins.c b/runtime/flang/descIntrins.c +index 61f6fdecb88..77edd3d3b6b 100644 +--- a/runtime/flang/descIntrins.c ++++ b/runtime/flang/descIntrins.c +@@ -279,7 +279,7 @@ ENTFTN(KINDEXX, kindexx_cr_nm) + + #endif + +-#if defined(WINNT) ++#if defined(_WIN64) + + /* functions here follow the msfortran/mscall conventions */ + +diff --git a/runtime/flang/drandm3f.c b/runtime/flang/drandm3f.c +index 411904e4c58..f217da1c924 100644 +--- a/runtime/flang/drandm3f.c ++++ b/runtime/flang/drandm3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + /* drand48, srand48 are not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/dtime3f.c b/runtime/flang/dtime3f.c +index 956a186ff32..a36b332847a 100644 +--- a/runtime/flang/dtime3f.c ++++ b/runtime/flang/dtime3f.c +@@ -14,14 +14,14 @@ + #include "ent3f.h" + + #define _LIBC_LIMITS_H_ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif + #include + #include + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #define CLK_TCK 10000000.0 + #else +diff --git a/runtime/flang/ent3f.h b/runtime/flang/ent3f.h +index 60822c3a643..e3b0589219b 100644 +--- a/runtime/flang/ent3f.h ++++ b/runtime/flang/ent3f.h +@@ -17,27 +17,13 @@ + #undef CADR + #undef CLEN + +-/* macros for entries */ +-#if defined(WINNT) && !defined(WIN64) && !defined(UXOBJS) +- +-#pragma global - x 121 0x20000 +-#define ENT3F(UC, LC) __attribute__((stdcall)) UC +-#define ENT3FSU(UC, LC) __attribute__((stdcall)) UC##_ +-/* macros to declare character arguments */ +-#define DCHAR(ARG) char *ARG##_adr, int ARG##_len +-#define DCLEN(ARG) +- +-#else +- + #define ENT3F(UC, LC) LC##_ + #define ENT3FSU(UC, LC) LC##__ + /* macros to declare character arguments */ + #define DCHAR(ARG) char *ARG##_adr + #define DCLEN(ARG) , int ARG##_len + +-#endif +- +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define j0 _j0 + #define j1 _j1 + #define jn _jn +diff --git a/runtime/flang/entry.c b/runtime/flang/entry.c +index 0ce5120251e..ec6eb096e2c 100644 +--- a/runtime/flang/entry.c ++++ b/runtime/flang/entry.c +@@ -16,7 +16,7 @@ + + WIN_API __INT_T LINENO[]; + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #endif + +@@ -44,7 +44,7 @@ static int __fort_trac_mflag; + static int __fort_prof_mflag; + int __fort_entry_mflag; + +-#ifdef WINNT ++#if defined(_WIN64) + /* pg access for dlls */ + char * + __get_fort_lineno_addr(void) +diff --git a/runtime/flang/etime3f.c b/runtime/flang/etime3f.c +index 90f2b937335..ad3378da5df 100644 +--- a/runtime/flang/etime3f.c ++++ b/runtime/flang/etime3f.c +@@ -15,7 +15,7 @@ + + /* Not implemented for WINNT */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif +@@ -24,7 +24,7 @@ + #include + + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #define CLK_TCK 10000000.0 + #else +diff --git a/runtime/flang/fdate3f.c b/runtime/flang/fdate3f.c +index fe82d98d4df..cf76749b002 100644 +--- a/runtime/flang/fdate3f.c ++++ b/runtime/flang/fdate3f.c +@@ -14,7 +14,7 @@ + #include + #include "utils3f.h" + +-#if !defined(WIN32) && !defined(WIN64) ++#if !defined(_WIN64) + WIN_MSVCRT_IMP char *WIN_CDECL ctime(const time_t *); + #endif + +diff --git a/runtime/flang/findfileqq3f.c b/runtime/flang/findfileqq3f.c +index 2b0a236576a..a4e81a1d6dd 100644 +--- a/runtime/flang/findfileqq3f.c ++++ b/runtime/flang/findfileqq3f.c +@@ -16,7 +16,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + extern char *__fstr2cstr(); + int ENT3F(FINDFILEQQ, findfileqq)(DCHAR(fname), DCHAR(fvarname), +diff --git a/runtime/flang/fioMacros.h b/runtime/flang/fioMacros.h +index d57a2cff71b..aaacc9742ae 100644 +--- a/runtime/flang/fioMacros.h ++++ b/runtime/flang/fioMacros.h +@@ -208,7 +208,7 @@ void __fort_set_second(double d); + #define __DIST_ENTRY_AWAIT(reqn) + #define __DIST_ENTRY_AWAIT_DONE(reqn) + +-#ifdef WINNT ++#if defined(_WIN64) + /* prototypes for HPF */ + + /* The PG compilers cannot yet create dlls that share data. For +@@ -1716,4 +1716,4 @@ void ENTF90(TEMPLATE1, template1)(F90_Desc *dd, __INT_T *p_flags, __INT_T *p_kin + void ENTF90(TEMPLATE2, template2)(F90_Desc *dd, __INT_T *p_flags, __INT_T *p_kind, __INT_T *p_len, __INT_T *p_l1, __INT_T *p_u1, __INT_T *p_l2, __INT_T *p_u2); + void ENTF90(TEMPLATE3, template3)(F90_Desc *dd, __INT_T *p_flags, __INT_T *p_kind, __INT_T *p_len, __INT_T *p_l1, __INT_T *p_u1, __INT_T *p_l2, __INT_T *p_u2, __INT_T *p_l3, __INT_T *p_u3); + +-#endif /*_PGHPF_H_*/ ++#endif /*_PGHPF_H_*/ +\ No newline at end of file +diff --git a/runtime/flang/fiodf.c b/runtime/flang/fiodf.c +index 07fbae8548d..1d6602dbcd2 100644 +--- a/runtime/flang/fiodf.c ++++ b/runtime/flang/fiodf.c +@@ -13,7 +13,7 @@ + + FIO_TBL fioFcbTbls = {0}; + +-#ifdef WINNT ++#if defined(_WIN64) + FIO_FCB * + __get_hpfio_fcbs(void) + { +diff --git a/runtime/flang/fmtwrite.c b/runtime/flang/fmtwrite.c +index e15ed57c2da..92e1eb68cfc 100644 +--- a/runtime/flang/fmtwrite.c ++++ b/runtime/flang/fmtwrite.c +@@ -2687,7 +2687,7 @@ fw_write_record(void) + f->nonadvance = FALSE; /* do it now */ + if (!(g->suppress_crlf)) { + /* append carriage return */ +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +diff --git a/runtime/flang/fork3f.c b/runtime/flang/fork3f.c +index bddb99108ac..4081cf4b589 100644 +--- a/runtime/flang/fork3f.c ++++ b/runtime/flang/fork3f.c +@@ -9,7 +9,7 @@ + + /* fork3f.c - Implements LIB3F fork subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -33,4 +33,4 @@ int ENT3F(FORK, fork)() + return pid; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/fortDt.h b/runtime/flang/fortDt.h +index 28e1eb0c675..75daa3dac09 100644 +--- a/runtime/flang/fortDt.h ++++ b/runtime/flang/fortDt.h +@@ -265,7 +265,7 @@ typedef __CPLX16_T __BIGCPLX_T; + + /* pointer-sized integer */ + +-#if defined(WIN64) ++#if defined(_WIN64) + + typedef long long __POINT_T; + +diff --git a/runtime/flang/fpcvt.c b/runtime/flang/fpcvt.c +index b72fba9ebca..59cedaeaa02 100644 +--- a/runtime/flang/fpcvt.c ++++ b/runtime/flang/fpcvt.c +@@ -7,7 +7,7 @@ + + #include + #include +-#if !defined(WIN64) ++#if !defined(_WIN64) + #include + #endif + #include "fioMacros.h" +@@ -731,7 +731,7 @@ __fortio_strtod(char *s, char **p) + * (0 is before first digit). *sign is sign. + */ + +-#if defined(WIN64) ++#if defined(_WIN64) + #define FE_TONEAREST 0 + #define FE_DOWNWARD 1024 + #define FE_UPWARD 2048 +diff --git a/runtime/flang/fstat3f.c b/runtime/flang/fstat3f.c +index ff3279753b1..b27c2e1e74b 100644 +--- a/runtime/flang/fstat3f.c ++++ b/runtime/flang/fstat3f.c +@@ -17,7 +17,7 @@ + + int ENT3F(FSTAT, fstat)(int *lu, int *statb) + { +-#ifdef _WIN64 ++#if defined(_WIN64) + struct _stat32 b; + char *p; + int i; +@@ -99,7 +99,7 @@ int ENT3F(FSTAT, fstat)(int *lu, int *statb) + statb[8] = b.st_atime; + statb[9] = b.st_mtime; + statb[10] = b.st_ctime; +-#if !defined(WINNT) ++#if !defined(_WIN64) + statb[11] = b.st_blksize; + statb[12] = b.st_blocks; + #else +diff --git a/runtime/flang/fstat643f.c b/runtime/flang/fstat643f.c +index 01e87acf74a..4cd52e55edd 100644 +--- a/runtime/flang/fstat643f.c ++++ b/runtime/flang/fstat643f.c +@@ -17,7 +17,7 @@ + + int ENT3F(FSTAT64, fstat64)(int *lu, long long *statb) + { +-#if defined(TARGET_WIN) || defined(WIN32) || defined(WIN64) ++#if defined(TARGET_WIN) || defined(_WIN64) + /* + * The __int64_t members in the _stat64 are 8-byte aligned, thus the + * st_size member is at offset 24. On WIN32, 64-bit ints are 4-byte +diff --git a/runtime/flang/fsync3f.c b/runtime/flang/fsync3f.c +index dad1748a88f..6eb3f739251 100644 +--- a/runtime/flang/fsync3f.c ++++ b/runtime/flang/fsync3f.c +@@ -20,7 +20,7 @@ void ENT3F(FSYNC, fsync)(lu) int *lu; + + f = __getfile3f(*lu); + if (f) +- #ifndef _WIN64 ++ #if !defined(_WIN64) + fsync(__io_getfd(f)); + #else + fflush(f); +diff --git a/runtime/flang/ftni64.h b/runtime/flang/ftni64.h +index ff57e3f8d30..d6660b55d0d 100644 +--- a/runtime/flang/ftni64.h ++++ b/runtime/flang/ftni64.h +@@ -46,7 +46,7 @@ typedef union { + I64_LSH(int64d.i) = l; \ + return int64d.lv; \ + } +-#elif defined(WIN64) ++#elif defined(_WIN64) + /* Someday, should only care if TM_I8 is defined */ + #define __I8RET_T long long + #define UTL_I_I64RET(m, l) \ +diff --git a/runtime/flang/fullpathqq3f.c b/runtime/flang/fullpathqq3f.c +index 29044e5f653..1cf6c2344a4 100644 +--- a/runtime/flang/fullpathqq3f.c ++++ b/runtime/flang/fullpathqq3f.c +@@ -15,7 +15,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + extern char *__fstr2cstr(); + int ENT3F(FULLPATHQQ, fullpathqq)(DCHAR(fname), +diff --git a/runtime/flang/gerror3f.c b/runtime/flang/gerror3f.c +index 9d5ee44aa60..b4c11446337 100644 +--- a/runtime/flang/gerror3f.c ++++ b/runtime/flang/gerror3f.c +@@ -17,7 +17,7 @@ + + #define Ftn_errmsg __fortio_errmsg + +-#if !defined(WIN64) && !defined(WIN32) ++#if !defined(_WIN64) + extern char *strerror(); /* SVR4 only ? */ + #endif + +diff --git a/runtime/flang/getcwd3f.c b/runtime/flang/getcwd3f.c +index f8462c801c5..ce5943313b7 100644 +--- a/runtime/flang/getcwd3f.c ++++ b/runtime/flang/getcwd3f.c +@@ -15,7 +15,7 @@ + #include "utils3f.h" + #include "mpalloc.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #define GETCWDM _getcwd /* getcwd deprecated in Windows in VC 2005 */ + #else + #define GETCWDM getcwd +diff --git a/runtime/flang/getdat3f.c b/runtime/flang/getdat3f.c +index 8f79a7a5473..6a90c9e3b93 100644 +--- a/runtime/flang/getdat3f.c ++++ b/runtime/flang/getdat3f.c +@@ -9,7 +9,7 @@ + + /* getdat3f.c - Implements getdat subroutine. */ + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + #include "ent3f.h" +diff --git a/runtime/flang/getdrivedirqq3f.c b/runtime/flang/getdrivedirqq3f.c +index 20069833821..c1e2214b413 100644 +--- a/runtime/flang/getdrivedirqq3f.c ++++ b/runtime/flang/getdrivedirqq3f.c +@@ -16,7 +16,7 @@ + #include "utils3f.h" + #include "mpalloc.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #define GETCWDM _getcwd /* getcwd deprecated in Windows in VC 2005 */ + #else + #define GETCWDM getcwd +diff --git a/runtime/flang/getfileinfoqq3f.c b/runtime/flang/getfileinfoqq3f.c +index 953adc8d859..bbed385430c 100644 +--- a/runtime/flang/getfileinfoqq3f.c ++++ b/runtime/flang/getfileinfoqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* getfileinfoqq3f.c - Implements DFLIB getfileinfoqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, + unsigned int *out); +diff --git a/runtime/flang/getfileinfoqqi83f.c b/runtime/flang/getfileinfoqqi83f.c +index 51dedfaed36..a4b9336c4d1 100644 +--- a/runtime/flang/getfileinfoqqi83f.c ++++ b/runtime/flang/getfileinfoqqi83f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* getfileinfoqq3f.c - Implements DFLIB getfileinfoqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -21,7 +21,7 @@ + #define FILE$LAST -2 + #define FILE$ERROR -3 + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, + unsigned int *out); +diff --git a/runtime/flang/getgid3f.c b/runtime/flang/getgid3f.c +index d5cd4373d2c..cf4ebe9559b 100644 +--- a/runtime/flang/getgid3f.c ++++ b/runtime/flang/getgid3f.c +@@ -9,11 +9,11 @@ + + /* getgid3f.c - Implements LIB3F getgid subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include + #include "ent3f.h" + + int ENT3F(GETGID, getgid)() { return getgid(); } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/getlog3f.c b/runtime/flang/getlog3f.c +index f52b2a58417..b3693adcdba 100644 +--- a/runtime/flang/getlog3f.c ++++ b/runtime/flang/getlog3f.c +@@ -9,7 +9,7 @@ + + /* getlog3f.c - Implements LIB3F getlog subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include "ent3f.h" + #include "utils3f.h" +@@ -24,4 +24,4 @@ void ENT3F(GETLOG, getlog)(DCHAR(nm) DCLEN(nm)) + __fcp_cstr(CADR(nm), CLEN(nm), p); + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/getpid3f.c b/runtime/flang/getpid3f.c +index f46d2061fae..c178db6038d 100644 +--- a/runtime/flang/getpid3f.c ++++ b/runtime/flang/getpid3f.c +@@ -10,7 +10,7 @@ + /* getpid3f.c - Implements LIB3F getpid subprogram. */ + + #include "ent3f.h" +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #else + #include +diff --git a/runtime/flang/gettim3f.c b/runtime/flang/gettim3f.c +index 122ea8ebb23..8ff554a9956 100644 +--- a/runtime/flang/gettim3f.c ++++ b/runtime/flang/gettim3f.c +@@ -9,7 +9,7 @@ + + /* gettim3f.c - Implements gettim subroutine. */ + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + #include "ent3f.h" +diff --git a/runtime/flang/getuid3f.c b/runtime/flang/getuid3f.c +index 105fd181b74..cb3ed4899ab 100644 +--- a/runtime/flang/getuid3f.c ++++ b/runtime/flang/getuid3f.c +@@ -9,11 +9,11 @@ + + /* getuid3f.c - Implements LIB3F getuid subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include "ent3f.h" + #include + + int ENT3F(GETUID, getuid)() { return getuid(); } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/getvolinfo3f.c b/runtime/flang/getvolinfo3f.c +index 7ddf734aadf..7e4ef2ef1eb 100644 +--- a/runtime/flang/getvolinfo3f.c ++++ b/runtime/flang/getvolinfo3f.c +@@ -18,18 +18,11 @@ + typedef char *LPSTR; + typedef int DWORD; + +-#if defined(WIN64) || defined(WIN32) +-#if defined(WIN64) ++#if defined(_WIN64) + typedef long long LDWORD; + extern int GetVolumeInformationA(); + #define ENTNAM(ss) _##ss + +-#else +-typedef long LDWORD; +-extern int __stdcall GetVolumeInformationA(); +-#define ENTNAM(ss) ss +-#endif +- + typedef LDWORD *LPDWORD; + + static void fill(LPSTR, int, int); +diff --git a/runtime/flang/global.h b/runtime/flang/global.h +index 8c93a23a52c..9fa68104ac4 100644 +--- a/runtime/flang/global.h ++++ b/runtime/flang/global.h +@@ -363,11 +363,7 @@ extern int __fortio_check_format(void); + extern int __fortio_eor_crlf(void); + extern VOID __fortio_fmtinit(void); + extern VOID __fortio_fmtend(void); +-#if defined(WINNT) +-#define EOR_CRLF 1 +-#else + #define EOR_CRLF __fortio_eor_crlf() +-#endif + extern int __fortio_no_minus_zero(void); + int __fortio_new_fp_formatter(void); + +diff --git a/runtime/flang/hand.c b/runtime/flang/hand.c +index 60b1a12f99a..91e639a7d0d 100644 +--- a/runtime/flang/hand.c ++++ b/runtime/flang/hand.c +@@ -5,12 +5,12 @@ + * + */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include "stdioInterf.h" + #include "fioMacros.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #endif + +@@ -85,7 +85,7 @@ static void sighand(s) int s; + + lcpu = __fort_myprocnum(); + __fort_psignal(lcpu, s); /* print message */ +-#if !defined(WIN64) && !defined(WIN32) ++#if !defined(_WIN64) + sleep(1); /* wait for message to clear */ + #endif + __fort_abort(NULL); /* abort */ +diff --git a/runtime/flang/heapinit.c b/runtime/flang/heapinit.c +index fdbbcb5249d..9ae1866f9e7 100644 +--- a/runtime/flang/heapinit.c ++++ b/runtime/flang/heapinit.c +@@ -30,14 +30,14 @@ int val; + void (*save)(); + int *pi; + +-#ifndef _WIN64 ++#if !defined(_WIN64) + save = signal(SIGBUS, sighand); + #endif + pi = (int *)beg; + while (pi < (int *)end) { + *pi++ = val; + } +-#ifndef _WIN64 ++#if !defined(_WIN64) + signal(SIGBUS, save); + #endif + } +diff --git a/runtime/flang/hostnm3f.c b/runtime/flang/hostnm3f.c +index a4a4c3e93f8..ff4af930971 100644 +--- a/runtime/flang/hostnm3f.c ++++ b/runtime/flang/hostnm3f.c +@@ -9,7 +9,7 @@ + + /* hostnm3f.c - Implements LIB3F hostnm subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -43,4 +43,4 @@ int ENT3F(HOSTNM, hostnm)(DCHAR(nm) DCLEN(nm)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/init.c b/runtime/flang/init.c +index 63f59da979d..e8f0b6f1f9d 100644 +--- a/runtime/flang/init.c ++++ b/runtime/flang/init.c +@@ -18,7 +18,7 @@ static int tid = 0; + + const char *__fort_transnam = "rpm1"; + +-#ifdef WINNT ++#if defined(_WIN64) + + /* pg access routines for data shared between windows dlls */ + +diff --git a/runtime/flang/initpar.c b/runtime/flang/initpar.c +index b02b502e96d..2b4f212c144 100644 +--- a/runtime/flang/initpar.c ++++ b/runtime/flang/initpar.c +@@ -15,7 +15,7 @@ + #include + #include + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + +@@ -89,8 +89,7 @@ __fort_ncpus() + return __fort_tcpus; + } + +-#if defined(WINNT) +-#if !defined(WIN64) && !defined(WIN32) ++#if defined(_WIN64) + __INT_T *CORMEM; + + /* special argument pointer access routines */ +@@ -152,7 +151,6 @@ __get_fort_np_addr(void) + { + return (char *)ENTCOMN(NP, np); + } +-#endif /* !WIN64 || !WIN32 */ + + /* access routines for data shared between windows dlls */ + +@@ -300,7 +298,7 @@ __set_fort_tids_elem(int idx, int val) + __fort_tids[idx] = val; + } + +-#endif /* WINNT */ ++#endif /* _WIN64 */ + + int + __fort_getioproc() +@@ -848,4 +846,3 @@ f90_compiled() + inited.atexit = 1; + } + } +- +diff --git a/runtime/flang/inquire.c b/runtime/flang/inquire.c +index 396c876992d..7a3f6251941 100644 +--- a/runtime/flang/inquire.c ++++ b/runtime/flang/inquire.c +@@ -16,7 +16,7 @@ + #include "global.h" + #include "async.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define access _access + #endif + +diff --git a/runtime/flang/io3f.h b/runtime/flang/io3f.h +index 9071dcac9e3..1fcd08ba880 100644 +--- a/runtime/flang/io3f.h ++++ b/runtime/flang/io3f.h +@@ -16,11 +16,11 @@ + #define __fio_close(f, s) __fortio_close(f, s) + #define __fio_find_unit(u) __fortio_find_unit(u) + #define fio_fileno(f) __fort_getfd(f) +-#ifndef WINNT ++#if !defined(_WIN64) + #define pgi_fio fioFcbTbl + #endif + +-#if defined(WINNT) ++#if defined(_WIN64) + #define __PC_DOS 1 + #else + #define __PC_DOS 0 +diff --git a/runtime/flang/irand3f.c b/runtime/flang/irand3f.c +index 619f5c8720a..28c9daebc66 100644 +--- a/runtime/flang/irand3f.c ++++ b/runtime/flang/irand3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + extern int rand(); +-#ifdef WIN64 ++#if defined(_WIN64) + int ENT3F(IRAND1, irand1)() { return rand(); } + int ENT3F(IRAND2, irand2)(int *flag) + { +diff --git a/runtime/flang/irandm3f.c b/runtime/flang/irandm3f.c +index 51c64786552..5376fac050a 100644 +--- a/runtime/flang/irandm3f.c ++++ b/runtime/flang/irandm3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef WINNT ++#if defined(_WIN64) + + int ENT3F(IRANDM, irandm)(int *flag) + { +diff --git a/runtime/flang/kill3f.c b/runtime/flang/kill3f.c +index 860a5d634e7..d6153345079 100644 +--- a/runtime/flang/kill3f.c ++++ b/runtime/flang/kill3f.c +@@ -9,7 +9,7 @@ + + /* kill3f.c - Implements LIB3F kill subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #define POSIX 1 + #include +@@ -29,4 +29,4 @@ int *sig; + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/ldread.c b/runtime/flang/ldread.c +index dbaf1e55930..cf1bfa5eea4 100644 +--- a/runtime/flang/ldread.c ++++ b/runtime/flang/ldread.c +@@ -1707,7 +1707,7 @@ skip_record(void) + } + return __io_errno(); + } +-#if defined(WINNT) ++#if defined(_WIN64) + if (ch == '\r') { + ch = __io_fgetc(fcb->fp); + if (ch == '\n') +diff --git a/runtime/flang/ldwrite.c b/runtime/flang/ldwrite.c +index 1dbfc37d259..565a798af4d 100644 +--- a/runtime/flang/ldwrite.c ++++ b/runtime/flang/ldwrite.c +@@ -869,7 +869,7 @@ write_record(void) + return __io_errno(); + } + } else { /* sequential write: append carriage return */ +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(fcb->fp)) + if (FWRITE("\r", 1, 1, fcb->fp) != 1) + return __io_errno(); +diff --git a/runtime/flang/link3f.c b/runtime/flang/link3f.c +index 7ac8b360010..2f0f7f83ca9 100644 +--- a/runtime/flang/link3f.c ++++ b/runtime/flang/link3f.c +@@ -9,7 +9,7 @@ + + /* link3f.c - Implements LIB3F link subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -35,4 +35,4 @@ int ENT3F(LINK, link)(DCHAR(n1), DCHAR(n2) DCLEN(n1) DCLEN(n2)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/lstat3f.c b/runtime/flang/lstat3f.c +index 3fe47e94822..ce3becada72 100644 +--- a/runtime/flang/lstat3f.c ++++ b/runtime/flang/lstat3f.c +@@ -9,7 +9,7 @@ + + /* lstat3f.c - Implements LIB3F lstat subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include +@@ -45,4 +45,4 @@ int ENT3F(LSTAT, lstat)(DCHAR(nm), int *statb DCLEN(nm)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/lstat643f.c b/runtime/flang/lstat643f.c +index d912bdbb3dc..ee821eb2679 100644 +--- a/runtime/flang/lstat643f.c ++++ b/runtime/flang/lstat643f.c +@@ -9,7 +9,7 @@ + + /* lstat3f.c - Implements 64-bit LIB3F lstat subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include +@@ -45,4 +45,4 @@ int ENT3F(LSTAT64, lstat64)(DCHAR(nm), long long *statb DCLEN(nm)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/map.c b/runtime/flang/map.c +index 0decde62461..940029237f4 100644 +--- a/runtime/flang/map.c ++++ b/runtime/flang/map.c +@@ -9,7 +9,7 @@ + #include "fioMacros.h" + #include + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + +diff --git a/runtime/flang/mclock3f.c b/runtime/flang/mclock3f.c +index 49ce09606c6..ecabbf8bdca 100644 +--- a/runtime/flang/mclock3f.c ++++ b/runtime/flang/mclock3f.c +@@ -12,7 +12,7 @@ + + /* assumes the Unix times system call */ + +-#if defined(WINNT) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/misc.c b/runtime/flang/misc.c +index d3d88873c5a..ae0ecbffef3 100644 +--- a/runtime/flang/misc.c ++++ b/runtime/flang/misc.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(PARAMID) && !defined(WINNT) ++#if !defined(PARAMID) && !defined(_WIN64) + #include + #include + #include +diff --git a/runtime/flang/miscsup_com.c b/runtime/flang/miscsup_com.c +index 09d018e32c6..9b300463dcd 100644 +--- a/runtime/flang/miscsup_com.c ++++ b/runtime/flang/miscsup_com.c +@@ -15,7 +15,7 @@ + + #include + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #else +diff --git a/runtime/flang/nmlwrite.c b/runtime/flang/nmlwrite.c +index 34dde490592..e12f1e6e60b 100644 +--- a/runtime/flang/nmlwrite.c ++++ b/runtime/flang/nmlwrite.c +@@ -306,12 +306,12 @@ ENTCRF90IO(NMLW_INTERN_INIT, nmlw_intern_init)( + static int + emit_eol(void) + { +-#if defined(WINNT) ++#if defined(_WIN64) + int ret_err; + #endif + + if (!internal_file) { +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) { + ret_err = write_char('\r'); + if (ret_err) +diff --git a/runtime/flang/open.c b/runtime/flang/open.c +index 3ad20dea42c..b0efac293f2 100644 +--- a/runtime/flang/open.c ++++ b/runtime/flang/open.c +@@ -20,7 +20,7 @@ + #include "async.h" + #include + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define access _access + #define unlink _unlink + #endif +@@ -94,7 +94,7 @@ __fortio_open(int unit, int action_flag, int status_flag, int dispose_flag, + for (i = 0; i < namelen; i++) + filename[i] = name[i]; + filename[namelen] = '\0'; +-#if defined(WINNT) ++#if defined(_WIN64) + if (filename[0] == '/' && filename[1] == '/' && filename[3] == '/') { + /* convert posix format to win32 format */ + filename[0] = filename[2]; /* drive letter */ +diff --git a/runtime/flang/packtimeqq3f.c b/runtime/flang/packtimeqq3f.c +index 3e665802487..c89a5ee7b15 100644 +--- a/runtime/flang/packtimeqq3f.c ++++ b/runtime/flang/packtimeqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* packtimeqq3f.c - Implements DFLIB packtimeqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, + unsigned int *out); +diff --git a/runtime/flang/perror3f.c b/runtime/flang/perror3f.c +index 2450a115161..f8fca431c49 100644 +--- a/runtime/flang/perror3f.c ++++ b/runtime/flang/perror3f.c +@@ -13,7 +13,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if !defined(WIN64) && !defined(WIN32) ++#if !defined(_WIN64) + extern char *strerror(); /* SVR4 only ? */ + #endif + extern FILE *__getfile3f(); +diff --git a/runtime/flang/rand3f.c b/runtime/flang/rand3f.c +index a0940fe1818..c7edd5ddea8 100644 +--- a/runtime/flang/rand3f.c ++++ b/runtime/flang/rand3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + /* drand48 is not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/random3f.c b/runtime/flang/random3f.c +index f8d23fe10f5..ba2820f3999 100644 +--- a/runtime/flang/random3f.c ++++ b/runtime/flang/random3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + /* drand48, srand48 are not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/rewind.c b/runtime/flang/rewind.c +index 66cc87df2e2..1030d77bcef 100644 +--- a/runtime/flang/rewind.c ++++ b/runtime/flang/rewind.c +@@ -44,7 +44,7 @@ _f90io_rewind(__INT_T *unit, __INT_T *bitv, __INT_T *iostat) + + if (f->nonadvance) { + f->nonadvance = FALSE; +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +diff --git a/runtime/flang/setfileaccessqq3f.c b/runtime/flang/setfileaccessqq3f.c +index 92441b67846..2f7b2e92c9c 100644 +--- a/runtime/flang/setfileaccessqq3f.c ++++ b/runtime/flang/setfileaccessqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* setfileaccessqq3f.c - Implements DFLIB setfileaccessqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -22,7 +22,7 @@ + #define FILE$ERROR -3 + #define FILE$CURTIME -1 + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + + int ENT3F(SETFILEACCESSQQ, setfileaccessqq)(DCHAR(ffile), +diff --git a/runtime/flang/setfiletimeqq3f.c b/runtime/flang/setfiletimeqq3f.c +index efcbe5a7d91..d19be2069ff 100644 +--- a/runtime/flang/setfiletimeqq3f.c ++++ b/runtime/flang/setfiletimeqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* setfiletimeqq3f.c - Implements DFLIB setfiletimeqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -22,7 +22,7 @@ + #define FILE$ERROR -3 + #define FILE$CURTIME -1 + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __UnpackTime(unsigned int secsSince1970, ULARGE_INTEGER *fileTime); + extern int __GETFILEINFOQQ(DCHAR(ffiles), char *buffer, +diff --git a/runtime/flang/signalqq3f.c b/runtime/flang/signalqq3f.c +index 29d04b539c6..038dfbce8b0 100644 +--- a/runtime/flang/signalqq3f.c ++++ b/runtime/flang/signalqq3f.c +@@ -14,7 +14,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || !defined(WINNT) ++#if defined(_WIN64) + + #define LONGINTSIZE unsigned long long + +@@ -30,4 +30,4 @@ ENT3F(SIGNALQQ, signalqq)(short *signum, void (*proc)(int)) + return (LONGINTSIZE)p; + } + +-#endif /* WIN64 or !WINNT */ ++#endif /* _WIN64 */ +diff --git a/runtime/flang/sleep3f.c b/runtime/flang/sleep3f.c +index 9f501998a3a..2ffbc14d5d7 100644 +--- a/runtime/flang/sleep3f.c ++++ b/runtime/flang/sleep3f.c +@@ -9,12 +9,12 @@ + + /* sleep3f.c - Implements LIB3F sleep subprogram. */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/sleepqq3f.c b/runtime/flang/sleepqq3f.c +index c74b71f1214..836971faa29 100644 +--- a/runtime/flang/sleepqq3f.c ++++ b/runtime/flang/sleepqq3f.c +@@ -9,12 +9,12 @@ + + /* sleep3f.c - Implements DFPORT SLEEPQQ subprogram. */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/splitpathqq3f.c b/runtime/flang/splitpathqq3f.c +index 1a479034d90..dd43a6549a1 100644 +--- a/runtime/flang/splitpathqq3f.c ++++ b/runtime/flang/splitpathqq3f.c +@@ -15,7 +15,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + extern char *__fstr2cstr(); + int ENT3F(SPLITPATHQQ, splitpathqq)(DCHAR(fpath), DCHAR(fdrive), DCHAR(fdir), +diff --git a/runtime/flang/srand3f.c b/runtime/flang/srand3f.c +index 1e93c4d188d..e112831c3fa 100644 +--- a/runtime/flang/srand3f.c ++++ b/runtime/flang/srand3f.c +@@ -13,7 +13,7 @@ + #include "ent3f.h" + + /* srand48 is not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + void ENT3F(SRAND1, srand1)(int *iseed) { srand(*iseed); } + +diff --git a/runtime/flang/stat.c b/runtime/flang/stat.c +index 34ea477590a..23a03282db3 100644 +--- a/runtime/flang/stat.c ++++ b/runtime/flang/stat.c +@@ -13,7 +13,7 @@ + #include + #include + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #endif + +diff --git a/runtime/flang/stat3f.c b/runtime/flang/stat3f.c +index 2fe309e510c..655baad06d5 100644 +--- a/runtime/flang/stat3f.c ++++ b/runtime/flang/stat3f.c +@@ -19,7 +19,7 @@ extern void __cstr_free(); + + int ENT3F(STAT, stat)(DCHAR(nm), int *statb DCLEN(nm)) + { +-#ifdef _WIN64 ++#if defined(_WIN64) + struct _stat32 b; + char *p; + int i; +@@ -62,7 +62,7 @@ int ENT3F(STAT, stat)(DCHAR(nm), int *statb DCLEN(nm)) + statb[8] = b.st_atime; + statb[9] = b.st_mtime; + statb[10] = b.st_ctime; +-#if !defined(WINNT) ++#if !defined(_WIN64) + statb[11] = b.st_blksize; + statb[12] = b.st_blocks; + #else +diff --git a/runtime/flang/stat643f.c b/runtime/flang/stat643f.c +index 360743b71e1..a47fcbcf595 100644 +--- a/runtime/flang/stat643f.c ++++ b/runtime/flang/stat643f.c +@@ -19,7 +19,7 @@ extern void __cstr_free(); + + int ENT3F(STAT64, stat64)(DCHAR(nm), long long *statb DCLEN(nm)) + { +-#if defined(TARGET_WIN) || defined(WIN32) || defined(WIN64) ++#if defined(TARGET_WIN) || defined(_WIN64) + /* + * The __int64_t members in the _stat64 are 8-byte aligned, thus the + * st_size member is at offset 24. On WIN32, 64-bit ints are 4-byte +diff --git a/runtime/flang/stat_linux.c b/runtime/flang/stat_linux.c +index 2b696791621..a4f3d34c0b8 100644 +--- a/runtime/flang/stat_linux.c ++++ b/runtime/flang/stat_linux.c +@@ -9,7 +9,7 @@ + * \brief Fill in statistics structure (Linux version) + */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #include +@@ -36,7 +36,7 @@ __fort_setarg(void) + // TODO: Implement functions for WIN32 + static void nodename(s) char *s; + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct utsname u0; + + uname(&u0); +@@ -46,7 +46,7 @@ static void nodename(s) char *s; + + void __fort_gettb(t) struct tb *t; + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct timeval tv0; + struct timezone tz0; + struct rusage rs0, rc0; +@@ -102,7 +102,7 @@ static double first = 0.0; + double + __fort_second() + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct timeval v; + struct timezone t; + double d; +diff --git a/runtime/flang/symlnk3f.c b/runtime/flang/symlnk3f.c +index af8e2c534e8..e79713e1d5e 100644 +--- a/runtime/flang/symlnk3f.c ++++ b/runtime/flang/symlnk3f.c +@@ -9,7 +9,7 @@ + + /* symlnk3f.c - Implements LIB3F symlnk subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include "io3f.h" + #include "ent3f.h" +@@ -34,4 +34,4 @@ int ENT3F(SYMLNK, symlnk)(DCHAR(n1), DCHAR(n2) DCLEN(n1) DCLEN(n2)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/time3f.c b/runtime/flang/time3f.c +index becd13a6866..e3f46d21373 100644 +--- a/runtime/flang/time3f.c ++++ b/runtime/flang/time3f.c +@@ -12,7 +12,7 @@ + #include + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #endif + +diff --git a/runtime/flang/timef3f.c b/runtime/flang/timef3f.c +index d6e928b54c2..ec5e9601779 100644 +--- a/runtime/flang/timef3f.c ++++ b/runtime/flang/timef3f.c +@@ -13,7 +13,7 @@ + /* how do we do this for WINNT */ + #include "ent3f.h" + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #define _LIBC_LIMITS_H_ + #include + #include +@@ -21,7 +21,7 @@ + #include + #include + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #endif + +diff --git a/runtime/flang/times3f.c b/runtime/flang/times3f.c +index 352f3334f42..aebe2bc8a51 100644 +--- a/runtime/flang/times3f.c ++++ b/runtime/flang/times3f.c +@@ -9,7 +9,7 @@ + + /* times3f.c - Implements LIB3F times subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include + #include "io3f.h" +@@ -27,4 +27,4 @@ int ENT3F(TIMES, times)(int *buff) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/ttynam3f.c b/runtime/flang/ttynam3f.c +index 79e75b7612f..8369d2f73f1 100644 +--- a/runtime/flang/ttynam3f.c ++++ b/runtime/flang/ttynam3f.c +@@ -9,7 +9,7 @@ + + /* ttynam3f.c - Implements LIB3F ttynam subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -48,4 +48,4 @@ void ENT3F(TTYNAM, ttynam)(DCHAR(nm) DCLEN(nm), int *lu) + return; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/type.c b/runtime/flang/type.c +index a0b55a0f096..1560a524e16 100644 +--- a/runtime/flang/type.c ++++ b/runtime/flang/type.c +@@ -1076,7 +1076,7 @@ get_source_and_dest_sizes(F90_Desc *ad, F90_Desc *bd, int *dest_sz, int *src_sz, + } + } else if (bd && !flag && ISSCALAR(bd) && bd->tag != __POLY && + bd->tag != __STR && bd->tag < __NTYPES) { +-#if defined(WINNT) ++#if defined(_WIN64) + *src_sz = __get_fort_size_of(bd->tag); + #else + *src_sz = __fort_size_of[bd->tag]; +diff --git a/runtime/flang/unpacktimeqq3f.c b/runtime/flang/unpacktimeqq3f.c +index f9a7f080ec0..92daf4b17e6 100644 +--- a/runtime/flang/unpacktimeqq3f.c ++++ b/runtime/flang/unpacktimeqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* unpacktimeqq3f.c - Implements DFLIB packtimeqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -18,7 +18,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __UnpackTime(unsigned int secsSince1970, ULARGE_INTEGER *fileTime); + +diff --git a/runtime/flang/usrio_smp.c b/runtime/flang/usrio_smp.c +index fd21e37a7d9..bd7eef48ab2 100644 +--- a/runtime/flang/usrio_smp.c ++++ b/runtime/flang/usrio_smp.c +@@ -10,7 +10,7 @@ + * a common system buffer pool and that the buffers are kept consistent. + * It also works for some other systems such as the Paragon. + */ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + + #include +diff --git a/runtime/flang/utils.c b/runtime/flang/utils.c +index 63ce88ccae0..04e12165a87 100644 +--- a/runtime/flang/utils.c ++++ b/runtime/flang/utils.c +@@ -9,7 +9,7 @@ + * \brief Utility functions for fortran i.o. + */ + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include + #include + #include +@@ -594,7 +594,7 @@ __fortio_trunc(FIO_FCB *p, seekoffx_t length) + return 0; + } + +-#ifdef _WIN64 ++#if defined(_WIN64) + void + sincos(double x, double *sine, double *cosine) { + *sine = sin(x); +diff --git a/runtime/flang/utils3f.c b/runtime/flang/utils3f.c +index 1cc588b8858..f19f38edf1b 100644 +--- a/runtime/flang/utils3f.c ++++ b/runtime/flang/utils3f.c +@@ -6,7 +6,7 @@ + */ + + /* */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include "io3f.h" +@@ -109,7 +109,7 @@ extern FILE *__getfile3f(unit) int unit; + } + } + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + void + __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, unsigned int *out) + { +diff --git a/runtime/flang/utilsi64.c b/runtime/flang/utilsi64.c +index 0205a78803f..fd9b0cee9ef 100644 +--- a/runtime/flang/utilsi64.c ++++ b/runtime/flang/utilsi64.c +@@ -26,7 +26,7 @@ extern int __fort_atoxi64(); + extern void __fort_i64toax(); + + /* has native support for 8-byte integers*/ +-#if !defined(WIN64) ++#if !defined(_WIN64) + typedef long I8_T; + typedef unsigned long UI8_T; + #else +diff --git a/runtime/flang/wait.c b/runtime/flang/wait.c +index 8b3676a9ea4..4488b170650 100644 +--- a/runtime/flang/wait.c ++++ b/runtime/flang/wait.c +@@ -14,7 +14,7 @@ + #include "global.h" + #include "async.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define access _access + #endif + +diff --git a/runtime/flang/wait3f.c b/runtime/flang/wait3f.c +index c09badd9ae3..21284fef35f 100644 +--- a/runtime/flang/wait3f.c ++++ b/runtime/flang/wait3f.c +@@ -9,7 +9,7 @@ + + /* wait3f.c - Implements LIB3F wait subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include + #include +@@ -26,4 +26,4 @@ int ENT3F(WAIT, wait)(int *st) + return wait(wst); + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/xfer_heap_dum.c b/runtime/flang/xfer_heap_dum.c +index 562f6d6ec23..06389b18e63 100644 +--- a/runtime/flang/xfer_heap_dum.c ++++ b/runtime/flang/xfer_heap_dum.c +@@ -16,7 +16,7 @@ extern char *sbrk(int); + char * + __fort_sbrk(int len) + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + return (sbrk(len)); + #endif + } diff --git a/ports/flang-fortran-runtime/1165.diff b/ports/flang-fortran-runtime/1165.diff new file mode 100644 index 00000000000000..ea26cdeb0a1cdb --- /dev/null +++ b/ports/flang-fortran-runtime/1165.diff @@ -0,0 +1,158 @@ +diff --git a/runtime/flangrti/iostdinit.c b/runtime/flangrti/iostdinit.c +index 00b101f3c1c..41061f2a3e3 100644 +--- a/runtime/flangrti/iostdinit.c ++++ b/runtime/flangrti/iostdinit.c +@@ -6,7 +6,7 @@ + */ + + #include +-#if !defined(WINNT) && !defined(ST100) ++#if !defined(_WIN64) && !defined(ST100) + #include + #include + #endif +@@ -15,7 +15,7 @@ + + /* get environ */ + +-#if defined(WIN64) ++#if defined(_WIN64) + char * * * __cdecl __p__environ(void); + /* + * enclose _fileno within parens to ensure calling the function rather than +@@ -24,7 +24,7 @@ char * * * __cdecl __p__environ(void); + #define fileno(x) (_fileno)(x) + #endif + +-#if defined(WINNT) ++#if defined(_WIN64) + #include + extern char **environ; + #elif defined(TARGET_OSX) +@@ -83,7 +83,7 @@ __io_stderr(void) + + /* convert macros to routines */ + +-#if defined(TARGET_WIN) || defined(WIN32) ++#if defined(TARGET_WIN) || defined(_WIN64) + #include + int + __io_fgetc(FILE *p) +@@ -169,13 +169,9 @@ __io_isatty(int fd) + int + __io_binary_mode(void *fp) + { +-#if defined(WINNT) ++#if defined(_WIN64) + #include + +-#if defined(WIN64) || defined(WIN32) +-#define O_BINARY _O_BINARY +-#endif +- + int mode; + + mode = setmode(fileno((FILE *)fp), O_BINARY); +@@ -196,13 +192,9 @@ __io_binary_mode(void *fp) + int + __io_setmode_binary(void *fp) + { +-#if defined(WINNT) ++#if defined(_WIN64) + #include + +-#if defined(WIN64) || defined(WIN32) +-#define O_BINARY _O_BINARY +-#endif +- + int mode; + + return setmode(fileno((FILE *)fp), O_BINARY); +@@ -214,7 +206,7 @@ __io_setmode_binary(void *fp) + int + __io_ispipe(void *f) + { +-#if !defined(WINNT) && !defined(ST100) ++#if !defined(_WIN64) && !defined(ST100) + struct stat st; + + fstat(fileno((FILE *)f), &st); +@@ -254,7 +246,7 @@ __io_fwrite(char *ptr, size_t size, size_t nitems, FILE *stream) + #endif + } + +-#if defined(WINNT) || defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #if defined(PGI_CRTDLL) + extern long *_imp___timezone_dll; /* for crtdll.dll */ +@@ -263,7 +255,7 @@ extern long *_imp___timezone_dll; /* for crtdll.dll */ + #define timezone _timezone /* cygnus, timezone is usually a function */ + #endif + +-#elif !defined(DEC) && !defined(IBM) && !defined(ST100_V1_2) && !defined(OSX86) /* !defined(WINNT) */ ++#elif !defined(DEC) && !defined(IBM) && !defined(ST100_V1_2) && !defined(OSX86) /* !defined(_WIN64) */ + extern time_t timezone; /* for the rest */ + #endif + +@@ -272,14 +264,14 @@ __io_timezone(void *tm) + { + #if defined(SUN4) || defined(PPC) || defined(OSX86) + return ((struct tm *)tm)->tm_gmtoff; +-#elif defined(WINNT) || defined(WIN64) || defined(WIN32) ++#elif defined(_WIN64) + return (0); + #else + return -(timezone - (((struct tm *)tm)->tm_isdst ? 3600 : 0)); + #endif + } + +-#if (defined(WIN32) || defined(WIN64)) ++#if defined(_WIN64) + /* wrappers for stderr, stdin, stdout : include + pgc/port/pgi_iobuf.h after stdio.h + */ +diff --git a/runtime/flangrti/tempnam.c b/runtime/flangrti/tempnam.c +index 7eff4860431..ddc5c8c607f 100644 +--- a/runtime/flangrti/tempnam.c ++++ b/runtime/flangrti/tempnam.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(WINNT) && !defined(USETEMPNAM) /* { */ ++#if !defined(_WIN64) && !defined(USETEMPNAM) /* { */ + #include + #include + +@@ -146,7 +146,7 @@ extern char *tempnam(char *, char *); + char * + __io_tempnam(char *dir, char *pfx) + { +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + return (_tempnam(dir, pfx)); + #else + return (tempnam(dir, pfx)); +diff --git a/runtime/flangrti/trace.c b/runtime/flangrti/trace.c +index dcb33b77f3a..6ae0be90556 100644 +--- a/runtime/flangrti/trace.c ++++ b/runtime/flangrti/trace.c +@@ -56,7 +56,7 @@ dbg_stop_before_exit(void) + * 3 - traceback (signal) + */ + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define getpid _getpid + #define _Exit _exit + #endif +@@ -133,7 +133,7 @@ __abort_init(char *path) + int n; + int neg; + +-#if defined(WINNT) ++#if defined(_WIN64) + fn = path; + #endif + p = getenv("TRACE_TERM"); diff --git a/ports/flang-fortran-runtime/1166.diff b/ports/flang-fortran-runtime/1166.diff new file mode 100644 index 00000000000000..1700e54a43c703 --- /dev/null +++ b/ports/flang-fortran-runtime/1166.diff @@ -0,0 +1,50 @@ +diff --git a/runtime/flangmain/flangmain.c b/runtime/flangmain/flangmain.c +index d564d2696f4e..5645990e93ec 100644 +--- a/runtime/flangmain/flangmain.c ++++ b/runtime/flangmain/flangmain.c +@@ -17,30 +17,6 @@ extern char **__io_environ(); + extern void __io_set_argc(int); + extern void __io_set_argv(char **); + +-#if defined(PGDLL) && defined(WINNT) && !defined(WIN64) +-struct { +- char *pghpf_01p; +- char *pghpf_02p; +- char *pghpf_03p; +- char *pghpf_04p; +-} pghpf_0; +- +-struct { +- char *pghpf_0cp; +-} pghpf_0c; +- +-struct { +- char *pg_typep; +-} pg_type; +- +-char *__get_fort_01_addr(void); +-char *__get_fort_02_addr(void); +-char *__get_fort_03_addr(void); +-char *__get_fort_04_addr(void); +-char *__get_fort_0c_addr(void); +-char *__get_fort_type_addr(void); +-#endif +- + int main(int argc, char** argv) + { + int i = 0; +@@ -48,14 +24,6 @@ int main(int argc, char** argv) + __io_set_argc(argc); + __io_set_argv(argv); + +-#if defined(PGDLL) && defined(WINNT) && !defined(WIN64) +- pghpf_0.pghpf_01p = __get_fort_01_addr(); +- pghpf_0.pghpf_02p = __get_fort_02_addr(); +- pghpf_0.pghpf_03p = __get_fort_03_addr(); +- pghpf_0.pghpf_04p = __get_fort_04_addr(); +- pghpf_0c.pghpf_0cp = __get_fort_0c_addr(); +- pg_type.pg_typep = __get_fort_type_addr(); +-#endif + MAIN_(argc, argv, __io_environ()); + ENTF90(EXIT, exit)(&i); + } diff --git a/ports/flang-fortran-runtime/1168.diff b/ports/flang-fortran-runtime/1168.diff new file mode 100644 index 00000000000000..88be181a297147 --- /dev/null +++ b/ports/flang-fortran-runtime/1168.diff @@ -0,0 +1,13 @@ +diff --git a/runtime/ompstub/init_nomp.c b/runtime/ompstub/init_nomp.c +index 8c99f5da741..310b4df0d3d 100644 +--- a/runtime/ompstub/init_nomp.c ++++ b/runtime/ompstub/init_nomp.c +@@ -15,7 +15,7 @@ + * is available in pgc lib. + */ + +-#if !defined(WIN64) ++#if !defined(_WIN64) + /* get max avail cpus */ + + int diff --git a/ports/flang-fortran-runtime/1177.diff b/ports/flang-fortran-runtime/1177.diff new file mode 100644 index 00000000000000..6c79ebe4cc849e --- /dev/null +++ b/ports/flang-fortran-runtime/1177.diff @@ -0,0 +1,18 @@ +diff --git a/tools/flang2/flang2exe/llassem.cpp b/tools/flang2/flang2exe/llassem.cpp +index 7c15e7338cb..6c6a953fc79 100644 +--- a/tools/flang2/flang2exe/llassem.cpp ++++ b/tools/flang2/flang2exe/llassem.cpp +@@ -1164,8 +1164,13 @@ assemble_end(void) + tdefsym = find_ag(gname); + typed = AG_TYPENAME(tdefsym); + fprintf(ASMFIL, "%%struct%s = type < { %s } > \n", name, typed); ++#if defined (_WIN64) ++ fprintf(ASMFIL, "@%s = %s global %%struct%s ", name, ++ AG_ISMOD(gblsym) ? "external dllimport" : "common", name); ++#else + fprintf(ASMFIL, "@%s = %s global %%struct%s ", name, + AG_ISMOD(gblsym) ? "external" : "common", name); ++#endif + fprintf(ASMFIL, "%s, align %d", + AG_ISMOD(gblsym) ? "" : " zeroinitializer", align_value); + for (llObjtodbgFirst(listp, &i); !llObjtodbgAtEnd(&i); diff --git a/ports/flang-fortran-runtime/1178.diff b/ports/flang-fortran-runtime/1178.diff new file mode 100644 index 00000000000000..7d88539cd2b141 --- /dev/null +++ b/ports/flang-fortran-runtime/1178.diff @@ -0,0 +1,47 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8308d5461d6..e9ec6c67e6a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -287,13 +287,16 @@ endif() + if (LLVM_COMPILER_IS_GCC_COMPATIBLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") + option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" ON) +- if (WITH_WERROR) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") +- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-but-set-variable") +- endif() ++elseif (MSVC) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14 -Woverloaded-virtual -Wno-long-long -Wno-unused-parameter -Wwrite-strings") ++ option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" OFF) ++endif () ++if (WITH_WERROR) ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") ++ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13) ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-but-set-variable") + endif () + endif () + +diff --git a/tools/flang1/flang1exe/CMakeLists.txt b/tools/flang1/flang1exe/CMakeLists.txt +index 7298861d3cc..a3367870013 100644 +--- a/tools/flang1/flang1exe/CMakeLists.txt ++++ b/tools/flang1/flang1exe/CMakeLists.txt +@@ -111,9 +111,11 @@ set(INCLUDE_DIRS + ${TOOLS_SHARED_DIR} + ) + +-set(COMPILE_OPTS +- -std=c11 +- ) ++if(NOT MSVC) ++ set(COMPILE_OPTS ++ -std=c11 ++ ) ++endif() + + add_flang_executable(flang1 + ${SOURCES} ${SHARED_SOURCES} diff --git a/ports/flang-fortran-runtime/1210.diff b/ports/flang-fortran-runtime/1210.diff new file mode 100644 index 00000000000000..3c566d2b1fc12f --- /dev/null +++ b/ports/flang-fortran-runtime/1210.diff @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93dd957888f..88c574b823a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,12 +46,14 @@ if (${TARGET_ARCHITECTURE} MATCHES "^(x86_64|AMD64|amd64)$") + set(TARGET_ARCHITECTURE x86_64) + set(ARCHNAME x86-64) + set(ARCH X86) +-elseif (${TARGET_ARCHITECTURE} MATCHES "^(aarch64|arm64)$") ++elseif (${TARGET_ARCHITECTURE} MATCHES "^(aarch64|arm64|ARM64)$") + set(TARGET_ARCHITECTURE aarch64) + set(ARCHNAME aarch64) + set(ARCH ARM) +- add_definitions(-DTARGET_SUPPORTS_QUADFP) +- set(TARGET_SUPPORTS_QUADFP True) ++ if (NOT ${TARGET_OS} STREQUAL "Windows") ++ add_definitions(-DTARGET_SUPPORTS_QUADFP) ++ set(TARGET_SUPPORTS_QUADFP True) ++ endif() + elseif( ${TARGET_ARCHITECTURE} STREQUAL "ppc64le" ) + set(ARCHNAME ppc64le) + set(ARCH POWER) diff --git a/ports/flang-fortran-runtime/awk.patch b/ports/flang-fortran-runtime/awk.patch new file mode 100644 index 00000000000000..211e73ea8d7dfb --- /dev/null +++ b/ports/flang-fortran-runtime/awk.patch @@ -0,0 +1,129 @@ +diff --git a/runtime/libpgmath/lib/common/CMakeLists.txt b/runtime/libpgmath/lib/common/CMakeLists.txt +index 59454c9de..caea12be3 100644 +--- a/runtime/libpgmath/lib/common/CMakeLists.txt ++++ b/runtime/libpgmath/lib/common/CMakeLists.txt +@@ -309,10 +309,11 @@ set(DEFINITIONS_CMPLX ${DEFINITIONS} MTH_CMPLX_C99_ABI) + libmath_add_object_library("${MTH_CMPLX_SRCS}" "${FLAGS}" "${DEFINITIONS_CMPLX}" "common_mth_cmplx") + + if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC}) ++ find_program(AWK_COMMAND NAMES awk) + # Generate mth_128mask.c + set(TARGET_NAME "mth_128mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2") +@@ -325,7 +326,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2") +@@ -338,7 +339,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_256mask.c + set(TARGET_NAME "mth_256mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge") +@@ -351,7 +352,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_256generic.c + set(TARGET_NAME "mth_256generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge") +@@ -364,7 +365,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_512mask.c + set(TARGET_NAME "mth_512mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") +@@ -378,7 +379,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_512generic.c + set(TARGET_NAME "mth_512generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl") +@@ -391,7 +392,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_z2yy.c + set(TARGET_NAME "mth_z2yy") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl") +@@ -404,7 +405,7 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "ppc64le") + # Generate mth_128mask.c + set(TARGET_NAME "mth_128mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -412,7 +413,7 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "ppc64le") + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -421,10 +422,10 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "aarch64") + set(TARGET_NAME "mth_128mask") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Windows") + add_custom_command(OUTPUT ${TARGET_NAME}.cpp DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -v TARGET_OS=WIN -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -v TARGET_OS=WIN -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) + else() + add_custom_command(OUTPUT ${TARGET_NAME}.cpp DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) + endif() + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.cpp") + libmath_add_object_library("${TARGET_NAME}.cpp" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") +@@ -433,7 +434,7 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "aarch64") + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -441,7 +442,7 @@ else() + # Generate mth_128mask.c + set(TARGET_NAME "mth_128mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -449,7 +450,7 @@ else() + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) diff --git a/ports/flang-fortran-runtime/cross.patch b/ports/flang-fortran-runtime/cross.patch new file mode 100644 index 00000000000000..7d107408e1db0a --- /dev/null +++ b/ports/flang-fortran-runtime/cross.patch @@ -0,0 +1,50 @@ +diff --git a/runtime/flang/CMakeLists.txt b/runtime/flang/CMakeLists.txt +index 850942b32..3ec95760e 100644 +--- a/runtime/flang/CMakeLists.txt ++++ b/runtime/flang/CMakeLists.txt +@@ -430,7 +430,7 @@ add_custom_command( + > "${I8_FILES_DIR}/ieee_arithmetic.F95" + COMMENT "Preprocessing ieee_arithmetic.F95" + VERBATIM +- DEPENDS flang1 flang2 ++ #DEPENDS flang1 flang2 + ) + + add_custom_command( +@@ -440,7 +440,7 @@ add_custom_command( + > "${I8_FILES_DIR}/ieee_exceptions.F95" + COMMENT "Preprocessing ieee_exceptions.F95" + VERBATIM +- DEPENDS flang1 flang2 ++ #DEPENDS flang1 flang2 + ) + + add_custom_command( +@@ -450,7 +450,7 @@ add_custom_command( + COMMAND "${CMAKE_Fortran_COMPILER}" -E -DPGFLANG -cpp ${SEPARATED_CMAKE_Fortran_FLAGS} + ${CMAKE_CURRENT_SOURCE_DIR}/norm2.F95 > "norm2_1.F95" + VERBATIM +- DEPENDS flang1 flang2 ++ #DEPENDS flang1 flang2 + ) + + # The files lists FTN_INTRINSICS_DESC_DEP and FTN_SUPPORT_DESC_DEP need to be compiled twice (with and without 'DESC_I8' compile definition). So an actual copy is made in a temp file on which this is done. +@@ -662,18 +662,6 @@ target_include_directories(flang_shared + ${CMAKE_CURRENT_BINARY_DIR} + ) + +-# Make sure the compiler is built before we bootstrap +-add_dependencies(flang_static +- flang1 +- flang2 +- ) +- +-# Make sure the compiler is built before we bootstrap +-add_dependencies(flang_shared +- flang1 +- flang2 +- ) +- + if (NOT MSVC) + target_compile_options(flang_static PRIVATE -fPIC) + target_compile_options(flang_shared PRIVATE -fPIC) diff --git a/ports/flang-fortran-runtime/move_flang2.patch b/ports/flang-fortran-runtime/move_flang2.patch new file mode 100644 index 00000000000000..4ce4584c47f0a7 --- /dev/null +++ b/ports/flang-fortran-runtime/move_flang2.patch @@ -0,0 +1,28 @@ +diff --git a/tools/flang2/flang2exe/CMakeLists.txt b/tools/flang2/flang2exe/CMakeLists.txt +index a9649e996..5aeeb0480 100644 +--- a/tools/flang2/flang2exe/CMakeLists.txt ++++ b/tools/flang2/flang2exe/CMakeLists.txt +@@ -160,7 +160,7 @@ target_include_directories(flang2 + + # Install flang2 executable + install(TARGETS flang2 +- RUNTIME DESTINATION ${LLVM_TOOLS_BINARY_DIR}) ++ RUNTIME DESTINATION bin) + + # Local Variables: + # mode: cmake +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f6513a04c..000055e73 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -390,8 +390,10 @@ add_definitions( -DPGFLANG ) + + add_subdirectory(lib) + add_subdirectory(runtime) ++if( FLANG_BUILD_TOOLS ) + add_subdirectory(utils) + add_subdirectory(tools) ++endif() + #add_subdirectory(test) + + #option(FLANG_BUILD_EXAMPLES "Build FLANG example programs by default." OFF) diff --git a/ports/flang-fortran-runtime/portfile.cmake b/ports/flang-fortran-runtime/portfile.cmake new file mode 100644 index 00000000000000..275c8f6f07d55d --- /dev/null +++ b/ports/flang-fortran-runtime/portfile.cmake @@ -0,0 +1,79 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) # unresolved symbol interr + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO flang-compiler/flang + REF 5a60d344443e38715b7c837de53d9ce2ed78b0d6 + SHA512 aff012c3cf9756d84b8bb5d0c369a1fd78d51af4cb2734183640e7fdcc16f6e6ab2ab78a56cc4b750f1571f7842b2b76b255e442df98e0aacd5e07db6a9d6a82 + PATCHES awk.patch + 1163.diff + 1165.diff + 1166.diff + 1168.diff + 1177.diff + 1178.diff + 1210.diff + move_flang2.patch + cross.patch + sep_runtime_from_compiler.patch +) + +set(NINJA "${CURRENT_HOST_INSTALLED_DIR}/tools/ninja/ninja${VCPKG_HOST_EXECUTABLE_SUFFIX}") +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) +vcpkg_add_to_path(${PYTHON3_DIR}) + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_cmake_get_vars(cmake_vars_file) + include("${cmake_vars_file}") + if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + vcpkg_list(SET OPTIONS + "-DCMAKE_C_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/vcpkg-tool-llvm/bin/clang-cl.exe" + "-DCMAKE_CXX_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/vcpkg-tool-llvm/bin/clang-cl.exe" + "-DCMAKE_AR=${VCPKG_DETECTED_CMAKE_AR}" + "-DCMAKE_LINKER=${VCPKG_DETECTED_CMAKE_LINKER}" + "-DCMAKE_MT=${VCPKG_DETECTED_CMAKE_MT}" + "-DCMAKE_RC=${VCPKG_DETECTED_CMAKE_RC}" + ) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + string(APPEND VCPKG_C_FLAGS " --target=aarch64-win32-msvc") + string(APPEND VCPKG_CXX_FLAGS " --target=aarch64-win32-msvc") + vcpkg_list(APPEND OPTIONS -DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR:STRING=ARM64 -DCMAKE_SYSTEM_NAME:STRING=Windows -DCMAKE_Fortran_FLAGS=--target=aarch64-win32-msvc) + endif() + endif() + vcpkg_list(APPEND OPTIONS + "-DCMAKE_Fortran_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/flang.exe" + "-DCMAKE_Fortran_COMPILER_ID=Flang" + ) + + vcpkg_acquire_msys(MSYS_ROOT PACKAGES gawk bash sed) + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(ARCH X86) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(ARCH ARM) + endif() + vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/${ARCH}") +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + #"-DLLVM_TARGETS_TO_BUILD=X86;AArch64" + "-DFLANG_BUILD_RUNTIME=ON" + "-DFLANG_LLVM_EXTENSIONS=ON" + "-DFLANG_INCLUDE_DOCS=OFF" + "-DLLVM_INCLUDE_TESTS=OFF" + "-DFLANG_BUILD_TOOLS=OFF" + "-DVCPKG_HOST_TRIPLET=${_HOST_TRIPLET}" + "-DLLVM_CONFIG=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/llvm-config.exe" + "-DLLVM_CMAKE_PATH=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/lib/cmake/llvm" # Flang does not link against anything in llvm + ${OPTIONS} +) +vcpkg_cmake_install(ADD_BIN_TO_PATH) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) \ No newline at end of file diff --git a/ports/flang-fortran-runtime/sep_runtime_from_compiler.patch b/ports/flang-fortran-runtime/sep_runtime_from_compiler.patch new file mode 100644 index 00000000000000..f1b29916a5e6f4 --- /dev/null +++ b/ports/flang-fortran-runtime/sep_runtime_from_compiler.patch @@ -0,0 +1,66 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 000055e73..28a738269 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -292,7 +292,7 @@ endif() + # Add appropriate flags for GCC + if (LLVM_COMPILER_IS_GCC_COMPATIBLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") +- option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" ON) ++ option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" OFF) + elseif (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14 -Woverloaded-virtual -Wno-long-long -Wno-unused-parameter -Wwrite-strings") + option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" OFF) +@@ -350,6 +350,7 @@ include_directories(BEFORE + set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) + + # Install Fortran module files ++if( FLANG_BUILD_RUNTIME ) + install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ + DESTINATION include + ) +@@ -360,6 +361,7 @@ get_filename_component(OMP_LIB_H_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include/omp_li + install(FILES ${OMP_LIB_H_PATH} + DESTINATION include + ) ++endif() + + add_definitions( -D_GNU_SOURCE ) + +@@ -389,7 +391,9 @@ set(FLANG_RTE_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib) + add_definitions( -DPGFLANG ) + +-add_subdirectory(lib) ++if( FLANG_BUILD_RUNTIME ) + add_subdirectory(runtime) ++endif() + if( FLANG_BUILD_TOOLS ) ++add_subdirectory(lib) + add_subdirectory(utils) + add_subdirectory(tools) +diff --git a/tools/flang1/flang1exe/CMakeLists.txt b/tools/flang1/flang1exe/CMakeLists.txt +index a33678700..b6967227b 100644 +--- a/tools/flang1/flang1exe/CMakeLists.txt ++++ b/tools/flang1/flang1exe/CMakeLists.txt +@@ -166,7 +166,7 @@ endif() + + # Install flang1 executable + install(TARGETS flang1 +- RUNTIME DESTINATION bin) ++ RUNTIME DESTINATION bin/${ARCH}) + + # Local Variables: + # mode: cmake +diff --git a/tools/flang2/flang2exe/CMakeLists.txt b/tools/flang2/flang2exe/CMakeLists.txt +index 5aeeb0480..105143325 100644 +--- a/tools/flang2/flang2exe/CMakeLists.txt ++++ b/tools/flang2/flang2exe/CMakeLists.txt +@@ -160,7 +160,7 @@ target_include_directories(flang2 + + # Install flang2 executable + install(TARGETS flang2 +- RUNTIME DESTINATION bin) ++ RUNTIME DESTINATION bin/${ARCH}) + + # Local Variables: + # mode: cmake diff --git a/ports/flang-fortran-runtime/vcpkg.json b/ports/flang-fortran-runtime/vcpkg.json new file mode 100644 index 00000000000000..69676d1c687d64 --- /dev/null +++ b/ports/flang-fortran-runtime/vcpkg.json @@ -0,0 +1,39 @@ +{ + "name": "flang-fortran-runtime", + "version-date": "2022-04-23", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "license": "Apache-2.0", + "dependencies": [ + "pgmath", + { + "name": "pkgconf", + "host": true + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-tool-flang", + "host": true + }, + { + "name": "vcpkg-tool-flang-llvm", + "host": true + }, + { + "name": "vcpkg-tool-llvm", + "host": true, + "platform": "windows" + }, + { + "name": "vcpkg-tool-ninja", + "host": true + } + ] +} diff --git a/ports/g2o/vcpkg.json b/ports/g2o/vcpkg.json index b81b5d65c9f8fc..168d5c1a69c42d 100644 --- a/ports/g2o/vcpkg.json +++ b/ports/g2o/vcpkg.json @@ -1,13 +1,14 @@ { "name": "g2o", - "version-string": "2020-02-07", - "port-version": 2, + "version-date": "2020-02-07", + "port-version": 3, "description": "g2o: A General Framework for Graph Optimization", "homepage": "https://openslam.org/g2o.html", "dependencies": [ "ceres", "eigen3", "lapack", + "opengl", "suitesparse" ] } diff --git a/ports/lapack-reference/FindLAPACK.cmake b/ports/lapack-reference/FindLAPACK.cmake index f4d25477d8dad4..855ac56f0b6334 100644 --- a/ports/lapack-reference/FindLAPACK.cmake +++ b/ports/lapack-reference/FindLAPACK.cmake @@ -8,11 +8,11 @@ FindLAPACK Find Linear Algebra PACKage (LAPACK) library This module finds an installed Fortran library that implements the -LAPACK linear-algebra interface (see http://www.netlib.org/lapack/). +`LAPACK linear-algebra interface`_. -The approach follows that taken for the ``autoconf`` macro file, -``acx_lapack.m4`` (distributed at -http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). +At least one of the ``C``, ``CXX``, or ``Fortran`` languages must be enabled. + +.. _`LAPACK linear-algebra interface`: http://www.netlib.org/lapack/ Input Variables ^^^^^^^^^^^^^^^ @@ -23,36 +23,26 @@ The following variables may be set to influence this module's behavior: if ``ON`` use static linkage ``BLA_VENDOR`` - If set, checks only the specified vendor, if not set checks all the - possibilities. List of vendors valid in this module: - - * ``OpenBLAS`` - * ``FLAME`` - * ``Intel10_32`` (intel mkl v10 32 bit) - * ``Intel10_64lp`` (intel mkl v10+ 64 bit, threaded code, lp64 model) - * ``Intel10_64lp_seq`` (intel mkl v10+ 64 bit, sequential code, lp64 model) - * ``Intel10_64ilp`` (intel mkl v10+ 64 bit, threaded code, ilp64 model) - * ``Intel10_64ilp_seq`` (intel mkl v10+ 64 bit, sequential code, ilp64 model) - * ``Intel10_64_dyn`` (intel mkl v10+ 64 bit, single dynamic library) - * ``Intel`` (obsolete versions of mkl 32 and 64 bit) - * ``ACML`` - * ``Apple`` - * ``NAS`` - * ``Arm`` - * ``Arm_mp`` - * ``Arm_ilp64`` - * ``Arm_ilp64_mp`` - * ``Generic`` + Set to one of the :ref:`BLAS/LAPACK Vendors` to search for BLAS only + from the specified vendor. If not set, all vendors are considered. ``BLA_F95`` if ``ON`` tries to find the BLAS95/LAPACK95 interfaces +``BLA_PREFER_PKGCONFIG`` + .. versionadded:: 3.20 + + if set ``pkg-config`` will be used to search for a LAPACK library first + and if one is found that is preferred + Imported targets ^^^^^^^^^^^^^^^^ -This module defines the following :prop_tgt:`IMPORTED` target: +This module defines the following :prop_tgt:`IMPORTED` targets: ``LAPACK::LAPACK`` + .. versionadded:: 3.18 + The libraries to use for LAPACK, if found. Result Variables @@ -73,69 +63,95 @@ This module defines the following variables: ``LAPACK95_FOUND`` library implementing the LAPACK95 interface is found -.. note:: +Intel MKL +^^^^^^^^^ - C, CXX or Fortran must be enabled to detect a BLAS/LAPACK library. - C or CXX must be enabled to use Intel Math Kernel Library (MKL). +To use the Intel MKL implementation of LAPACK, a project must enable at least +one of the ``C`` or ``CXX`` languages. Set ``BLA_VENDOR`` to an Intel MKL +variant either on the command-line as ``-DBLA_VENDOR=Intel10_64lp`` or in +project code: - For example, to use Intel MKL libraries and/or Intel compiler: +.. code-block:: cmake - .. code-block:: cmake + set(BLA_VENDOR Intel10_64lp) + find_package(LAPACK) + +In order to build a project using Intel MKL, and end user must first +establish an Intel MKL environment. See the :module:`FindBLAS` module +section on :ref:`Intel MKL` for details. - set(BLA_VENDOR Intel10_64lp) - find_package(LAPACK) #]=======================================================================] -enable_language(C) -# Check the language being used -if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED)) - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR "FindLAPACK requires Fortran, C, or C++ to be enabled.") - else() - message(STATUS "Looking for LAPACK... - NOT found (Unsupported languages)") - return() - endif() -endif() +# The approach follows that of the ``autoconf`` macro file, ``acx_lapack.m4`` +# (distributed at http://ac-archive.sourceforge.net/ac-archive/acx_lapack.html). if(CMAKE_Fortran_COMPILER_LOADED) - include(${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake) + include("${CMAKE_ROOT}/Modules/CheckFortranFunctionExists.cmake") else() - include(${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake) -endif() -include(${CMAKE_ROOT}/Modules/CMakePushCheckState.cmake) - -cmake_push_check_state() -set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) - -set(LAPACK_FOUND FALSE) -set(LAPACK95_FOUND FALSE) - -# store original values for CMAKE_FIND_LIBRARY_SUFFIXES -set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) -if (CMAKE_SYSTEM_NAME STREQUAL "Linux") - list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES .so.3gfs .so.3 .so.4 .so.5) + include("${CMAKE_ROOT}/Modules/CheckFunctionExists.cmake") endif() +include("${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake") + +function(_add_lapack_target) + if(LAPACK_FOUND AND NOT TARGET LAPACK::LAPACK) + add_library(LAPACK::LAPACK INTERFACE IMPORTED) + + # Filter out redundant BLAS info and replace with the BLAS target + set(_lapack_libs "${LAPACK_LIBRARIES}") + set(_lapack_flags "${LAPACK_LINKER_FLAGS}") + if(TARGET BLAS::BLAS) + if(_lapack_libs AND BLAS_LIBRARIES) + foreach(_blas_lib IN LISTS BLAS_LIBRARIES) + list(REMOVE_ITEM _lapack_libs "${_blas_lib}") + endforeach() + endif() + if(_lapack_flags AND BLAS_LINKER_FLAGS) + foreach(_blas_flag IN LISTS BLAS_LINKER_FLAGS) + list(REMOVE_ITEM _lapack_flags "${_blas_flag}") + endforeach() + endif() + list(APPEND _lapack_libs BLAS::BLAS) + endif() + if(_lapack_libs) + set_target_properties(LAPACK::LAPACK PROPERTIES + INTERFACE_LINK_LIBRARIES "${_lapack_libs}" + ) + endif() + if(_lapack_flags) + set_target_properties(LAPACK::LAPACK PROPERTIES + INTERFACE_LINK_OPTIONS "${_lapack_flags}" + ) + endif() + endif() +endfunction() # TODO: move this stuff to a separate module -macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _addlibdir _subdirs _blas) - # This macro checks for the existence of the combination of fortran libraries - # given by _list. If the combination is found, this macro checks (using the - # Check_Fortran_Function_Exists macro) whether can link against that library - # combination using the name of a routine given by _name using the linker - # flags given by _flags. If the combination of libraries is found and passes - # the link test, LIBRARIES is set to the list of complete library paths that - # have been found. Otherwise, LIBRARIES is set to FALSE. - - # N.B. _prefix is the prefix applied to the names of all cached variables that - # are generated internally and marked advanced by this macro. - # _addlibdir is a list of additional search paths. _subdirs is a list of path - # suffixes to be used by find_library(). +function(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _deps _addlibdir _subdirs _blas) + # This function checks for the existence of the combination of libraries + # given by _list. If the combination is found, this checks whether can link + # against that library combination using the name of a routine given by _name + # using the linker flags given by _flags. If the combination of libraries is + # found and passes the link test, ${LIBRARIES} is set to the list of complete + # library paths that have been found. Otherwise, ${LIBRARIES} is set to FALSE. set(_libraries_work TRUE) - set(${LIBRARIES}) + set(_libraries) set(_combined_name) + if(BLA_STATIC) + if(WIN32) + set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() + else() + if(CMAKE_SYSTEM_NAME STREQUAL "Linux") + # for ubuntu's libblas3gf and liblapack3gf packages + set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf) + endif() + endif() + set(_extaddlibdir "${_addlibdir}") if(WIN32) list(APPEND _extaddlibdir ENV LIB) @@ -147,29 +163,37 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a list(APPEND _extaddlibdir "${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}") foreach(_library ${_list}) - if(_library MATCHES "^-Wl,--(start|end)-group$") - # Respect linker flags like --start/end-group (required by MKL) - set(${LIBRARIES} ${${LIBRARIES}} "${_library}") + if(_library MATCHES "^-") + # Respect linker flags as-is (required by MKL) + list(APPEND _libraries "${_library}") else() - set(_combined_name ${_combined_name}_${_library}) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" _lib_var "${_library}") + set(_combined_name ${_combined_name}_${_lib_var}) + if(NOT "${_deps}" STREQUAL "") + set(_combined_name ${_combined_name}_deps) + endif() if(_libraries_work) - find_library(${_prefix}_${_library}_LIBRARY + find_library(${_prefix}_${_lib_var}_LIBRARY NAMES ${_library} + NAMES_PER_DIR PATHS ${_extaddlibdir} PATH_SUFFIXES ${_subdirs} ) - #message("DEBUG: find_library(${_library}) got ${${_prefix}_${_library}_LIBRARY}") - mark_as_advanced(${_prefix}_${_library}_LIBRARY) - set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY}) - set(_libraries_work ${${_prefix}_${_library}_LIBRARY}) + mark_as_advanced(${_prefix}_${_lib_var}_LIBRARY) + list(APPEND _libraries ${${_prefix}_${_lib_var}_LIBRARY}) + set(_libraries_work ${${_prefix}_${_lib_var}_LIBRARY}) endif() endif() endforeach() + foreach(_flag ${_flags}) + string(REGEX REPLACE "[^A-Za-z0-9]" "_" _flag_var "${_flag}") + set(_combined_name ${_combined_name}_${_flag_var}) + endforeach() if(_libraries_work) # Test this combination of libraries. - set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_blas} ${_threadlibs}) - #message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}") + set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${_libraries} ${_blas} ${_deps}) + set(CMAKE_REQUIRED_QUIET ${LAPACK_FIND_QUIETLY}) if(CMAKE_Fortran_COMPILER_LOADED) check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS) else() @@ -181,354 +205,118 @@ macro(CHECK_LAPACK_LIBRARIES LIBRARIES _prefix _name _flags _list _threadlibs _a if(_libraries_work) if("${_list}${_blas}" STREQUAL "") - set(${LIBRARIES} "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") + set(_libraries "${LIBRARIES}-PLACEHOLDER-FOR-EMPTY-LIBRARIES") else() - set(${LIBRARIES} ${${LIBRARIES}} ${_blas} ${_threadlibs}) + list(APPEND _libraries ${_blas} ${_deps}) endif() else() - set(${LIBRARIES} FALSE) + set(_libraries FALSE) endif() - #message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}") -endmacro() - -set(LAPACK_LINKER_FLAGS) -set(LAPACK_LIBRARIES) -set(LAPACK95_LIBRARIES) - -include(CMakeFindDependencyMacro) -find_dependency(BLAS) + set(${LIBRARIES} "${_libraries}" PARENT_SCOPE) +endfunction() -if(BLAS_FOUND) - set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) - if(NOT $ENV{BLA_VENDOR} STREQUAL "") - set(BLA_VENDOR $ENV{BLA_VENDOR}) - else() - if(NOT BLA_VENDOR) - set(BLA_VENDOR "All") - endif() +macro(_lapack_find_dependency dep) + set(_lapack_quiet_arg) + if(LAPACK_FIND_QUIETLY) + set(_lapack_quiet_arg QUIET) endif() - - # LAPACK in the Intel MKL 10+ library? - if(BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - if(CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED) - # System-specific settings - if(NOT WIN32) - set(LAPACK_mkl_LM "-lm") - set(LAPACK_mkl_LDL "-ldl") - endif() - - if(LAPACK_FIND_QUIETLY OR NOT LAPACK_FIND_REQUIRED) - find_package(Threads) - else() - find_package(Threads REQUIRED) - endif() - - if(BLA_VENDOR MATCHES "_64ilp") - set(LAPACK_mkl_ILP_MODE "ilp64") - else() - set(LAPACK_mkl_ILP_MODE "lp64") - endif() - - set(LAPACK_SEARCH_LIBS "") - - if(BLA_F95) - set(LAPACK_mkl_SEARCH_SYMBOL "cheev_f95") - set(_LIBRARIES LAPACK95_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS95_LIBRARIES}) - - # old - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95") - # new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_intel_c") - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack95_${LAPACK_mkl_ILP_MODE}") - else() - set(LAPACK_mkl_SEARCH_SYMBOL "cheev") - set(_LIBRARIES LAPACK_LIBRARIES) - set(_BLAS_LIBRARIES ${BLAS_LIBRARIES}) - - # old and new >= 10.3 - list(APPEND LAPACK_SEARCH_LIBS - "mkl_lapack") - endif() - - # MKL uses a multitude of partially platform-specific subdirectories: - if(BLA_VENDOR STREQUAL "Intel10_32") - set(LAPACK_mkl_ARCH_NAME "ia32") - else() - set(LAPACK_mkl_ARCH_NAME "intel64") - endif() - if(WIN32) - set(LAPACK_mkl_OS_NAME "win") - elseif(APPLE) - set(LAPACK_mkl_OS_NAME "mac") - else() - set(LAPACK_mkl_OS_NAME "lin") - endif() - if(DEFINED ENV{MKLROOT}) - file(TO_CMAKE_PATH "$ENV{MKLROOT}" LAPACK_mkl_MKLROOT) - # If MKLROOT points to the subdirectory 'mkl', use the parent directory instead - # so we can better detect other relevant libraries in 'compiler' or 'tbb': - get_filename_component(LAPACK_mkl_MKLROOT_LAST_DIR "${LAPACK_mkl_MKLROOT}" NAME) - if(LAPACK_mkl_MKLROOT_LAST_DIR STREQUAL "mkl") - get_filename_component(LAPACK_mkl_MKLROOT "${LAPACK_mkl_MKLROOT}" DIRECTORY) - endif() - endif() - set(LAPACK_mkl_LIB_PATH_SUFFIXES - "compiler/lib" "compiler/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}" - "mkl/lib" "mkl/lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}" - "lib/${LAPACK_mkl_ARCH_NAME}_${LAPACK_mkl_OS_NAME}") - - # First try empty lapack libs - if(NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - LAPACK - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "" - "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}" - "${LAPACK_mkl_MKLROOT}" - "${LAPACK_mkl_LIB_PATH_SUFFIXES}" - "${_BLAS_LIBRARIES}" - ) - endif() - - # Then try the search libs - foreach(IT ${LAPACK_SEARCH_LIBS}) - string(REPLACE " " ";" SEARCH_LIBS ${IT}) - if(NOT ${_LIBRARIES}) - check_lapack_libraries( - ${_LIBRARIES} - LAPACK - ${LAPACK_mkl_SEARCH_SYMBOL} - "" - "${SEARCH_LIBS}" - "${CMAKE_THREAD_LIBS_INIT};${LAPACK_mkl_LM};${LAPACK_mkl_LDL}" - "${LAPACK_mkl_MKLROOT}" - "${LAPACK_mkl_LIB_PATH_SUFFIXES}" - "${_BLAS_LIBRARIES}" - ) - endif() - endforeach() - - unset(LAPACK_mkl_ILP_MODE) - unset(LAPACK_mkl_SEARCH_SYMBOL) - unset(LAPACK_mkl_LM) - unset(LAPACK_mkl_LDL) - unset(LAPACK_mkl_MKLROOT) - unset(LAPACK_mkl_ARCH_NAME) - unset(LAPACK_mkl_OS_NAME) - unset(LAPACK_mkl_LIB_PATH_SUFFIXES) - endif() - endif() - endif() - - # gotoblas? (http://www.tacc.utexas.edu/tacc-projects/gotoblas2) - if(BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "goto2" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - endif() + set(_lapack_required_arg) + if(LAPACK_FIND_REQUIRED) + set(_lapack_required_arg REQUIRED) endif() - - # OpenBLAS? (http://www.openblas.net) - if(BLA_VENDOR STREQUAL "OpenBLAS" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "openblas" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - endif() + find_package(${dep} ${ARGN} + ${_lapack_quiet_arg} + ${_lapack_required_arg} + ) + if (NOT ${dep}_FOUND) + set(LAPACK_NOT_FOUND_MESSAGE "LAPACK could not be found because dependency ${dep} could not be found.") endif() - # ArmPL? (https://developer.arm.com/tools-and-software/server-and-hpc/compile/arm-compiler-for-linux/arm-performance-libraries) - if(BLA_VENDOR MATCHES "Arm" OR BLA_VENDOR STREQUAL "All") - - # Check for 64bit Integer support - if(BLA_VENDOR MATCHES "_ilp64") - set(LAPACK_armpl_LIB "armpl_ilp64") - else() - set(LAPACK_armpl_LIB "armpl_lp64") - endif() - - # Check for OpenMP support, VIA BLA_VENDOR of Arm_mp or Arm_ipl64_mp - if(BLA_VENDOR MATCHES "_mp") - set(LAPACK_armpl_LIB "${LAPACK_armpl_LIB}_mp") - endif() + set(_lapack_required_arg) + set(_lapack_quiet_arg) +endmacro() - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "${LAPACK_armpl_LIB}" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - endif() - endif() +set(LAPACK_LINKER_FLAGS) +set(LAPACK_LIBRARIES) +set(LAPACK95_LIBRARIES) +set(_lapack_fphsa_req_var LAPACK_LIBRARIES) - # FLAME's blis library? (https://github.com/flame/blis) - if(BLA_VENDOR STREQUAL "FLAME" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "flame" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - endif() - endif() +# Check the language being used +if(NOT (CMAKE_C_COMPILER_LOADED OR CMAKE_CXX_COMPILER_LOADED OR CMAKE_Fortran_COMPILER_LOADED)) + set(LAPACK_NOT_FOUND_MESSAGE + "FindLAPACK requires Fortran, C, or C++ to be enabled.") +endif() - # BLAS in acml library? - if(BLA_VENDOR MATCHES "ACML" OR BLA_VENDOR STREQUAL "All") - if(BLAS_LIBRARIES MATCHES ".+acml.+") - set(LAPACK_LIBRARIES ${BLAS_LIBRARIES}) - endif() - endif() +# Load BLAS +if(NOT LAPACK_NOT_FOUND_MESSAGE) + _lapack_find_dependency(BLAS) +endif() - # Apple LAPACK library? - if(BLA_VENDOR STREQUAL "Apple" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "Accelerate" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) +# Search with pkg-config if specified +if(BLA_PREFER_PKGCONFIG) + find_package(PkgConfig) + pkg_check_modules(PKGC_LAPACK lapack) + if(PKGC_LAPACK_FOUND) + set(LAPACK_FOUND TRUE) + set(LAPACK_LIBRARIES "${PKGC_LAPACK_LINK_LIBRARIES}") + if (BLAS_LIBRARIES) + list(APPEND LAPACK_LIBRARIES "${BLAS_LIBRARIES}") endif() + _add_lapack_target() + return() endif() +endif() - # Apple NAS (vecLib) library? - if(BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "vecLib" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - endif() +# Search for different LAPACK distributions if BLAS is found +if(NOT LAPACK_NOT_FOUND_MESSAGE) + set(LAPACK_LINKER_FLAGS ${BLAS_LINKER_FLAGS}) + if(NOT $ENV{BLA_VENDOR} STREQUAL "") + set(BLA_VENDOR $ENV{BLA_VENDOR}) + elseif(NOT BLA_VENDOR) + set(BLA_VENDOR "All") endif() # Generic LAPACK library? - if(BLA_VENDOR STREQUAL "Generic" OR - BLA_VENDOR STREQUAL "ATLAS" OR - BLA_VENDOR STREQUAL "All") - if(NOT LAPACK_LIBRARIES) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) - endif() - if(NOT LAPACK_LIBRARIES AND NOT WIN32) - check_lapack_libraries( - LAPACK_LIBRARIES - LAPACK - cheev - "" - "lapack;m;gfortran" - "" - "" - "" - "${BLAS_LIBRARIES}" - ) + if(NOT LAPACK_LIBRARIES + AND (BLA_VENDOR STREQUAL "Generic" + OR BLA_VENDOR STREQUAL "ATLAS" + OR BLA_VENDOR STREQUAL "All")) + if(BLA_STATIC) + # We do not know for sure how the LAPACK reference implementation + # is built on this host. Guess typical dependencies. + set(_lapack_generic_deps "-lgfortran;-lm") + else() + set(_lapack_generic_deps "") endif() + check_lapack_libraries( + LAPACK_LIBRARIES + LAPACK + cheev + "" + "lapack" + "${_lapack_generic_deps}" + "" + "" + "${BLAS_LIBRARIES}" + ) + unset(_lapack_generic_deps) endif() -else() - message(STATUS "LAPACK requires BLAS") endif() if(BLA_F95) - if(LAPACK95_LIBRARIES) - set(LAPACK95_FOUND TRUE) - else() - set(LAPACK95_FOUND FALSE) - endif() - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK95_FOUND) - message(STATUS "A library with LAPACK95 API found.") - else() - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK95 API not found. Please specify library location." - ) - else() - message(STATUS - "A library with LAPACK95 API not found. Please specify library location." - ) - endif() - endif() - endif() - set(LAPACK_FOUND "${LAPACK95_FOUND}") set(LAPACK_LIBRARIES "${LAPACK95_LIBRARIES}") -else() - if(LAPACK_LIBRARIES) - set(LAPACK_FOUND TRUE) - else() - set(LAPACK_FOUND FALSE) - endif() +endif() - if(NOT LAPACK_FIND_QUIETLY) - if(LAPACK_FOUND) - message(STATUS "A library with LAPACK API found.") - else() - if(LAPACK_FIND_REQUIRED) - message(FATAL_ERROR - "A required library with LAPACK API not found. Please specify library location." - ) - else() - message(STATUS - "A library with LAPACK API not found. Please specify library location." - ) - endif() - endif() - endif() +if(LAPACK_NOT_FOUND_MESSAGE) + set(LAPACK_NOT_FOUND_MESSAGE + REASON_FAILURE_MESSAGE ${LAPACK_NOT_FOUND_MESSAGE}) +endif() +find_package_handle_standard_args(LAPACK REQUIRED_VARS ${_lapack_fphsa_req_var} + ${LAPACK_NOT_FOUND_MESSAGE}) +unset(LAPACK_NOT_FOUND_MESSAGE) + +if(BLA_F95) + set(LAPACK95_FOUND ${LAPACK_FOUND}) endif() # On compilers that implicitly link LAPACK (such as ftn, cc, and CC on Cray HPC machines) @@ -537,23 +325,4 @@ if(LAPACK_LIBRARIES STREQUAL "LAPACK_LIBRARIES-PLACEHOLDER-FOR-EMPTY-LIBRARIES") set(LAPACK_LIBRARIES "") endif() -if(NOT TARGET LAPACK::LAPACK) - add_library(LAPACK::LAPACK INTERFACE IMPORTED) - set(_lapack_libs "${LAPACK_LIBRARIES}") - if(_lapack_libs AND TARGET BLAS::BLAS) - # remove the ${BLAS_LIBRARIES} from the interface and replace it - # with the BLAS::BLAS target - list(REMOVE_ITEM _lapack_libs "${BLAS_LIBRARIES}") - endif() - - if(_lapack_libs) - set_target_properties(LAPACK::LAPACK PROPERTIES - INTERFACE_LINK_LIBRARIES "${_lapack_libs}" - ) - endif() - unset(_lapack_libs) -endif() - -cmake_pop_check_state() -# restore original values for CMAKE_FIND_LIBRARY_SUFFIXES -set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) +_add_lapack_target() diff --git a/ports/lapack-reference/intel.patch b/ports/lapack-reference/intel.patch new file mode 100644 index 00000000000000..84c8002f21b2d6 --- /dev/null +++ b/ports/lapack-reference/intel.patch @@ -0,0 +1,28 @@ +diff --git a/INSTALL/dsecnd_EXT_ETIME.f b/INSTALL/dsecnd_EXT_ETIME.f +index 35377643b..f98aad7a9 100644 +--- a/INSTALL/dsecnd_EXT_ETIME.f ++++ b/INSTALL/dsecnd_EXT_ETIME.f +@@ -34,6 +34,9 @@ + * + * ===================================================================== + DOUBLE PRECISION FUNCTION DSECND( ) ++#if defined(__INTEL_COMPILER) ++ USE IFPORT ++#endif + * + * -- LAPACK auxiliary routine -- + * -- LAPACK is a software package provided by Univ. of Tennessee, -- +diff --git a/INSTALL/second_EXT_ETIME.f b/INSTALL/second_EXT_ETIME.f +index 43044cda7..0e2a9a331 100644 +--- a/INSTALL/second_EXT_ETIME.f ++++ b/INSTALL/second_EXT_ETIME.f +@@ -34,6 +34,9 @@ + * + * ===================================================================== + REAL FUNCTION SECOND( ) ++#if defined(__INTEL_COMPILER) ++ USE IFPORT ++#endif + * + * -- LAPACK auxiliary routine -- + * -- LAPACK is a software package provided by Univ. of Tennessee, -- diff --git a/ports/lapack-reference/portfile.cmake b/ports/lapack-reference/portfile.cmake index 8e7490c8f47b31..9c6cf996f35c43 100644 --- a/ports/lapack-reference/portfile.cmake +++ b/ports/lapack-reference/portfile.cmake @@ -8,7 +8,6 @@ if(EXISTS "${CURRENT_INSTALLED_DIR}/share/clapack/copyright") message(FATAL_ERROR "Can't build ${PORT} if clapack is installed. Please remove clapack:${TARGET_TRIPLET}, and try to install ${PORT}:${TARGET_TRIPLET} again.") endif() -include(vcpkg_find_fortran) SET(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) set(lapack_ver 3.10.0) @@ -19,6 +18,8 @@ vcpkg_from_github( REF "v${lapack_ver}" SHA512 56055000c241bab8f318ebd79249ea012c33be0c4c3eca6a78e247f35ad9e8088f46605a0ba52fd5ad3e7898be3b7bc6c50ceb3af327c4986a266b06fe768cbf HEAD_REF master + PATCHES #intel.patch + "time_test.patch" # The test doesnot correctly forward required compiler flags -> So only build static libs for testing ) if(NOT VCPKG_TARGET_IS_WINDOWS) @@ -34,7 +35,7 @@ if("cblas" IN_LIST FEATURES) endif() set(USE_OPTIMIZED_BLAS OFF) -if("noblas" IN_LIST FEATURES) +if(1) set(USE_OPTIMIZED_BLAS ON) set(pcfile "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/openblas.pc") if(EXISTS "${pcfile}") @@ -47,31 +48,30 @@ if("noblas" IN_LIST FEATURES) endif() set(VCPKG_CRT_LINKAGE_BACKUP ${VCPKG_CRT_LINKAGE}) -vcpkg_find_fortran(FORTRAN_CMAKE) -if(VCPKG_USE_INTERNAL_Fortran) - if(VCPKG_CRT_LINKAGE_BACKUP STREQUAL static) - # If openblas has been built with static crt linkage we cannot use it with gfortran! - set(USE_OPTIMIZED_BLAS OFF) - #Cannot use openblas from vcpkg if we are building with gfortran here. - if("noblas" IN_LIST FEATURES) - message(FATAL_ERROR "Feature 'noblas' cannot be used without supplying an external fortran compiler") - endif() - endif() -else() - set(USE_OPTIMIZED_BLAS ON) -endif() +x_vcpkg_find_fortran(OUT_OPTIONS fortran_cmake + OUT_OPTIONS_RELEASE fortran_cmake_rel + OUT_OPTIONS_DEBUG fortran_cmake_dbg) vcpkg_cmake_configure( SOURCE_PATH "${SOURCE_PATH}" OPTIONS - "-DUSE_OPTIMIZED_BLAS=${USE_OPTIMIZED_BLAS}" + "-DUSE_OPTIMIZED_BLAS=ON" "-DCBLAS=${CBLAS}" - ${FORTRAN_CMAKE} + ${fortran_cmake} + OPTIONS_RELEASE + ${fortran_cmake_rel} + OPTIONS_DEBUG + ${fortran_cmake_dbg} ) -vcpkg_cmake_install() +file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/CMakeFiles/CMakeError.log" "${CURRENT_BUILDTREES_DIR}/CMakeError-rel.log") +file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/CMakeFiles/CMakeOutput.log" "${CURRENT_BUILDTREES_DIR}/CMakeOutput-rel.log") + +file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/CMakeFiles/CMakeError.log" "${CURRENT_BUILDTREES_DIR}/CMakeError-dbg.log") +file(RENAME "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/CMakeFiles/CMakeOutput.log" "${CURRENT_BUILDTREES_DIR}/CMakeOutput-dbg.log") -vcpkg_cmake_config_fixup(PACKAGE_NAME lapack-${lapack_ver} CONFIG_PATH lib/cmake/lapack-${lapack_ver}) #Should the target path be lapack and not lapack-reference? +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME "lapack-${lapack_ver}" CONFIG_PATH "lib/cmake/lapack-${lapack_ver}") #Should the target path be lapack and not lapack-reference? set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/lapack.pc") if(EXISTS "${pcfile}") @@ -85,7 +85,7 @@ if(EXISTS "${pcfile}") set(_contents "prefix=${CURRENT_INSTALLED_DIR}/debug\n${_contents}") file(WRITE "${pcfile}" "${_contents}") endif() -if(NOT USE_OPTIMIZED_BLAS AND NOT (VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")) +if(NOT USE_OPTIMIZED_BLAS) set(pcfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/blas.pc") if(EXISTS "${pcfile}") file(READ "${pcfile}" _contents) @@ -119,24 +119,7 @@ vcpkg_fixup_pkgconfig() file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) # remove debug includes -file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include) - -if(VCPKG_TARGET_IS_WINDOWS) - if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/liblapack.lib") - file(RENAME "${CURRENT_PACKAGES_DIR}/lib/liblapack.lib" "${CURRENT_PACKAGES_DIR}/lib/lapack.lib") - endif() - if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/liblapack.lib") - file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/liblapack.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/lapack.lib") - endif() - if(NOT USE_OPTIMIZED_BLAS) - if(EXISTS "${CURRENT_PACKAGES_DIR}/lib/libblas.lib") - file(RENAME "${CURRENT_PACKAGES_DIR}/lib/libblas.lib" "${CURRENT_PACKAGES_DIR}/lib/blas.lib") - endif() - if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/lib/libblas.lib") - file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/libblas.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/blas.lib") - endif() - endif() -endif() +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") -file(COPY ${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/lapack) -file(COPY ${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/lapack) +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake" "${CURRENT_PACKAGES_DIR}/share/lapack/vcpkg-cmake-wrapper.cmake" @ONLY) +file(COPY "${CMAKE_CURRENT_LIST_DIR}/FindLAPACK.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/lapack") diff --git a/ports/lapack-reference/time_test.patch b/ports/lapack-reference/time_test.patch new file mode 100644 index 00000000000000..5e14a192939526 --- /dev/null +++ b/ports/lapack-reference/time_test.patch @@ -0,0 +1,21 @@ +diff --git a/INSTALL/CMakeLists.txt b/INSTALL/CMakeLists.txt +index b6f6e838a..bb336fb72 100644 +--- a/INSTALL/CMakeLists.txt ++++ b/INSTALL/CMakeLists.txt +@@ -1,9 +1,9 @@ + cmake_minimum_required(VERSION 3.2) + project(TIMING Fortran) +-add_executable(secondtst_NONE second_NONE.f secondtst.f) +-add_executable(secondtst_EXT_ETIME second_EXT_ETIME.f secondtst.f) +-add_executable(secondtst_EXT_ETIME_ second_EXT_ETIME_.f secondtst.f) +-add_executable(secondtst_INT_ETIME second_INT_ETIME.f secondtst.f) +-add_executable(secondtst_INT_CPU_TIME second_INT_CPU_TIME.f secondtst.f) +-add_executable(testieee tstiee.f) +-add_executable(testversion ilaver.f LAPACK_version.f) ++add_library(secondtst_NONE STATIC second_NONE.f secondtst.f) ++add_library(secondtst_EXT_ETIME STATIC second_EXT_ETIME.f secondtst.f) ++add_executable(secondtst_EXT_ETIME_ second_EXT_ETIME_.f secondtst.f) ++add_library(secondtst_INT_ETIME STATIC second_INT_ETIME.f secondtst.f) ++add_library(secondtst_INT_CPU_TIME STATIC second_INT_CPU_TIME.f secondtst.f) ++add_library(testieee STATIC tstiee.f) ++add_library(testversion STATIC ilaver.f LAPACK_version.f) diff --git a/ports/lapack-reference/vcpkg-cmake-wrapper.cmake b/ports/lapack-reference/vcpkg-cmake-wrapper.cmake index b3a7128fff0150..a1d9dc2f6994c1 100644 --- a/ports/lapack-reference/vcpkg-cmake-wrapper.cmake +++ b/ports/lapack-reference/vcpkg-cmake-wrapper.cmake @@ -5,7 +5,10 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) list(REMOVE_ITEM ARGS "NO_MODULE") list(REMOVE_ITEM ARGS "CONFIG") list(REMOVE_ITEM ARGS "MODULE") - +if(MSVC AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static") + set(CMAKE_REQUIRED_LINK_OPTIONS "-LIBPATH:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/$<$:debug/>lib/") + add_link_options("-LIBPATH:${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/$<$:debug/>lib/") +endif() _find_package(${ARGS}) set(CMAKE_MODULE_PATH ${LAPACK_PREV_MODULE_PATH}) diff --git a/ports/lapack-reference/vcpkg.json b/ports/lapack-reference/vcpkg.json index e52b1ef84d7d33..2df58609c8a8d7 100644 --- a/ports/lapack-reference/vcpkg.json +++ b/ports/lapack-reference/vcpkg.json @@ -1,6 +1,7 @@ { "name": "lapack-reference", "version": "3.10.0", + "port-version": 1, "description": "LAPACK - Linear Algebra PACKage", "homepage": "http://www.netlib.org/lapack/", "license": "BSD-3-Clause-Open-MPI", @@ -13,10 +14,7 @@ "name": "vcpkg-cmake-config", "host": true }, - { - "name": "vcpkg-gfortran", - "platform": "windows" - } + "vcpkg-fortran-flang" ], "default-features": [ "blas-select" @@ -31,7 +29,7 @@ "features": [ "noblas" ], - "platform": "!windows | !static" + "platform": "!(windows & arm)" } ] }, diff --git a/ports/lapack/vcpkg.json b/ports/lapack/vcpkg.json index 70a2aabec304fe..1251581b3b5aa4 100644 --- a/ports/lapack/vcpkg.json +++ b/ports/lapack/vcpkg.json @@ -1,16 +1,16 @@ { "name": "lapack", - "version-date": "2022-02-22", + "version-date": "2022-04-23", "description": "Metapackage for packages which provide LAPACK", "license": null, "dependencies": [ { "name": "clapack", - "platform": "(arm & windows) | uwp" + "platform": "(arm32 | x86) & windows" }, { "name": "lapack-reference", - "platform": "!((arm & windows) | uwp)" + "platform": "!((arm32 | x86) & windows)" } ] } diff --git a/ports/openblas/portfile.cmake b/ports/openblas/portfile.cmake index 45c1f86c51e7e5..4e281723901a5d 100644 --- a/ports/openblas/portfile.cmake +++ b/ports/openblas/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO xianyi/OpenBLAS - REF 2480e5046e3b0120da8a7fd1442eca628df55f87 # v0.3.19 - SHA512 b85a96c8cd75bf7197732f3b923b8b0ffdc6261d7d6dc7b622d4bf24f061d02273ad99571cabe4686d92f77ff8e6f7e2de0851758cbb3c529d7c2ca96a0bc34d + REF 0b678b19dc03f2a999d6e038814c4c50b9640a4e # v0.3.20 + SHA512 6e32f7dfc5dde46570873810c1da09d102f76ccfce41a5adbaeef2fccada54f9ab07e1ee541a6d55e138e6500392a6f55236f4f3a7766803358e5a6205334946 HEAD_REF develop PATCHES uwp.patch @@ -36,8 +36,8 @@ set(COMMON_OPTIONS -DBUILD_WITHOUT_LAPACK=ON) if(VCPKG_TARGET_IS_OSX) if("dynamic-arch" IN_LIST FEATURES) - vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) - message(STATUS "Openblas with \"dynamic-arch\" option for OSX supports only dynamic linkage. It's not a bag of openblas but bug of combination cmake+ninja+osx. See: https://gitlab.kitware.com/cmake/cmake/-/issues/16731") + #vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + #message(STATUS "Openblas with \"dynamic-arch\" option for OSX supports only dynamic linkage. It's not a bag of openblas but bug of combination cmake+ninja+osx. See: https://gitlab.kitware.com/cmake/cmake/-/issues/16731") endif() endif() diff --git a/ports/openblas/vcpkg.json b/ports/openblas/vcpkg.json index d7be1f3383ab11..1bc43d57359048 100644 --- a/ports/openblas/vcpkg.json +++ b/ports/openblas/vcpkg.json @@ -1,9 +1,10 @@ { "name": "openblas", - "version": "0.3.19", - "port-version": 1, + "version": "0.3.20", "description": "OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.", "homepage": "https://github.com/xianyi/OpenBLAS", + "license": "BSD-3-Clause", + "supports": "!(windows & arm)", "dependencies": [ { "name": "openblas", diff --git a/ports/pgmath/1167.diff b/ports/pgmath/1167.diff new file mode 100644 index 00000000000000..90423543c56be9 --- /dev/null +++ b/ports/pgmath/1167.diff @@ -0,0 +1,1538 @@ +diff --git a/runtime/libpgmath/lib/common/dispatch.c b/runtime/libpgmath/lib/common/dispatch.c +index 423993e52493..717b3bab92ce 100644 +--- a/runtime/libpgmath/lib/common/dispatch.c ++++ b/runtime/libpgmath/lib/common/dispatch.c +@@ -333,7 +333,7 @@ __mth_rt_vi_ptrs_t __mth_rt_vi_ptrs_stat; + uint64_t __mth_rt_stats[frp_size][func_size][sv_size]; + static __mth_rt_vi_ptrs_t __mth_rt_vi_ptrs_new; + +-#if !defined(WIN64) && !defined(DISPATCH_IS_STATIC) ++#if !defined(_WIN64) && !defined(DISPATCH_IS_STATIC) + #define CONSTRUCTOR __attribute__((constructor(101))) + #define DESTRUCTOR __attribute__((destructor)) + #else +diff --git a/runtime/libpgmath/lib/common/fltfenv.c b/runtime/libpgmath/lib/common/fltfenv.c +index 0f96e9742b1f..8411572a6d13 100644 +--- a/runtime/libpgmath/lib/common/fltfenv.c ++++ b/runtime/libpgmath/lib/common/fltfenv.c +@@ -164,7 +164,7 @@ __fenv_fetestexcept(int exc) + /* Windows doesn't seem to preserve x87 exception bits across context + * switches, so this info is unreliable. + */ +-#ifdef WINNT ++#if defined(_WIN64) + x87 = 0; + #else + asm("\tfnstsw %0" : "=m"(x87) :); +diff --git a/runtime/libpgmath/lib/common/mthdecls.h b/runtime/libpgmath/lib/common/mthdecls.h +index 8bd2de28dadc..bac177562eae 100644 +--- a/runtime/libpgmath/lib/common/mthdecls.h ++++ b/runtime/libpgmath/lib/common/mthdecls.h +@@ -348,7 +348,7 @@ static inline __attribute__((always_inline)) double_complex_t pgmath_cmplx(doub + * to the different entry points for the various architectures. + */ + +-#if defined(WIN64) ++#if defined(_WIN64) + /* + * Windows. + */ +@@ -400,7 +400,7 @@ static inline __attribute__((always_inline)) double_complex_t pgmath_cmplx(doub + #define BESSEL_Y0 y0 + #define BESSEL_Y1 y1 + #define BESSEL_YN yn +-#endif /* #if defined (WIN64) */ ++#endif /* #if defined (_WIN64) */ + + /* declarations for math functions */ + +diff --git a/runtime/libpgmath/lib/generic/datan.c b/runtime/libpgmath/lib/generic/datan.c +index 0400edcfa8b9..83f30f275fb0 100644 +--- a/runtime/libpgmath/lib/generic/datan.c ++++ b/runtime/libpgmath/lib/generic/datan.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(WIN64) ++#if !defined(_WIN64) + #include "mthdecls.h" + #else + double atan(double d); +diff --git a/runtime/libpgmath/lib/generic/datan2.c b/runtime/libpgmath/lib/generic/datan2.c +index 37816fec3d05..cb8868f7f1b7 100644 +--- a/runtime/libpgmath/lib/generic/datan2.c ++++ b/runtime/libpgmath/lib/generic/datan2.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(WIN64) ++#if !defined(_WIN64) + #include "mthdecls.h" + #else + double atan2(double x, double y); +diff --git a/runtime/libpgmath/lib/generic/dlog10.c b/runtime/libpgmath/lib/generic/dlog10.c +index f1925fdb4b6e..ba76d33e2b1e 100644 +--- a/runtime/libpgmath/lib/generic/dlog10.c ++++ b/runtime/libpgmath/lib/generic/dlog10.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(WIN64) ++#if !defined(_WIN64) + #include "mthdecls.h" + #else + double log10(double d); +diff --git a/runtime/libpgmath/lib/x86_64/dint.S b/runtime/libpgmath/lib/x86_64/dint.S +index 3436617cdde2..f4c60e8a0b81 100644 +--- a/runtime/libpgmath/lib/x86_64/dint.S ++++ b/runtime/libpgmath/lib/x86_64/dint.S +@@ -7,7 +7,7 @@ + + + #if 0 +-#if defined(WIN64) ++#if defined(_WIN64) + typedef long long I64; + typedef unsigned long long UI64; + #else +diff --git a/runtime/libpgmath/lib/x86_64/fast/fastmath.h b/runtime/libpgmath/lib/x86_64/fast/fastmath.h +index d7029d8e1562..351e2ef188d2 100644 +--- a/runtime/libpgmath/lib/x86_64/fast/fastmath.h ++++ b/runtime/libpgmath/lib/x86_64/fast/fastmath.h +@@ -1817,7 +1817,7 @@ LBL(.L__lnan): + jmp LBL(.L__finish) + + LBL(.L__finish): +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp), %xmm6 + #endif + +@@ -1841,7 +1841,7 @@ LBL(.L__finish): + ENT(__fvs_exp_dbl): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -1910,7 +1910,7 @@ LBL(.L__Scalar_fvsexp_dbl): + popq %rbp + + /* Done */ +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -1987,7 +1987,7 @@ ENT(__fvd_exp_long): + sar $5,%edx + addpd %xmm5,%xmm2 /* xmm2 = r = r1 + r2 */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + #endif + /* Step 2. Compute the polynomial. */ +@@ -2061,7 +2061,7 @@ ENT(__fvd_exp_long): + movq %rdx,RZ_OFF(16)(%rsp) /* get 2^n to memory */ + mulpd RZ_OFF(24)(%rsp),%xmm0 /* result*= 2^n */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + #endif + +@@ -2667,7 +2667,7 @@ ENT(ASM_CONCAT(__mth_i_cdexp_gh,__MTH_C99_CMPLX_SUFFIX)): + ENT(ASM_CONCAT(__mth_i_cdexp,__MTH_C99_CMPLX_SUFFIX)): + #endif + +-#ifdef WIN64 ++#ifdef _WIN64 + /* + * Return structure in (%rcx). + * Will be managed by macro I1. +@@ -2760,7 +2760,7 @@ ENT_GH(__mth_i_cdexp_1v): + IF_GH(ENT(__fsz_exp):) + ENT_GH(__mth_i_cdexp): + +-#if defined(WIN64) ++#if defined(_WIN64) + /* + * WIN64 ONLY: + * Jump entry point into routine from __fsz_exp_c99. +@@ -2794,7 +2794,7 @@ LBL(.L__fsz_exp_win64): + mulpd %xmm1,%xmm4 /* Mpy to scale both */ + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(40)(%rsp) + movdqa %xmm7, RZ_OFF(56)(%rsp) + movdqa %xmm8, RZ_OFF(72)(%rsp) +@@ -3031,7 +3031,7 @@ LBL(.L__fsz_exp_win64): + mulsd %xmm0,%xmm1 + mulsd %xmm9,%xmm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + movq RZ_OFF(104)(%rsp),I1 + movdqa RZ_OFF(40)(%rsp),%xmm6 + movdqa RZ_OFF(56)(%rsp),%xmm7 +@@ -3194,7 +3194,7 @@ IF_GH(ENT(__fvs_exp):) + ENT_GH(__fvsexp): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -3327,7 +3327,7 @@ ENT_GH(__fvsexp): + + LBL(.L_vsp_final_check): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -3338,7 +3338,7 @@ LBL(.L_vsp_final_check): + ret + + LBL(.L__Scalar_fvsexp): +-#if defined(WIN64) ++#if defined(_WIN64) + /* Need to restore callee-saved regs can do here for this path + * because entry was only thru fvs_exp/fvsexp_gh + */ +@@ -3621,7 +3621,7 @@ IF_GH(ENT(__fss_log):) + ENT_GH(__fmth_i_alog): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + #endif + /* First check for valid input: +@@ -3717,7 +3717,7 @@ LBL(.LB1_100): + + LBL(.LB1_900): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp), %xmm6 + #endif + RZ_POP +@@ -3809,7 +3809,7 @@ IF_GH(ENT(__fsd_log):) + ENT_GH(__fmth_i_dlog): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + #endif + /* Get input x into the range [0.5,1) */ +@@ -3889,7 +3889,7 @@ LBL(.L__100): + addsd %xmm1,%xmm0 + + LBL(.L__finish): +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp), %xmm6 + #endif + +@@ -4012,7 +4012,7 @@ IF_GH(ENT(__fvs_log):) + ENT_GH(__fvslog): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + movdqa %xmm7, RZ_OFF(72)(%rsp) + #endif +@@ -4148,7 +4148,7 @@ LBL(.LB_100): + + LBL(.LB_900): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movdqa RZ_OFF(72)(%rsp), %xmm7 + #endif +@@ -4227,7 +4227,7 @@ IF_GH(ENT(__fvd_log):) + ENT_GH(__fvdlog): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + #endif + +@@ -4324,7 +4324,7 @@ LBL(.Lfinish): + jnz LBL(.Lnear_one) + LBL(.Lfinishn1): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + #endif + RZ_POP +@@ -4651,7 +4651,7 @@ ENT_GH(__fmth_i_dsin): + mulsd %xmm0,%xmm4 + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + movdqa %xmm7, RZ_OFF(40)(%rsp) + #endif +@@ -4783,7 +4783,7 @@ ENT_GH(__fmth_i_dsin): + addsd %xmm4,%xmm1 /* ((ds2...) + dc2*dp) + ds1*dq */ + addsd %xmm5,%xmm1 + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp),%xmm6 + movdqa RZ_OFF(40)(%rsp),%xmm7 + #endif +@@ -5379,7 +5379,7 @@ ENT_GH(__fvdsin): + test $3, %ecx + jnz LBL(.L__Scalar_fvdsin2) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, (%rsp) + movdqa %xmm7, 16(%rsp) + #endif +@@ -5543,7 +5543,7 @@ ENT_GH(__fvdsin): + mulpd %xmm6,%xmm0 /* dc1 * dp */ + addpd %xmm4,%xmm1 /* ((ds2...) + dc2*dp) + ds1*dq */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa (%rsp),%xmm6 + movdqa 16(%rsp),%xmm7 + #endif +@@ -5923,7 +5923,7 @@ ENT_GH(__fmth_i_dcos): + mulsd %xmm0,%xmm4 + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + movdqa %xmm7, RZ_OFF(40)(%rsp) + #endif +@@ -6057,7 +6057,7 @@ ENT_GH(__fmth_i_dcos): + addsd %xmm4,%xmm1 + addsd %xmm1,%xmm0 /* cos(x) = (C + Cq(r)) + Sq(r) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp),%xmm6 + movdqa RZ_OFF(40)(%rsp),%xmm7 + #endif +@@ -6662,7 +6662,7 @@ ENT_GH(__fvdcos): + test $3, %ecx + jnz LBL(.L__Scalar_fvdcos2) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, (%rsp) + movdqa %xmm7, 16(%rsp) + #endif +@@ -6827,7 +6827,7 @@ ENT_GH(__fvdcos): + mulpd %xmm0,%xmm4 /* dc1 * dq */ + subpd %xmm6,%xmm1 /* ((dc2...) - ds2*dp) - ds1*dp */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa (%rsp),%xmm6 + movdqa 16(%rsp),%xmm7 + #endif +@@ -7189,7 +7189,7 @@ LBL(.L__fss_sinh_shortcuts): + IF_GH(ENT(__fsd_sinh):) + ENT_GH(__fmth_i_dsinh): + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(40)(%rsp) + #endif + +@@ -7329,7 +7329,7 @@ ENT_GH(__fmth_i_dsinh): + + LBL(.L__fsd_sinh_done): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(40)(%rsp), %xmm6 + #endif + RZ_POP +@@ -7393,7 +7393,7 @@ IF_GH(ENT(__fvs_sinh):) + ENT_GH(__fvssinh): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -7595,7 +7595,7 @@ ENT_GH(__fvssinh): + + LBL(.L_fvsinh_final_check): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -7610,7 +7610,7 @@ LBL(.L__Scalar_fvssinh): + /* Need to restore callee-saved regs can do here for this path + * because entry was only thru fvs_sinh/fvs_sinh + */ +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -7711,7 +7711,7 @@ ENT_GH(__fvdsinh): + testl $3, %r8d + jnz LBL(.L__Scalar_fvdsinh) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(72)(%rsp) + #endif + +@@ -7885,7 +7885,7 @@ ENT_GH(__fvdsinh): + + subpd %xmm6,%xmm0 /* done with sinh */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(72)(%rsp),%xmm6 + + #endif +@@ -8078,7 +8078,7 @@ IF_GH(ENT(__fsd_cosh):) + ENT_GH(__fmth_i_dcosh): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(40)(%rsp) + #endif + +@@ -8209,7 +8209,7 @@ ENT_GH(__fmth_i_dcosh): + mulsd RZ_OFF(24)(%rsp),%xmm6 /* result *= 2^n */ + addsd %xmm6, %xmm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(40)(%rsp), %xmm6 + #endif + +@@ -8244,7 +8244,7 @@ IF_GH(ENT(__fvs_cosh):) + ENT_GH(__fvscosh): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -8440,7 +8440,7 @@ ENT_GH(__fvscosh): + + LBL(.L_fvcosh_final_check): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -8455,7 +8455,7 @@ LBL(.L__Scalar_fvscosh): + /* Need to restore callee-saved regs can do here for this path + * because entry was only thru fvs_cosh_fma4/fvs_cosh_vex + */ +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -8551,7 +8551,7 @@ ENT_GH(__fvdcosh): + testl $3, %r8d + jnz LBL(.L__Scalar_fvdcosh) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(72)(%rsp) + #endif + +@@ -8718,7 +8718,7 @@ ENT_GH(__fvdcosh): + + addpd %xmm6,%xmm0 /* done with cosh */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(72)(%rsp),%xmm6 + #endif + +@@ -9008,7 +9008,7 @@ ENT_GH(__fmth_i_dsincos): + mulsd %xmm0,%xmm4 + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + movdqa %xmm7, RZ_OFF(40)(%rsp) + movdqa %xmm8, RZ_OFF(56)(%rsp) +@@ -9163,7 +9163,7 @@ ENT_GH(__fmth_i_dsincos): + addsd %xmm8,%xmm0 /* sin(x) = Cp(r) + (S+Sq(r)) */ + addsd %xmm7,%xmm1 /* cos(x) = (C + Cq(r)) + Sq(r) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp),%xmm6 + movdqa RZ_OFF(40)(%rsp),%xmm7 + movdqa RZ_OFF(56)(%rsp),%xmm8 +@@ -9298,7 +9298,7 @@ ENT_GH(__fvssincos): + /* Set n = nearest integer to r */ + movhps %xmm1,(%rsp) /* Store x4, x3 */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, 16(%rsp) + movdqa %xmm7, 32(%rsp) + #endif +@@ -9458,7 +9458,7 @@ LBL(.L__fvsincos_done_twice): + movaps %xmm5, %xmm0 + movaps %xmm7, %xmm1 + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa 16(%rsp), %xmm6 + movdqa 32(%rsp), %xmm7 + #endif +@@ -9486,7 +9486,7 @@ LBL(.L__Scalar_fvsincos1): + cvtps2pd 16(%rsp),%xmm0 /* x(2), x(1) */ + cvtps2pd 24(%rsp),%xmm1 /* x(4), x(3) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, 0(%rsp) + #endif + movapd %xmm0,16(%rsp) +@@ -9597,7 +9597,7 @@ LBL(.L__Scalar_fvsincos1): + cvtpd2ps %xmm4,%xmm4 /* cos(x4), cos(x3) */ + shufps $68, %xmm4, %xmm1 /* cos(x4),cos(x3),cos(x2),cos(x1) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa (%rsp), %xmm6 + #endif + +@@ -9888,7 +9888,7 @@ ENT_GH(__fvdsincos): + test $3, %ecx + jnz LBL(.L__Scalar_fvdsincos2) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, (%rsp) + movdqa %xmm7, 16(%rsp) + movdqa %xmm8, 32(%rsp) +@@ -10076,7 +10076,7 @@ ENT_GH(__fvdsincos): + addpd %xmm8,%xmm0 /* sin(x) = Cp(r) + (S+Sq(r)) */ + addpd %xmm7,%xmm1 /* cos(x) = (C + Cq(r)) + Sq(r) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa (%rsp),%xmm6 + movdqa 16(%rsp),%xmm7 + movdqa 32(%rsp),%xmm8 +@@ -10100,7 +10100,7 @@ LBL(.L__Scalar_fvdsincos1): + test $2, %eax + jz LBL(.L__Scalar_fvdsincos1a) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, (%rsp) + movdqa %xmm7, 16(%rsp) + #endif +@@ -10199,7 +10199,7 @@ LBL(.L__Scalar_fvdsincos1): + mulpd %xmm3,%xmm1 /* x2 * (0.5 + ...) */ + addpd .L__real_one(%rip),%xmm1 /* 1.0 - 0.5x2 + (...) done */ + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa (%rsp),%xmm6 + movdqa 16(%rsp),%xmm7 + #endif +@@ -10684,7 +10684,7 @@ ENT_GH(__fmth_i_dpowd): + movsd %xmm1, 0(%rsp) + movsd %xmm0, 8(%rsp) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, 16(%rsp) + #endif + /* r8 holds flags for x, in rax */ +@@ -10782,7 +10782,7 @@ LBL(.L__D_algo_start): + CALL(ENT(__fsd_exp_long)) + + LBL(.L__Dpop_and_return): +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa 16(%rsp), %xmm6 + #endif + movq %rbp, %rsp +@@ -11212,7 +11212,7 @@ ENT_GH(__fvdpow): + test $3, %r8d + jnz LBL(.L__Scalar_fvdpow) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, 48(%rsp) + #endif + /* Call log long version */ +@@ -11251,7 +11251,7 @@ ENT_GH(__fvdpow): + + CALL(ENT(__fvd_exp_long)) + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa 48(%rsp), %xmm6 + #endif + +@@ -11328,7 +11328,7 @@ IF_GH(ENT(__fss_log10):) + ENT_GH(__fmth_i_alog10): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + #endif + /* First check for valid input: +@@ -11427,7 +11427,7 @@ LBL(.LB1_100_log10): + + LBL(.LB1_900_log10): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp), %xmm6 + #endif + RZ_POP +@@ -11503,7 +11503,7 @@ IF_GH(ENT(__fsd_log10):) + ENT_GH(__fmth_i_dlog10): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(24)(%rsp) + #endif + /* Get input x into the range [0.5,1) */ +@@ -11590,7 +11590,7 @@ LBL(.L__cvt_to_dlog10): + addsd %xmm1,%xmm0 + + LBL(.L__finish_dlog10): +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(24)(%rsp), %xmm6 + #endif + +@@ -11715,7 +11715,7 @@ IF_GH(ENT(__fvs_log10):) + ENT_GH(__fvslog10): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + movdqa %xmm7, RZ_OFF(72)(%rsp) + #endif +@@ -11853,7 +11853,7 @@ LBL(.LB_100_log10): + + LBL(.LB_900_log10): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + movdqa RZ_OFF(72)(%rsp), %xmm7 + #endif +@@ -11935,7 +11935,7 @@ IF_GH(ENT(__fvd_log10):) + ENT_GH(__fvdlog10): + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa %xmm6, RZ_OFF(56)(%rsp) + #endif + +@@ -12039,7 +12039,7 @@ ENT_GH(__fvdlog10): + + LBL(.Lfinishn1_log10): + +-#if defined(WIN64) ++#if defined(_WIN64) + movdqa RZ_OFF(56)(%rsp), %xmm6 + #endif + RZ_POP +diff --git a/runtime/libpgmath/lib/x86_64/fast/fastmath_vex.h b/runtime/libpgmath/lib/x86_64/fast/fastmath_vex.h +index b149d069c71e..0d9a4878543d 100644 +--- a/runtime/libpgmath/lib/x86_64/fast/fastmath_vex.h ++++ b/runtime/libpgmath/lib/x86_64/fast/fastmath_vex.h +@@ -106,7 +106,7 @@ ENT(ASM_CONCAT(__fvd_sin_,TARGET_VEX_OR_FMA)): + test $3, %ecx + jnz LBL(.L__Scalar_fvdsin2) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 64(%rsp) + vmovdqu %ymm7, 96(%rsp) + #endif +@@ -300,7 +300,7 @@ ENT(ASM_CONCAT(__fvd_sin_,TARGET_VEX_OR_FMA)): + #endif + vmulpd %xmm6,%xmm0,%xmm0 /* dc1 * dp */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 64(%rsp),%ymm6 + vmovdqu 96(%rsp),%ymm7 + #endif +@@ -554,7 +554,7 @@ ENT(ASM_CONCAT(__fvd_cos_,TARGET_VEX_OR_FMA)): + test $3, %ecx + jnz LBL(.L__Scalar_fvdcos2) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 64(%rsp) + vmovdqu %ymm7, 96(%rsp) + #endif +@@ -752,7 +752,7 @@ ENT(ASM_CONCAT(__fvd_cos_,TARGET_VEX_OR_FMA)): + vsubpd %xmm6,%xmm1,%xmm1 /* ((dc2...) - ds2*dp) - ds1*dp */ + #endif + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 64(%rsp),%ymm6 + vmovdqu 96(%rsp),%ymm7 + #endif +@@ -1012,7 +1012,7 @@ ENT(ASM_CONCAT(__fvd_sincos_,TARGET_VEX_OR_FMA)): + test $3, %ecx + jnz LBL(.L__Scalar_fvdsincos2) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 32(%rsp) + vmovdqu %ymm7, 64(%rsp) + vmovdqu %ymm8, 96(%rsp) +@@ -1244,7 +1244,7 @@ ENT(ASM_CONCAT(__fvd_sincos_,TARGET_VEX_OR_FMA)): + #endif + vaddpd %xmm7,%xmm1,%xmm1 /* cos(x) = (C + Cq(r)) + Sq(r) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 32(%rsp),%ymm6 + vmovdqu 64(%rsp),%ymm7 + vmovdqu 96(%rsp),%ymm8 +@@ -1268,7 +1268,7 @@ LBL(.L__Scalar_fvdsincos1): + test $2, %eax + jz LBL(.L__Scalar_fvdsincos1a) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 64(%rsp) + vmovdqu %ymm7, 96(%rsp) + #endif +@@ -1348,7 +1348,7 @@ LBL(.L__Scalar_fvdsincos1): + vaddpd .L__real_one(%rip),%xmm1,%xmm1 /* 1.0 - 0.5x2 + (...) done */ + /* #endif */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 64(%rsp),%ymm6 + vmovdqu 96(%rsp),%ymm7 + #endif +@@ -2568,7 +2568,7 @@ ENT(ASM_CONCAT(__fvs_sincos_,TARGET_VEX_OR_FMA)): + /* Set n = nearest integer to r */ + vmovhps %xmm1,(%rsp) /* Store x4, x3 */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 64(%rsp) + vmovdqu %ymm7, 96(%rsp) + #endif +@@ -2754,7 +2754,7 @@ LBL(.L__fvsincos_done_twice): + vmovaps %xmm5, %xmm0 + vmovaps %xmm7, %xmm1 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 64(%rsp), %ymm6 + vmovdqu 96(%rsp), %ymm7 + #endif +@@ -2782,7 +2782,7 @@ LBL(.L__Scalar_fvsincos1): + vcvtps2pd 16(%rsp),%xmm0 /* x(2), x(1) */ + vcvtps2pd 24(%rsp),%xmm1 /* x(4), x(3) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 96(%rsp) + #endif + vmovapd %xmm0,16(%rsp) +@@ -2926,7 +2926,7 @@ LBL(.L__Scalar_fvsincos1): + vcvtpd2ps %xmm4,%xmm4 /* cos(x4), cos(x3) */ + vshufps $68, %xmm4, %xmm1,%xmm1 /* cos(x4),cos(x3),cos(x2),cos(x1) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 96(%rsp), %ymm6 + #endif + +@@ -3801,7 +3801,7 @@ ENT(ASM_CONCAT(__fsd_sin_,TARGET_VEX_OR_FMA)): + vmulsd %xmm0,%xmm4,%xmm4 + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(64)(%rsp) + vmovdqu %ymm7, RZ_OFF(96)(%rsp) + #endif +@@ -3996,7 +3996,7 @@ ENT(ASM_CONCAT(__fsd_sin_,TARGET_VEX_OR_FMA)): + vaddsd %xmm1,%xmm0,%xmm0 /* sin(x) = Cp(r) + (S+Sq(r)) */ + /* #endif */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(64)(%rsp),%ymm6 + vmovdqu RZ_OFF(96)(%rsp),%ymm7 + #endif +@@ -4093,7 +4093,7 @@ ENT(ASM_CONCAT(__fsd_cos_,TARGET_VEX_OR_FMA)): + vmulsd %xmm0,%xmm4,%xmm4 + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(64)(%rsp) + vmovdqu %ymm7, RZ_OFF(96)(%rsp) + #endif +@@ -4284,7 +4284,7 @@ ENT(ASM_CONCAT(__fsd_cos_,TARGET_VEX_OR_FMA)): + + vaddsd %xmm1,%xmm0,%xmm0 /* cos(x) = (C + Cq(r)) + Sq(r) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(64)(%rsp),%ymm6 + vmovdqu RZ_OFF(96)(%rsp),%ymm7 + #endif +@@ -4377,7 +4377,7 @@ ENT(ASM_CONCAT(__fsd_sincos_,TARGET_VEX_OR_FMA)): + vmulsd %xmm0,%xmm4,%xmm4 + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(32)(%rsp) + vmovdqu %ymm7, RZ_OFF(64)(%rsp) + vmovdqu %ymm8, RZ_OFF(96)(%rsp) +@@ -4578,7 +4578,7 @@ ENT(ASM_CONCAT(__fsd_sincos_,TARGET_VEX_OR_FMA)): + #endif + vaddsd %xmm7,%xmm1,%xmm1 /* cos(x) = (C + Cq(r)) + Sq(r) */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(32)(%rsp),%ymm6 + vmovdqu RZ_OFF(64)(%rsp),%ymm7 + vmovdqu RZ_OFF(96)(%rsp),%ymm8 +@@ -4873,7 +4873,7 @@ ENT(ASM_CONCAT(__fvz_exp_,TARGET_VEX_OR_FMA)): + ENT(ASM_CONCAT(__fsz_exp_1v_,TARGET_VEX_OR_FMA)): + + +-#ifdef WIN64 ++#ifdef _WIN64 + /* + * Return structure in (%rcx). + * Will be managed by macro I1. +@@ -4946,7 +4946,7 @@ ENT(ASM_CONCAT3(__fsz_exp_,TARGET_VEX_OR_FMA,_c99)): + ENT(ASM_CONCAT(__fsz_exp_,TARGET_VEX_OR_FMA)): + + +-#if defined(WIN64) ++#if defined(_WIN64) + /* + * WIN64 ONLY: + * Jump entry point into routine from __fsz_exp_vex_v1. +@@ -4954,7 +4954,7 @@ ENT(ASM_CONCAT(__fsz_exp_,TARGET_VEX_OR_FMA)): + LBL(.L__fsz_exp_vex_win64): + #endif + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovapd %xmm1,%xmm0 + vmovapd %xmm2,%xmm1 + #endif +@@ -4985,7 +4985,7 @@ LBL(.L__fsz_exp_vex_win64): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + vmovdqu %ymm8, 192(%rsp) +@@ -5291,7 +5291,7 @@ LBL(.L__fsz_exp_vex_win64): + vmulsd %xmm0,%xmm1,%xmm1 + vmulsd %xmm9,%xmm0,%xmm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + movq 24(%rsp),I1 + vmovdqu 128(%rsp),%ymm6 + vmovdqu 160(%rsp),%ymm7 +@@ -5894,7 +5894,7 @@ ENT(ASM_CONCAT(__fvd_pow_,TARGET_VEX_OR_FMA)): + test $3, %r8d + jnz LBL(.L__Scalar_fvdpow) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 96(%rsp) + #endif + /* Call log long version */ +@@ -5945,7 +5945,7 @@ ENT(ASM_CONCAT(__fvd_pow_,TARGET_VEX_OR_FMA)): + CALL(ENT(ASM_CONCAT(__fvd_exp_long_,TARGET_VEX_OR_FMA))) + + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 96(%rsp), %ymm6 + #endif + +@@ -5989,7 +5989,7 @@ ENT(ASM_CONCAT(__fsd_pow_,TARGET_VEX_OR_FMA)): + vmovsd %xmm1, 0(%rsp) + vmovsd %xmm0, 8(%rsp) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 32(%rsp) + #endif + /* r8 holds flags for x, in rax */ +@@ -6100,7 +6100,7 @@ LBL(.L__D_algo_start): + + + LBL(.L__Dpop_and_return): +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 32(%rsp), %ymm6 + #endif + movq %rbp, %rsp +@@ -7067,7 +7067,7 @@ ENT(ASM_CONCAT(__fvs_exp_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(104)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -7223,7 +7223,7 @@ ASM_CONCAT(.L__fvs_exp_dbl_entry_,TARGET_VEX_OR_FMA): + + LBL(.L_vsp_final_check): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(104)(%rsp), %ymm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -7234,7 +7234,7 @@ LBL(.L_vsp_final_check): + ret + + LBL(.L__Scalar_fvsexp): +-#if defined(WIN64) ++#if defined(_WIN64) + /* Need to restore callee-saved regs can do here for this path + * because entry was only thru fvs_exp_fma4/fvs_exp_vex + */ +@@ -7292,7 +7292,7 @@ ENT(__fvs_exp_dbl_vex): + #endif + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(104)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -7357,7 +7357,7 @@ LBL(.L__Scalar_fvs_exp_dbl): + popq %rbp + + /* Done */ +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(104)(%rsp), %ymm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -7641,7 +7641,7 @@ ENT(__fvd_exp_long_vex): + sar $5,%edx + vaddpd %xmm5,%xmm2,%xmm2 /* xmm2 = r = r1 + r2 */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(72)(%rsp) + #endif + /* Step 2. Compute the polynomial. */ +@@ -7738,7 +7738,7 @@ ENT(__fvd_exp_long_vex): + movq %rdx,RZ_OFF(16)(%rsp) /* get 2^n to memory */ + vmulpd RZ_OFF(24)(%rsp),%xmm0,%xmm0 /* result*= 2^n */ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(72)(%rsp), %ymm6 + #endif + +@@ -7842,7 +7842,7 @@ ENT(ASM_CONCAT(__fsd_log_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(96)(%rsp) + #endif + /* Get input x into the range [0.5,1) */ +@@ -7946,7 +7946,7 @@ LBL(.L__100): + vaddsd %xmm1,%xmm0,%xmm0 + + LBL(.L__finish): +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(96)(%rsp), %ymm6 + #endif + +@@ -8061,7 +8061,7 @@ ENT(ASM_CONCAT(__fvd_log_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(72)(%rsp) + #endif + +@@ -8178,7 +8178,7 @@ LBL(.Lfinish): + jnz LBL(.Lnear_one) + LBL(.Lfinishn1): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(72)(%rsp), %ymm6 + #endif + RZ_POP +@@ -8801,7 +8801,7 @@ ENT(ASM_CONCAT(__fvs_log_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(72)(%rsp) + vmovdqu %ymm7, RZ_OFF(104)(%rsp) + #endif +@@ -8961,7 +8961,7 @@ LBL(.LB_100): + + LBL(.LB_900): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(72)(%rsp), %ymm6 + vmovdqu RZ_OFF(104)(%rsp), %ymm7 + #endif +@@ -9069,7 +9069,7 @@ ENT(ASM_CONCAT(__fss_log_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(96)(%rsp) + #endif + /* First check for valid input: +@@ -9182,7 +9182,7 @@ LBL(.LB1_100): + + LBL(.LB1_900): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(96)(%rsp), %ymm6 + #endif + RZ_POP +@@ -9258,7 +9258,7 @@ ENT(ASM_CONCAT(__fvd_log10_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(72)(%rsp) + #endif + +@@ -9391,7 +9391,7 @@ ENT(ASM_CONCAT(__fvd_log10_,TARGET_VEX_OR_FMA)): + + LBL(.Lfinishn1_log10): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(72)(%rsp), %ymm6 + #endif + RZ_POP +@@ -9570,7 +9570,7 @@ ENT(ASM_CONCAT(__fsd_log10_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(96)(%rsp) + #endif + /* Get input x into the range [0.5,1) */ +@@ -9689,7 +9689,7 @@ LBL(.L__cvt_to_dlog10): + vaddsd %xmm1,%xmm0,%xmm0 + + LBL(.L__finish_dlog10): +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(96)(%rsp), %ymm6 + #endif + +@@ -9824,7 +9824,7 @@ ENT(ASM_CONCAT(__fvs_log10_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(72)(%rsp) + vmovdqu %ymm7, RZ_OFF(104)(%rsp) + #endif +@@ -9991,7 +9991,7 @@ LBL(.LB_100_log10): + + LBL(.LB_900_log10): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(72)(%rsp), %ymm6 + vmovdqu RZ_OFF(104)(%rsp), %ymm7 + #endif +@@ -10099,7 +10099,7 @@ ENT(ASM_CONCAT(__fss_log10_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(96)(%rsp) + #endif + /* First check for valid input: +@@ -10210,7 +10210,7 @@ LBL(.LB1_100_log10): + + LBL(.LB1_900_log10): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(96)(%rsp), %ymm6 + #endif + RZ_POP +@@ -10615,7 +10615,7 @@ ENT(ASM_CONCAT(__fsd_cosh_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(96)(%rsp) + #endif + +@@ -10801,7 +10801,7 @@ ENT(ASM_CONCAT(__fsd_cosh_,TARGET_VEX_OR_FMA)): + vaddsd %xmm6, %xmm0,%xmm0 + #endif + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(96)(%rsp), %ymm6 + #endif + +@@ -10832,7 +10832,7 @@ ENT(ASM_CONCAT(__fsd_cosh_,TARGET_VEX_OR_FMA)): + ENT(ASM_CONCAT(__fsd_sinh_,TARGET_VEX_OR_FMA)): + + RZ_PUSH +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, RZ_OFF(96)(%rsp) + #endif + +@@ -11024,7 +11024,7 @@ ENT(ASM_CONCAT(__fsd_sinh_,TARGET_VEX_OR_FMA)): + + LBL(.L__fsd_sinh_done): + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu RZ_OFF(96)(%rsp), %ymm6 + #endif + RZ_POP +@@ -11104,7 +11104,7 @@ ENT(ASM_CONCAT(__fvs_cosh_,TARGET_VEX_OR_FMA)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + movq %rsi, 64(%rsp) + movq %rdi, 56(%rsp) + vmovdqu %ymm6, 192(%rsp) +@@ -11342,7 +11342,7 @@ ENT(ASM_CONCAT(__fvs_cosh_,TARGET_VEX_OR_FMA)): + + LBL(.L_fvcosh_final_check): + +-#if defined(WIN64) ++#if defined(_WIN64) + movq 64(%rsp), %rsi + movq 56(%rsp), %rdi + vmovdqu 192(%rsp), %ymm6 +@@ -11358,7 +11358,7 @@ LBL(.L__Scalar_fvscosh): + /* Need to restore callee-saved regs can do here for this path + * because entry was only thru fvs_cosh_fma4/fvs_cosh_vex + */ +-#if defined(WIN64) ++#if defined(_WIN64) + movq 64(%rsp), %rsi + movq 56(%rsp), %rdi + vmovdqu 192(%rsp), %ymm6 +@@ -11418,7 +11418,7 @@ ENT(ASM_CONCAT(__fvs_sinh_,TARGET_VEX_OR_FMA)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + movq %rsi, 64(%rsp) + movq %rdi, 56(%rsp) + vmovdqu %ymm6, 192(%rsp) +@@ -11656,7 +11656,7 @@ ENT(ASM_CONCAT(__fvs_sinh_,TARGET_VEX_OR_FMA)): + + LBL(.L_fvsinh_final_check): + +-#if defined(WIN64) ++#if defined(_WIN64) + movq 64(%rsp), %rsi + movq 56(%rsp), %rdi + vmovdqu 192(%rsp), %ymm6 +@@ -11672,7 +11672,7 @@ LBL(.L__Scalar_fvssinh): + /* Need to restore callee-saved regs can do here for this path + * because entry was only thru fvs_sinh_fma4/fvs_sinh_vex + */ +-#if defined(WIN64) ++#if defined(_WIN64) + movq 64(%rsp), %rsi + movq 56(%rsp), %rdi + vmovdqu 192(%rsp), %ymm6 +@@ -11751,7 +11751,7 @@ ENT(ASM_CONCAT(__fvd_cosh_,TARGET_VEX_OR_FMA)): + testl $3, %r8d + jnz LBL(.L__Scalar_fvdcosh) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 72(%rsp) + #endif + +@@ -11963,7 +11963,7 @@ ENT(ASM_CONCAT(__fvd_cosh_,TARGET_VEX_OR_FMA)): + vaddpd %xmm6,%xmm0,%xmm0 /* done with cosh */ + #endif + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 72(%rsp),%ymm6 + #endif + +@@ -12044,7 +12044,7 @@ ENT(ASM_CONCAT(__fvd_sinh_,TARGET_VEX_OR_FMA)): + testl $3, %r8d + jnz LBL(.L__Scalar_fvdsinh) + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 72(%rsp) + #endif + +@@ -12264,7 +12264,7 @@ ENT(ASM_CONCAT(__fvd_sinh_,TARGET_VEX_OR_FMA)): + vsubpd %xmm6,%xmm0,%xmm0 /* done with sinh */ + #endif + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 72(%rsp),%ymm6 + #endif + +@@ -12325,7 +12325,7 @@ ENT(ASM_CONCAT3(__fvs_exp_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + movq %rsi, 192(%rsp) + movq %rdi, 224(%rsp) +@@ -12346,7 +12346,7 @@ ENT(ASM_CONCAT3(__fvs_exp_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + movq %rsi, 192(%rsp) + movq %rdi, 224(%rsp) +@@ -12471,7 +12471,7 @@ ENT(ASM_CONCAT3(__fvd_sin_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + #endif +@@ -12492,7 +12492,7 @@ ENT(ASM_CONCAT3(__fvd_sin_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + #endif +@@ -12571,7 +12571,7 @@ ENT(ASM_CONCAT3(__fvd_cos_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + #endif +@@ -12592,7 +12592,7 @@ ENT(ASM_CONCAT3(__fvd_cos_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + #endif +@@ -12627,7 +12627,7 @@ ENT(ASM_CONCAT3(__fvs_log_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $512, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + vmovdqu %ymm8, 192(%rsp) +@@ -12816,7 +12816,7 @@ LBL(.LB_900_256): + + /*******************************************/ + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + vmovdqu 192(%rsp), %ymm8 +@@ -12925,7 +12925,7 @@ ENT(ASM_CONCAT3(__fvd_log_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + #endif + +@@ -12945,7 +12945,7 @@ ENT(ASM_CONCAT3(__fvd_log_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + #endif + +@@ -12978,7 +12978,7 @@ ENT(ASM_CONCAT3(__fvs_log10_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + #endif +@@ -12999,7 +12999,7 @@ ENT(ASM_CONCAT3(__fvs_log10_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + #endif +@@ -13033,7 +13033,7 @@ ENT(ASM_CONCAT3(__fvd_log10_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + #endif + +@@ -13053,7 +13053,7 @@ ENT(ASM_CONCAT3(__fvd_log10_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + #endif + +@@ -13086,7 +13086,7 @@ ENT(ASM_CONCAT3(__fvs_sinh_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + movq %rsi, 192(%rsp) +@@ -13109,7 +13109,7 @@ ENT(ASM_CONCAT3(__fvs_sinh_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + movq 192(%rsp), %rsi +@@ -13190,7 +13190,7 @@ ENT(ASM_CONCAT3(__fvs_cosh_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + movq %rsi, 192(%rsp) +@@ -13213,7 +13213,7 @@ ENT(ASM_CONCAT3(__fvs_cosh_,TARGET_VEX_OR_FMA,_256)): + vmovups 80(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + movq 192(%rsp), %rsi +@@ -13294,7 +13294,7 @@ ENT(ASM_CONCAT3(__fvs_sincos_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + #endif +@@ -13319,7 +13319,7 @@ ENT(ASM_CONCAT3(__fvs_sincos_,TARGET_VEX_OR_FMA,_256)): + vmovups 96(%rsp), %ymm4 + vinsertf128 $1, %xmm1, %ymm4, %ymm1 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + #endif +@@ -13353,7 +13353,7 @@ ENT(ASM_CONCAT3(__fvd_sincos_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + vmovdqu %ymm7, 160(%rsp) + vmovdqu %ymm8, 192(%rsp) +@@ -13379,7 +13379,7 @@ ENT(ASM_CONCAT3(__fvd_sincos_,TARGET_VEX_OR_FMA,_256)): + vmovups 96(%rsp), %ymm4 + vinsertf128 $1, %xmm1, %ymm4, %ymm1 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + vmovdqu 160(%rsp), %ymm7 + vmovdqu 192(%rsp), %ymm8 +@@ -13463,7 +13463,7 @@ ENT(ASM_CONCAT3(__fvd_pow_,TARGET_VEX_OR_FMA,_256)): + movq %rsp, %rbp + subq $256, %rsp + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu %ymm6, 128(%rsp) + #endif + +@@ -13486,7 +13486,7 @@ ENT(ASM_CONCAT3(__fvd_pow_,TARGET_VEX_OR_FMA,_256)): + vmovups 64(%rsp), %ymm1 + vinsertf128 $1, %xmm0, %ymm1, %ymm0 + +-#if defined(WIN64) ++#if defined(_WIN64) + vmovdqu 128(%rsp), %ymm6 + #endif + +diff --git a/runtime/libpgmath/lib/x86_64/mthdecls.h b/runtime/libpgmath/lib/x86_64/mthdecls.h +index a7f5e60e23fb..fc7aead502d4 100644 +--- a/runtime/libpgmath/lib/x86_64/mthdecls.h ++++ b/runtime/libpgmath/lib/x86_64/mthdecls.h +@@ -339,7 +339,7 @@ static inline __attribute__((always_inline)) double_complex_t pgmath_cmplx(doub + * to the different entry points for the various architectures. + */ + +-#if defined(WIN64) ++#if defined(_WIN64) + /* + * Windows. + */ +@@ -391,7 +391,7 @@ static inline __attribute__((always_inline)) double_complex_t pgmath_cmplx(doub + #define BESSEL_Y0 y0 + #define BESSEL_Y1 y1 + #define BESSEL_YN yn +-#endif /* #if defined (WIN64) */ ++#endif /* #if defined (_WIN64) */ + + /* declarations for math functions */ + +diff --git a/runtime/libpgmath/lib/x86_64/relaxed/relaxedmath_vex.h b/runtime/libpgmath/lib/x86_64/relaxed/relaxedmath_vex.h +index 9a81ea590d3f..2b097f71ecad 100644 +--- a/runtime/libpgmath/lib/x86_64/relaxed/relaxedmath_vex.h ++++ b/runtime/libpgmath/lib/x86_64/relaxed/relaxedmath_vex.h +@@ -678,7 +678,7 @@ ENT(ASM_CONCAT(__rvs_exp_,TARGET_VEX_OR_FMA)): + + RZ_PUSH + +-#if defined(WIN64) || defined(TARGET_INTERIX_X8664) ++#if defined(_WIN64) || defined(TARGET_INTERIX_X8664) + vmovdqu %ymm6, RZ_OFF(104)(%rsp) + movq %rsi, RZ_OFF(64)(%rsp) + movq %rdi, RZ_OFF(72)(%rsp) +@@ -912,7 +912,7 @@ ENT(ASM_CONCAT(__rvs_exp_,TARGET_VEX_OR_FMA)): + + LBL(.L_vsp_final_check): + +-#if defined(WIN64) || defined(TARGET_INTERIX_X8664) ++#if defined(_WIN64) || defined(TARGET_INTERIX_X8664) + vmovdqu RZ_OFF(104)(%rsp), %ymm6 + movq RZ_OFF(64)(%rsp), %rsi + movq RZ_OFF(72)(%rsp), %rdi +@@ -986,7 +986,7 @@ ENT(ASM_CONCAT3(__rvs_exp_,TARGET_VEX_OR_FMA,_256)): + movq %r14, 232(%rsp) + movq %r15, 240(%rsp) + +-#if defined(WIN64) || defined(TARGET_INTERIX_X8664) ++#if defined(_WIN64) || defined(TARGET_INTERIX_X8664) + vmovdqu %ymm6, 128(%rsp) + movq %rsi, 200(%rsp) + movq %rdi, 208(%rsp) +@@ -1207,7 +1207,7 @@ ENT(ASM_CONCAT3(__rvs_exp_,TARGET_VEX_OR_FMA,_256)): + + LBL(.L_vsp_final_check_256): + +-#if defined(WIN64) || defined(TARGET_INTERIX_X8664) ++#if defined(_WIN64) || defined(TARGET_INTERIX_X8664) + vmovdqu 128(%rsp), %ymm6 + movq 200(%rsp), %rsi + movq 208(%rsp), %rdi diff --git a/ports/pgmath/build_only_one_kind.patch b/ports/pgmath/build_only_one_kind.patch new file mode 100644 index 00000000000000..8805668bf06c1a --- /dev/null +++ b/ports/pgmath/build_only_one_kind.patch @@ -0,0 +1,16 @@ +diff --git a/runtime/libpgmath/lib/CMakeLists.txt b/runtime/libpgmath/lib/CMakeLists.txt +index c64f7fb83..149d8bfcd 100644 +--- a/runtime/libpgmath/lib/CMakeLists.txt ++++ b/runtime/libpgmath/lib/CMakeLists.txt +@@ -259,7 +259,10 @@ endif() + else() + set_target_properties(${LIBPGMATH_LIBRARY_NAME}_static PROPERTIES OUTPUT_NAME ${LIBPGMATH_LIBRARY_NAME}) + endif() ++if(PGMATH_SHARED) + install(TARGETS ${LIBPGMATH_LIBRARY_NAME} + LIBRARY DESTINATION lib) ++else() + install(TARGETS ${LIBPGMATH_LIBRARY_NAME}_static + ARCHIVE DESTINATION lib) ++endif() +\ No newline at end of file diff --git a/ports/pgmath/portfile.cmake b/ports/pgmath/portfile.cmake new file mode 100644 index 00000000000000..348136897aea27 --- /dev/null +++ b/ports/pgmath/portfile.cmake @@ -0,0 +1,62 @@ +#vcpkg_check_linkage(ONLY_STATIC_LIBRARY) # requires same linkage as vcpkg-tool-flang + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO flang-compiler/flang + REF 5a60d344443e38715b7c837de53d9ce2ed78b0d6 + SHA512 aff012c3cf9756d84b8bb5d0c369a1fd78d51af4cb2734183640e7fdcc16f6e6ab2ab78a56cc4b750f1571f7842b2b76b255e442df98e0aacd5e07db6a9d6a82 + PATCHES 1167.diff + build_only_one_kind.patch + werror.patch +) + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY) +vcpkg_add_to_path(${PYTHON3_DIR}) + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_cmake_get_vars(cmake_vars_file) + include("${cmake_vars_file}") + if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + vcpkg_list(SET OPTIONS + "-DCMAKE_C_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/vcpkg-tool-llvm/bin/clang-cl.exe" + "-DCMAKE_CXX_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/vcpkg-tool-llvm/bin/clang-cl.exe" + "-DCMAKE_AR=${VCPKG_DETECTED_CMAKE_AR}" + "-DCMAKE_LINKER=${VCPKG_DETECTED_CMAKE_LINKER}" + "-DCMAKE_MT=${VCPKG_DETECTED_CMAKE_MT}" + ) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + string(APPEND VCPKG_C_FLAGS " --target=aarch64-win32-msvc") + string(APPEND VCPKG_CXX_FLAGS " --target=aarch64-win32-msvc") + endif() + endif() + vcpkg_acquire_msys(MSYS_ROOT PACKAGES gawk bash sed) + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + vcpkg_list(APPEND OPTIONS -DCMAKE_SYSTEM_PROCESSOR=AMD64) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + vcpkg_list(APPEND OPTIONS -DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR:STRING=ARM64 -DCMAKE_SYSTEM_NAME:STRING=Windows) + message(STATUS "OPTIONS:${OPTIONS}" ) + else() + vcpkg_list(APPEND OPTIONS -DCMAKE_SYSTEM_PROCESSOR=generic + -DLIBPGMATH_WITH_GENERIC=ON) + endif() +endif() + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" PGMATH_SHARED) +vcpkg_list(APPEND OPTIONS "-DPGMATH_SHARED=${PGMATH_SHARED}") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/runtime/libpgmath" + OPTIONS ${OPTIONS} + "-DWITH_WERROR=OFF" + MAYBE_UNUSED_VARIABLES + WITH_WERROR + +) +vcpkg_cmake_install(ADD_BIN_TO_PATH) + +configure_file("${SOURCE_PATH}/runtime/libpgmath/LICENSE.txt" "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") + +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) # Build depends on VCPKG_CRT_LINKAGE (maybe introcude VCPKG_FRT_LINKAGE?) diff --git a/ports/pgmath/vcpkg.json b/ports/pgmath/vcpkg.json new file mode 100644 index 00000000000000..5f324678edc705 --- /dev/null +++ b/ports/pgmath/vcpkg.json @@ -0,0 +1,23 @@ +{ + "name": "pgmath", + "version-date": "2022-04-23", + "description": "PGI Math Library", + "homepage": "https://llvm.org", + "license": "Apache-2.0", + "supports": "x64 | arm64", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-tool-llvm", + "host": true, + "platform": "windows" + } + ] +} diff --git a/ports/pgmath/werror.patch b/ports/pgmath/werror.patch new file mode 100644 index 00000000000000..2972b88882a6ee --- /dev/null +++ b/ports/pgmath/werror.patch @@ -0,0 +1,13 @@ +diff --git a/runtime/libpgmath/lib/x86_64/CMakeLists.txt b/runtime/libpgmath/lib/x86_64/CMakeLists.txt +index c96c8357f..9b1bf08e5 100644 +--- a/runtime/libpgmath/lib/x86_64/CMakeLists.txt ++++ b/runtime/libpgmath/lib/x86_64/CMakeLists.txt +@@ -87,7 +87,7 @@ if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + endif() + set(FLAGS "${FLAGS}-Wall -W -Wstrict-prototypes -Wwrite-strings ") + if(NOT ${LIBPGMATH_SYSTEM_NAME} MATCHES "Windows") +- set(FLAGS "${FLAGS}-Werror ") ++# set(FLAGS "${FLAGS}-Werror ") + endif() + libmath_add_object_library("${SRCS}" "${FLAGS}" "${DEFINITIONS}" "isoc99") + diff --git a/ports/vcpkg-fortran-flang/copyright b/ports/vcpkg-fortran-flang/copyright new file mode 100644 index 00000000000000..2e4eac8264fa4c --- /dev/null +++ b/ports/vcpkg-fortran-flang/copyright @@ -0,0 +1,23 @@ +Copyright (c) Microsoft Corporation + +All rights reserved. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/ports/vcpkg-fortran-flang/portfile.cmake b/ports/vcpkg-fortran-flang/portfile.cmake new file mode 100644 index 00000000000000..84c63959259e1e --- /dev/null +++ b/ports/vcpkg-fortran-flang/portfile.cmake @@ -0,0 +1,15 @@ +set(FUNCTION_NAME x_vcpkg_find_fortran) + +if(VCPKG_CROSSCOMPILING) + # make FATAL_ERROR in CI when issue #16773 fixed + message(WARNING "${PORT} is a host-only port; please mark it as a host port in your dependencies.") +endif() + +file(COPY + "${CMAKE_CURRENT_LIST_DIR}/${FUNCTION_NAME}.cmake" + "${CMAKE_CURRENT_LIST_DIR}/copyright" + DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY) + +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/ports/vcpkg-fortran-flang/vcpkg-port-config.cmake.in b/ports/vcpkg-fortran-flang/vcpkg-port-config.cmake.in new file mode 100644 index 00000000000000..de47d418ce61b5 --- /dev/null +++ b/ports/vcpkg-fortran-flang/vcpkg-port-config.cmake.in @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/@FUNCTION_NAME@.cmake") diff --git a/ports/vcpkg-fortran-flang/vcpkg.json b/ports/vcpkg-fortran-flang/vcpkg.json new file mode 100644 index 00000000000000..817372c77f062c --- /dev/null +++ b/ports/vcpkg-fortran-flang/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "vcpkg-fortran-flang", + "version-date": "2022-02-22", + "description": "Metaport to use the flang fortran compiler", + "license": "MIT", + "supports": "windows", + "dependencies": [ + "flang-fortran-runtime", + { + "name": "vcpkg-tool-flang", + "host": true, + "platform": "windows" + } + ] +} diff --git a/ports/vcpkg-fortran-flang/x_vcpkg_find_fortran.cmake b/ports/vcpkg-fortran-flang/x_vcpkg_find_fortran.cmake new file mode 100644 index 00000000000000..45da5e46f684e0 --- /dev/null +++ b/ports/vcpkg-fortran-flang/x_vcpkg_find_fortran.cmake @@ -0,0 +1,123 @@ +#[===[.md: +# x_vcpkg_find_fortran + +Checks if a Fortran compiler can be found. +Windows(x86/x64) Only: If not it will search and enable Intel + ifort compiler if available. + +## Usage +```cmake +x_vcpkg_find_fortran() +``` + +## Example +```cmake +x_vcpkg_find_fortran(fortran_args) +# ... +vcpkg_configure_cmake(... + OPTIONS + ${fortran_args} +) +``` +#]===] + + +function(x_vcpkg_find_fortran) + + cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "OUT_OPTIONS;OUT_OPTIONS_RELEASE;OUT_OPTIONS_DEBUG" "") + + vcpkg_list(SET additional_cmake_args) + + set(CMAKE_BINARY_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}") + set(CMAKE_CURRENT_BINARY_DIR "${CMAKE_BINARY_DIR}") + set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_BINARY_DIR}/Platform") + include(CMakeDetermineFortranCompiler) + + if(NOT CMAKE_Fortran_COMPILER AND "${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}" STREQUAL "") + # If a user uses their own VCPKG_CHAINLOAD_TOOLCHAIN_FILE, they _must_ figure out Fortran on their own. + if(WIN32) + message(STATUS "No Fortran compiler found on the PATH. Trying to use classic flang!") + if(VCPKG_TARGET_IS_UWP) + set(extra_uwp_flags "-Wl,/NODEFAULTLIB:libcmt -Wl,/NODEFAULTLIB:libcmtd -Wl,/NODEFAULTLIB:msvcrt -Wl,/NODEFAULTLIB:msvcrtd") + set(exta_uwp_link_flags "-DCMAKE_SHARED_LINKER_FLAGS_INIT:STRING=-Wl,/APPCONTAINER") + endif() + + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(ARCH X86) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(ARCH ARM) + endif() + vcpkg_add_to_path("${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/${ARCH}") + + z_vcpkg_get_cmake_vars(cmake_vars_file) + include("${cmake_vars_file}") + + find_library(PGMATH NAMES libpgmath pgmath PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATHS) + cmake_path(GET PGMATH FILENAME pgmathlibname) + find_library(flanglib NAMES libflang flang PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATHS) + cmake_path(GET flanglib FILENAME flanglibname) + find_library(flangrtilib NAMES libflangrti flangrti PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATHS) + cmake_path(GET flangrtilib FILENAME flangrtilibname) + if(VCPKG_OPENMP) + find_library(omplib NAMES libomp omp PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATHS) + cmake_path(GET omplib FILENAME omplibname) + else() + find_library(omplib NAMES libompstub ompstub PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATHS) + cmake_path(GET omplib FILENAME omplibname) + endif() + find_library(flangmainlib NAMES libflangmain flangmain PATHS "${CURRENT_INSTALLED_DIR}/lib" NO_DEFAULT_PATHS) + cmake_path(GET flangmainlib FILENAME flangmainlibname) + + vcpkg_list(SET flang_compile_libs "") + vcpkg_list(SET flang_link_lib "${flanglibname} ${flangrtilibname} ${pgmathlibname} ${omplibname}") + vcpkg_list(SET flang_link_default_lib "/DEFAULTLIB:${flanglibname} /DEFAULTLIB:${flangrtilibname} /DEFAULTLIB:${pgmathlibname} /DEFAULTLIB:${omplibname}") + + set(static_flang "") + if("${pgmathlibname}" STREQUAL "libpgmath.lib") + set(static_flang "-static-flang-libs ") + endif() + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + set(arch_flag "--target=aarch64-win32-msvc") + endif() + #-noFlangLibs -fno-fortran-main + #-Wno-unused-command-line-argument + vcpkg_list(APPEND additional_cmake_args + "-DCMAKE_C_COMPILER=${VCPKG_DETECTED_CMAKE_C_COMPILER}" + "-DCMAKE_Fortran_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/flang.exe" + "-DCMAKE_EXE_LINKER_FLAGS_DEBUG_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib" + "-DCMAKE_EXE_LINKER_FLAGS_RELEASE_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib" + "-DCMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib" + "-DCMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib" + "-DCMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib" + "-DCMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib" + "-DCMAKE_Fortran_FLAGS_DEBUG_INIT:STRING=-O0 -Wl,/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib" + "-DCMAKE_Fortran_FLAGS_RELEASE_INIT:STRING=-O3 -Wl,/LIBPATH:${CURRENT_INSTALLED_DIR}/lib" + "-DCMAKE_Fortran_STANDARD_LIBRARIES_INIT=${flang_link_lib}" + #"-DCMAKE_Fortran_LINKER_FLAGS_RELEASE_INIT=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${flang_link_default_lib}" + #"-DCMAKE_Fortran_LINKER_FLAGS_DEBUG_INIT=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib ${flang_link_default_lib}" + "-DCMAKE_REQUIRED_LINK_OPTIONS:STRING=-LIBPATH:${CURRENT_INSTALLED_DIR}/\$$<\$$:debug/>lib/" + #"-DCMAKE_Fortran_LINK_EXECUTABLE=\\\\\"\\\\\${_CMAKE_VS_LINK_EXE} \\\\\${CMAKE_CL_NOLOGO} \\\\\${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /version:.${_PLATFORM_LINK_FLAGS} \\\\\${CMAKE_END_TEMP_FILE}\\\\\"" + "${exta_uwp_link_flags}") + vcpkg_list(APPEND additional_cmake_args_rel + "-DCMAKE_EXE_LINKER_FLAGS_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${flangmainlibname} ${flang_link_default_lib}" + "-DCMAKE_SHARED_LINKER_FLAGS_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${flang_link_default_lib}" + "-DCMAKE_STATIC_LINKER_FLAGS_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${flang_link_default_lib}" + "-DCMAKE_Fortran_FLAGS_INIT:STRING=${arch_flag} -Mreentrant -I ${CURRENT_INSTALLED_DIR}/include ${static_flang}${flang_compile_libs} -Wl,/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${extra_uwp_flags}" + #"-DCMAKE_Fortran_LINKER_FLAGS_INIT=/LIBPATH:${CURRENT_INSTALLED_DIR}/lib ${flang_link_default_lib}" + ) + vcpkg_list(APPEND additional_cmake_args_dbg + "-DCMAKE_EXE_LINKER_FLAGS_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib ${flangmainlibname} ${flang_link_default_lib}" + "-DCMAKE_SHARED_LINKER_FLAGS_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib ${flang_link_default_lib}" + "-DCMAKE_STATIC_LINKER_FLAGS_INIT:STRING=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib ${flang_link_default_lib}" + "-DCMAKE_Fortran_FLAGS_INIT:STRING=${arch_flag} -Mreentrant -I ${CURRENT_INSTALLED_DIR}/include ${static_flang}${flang_compile_libs} -Wl,/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib ${extra_uwp_flags}" + #"-DCMAKE_Fortran_LINKER_FLAGS_INIT=/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib ${flang_link_default_lib}" + ) + set(VCPKG_USE_INTERNAL_Fortran TRUE CACHE INTERNAL "") + else() + message(FATAL_ERROR "Unable to find a Fortran compiler using 'CMakeDetermineFortranCompiler'. Please install one (e.g. gfortran) and make it available on the PATH!") + endif() + endif() + set("${arg_OUT_OPTIONS}" "${additional_cmake_args}" PARENT_SCOPE) + set("${arg_OUT_OPTIONS_RELEASE}" "${additional_cmake_args_rel}" PARENT_SCOPE) + set("${arg_OUT_OPTIONS_DEBUG}" "${additional_cmake_args_dbg}" PARENT_SCOPE) +endfunction() diff --git a/ports/vcpkg-tool-7zip/portfile.cmake b/ports/vcpkg-tool-7zip/portfile.cmake new file mode 100644 index 00000000000000..e52b3ee0708615 --- /dev/null +++ b/ports/vcpkg-tool-7zip/portfile.cmake @@ -0,0 +1,47 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +file(READ "${CURRENT_PORT_DIR}/vcpkg.json" manifest_contents) +string(JSON version GET "${manifest_contents}" "version-string") +string(REPLACE "." "" versionraw "${version}") +if(VCPKG_TARGET_IS_WINDOWS) + set(name_msg 7z) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(arch_suffix "") + set(hash 103210153e60b4234015796bb5f12483f99b5909df8c2fe5c9d3a823d4bdc721602a5261ad794e5280ff9f0d5f79add4e2a732dfb087fe8b4844d789acb8ea42) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(arch_suffix "-x64") + set(hash d55b44f1255d1b0e629719383a600a7e83dc6378d470096337b886ce24684d26bcc2b04f9cea39ad888179edce23ad2bd0e8e1863ddc40106c176adece8c012d) + endif() + set(name_folder "${name_msg}${versionraw}${arch_suffix}") + set(name_msi "${name_folder}.msi") + set(url "https://www.7-zip.org/a/${name_msi}") + + vcpkg_download_distfile(archive_path + URLS "${url}" + SHA512 "${hash}" + FILENAME "${name_msi}" + ) + + set(output_path "${CURRENT_PACKAGES_DIR}/manual-tools") # vcpkg.cmake adds everything in /tools to CMAKE_PROGRAM_PATH. That is not desired for Python2 + file(MAKE_DIRECTORY "${output_path}") + cmake_path(NATIVE_PATH archive_path archive_path_native) # lessmsi is a bit picky about path formats. + message(STATUS "Extracting ${name_msg} ...") + vcpkg_execute_in_download_mode( + COMMAND "${CURRENT_HOST_INSTALLED_DIR}/tools/vcpkg-tool-lessmsi/lessmsi.exe" x "${archive_path_native}" # Using output_path here does not work in bash + WORKING_DIRECTORY "${output_path}" + OUTPUT_FILE "${CURRENT_BUILDTREES_DIR}/lessmsi-${TARGET_TRIPLET}-out.log" + ERROR_FILE "${CURRENT_BUILDTREES_DIR}/lessmsi-${TARGET_TRIPLET}-err.log" + RESULT_VARIABLE error_code + ) + if(error_code) + message(FATAL_ERROR "Couldn't extract ${name_msg} with lessmsi!") + endif() + message(STATUS "Extracting ${name_msg} ... finished!") + file(RENAME "${output_path}/7z2107-x64/SourceDir/Files/7-Zip" "${output_path}/${PORT}/") + + set(details "set(program_version \"${program_version}\")\n") + string(APPEND details "set(paths_to_search \"\${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}\")\n") + file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/details.cmake" "${details}") +endif() + + diff --git a/ports/vcpkg-tool-7zip/vcpkg.json b/ports/vcpkg-tool-7zip/vcpkg.json new file mode 100644 index 00000000000000..a264ffbc293bda --- /dev/null +++ b/ports/vcpkg-tool-7zip/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-tool-7zip", + "version-string": "21.07", + "description": "7-Zip is a file archiver with a high compression ratio.", + "homepage": "https://www.7-zip.org/", + "license": null, + "supports": "native & windows & (x64 | x86)", + "dependencies": [ + { + "name": "vcpkg-tool-lessmsi", + "host": true + } + ] +} diff --git a/ports/vcpkg-tool-flang-llvm/0004-fix-dr-1734.patch b/ports/vcpkg-tool-flang-llvm/0004-fix-dr-1734.patch new file mode 100644 index 00000000000000..3a2f4a28e3e956 --- /dev/null +++ b/ports/vcpkg-tool-flang-llvm/0004-fix-dr-1734.patch @@ -0,0 +1,17 @@ + llvm/include/llvm/Support/type_traits.h | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/llvm/include/llvm/Support/type_traits.h b/llvm/include/llvm/Support/type_traits.h +index 7b7d5d991f3f..469b681deea3 100644 +--- a/llvm/include/llvm/Support/type_traits.h ++++ b/llvm/include/llvm/Support/type_traits.h +@@ -176,7 +176,8 @@ class is_trivially_copyable { + (has_deleted_copy_assign || has_trivial_copy_assign) && + (has_deleted_copy_constructor || has_trivial_copy_constructor); + +-#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE ++// due to DR 1734, a type can be std::is_trivially_copyable but not llvm::is_trivially_copyable ++#if 0 + static_assert(value == std::is_trivially_copyable::value, + "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable"); + #endif diff --git a/ports/vcpkg-tool-flang-llvm/0010-fix-libffi.patch b/ports/vcpkg-tool-flang-llvm/0010-fix-libffi.patch new file mode 100644 index 00000000000000..93d0cb4da4d421 --- /dev/null +++ b/ports/vcpkg-tool-flang-llvm/0010-fix-libffi.patch @@ -0,0 +1,16 @@ + llvm/cmake/config-ix.cmake | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake +index dd0aaadb47c7..279435b5b27d 100644 +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -343,7 +343,7 @@ if( LLVM_ENABLE_FFI ) + message(FATAL_ERROR "libffi includes are not found.") + endif() + +- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) ++ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) + if( NOT FFI_LIBRARY_PATH ) + message(FATAL_ERROR "libffi is not found.") + endif() diff --git a/ports/vcpkg-tool-flang-llvm/0011-fix-libxml2.patch b/ports/vcpkg-tool-flang-llvm/0011-fix-libxml2.patch new file mode 100644 index 00000000000000..d3f953f320df6b --- /dev/null +++ b/ports/vcpkg-tool-flang-llvm/0011-fix-libxml2.patch @@ -0,0 +1,34 @@ + clang/tools/c-index-test/CMakeLists.txt | 6 +----- + lldb/cmake/modules/LLDBConfig.cmake | 2 +- + 2 files changed, 2 insertions(+), 6 deletions(-) + +diff --git a/clang/tools/c-index-test/CMakeLists.txt b/clang/tools/c-index-test/CMakeLists.txt +index ceef4b08637c..40b9e995597f 100644 +--- a/clang/tools/c-index-test/CMakeLists.txt ++++ b/clang/tools/c-index-test/CMakeLists.txt +@@ -40,11 +40,7 @@ set_target_properties(c-index-test + + # If libxml2 is available, make it available for c-index-test. + if (CLANG_HAVE_LIBXML) +- if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})) +- include_directories(SYSTEM ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}) +- else() +- include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR}) +- endif() ++ include_directories(SYSTEM ${LIBXML2_INCLUDE_DIRS}) + target_link_libraries(c-index-test PRIVATE ${LIBXML2_LIBRARIES}) + endif() + +diff --git a/lldb/cmake/modules/LLDBConfig.cmake b/lldb/cmake/modules/LLDBConfig.cmake +index b62cd7d24438..a8c78ee1bccd 100644 +--- a/lldb/cmake/modules/LLDBConfig.cmake ++++ b/lldb/cmake/modules/LLDBConfig.cmake +@@ -215,7 +215,7 @@ if (LLDB_ENABLE_LZMA) + endif() + + if (LLDB_ENABLE_LIBXML2) +- include_directories(${LIBXML2_INCLUDE_DIR}) ++ include_directories(${LIBXML2_INCLUDE_DIRS}) + endif() + + include_directories(BEFORE diff --git a/ports/vcpkg-tool-flang-llvm/65.diff b/ports/vcpkg-tool-flang-llvm/65.diff new file mode 100644 index 00000000000000..0d8495e7b4f016 --- /dev/null +++ b/ports/vcpkg-tool-flang-llvm/65.diff @@ -0,0 +1,175 @@ +diff --git a/clang/lib/Driver/ToolChains/ClassicFlang.cpp b/clang/lib/Driver/ToolChains/ClassicFlang.cpp +index b6ce5d9ac99d..a2003fc77f3d 100644 +--- a/clang/lib/Driver/ToolChains/ClassicFlang.cpp ++++ b/clang/lib/Driver/ToolChains/ClassicFlang.cpp +@@ -1072,6 +1072,14 @@ void ClassicFlang::ConstructJob(Compilation &C, const JobAction &JA, + LowerCmdArgs.push_back(Args.MakeArgString(OutFile)); + } + ++ bool IsWindowsMSVC = getToolChain().getTriple().isWindowsMSVCEnvironment(); ++ if (IsWindowsMSVC && !Args.hasArg(options::OPT_noFlangLibs)) { ++ getToolChain().AddFortranStdlibLibArgs(Args, LowerCmdArgs); ++ for (auto Arg : Args.filtered(options::OPT_noFlangLibs)) { ++ Arg->claim(); ++ } ++ } ++ + C.addCommand(std::make_unique(JA, *this, ResponseFileSupport::AtFileUTF8(), LowerExec, LowerCmdArgs, Inputs)); + } + +diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp +index 332a52ea92a1..2624c88b45be 100644 +--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp ++++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp +@@ -118,7 +118,7 @@ static void renderRemarksHotnessOptions(const ArgList &Args, + } + + /// \brief Determine if Fortran "main" object is needed +-static bool needFortranMain(const Driver &D, const ArgList &Args) { ++bool tools::needFortranMain(const Driver &D, const ArgList &Args) { + return (needFortranLibs(D, Args) + && (!Args.hasArg(options::OPT_Mnomain) || + !Args.hasArg(options::OPT_no_fortran_main))); +diff --git a/clang/lib/Driver/ToolChains/CommonArgs.h b/clang/lib/Driver/ToolChains/CommonArgs.h +index 624353edc1ab..6a5962a76505 100644 +--- a/clang/lib/Driver/ToolChains/CommonArgs.h ++++ b/clang/lib/Driver/ToolChains/CommonArgs.h +@@ -22,6 +22,8 @@ namespace tools { + + bool needFortranLibs(const Driver &D, const llvm::opt::ArgList &Args); + ++bool needFortranMain(const Driver &D, const llvm::opt::ArgList &Args); ++ + void addPathIfExists(const Driver &D, const Twine &Path, + ToolChain::path_list &Paths); + +diff --git a/clang/lib/Driver/ToolChains/MSVC.cpp b/clang/lib/Driver/ToolChains/MSVC.cpp +index 13943b6c404a..f2348a13f7be 100644 +--- a/clang/lib/Driver/ToolChains/MSVC.cpp ++++ b/clang/lib/Driver/ToolChains/MSVC.cpp +@@ -335,7 +335,10 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, + + if (!Args.hasArg(options::OPT_nostdlib, options::OPT_nostartfiles) && + !C.getDriver().IsCLMode()) { +- CmdArgs.push_back("-defaultlib:libcmt"); ++#ifdef ENABLE_CLASSIC_FLANG ++ if (!C.getDriver().IsFlangMode()) ++#endif ++ CmdArgs.push_back("-defaultlib:libcmt"); + CmdArgs.push_back("-defaultlib:oldnames"); + } + +@@ -481,6 +484,13 @@ void visualstudio::Linker::ConstructJob(Compilation &C, const JobAction &JA, + } + } + ++#ifdef ENABLE_CLASSIC_FLANG ++ if (C.getDriver().IsFlangMode()) { ++ CmdArgs.push_back(Args.MakeArgString(std::string("-libpath:") + ++ TC.getDriver().Dir + "/../lib")); ++ } ++#endif ++ + // Add compiler-rt lib in case if it was explicitly + // specified as an argument for --rtlib option. + if (!Args.hasArg(options::OPT_nostdlib)) { +@@ -825,6 +835,83 @@ void MSVCToolChain::AddHIPIncludeArgs(const ArgList &DriverArgs, + RocmInstallation.AddHIPIncludeArgs(DriverArgs, CC1Args); + } + ++#ifdef ENABLE_CLASSIC_FLANG ++void MSVCToolChain::AddFortranStdlibLibArgs(const ArgList &Args, ++ ArgStringList &CmdArgs) const { ++ bool staticFlangLibs = false; ++ bool useOpenMP = false; ++ ++ if (Args.hasArg(options::OPT_staticFlangLibs)) { ++ for (auto *A: Args.filtered(options::OPT_staticFlangLibs)) { ++ A->claim(); ++ staticFlangLibs = true; ++ } ++ } ++ ++ Arg *A = Args.getLastArg(options::OPT_mp, options::OPT_nomp, ++ options::OPT_fopenmp, options::OPT_fno_openmp); ++ if (A && ++ (A->getOption().matches(options::OPT_mp) || ++ A->getOption().matches(options::OPT_fopenmp))) { ++ useOpenMP = true; ++ } ++ ++ if (needFortranMain(getDriver(), Args)) { ++ // flangmain is always static ++ //CmdArgs.push_back("-linker"); ++ //CmdArgs.push_back("/subsystem:console"); ++ //CmdArgs.push_back("-linker"); ++ //CmdArgs.push_back("/defaultlib:flangmain.lib"); ++ } ++ ++ if (staticFlangLibs) { ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:libflang.lib"); ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:libflangrti.lib"); ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:libpgmath.lib"); ++ } else { ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:flang.lib"); ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:flangrti.lib"); ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:pgmath.lib"); ++ } ++ if (useOpenMP) { ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/nodefaultlib:vcomp.lib"); ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/nodefaultlib:vcompd.lib"); ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:libomp.lib"); ++ } ++ else { ++ if (staticFlangLibs) { ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:libompstub.lib"); ++ } else { ++ CmdArgs.push_back("-linker"); ++ CmdArgs.push_back("/defaultlib:ompstub.lib"); ++ } ++ } ++ ++ // Allways link Fortran executables with Pthreads ++ // CmdArgs.push_back("-lpthread"); ++ ++ // These options are added clang-cl in Clang.cpp for C/C++ ++ // In clang-cl.exe -MD and -MT control these options, but in ++ // flang.exe like clang.exe these are different options for ++ // dependency tracking. Let's assume that if somebody needs ++ // static flang libs, they don't need static C runtime libs. ++ // FIXME: Use LLVM_USE_CRT_ variable ++ // to use libcmt.lib or msvcrt.lib ++ // CmdArgs.push_back("-linker"); ++ // CmdArgs.push_back("/defaultlib:libcmt.lib"); ++} ++#endif ++ + void MSVCToolChain::printVerboseInfo(raw_ostream &OS) const { + CudaInstallation.print(OS); + RocmInstallation.print(OS); +diff --git a/clang/lib/Driver/ToolChains/MSVC.h b/clang/lib/Driver/ToolChains/MSVC.h +index dba99ed77246..540094e5191b 100644 +--- a/clang/lib/Driver/ToolChains/MSVC.h ++++ b/clang/lib/Driver/ToolChains/MSVC.h +@@ -126,6 +126,11 @@ class LLVM_LIBRARY_VISIBILITY MSVCToolChain : public ToolChain { + void AddHIPIncludeArgs(const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + ++#ifdef ENABLE_CLASSIC_FLANG ++ void AddFortranStdlibLibArgs(const llvm::opt::ArgList &Args, ++ llvm::opt::ArgStringList &CmdArgs) const override; ++#endif ++ + bool getWindowsSDKLibraryPath( + const llvm::opt::ArgList &Args, std::string &path) const; + bool getUniversalCRTLibraryPath(const llvm::opt::ArgList &Args, diff --git a/ports/vcpkg-tool-flang-llvm/portfile.cmake b/ports/vcpkg-tool-flang-llvm/portfile.cmake new file mode 100644 index 00000000000000..f107d3ec81b7fe --- /dev/null +++ b/ports/vcpkg-tool-flang-llvm/portfile.cmake @@ -0,0 +1,249 @@ +set(LLVM_VERSION "13.0.1") + +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO flang-compiler/classic-flang-llvm-project + REF eafb7696e6f1cbf00f19d3c418f71cdac574bad3 # 0254365051067b50372914150a004048c5cbce54 + SHA512 8008c11145cacd2d5237af3c5d00b86fba922d67a444b67a05fd5a20162dec4e8d187016a28c1bdc008ce42dfce0254fa5b0635a50bc8fc8af3281de97a76951 + #c412c1bfb93803568e83be3777491b1b99be9ae9338b3d4fd87b0422ad428b9e45ebc7488f668f21957930c07189ee72567c5661964e5458d0d0cf37fe1c0608 + HEAD_REF release_13x + PATCHES + 0004-fix-dr-1734.patch + 0010-fix-libffi.patch + 0011-fix-libxml2.patch + 65.diff +) + +# LLVM generates CMake error due to Visual Studio version 16.4 is known to miscompile part of LLVM. +# LLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON disables this error. +# See https://developercommunity.visualstudio.com/content/problem/845933/miscompile-boolean-condition-deduced-to-be-always.html +# and thread "[llvm-dev] Longstanding failing tests - clang-tidy, MachO, Polly" on llvm-dev Jan 21-23 2020. +#list(APPEND FEATURE_OPTIONS +# -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON +#) + +# Force enable or disable external libraries +set(llvm_external_libraries + zlib + libxml2 +) +foreach(external_library IN LISTS llvm_external_libraries) + string(TOLOWER "enable-${external_library}" feature_name) + string(TOUPPER "LLVM_ENABLE_${external_library}" define_name) + list(APPEND FEATURE_OPTIONS + -D${define_name}=FORCE_ON + ) +endforeach() + +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_DIR ${PYTHON3} DIRECTORY) +vcpkg_add_to_path(${PYTHON3_DIR}) +vcpkg_find_acquire_program(PERL) +get_filename_component(PERL_DIR ${PERL} DIRECTORY) +vcpkg_add_to_path(${PERL_DIR}) + +set(VCPKG_BUILD_TYPE release) # Only need release tools +set(CURRENT_PACKAGES_DIR_BAK "${CURRENT_PACKAGES_DIR}") +set(CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang") +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/llvm" + OPTIONS + ${FEATURE_OPTIONS} + ${CROSS_OPTIONS} + -DLLVM_INCLUDE_EXAMPLES=OFF + -DLLVM_BUILD_EXAMPLES=OFF + -DLLVM_INCLUDE_TESTS=OFF + -DLLVM_INCLUDE_BENCHMARKS=OFF + -DLLVM_BUILD_TESTS=OFF + -DLLVM_BUILD_UTILS=OFF + -DLLVM_INSTALL_UTILS=ON + -DLLVM_TOOL_BUGPOINT_BUILD=OFF + -DLLVM_TOOL_BUGPOINT_PASSES_BUILD=OFF + -DLLVM_TOOL_DSYMÙTIL_BUILD=OFF + -DLLVM_TOOL_GOLD_BUILD=OFF + -DLLVM_TOOL_LLC_BUILD=OFF + -DLLVM_TOOL_LLVM_AS_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_BCANALYZER_BUILD=OFF + -DLLVM_TOOL_LLVM_CAT_BUILD=OFF + -DLLVM_TOOL_LLVM_CFI_VERIFY_BUILD=OFF + -DLLVM_TOOL_LLVM_COV_BUILD=OFF + -DLLVM_TOOL_LLVM_CVTRES_BUILD=OFF + -DLLVM_TOOL_LLVM_CXXDUMP_BUILD=OFF + -DLLVM_TOOL_LLVM_CXXFILT_BUILD=OFF + -DLLVM_TOOL_LLVM_CXXMAP_BUILD=OFF + -DLLVM_TOOL_LLVM_C_TEST_BUILD=OFF + -DLLVM_TOOL_LLVM_DIFF_BUILD=OFF + -DLLVM_TOOL_LLVM_DIS_BUILD=OFF + -DLLVM_TOOL_LLVM_DWARFDUMP_BUILD=ON + -DLLVM_TOOL_LLVM_DWP_BUILD=OFF + -DLLVM_TOOL_LLVM_EXEGESIS_BUILD=OFF + -DLLVM_TOOL_LLVM_EXTRACT_BUILD=OFF + -DLLVM_TOOL_LLVM_GO_BUILD=OFF + -DLLVM_TOOL_LLVM_GSYMUTIL_BUILD=OFF + -DLLVM_TOOL_LLVM_IFS_BUILD=OFF + -DLLVM_TOOL_LLVM_ISEL_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_ITANIUM_DEMANGLE_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_JITLINK_BUILD=OFF + -DLLVM_TOOL_LLVM_JITLISTENER_BUILD=OFF + -DLLVM_TOOL_LLVM_LIBTOOL_DARWIN_BUILD=OFF + -DLLVM_TOOL_LLVM_LIPO_BUILD=OFF + -DLLVM_TOOL_LLVM_MCA_BUILD=OFF + -DLLVM_TOOL_LLVM_MC_ASSEMBLE_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_MC_BUILD=OFF + -DLLVM_TOOL_LLVM_MC_DISASSEMBLE_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_ML_BUILD=OFF + -DLLVM_TOOL_LLVM_MODEXTRACT_BUILD=OFF + -DLLVM_TOOL_LLVM_OPT_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_OPT_REPORT_BUILD=OFF + -DLLVM_TOOL_LLVM_PROFDATA_BUILD=OFF + -DLLVM_TOOL_LLVM_PROFGEN_BUILD=OFF + -DLLVM_TOOL_LLVM_REDUCE_BUILD=OFF + -DLLVM_TOOL_LLVM_RTDYLD_BUILD=OFF + -DLLVM_TOOL_LLVM_RUST_DEMANGLE_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_SHLIB_BUILD=OFF + -DLLVM_TOOL_LLVM_SIM_BUILD=OFF + -DLLVM_TOOL_LLVM_SIZE_BUILD=OFF + -DLLVM_TOOL_LLVM_SPECIAL_CASE_LIST_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_SPLIT_BUILD=OFF + -DLLVM_TOOL_LLVM_STRESS_BUILD=OFF + -DLLVM_TOOL_LLVM_STRINGS_BUILD=OFF + -DLLVM_TOOL_LLVM_SYMBOLIZER_BUILD=OFF + -DLLVM_TOOL_LLVM_TAPI_DIFF_BUILD=OFF + -DLLVM_TOOL_LLVM_UNDNAME_BUILD=OFF + -DLLVM_TOOL_LLVM_XRAY_BUILD=OFF + -DLLVM_TOOL_LLVM_YAML_NUMERIC_PARSER_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_YAML_PARSER_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLVM_LTO2_BUILD=OFF + -DLLVM_TOOL_LLVM_LTO_BUILD=OFF + -DLLVM_TOOL_REMARKS_SHLIB_BUILD=OFF + -DLLVM_TOOL_SANCOV_BUILD=OFF + -DLLVM_TOOL_SANSTATS_BUILD=OFF + -DLLVM_TOOL_SPLIT_FILE_BUILD=OFF + -DLLVM_TOOL_VERIFY_USELISTORDER_BUILD=OFF + -DLLVM_TOOL_XCODE_TOOLCHAIN_BUILD=OFF + -DLLVM_TOOL_YAML2OBJ_BUILD=OFF + -DLLVM_TOOL_OBJ2YAML_BUILD=OFF + -DLLVM_TOOL_OPT_BUILD=OFF + -DLLVM_TOOL_OPT_VIEWER_BUILD=OFF + -DLLVM_TOOL_VFABI_DEMANGLE_FUZZER_BUILD=OFF + -DLLVM_TOOL_LLI_BUILD=OFF + -DLLVM_TOOL_MLIR_BUILD=ON + -DCLANG_TOOL_AMDGPU_ARCH_BUILD=OFF + -DCLANG_TOOL_APINOTES_TEST_BUILD=OFF + -DCLANG_TOOL_ARCMT_TEST_BUILD=OFF + -DCLANG_TOOL_CLANG_CHECK_BUILD=OFF + -DCLANG_TOOL_CLANG_DIFF_BUILD=OFF + -DCLANG_TOOL_CLANG_EXTDEF_MAPPING_BUILD=OFF + -DCLANG_TOOL_CLANG_FORMAT_BUILD=OFF + -DCLANG_TOOL_CLANG_FORMAT_VS_BUILD=OFF + -DCLANG_TOOL_CLANG_FUZZER_BUILD=OFF + -DCLANG_TOOL_CLANG_IMPORT_TEST_BUILD=OFF + -DCLANG_TOOL_CLANG_OFFLOAD_BUNDLER_BUILD=OFF + -DCLANG_TOOL_CLANG_OFFLOAD_WRAPPER_BUILD=OFF + -DCLANG_TOOL_CLANG_REFACTOR_BUILD=OFF + -DCLANG_TOOL_CLANG_RENAME_BUILD=OFF + -DCLANG_TOOL_CLANG_REPL_BUILD=OFF + -DCLANG_TOOL_CLANG_SCAN_DEPS_BUILD=OFF + -DCLANG_TOOL_CLANG_SHLIB_BUILD=OFF + -DCLANG_TOOL_C_ARCMT_TEST_BUILD=OFF + -DCLANG_TOOL_C_INDEX_TEST_BUILD=OFF + -DCLANG_TOOL_DIAGTOOL_BUILD=OFF + -DCLANG_TOOL_SCAN_BUILD_BUILD=OFF + -DCLANG_TOOL_SCAN_BUILD_PY_BUILD=OFF + -DCLANG_TOOL_SCAN_VIEW_BUILD=OFF + #-DLLDB_ENABLE_CURSES=OFF + # Force TableGen to be built with optimization. This will significantly improve build time. + -DLLVM_OPTIMIZED_TABLEGEN=ON + #"-DLLVM_ENABLE_PROJECTS=${LLVM_ENABLE_PROJECTS}" + -DLLVM_ENABLE_CLASSIC_FLANG=ON + "-DLLVM_ENABLE_PROJECTS=clang;flang;openmp" + "-DLLVM_TARGETS_TO_BUILD=X86;AArch64" + -DFLANG_BUILD_NEW_DRIVER=OFF + -DFLANG_INCLUDE_DOCS=OFF + #-DPACKAGE_VERSION=${LLVM_VERSION} + # Limit the maximum number of concurrent link jobs to 1. This should fix low amount of memory issue for link. + # Disable build LLVM-C.dll (Windows only) due to doesn't compile with CMAKE_DEBUG_POSTFIX + -DLLVM_BUILD_LLVM_C_DYLIB=OFF + # Path for binary subdirectory (defaults to 'bin') + #-DLLVM_TOOLS_INSTALL_DIR=tools/flang + -DCMAKE_INSTALL_PREFIX=${CURRENT_PACKAGES_DIR} +) +set(CURRENT_PACKAGES_DIR "${CURRENT_PACKAGES_DIR_BAK}") + +vcpkg_cmake_install(ADD_BIN_TO_PATH) + +function(llvm_cmake_package_config_fixup package_name) + cmake_parse_arguments("arg" "DO_NOT_DELETE_PARENT_CONFIG_PATH" "FEATURE_NAME" "" ${ARGN}) + if(NOT DEFINED arg_FEATURE_NAME) + set(arg_FEATURE_NAME ${package_name}) + endif() + if("${arg_FEATURE_NAME}" STREQUAL "${PORT}" OR "${arg_FEATURE_NAME}" IN_LIST FEATURES) + set(args) + list(APPEND args PACKAGE_NAME "${package_name}") + if(arg_DO_NOT_DELETE_PARENT_CONFIG_PATH) + list(APPEND args "DO_NOT_DELETE_PARENT_CONFIG_PATH") + endif() + vcpkg_cmake_config_fixup(${args}) + file(INSTALL "${SOURCE_PATH}/${package_name}/LICENSE.TXT" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${package_name}" RENAME copyright) + if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/${package_name}_usage") + file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/${package_name}_usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${package_name}" RENAME usage) + endif() + endif() +endfunction() + +llvm_cmake_package_config_fixup("clang" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("flang" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("lld" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("mlir" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("polly" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("ParallelSTL" FEATURE_NAME "pstl" DO_NOT_DELETE_PARENT_CONFIG_PATH) +llvm_cmake_package_config_fixup("llvm") + + +# Don't let LLVM take control over vcpkg here! +vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/lib/cmake/llvm/ChooseMSVCCRT.cmake" "choose_msvc_crt(MSVC_CRT)" "#choose_msvc_crt(MSVC_CRT)") + +set(empty_dirs) + +if("clang-tools-extra" IN_LIST FEATURES) + list(APPEND empty_dirs "${CURRENT_PACKAGES_DIR}/include/clang-tidy/plugin") +endif() + + +if(empty_dirs) + foreach(empty_dir IN LISTS empty_dirs) + if(NOT EXISTS "${empty_dir}") + message(SEND_ERROR "Directory '${empty_dir}' is not exist. Please remove it from the checking.") + else() + file(GLOB_RECURSE files_in_dir "${empty_dir}/*") + if(files_in_dir) + message(SEND_ERROR "Directory '${empty_dir}' is not empty. Please remove it from the checking.") + else() + file(REMOVE_RECURSE "${empty_dir}") + endif() + endif() + endforeach() +endif() + +vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/bin") + +# LLVM still generates a few DLLs in the static build: +# * libclang.dll +# * LTO.dll +# * Remarks.dll +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) +set(VCPKG_POLICY_MISMATCHED_NUMBER_OF_BINARIES enabled) + +configure_file("${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/bin/clang.exe" "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/bin/flang.exe" COPYONLY) + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/include/flang/CMakeFiles" + "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/include/flang/Config" + "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/include/flang/Optimizer/CMakeFiles" + "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/include/flang/Optimizer/CodeGen/CMakeFiles" + "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/include/flang/Optimizer/Dialect/CMakeFiles" + "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/include/flang/Optimizer/Transforms/CMakeFiles") + +file(INSTALL "${SOURCE_PATH}/llvm/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) diff --git a/ports/vcpkg-tool-flang-llvm/vcpkg.json b/ports/vcpkg-tool-flang-llvm/vcpkg.json new file mode 100644 index 00000000000000..fab8eb9c7b8b72 --- /dev/null +++ b/ports/vcpkg-tool-flang-llvm/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "vcpkg-tool-flang-llvm", + "version-date": "2022-04-23", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "license": "Apache-2.0", + "supports": "windows & native", + "dependencies": [ + "libxml2", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + "zlib" + ] +} diff --git a/ports/vcpkg-tool-flang/1163.diff b/ports/vcpkg-tool-flang/1163.diff new file mode 100644 index 00000000000000..6f2cccf0a46f4f --- /dev/null +++ b/ports/vcpkg-tool-flang/1163.diff @@ -0,0 +1,1928 @@ +diff --git a/runtime/flang/access3f.c b/runtime/flang/access3f.c +index f330b57b18e..62a78edd0b5 100644 +--- a/runtime/flang/access3f.c ++++ b/runtime/flang/access3f.c +@@ -10,7 +10,7 @@ + /* access3f.c - Implements LIB3F access subroutine. */ + + /* must include ent3f.h AFTER io3f.h */ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + +diff --git a/runtime/flang/alarm3f.c b/runtime/flang/alarm3f.c +index bf65ac96c01..e81f8f49cee 100644 +--- a/runtime/flang/alarm3f.c ++++ b/runtime/flang/alarm3f.c +@@ -9,7 +9,7 @@ + + /* alarm3f.c - Implements LIB3F alarm subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + #include + #include "ent3f.h" + +diff --git a/runtime/flang/alias.c b/runtime/flang/alias.c +index 58c582abe03..6f5e06223fb 100644 +--- a/runtime/flang/alias.c ++++ b/runtime/flang/alias.c +@@ -5,7 +5,7 @@ + * + */ + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "omp.h" + + extern void omp_set_num_threads_(int num_threads) +diff --git a/runtime/flang/allo.c b/runtime/flang/allo.c +index f9c1db5289f..b383bf44339 100644 +--- a/runtime/flang/allo.c ++++ b/runtime/flang/allo.c +@@ -239,7 +239,7 @@ I8(__fort_alloc)(__INT_T nelem, dtype kind, size_t len, __STAT_T *stat, + char msg[80]; + char *p_env; + +-#if (defined(WIN64) || defined(WIN32)) ++#if (defined(_WIN64)) + #define ALN_LARGE + #else + #undef ALN_LARGE +@@ -398,7 +398,7 @@ I8(__alloc04)(__NELEM_T nelem, dtype kind, size_t len, + MP_V_STDIO; + } + +-#if (defined(WIN64) || defined(WIN32)) ++#if (defined(_WIN64)) + #define ALN_LARGE + #else + #undef ALN_LARGE +diff --git a/runtime/flang/backspace.c b/runtime/flang/backspace.c +index ef27003d94a..0ee3b837636 100644 +--- a/runtime/flang/backspace.c ++++ b/runtime/flang/backspace.c +@@ -64,7 +64,7 @@ _f90io_backspace(__INT_T *unit, __INT_T *bitv, __INT_T *iostat, int swap_bytes) + + if (f->nonadvance) { + f->nonadvance = FALSE; +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +diff --git a/runtime/flang/besj03f.c b/runtime/flang/besj03f.c +index de01cd8ce1e..9c6ea374d95 100644 +--- a/runtime/flang/besj03f.c ++++ b/runtime/flang/besj03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j0 _j0 + #endif + +diff --git a/runtime/flang/besj13f.c b/runtime/flang/besj13f.c +index edf45a4dbc7..1ec34afc157 100644 +--- a/runtime/flang/besj13f.c ++++ b/runtime/flang/besj13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j1 _j1 + #endif + +diff --git a/runtime/flang/besjn3f.c b/runtime/flang/besjn3f.c +index 77dc92b923c..6f39867b9b7 100644 +--- a/runtime/flang/besjn3f.c ++++ b/runtime/flang/besjn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define jn _jn + #endif + +diff --git a/runtime/flang/besy03f.c b/runtime/flang/besy03f.c +index 7fa4aea96c8..634661382f7 100644 +--- a/runtime/flang/besy03f.c ++++ b/runtime/flang/besy03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y0 _y0 + #endif + +diff --git a/runtime/flang/besy13f.c b/runtime/flang/besy13f.c +index 98167989af7..ba661fe6efe 100644 +--- a/runtime/flang/besy13f.c ++++ b/runtime/flang/besy13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y1 _y1 + #endif + +diff --git a/runtime/flang/besyn3f.c b/runtime/flang/besyn3f.c +index 3c271de14ae..cb4a8ef950f 100644 +--- a/runtime/flang/besyn3f.c ++++ b/runtime/flang/besyn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define yn _yn + #endif + +diff --git a/runtime/flang/buffer.c b/runtime/flang/buffer.c +index d6061056918..c55817f0822 100644 +--- a/runtime/flang/buffer.c ++++ b/runtime/flang/buffer.c +@@ -12,7 +12,7 @@ + #include "stdioInterf.h" + #include "fioMacros.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #define creat _creat + #define close _close +diff --git a/runtime/flang/chdir3f.c b/runtime/flang/chdir3f.c +index c64d313840e..9947c6a19c9 100644 +--- a/runtime/flang/chdir3f.c ++++ b/runtime/flang/chdir3f.c +@@ -10,7 +10,7 @@ + /* chdir3f.c - Implements LIB3F chdir subprogram. */ + + /* must include ent3f.h AFTER io3f.h */ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #else + #include +@@ -18,7 +18,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define chdir _chdir + #endif + +diff --git a/runtime/flang/chmod3f.c b/runtime/flang/chmod3f.c +index 58dbd8c250f..8a7a88e2e69 100644 +--- a/runtime/flang/chmod3f.c ++++ b/runtime/flang/chmod3f.c +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define chmod _chmod + #endif + +diff --git a/runtime/flang/close.c b/runtime/flang/close.c +index 628b8e83dcc..a66ce2428e4 100644 +--- a/runtime/flang/close.c ++++ b/runtime/flang/close.c +@@ -13,12 +13,12 @@ + + #include + #include "global.h" +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + #include "stdioInterf.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define unlink _unlink + #define access _access + #endif +@@ -38,7 +38,7 @@ __fortio_close(FIO_FCB *f, int flag) + + if (f->nonadvance) { + f->nonadvance = FALSE; +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +@@ -61,7 +61,7 @@ __fortio_close(FIO_FCB *f, int flag) + else + __fort_unlink(f->name); + } +-#ifdef WINNT ++#if defined(_WIN64) + else if (f->status == FIO_SCRATCH) + unlink(f->name); + #endif +diff --git a/runtime/flang/cnfg.c b/runtime/flang/cnfg.c +index 020fa06c0ec..800d2549078 100644 +--- a/runtime/flang/cnfg.c ++++ b/runtime/flang/cnfg.c +@@ -77,7 +77,7 @@ __fortio_scratch_name(char *filename, int unit) + extern char *__io_tempnam(); + char *nm; + +-#if defined(WINNT) ++#if defined(_WIN64) + if (getenv("TMP") == 0) + nm = __io_tempnam("C:\\", "FTN"); + else +@@ -85,13 +85,13 @@ __fortio_scratch_name(char *filename, int unit) + strcpy(filename, nm); + if (nm) + free(nm); +-#else /*WINNT*/ ++#else /*_WIN64*/ + + nm = __io_tempnam((char *)0, "FTN"); + strcpy(filename, nm); + if (nm) + free(nm); + +-#endif /*WINNT*/ ++#endif /*_WIN64*/ + + } +diff --git a/runtime/flang/cnfg.h b/runtime/flang/cnfg.h +index 37571b94877..4f30164d440 100644 +--- a/runtime/flang/cnfg.h ++++ b/runtime/flang/cnfg.h +@@ -17,7 +17,7 @@ typedef struct { + int ftn_true; /* -1 ==> VAX; 1 => unix */ + } FIO_CNFG; + +-#ifdef WINNT ++#if defined(_WIN64) + + extern const char *__get_fio_cnfg_default_name(void); + extern int __get_fio_cnfg_true_mask(void); +diff --git a/runtime/flang/const.c b/runtime/flang/const.c +index e0fb057b976..fff4c3d999d 100644 +--- a/runtime/flang/const.c ++++ b/runtime/flang/const.c +@@ -125,14 +125,6 @@ __INT_T ENTCOMN(TYPE, type)[] = { + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43}; + +-#if defined(WINNT) && !defined(WIN64) && !defined(WIN32) +-char * +-__get_fort_type_addr(void) +-{ +- return (char *)ENTCOMN(TYPE, type); +-} +-#endif +- + /* universal constants */ + + long long int __fort_one[4] = {~0, ~0, ~0, ~0}; +@@ -422,7 +414,7 @@ __get_size_of(int* idx) + return __fort_size_of[*idx]; + } + +-#ifdef WINNT ++#if defined(_WIN64) + + /* pg access routines for data shared between windows dlls */ + +@@ -657,7 +649,7 @@ __get_fort_zed(void) + return __fort_zed; + } + +-#endif /* WINNT */ ++#endif /* _WIN64 */ + + void + __fort_init_consts() +@@ -765,7 +757,7 @@ __fort_init_consts() + /* + * Always emit the comms for non-windows systems. + */ +-#ifdef WINNT ++#if defined(_WIN64) + /* + * Emit the comms for win if pg.dll is not used -- PGDLL is defined + * if we need to revert to pg.dll. +diff --git a/runtime/flang/cplxf.c b/runtime/flang/cplxf.c +index 3b5103b9c4e..721ba755ba5 100644 +--- a/runtime/flang/cplxf.c ++++ b/runtime/flang/cplxf.c +@@ -10,7 +10,7 @@ + #include "stdioInterf.h" + #include "fioMacros.h" + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif +diff --git a/runtime/flang/curdir.c b/runtime/flang/curdir.c +index 4f6bebf8ac5..2c8dc429138 100644 +--- a/runtime/flang/curdir.c ++++ b/runtime/flang/curdir.c +@@ -6,7 +6,7 @@ + */ + + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif +@@ -18,7 +18,7 @@ + #define MAXPATHLEN 1024 + #endif + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define getcwd _getcwd + #endif + +@@ -89,7 +89,7 @@ void __fort_getdir(curdir) char *curdir; + + void __fort_gethostname(host) char *host; + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct utsname un; + #endif + const char *p; +@@ -97,7 +97,7 @@ void __fort_gethostname(host) char *host; + + p = __fort_getopt("-curhost"); + if (p == NULL) { +-#ifndef _WIN64 ++#if !defined(_WIN64) + s = uname(&un); /* get hostname */ + if (s == -1) { + __fort_abortp("uname"); +diff --git a/runtime/flang/dbesj03f.c b/runtime/flang/dbesj03f.c +index a2575abfe35..1c6daf31e13 100644 +--- a/runtime/flang/dbesj03f.c ++++ b/runtime/flang/dbesj03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j0 _j0 + #endif + +diff --git a/runtime/flang/dbesj13f.c b/runtime/flang/dbesj13f.c +index b4546ca9741..a2754cad4a3 100644 +--- a/runtime/flang/dbesj13f.c ++++ b/runtime/flang/dbesj13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define j1 _j1 + #endif + +diff --git a/runtime/flang/dbesjn3f.c b/runtime/flang/dbesjn3f.c +index 0161cbb2115..b629455a72e 100644 +--- a/runtime/flang/dbesjn3f.c ++++ b/runtime/flang/dbesjn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define jn _jn + #endif + +diff --git a/runtime/flang/dbesy03f.c b/runtime/flang/dbesy03f.c +index 92bf37e4d72..5d83efd4c4a 100644 +--- a/runtime/flang/dbesy03f.c ++++ b/runtime/flang/dbesy03f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y0 _y0 + #endif + +diff --git a/runtime/flang/dbesy13f.c b/runtime/flang/dbesy13f.c +index 778724c5bf5..19e6fcfc723 100644 +--- a/runtime/flang/dbesy13f.c ++++ b/runtime/flang/dbesy13f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define y1 _y1 + #endif + +diff --git a/runtime/flang/dbesyn3f.c b/runtime/flang/dbesyn3f.c +index 0e5f7495779..7ac77bb636b 100644 +--- a/runtime/flang/dbesyn3f.c ++++ b/runtime/flang/dbesyn3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define yn _yn + #endif + +diff --git a/runtime/flang/delfilesqq3f.c b/runtime/flang/delfilesqq3f.c +index 9263df52976..2411d6c6d5b 100644 +--- a/runtime/flang/delfilesqq3f.c ++++ b/runtime/flang/delfilesqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* delfilesqq3f.c - Implements DFLIB delfilesqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + int ENT3F(DELFILESQQ, delfilesqq)(DCHAR(ffiles) DCLEN(ffiles)) + { +diff --git a/runtime/flang/descIntrins.c b/runtime/flang/descIntrins.c +index 61f6fdecb88..77edd3d3b6b 100644 +--- a/runtime/flang/descIntrins.c ++++ b/runtime/flang/descIntrins.c +@@ -279,7 +279,7 @@ ENTFTN(KINDEXX, kindexx_cr_nm) + + #endif + +-#if defined(WINNT) ++#if defined(_WIN64) + + /* functions here follow the msfortran/mscall conventions */ + +diff --git a/runtime/flang/drandm3f.c b/runtime/flang/drandm3f.c +index 411904e4c58..f217da1c924 100644 +--- a/runtime/flang/drandm3f.c ++++ b/runtime/flang/drandm3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + /* drand48, srand48 are not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/dtime3f.c b/runtime/flang/dtime3f.c +index 956a186ff32..a36b332847a 100644 +--- a/runtime/flang/dtime3f.c ++++ b/runtime/flang/dtime3f.c +@@ -14,14 +14,14 @@ + #include "ent3f.h" + + #define _LIBC_LIMITS_H_ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif + #include + #include + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #define CLK_TCK 10000000.0 + #else +diff --git a/runtime/flang/ent3f.h b/runtime/flang/ent3f.h +index 60822c3a643..e3b0589219b 100644 +--- a/runtime/flang/ent3f.h ++++ b/runtime/flang/ent3f.h +@@ -17,27 +17,13 @@ + #undef CADR + #undef CLEN + +-/* macros for entries */ +-#if defined(WINNT) && !defined(WIN64) && !defined(UXOBJS) +- +-#pragma global - x 121 0x20000 +-#define ENT3F(UC, LC) __attribute__((stdcall)) UC +-#define ENT3FSU(UC, LC) __attribute__((stdcall)) UC##_ +-/* macros to declare character arguments */ +-#define DCHAR(ARG) char *ARG##_adr, int ARG##_len +-#define DCLEN(ARG) +- +-#else +- + #define ENT3F(UC, LC) LC##_ + #define ENT3FSU(UC, LC) LC##__ + /* macros to declare character arguments */ + #define DCHAR(ARG) char *ARG##_adr + #define DCLEN(ARG) , int ARG##_len + +-#endif +- +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define j0 _j0 + #define j1 _j1 + #define jn _jn +diff --git a/runtime/flang/entry.c b/runtime/flang/entry.c +index 0ce5120251e..ec6eb096e2c 100644 +--- a/runtime/flang/entry.c ++++ b/runtime/flang/entry.c +@@ -16,7 +16,7 @@ + + WIN_API __INT_T LINENO[]; + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #endif + +@@ -44,7 +44,7 @@ static int __fort_trac_mflag; + static int __fort_prof_mflag; + int __fort_entry_mflag; + +-#ifdef WINNT ++#if defined(_WIN64) + /* pg access for dlls */ + char * + __get_fort_lineno_addr(void) +diff --git a/runtime/flang/etime3f.c b/runtime/flang/etime3f.c +index 90f2b937335..ad3378da5df 100644 +--- a/runtime/flang/etime3f.c ++++ b/runtime/flang/etime3f.c +@@ -15,7 +15,7 @@ + + /* Not implemented for WINNT */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #endif +@@ -24,7 +24,7 @@ + #include + + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #define CLK_TCK 10000000.0 + #else +diff --git a/runtime/flang/fdate3f.c b/runtime/flang/fdate3f.c +index fe82d98d4df..cf76749b002 100644 +--- a/runtime/flang/fdate3f.c ++++ b/runtime/flang/fdate3f.c +@@ -14,7 +14,7 @@ + #include + #include "utils3f.h" + +-#if !defined(WIN32) && !defined(WIN64) ++#if !defined(_WIN64) + WIN_MSVCRT_IMP char *WIN_CDECL ctime(const time_t *); + #endif + +diff --git a/runtime/flang/findfileqq3f.c b/runtime/flang/findfileqq3f.c +index 2b0a236576a..a4e81a1d6dd 100644 +--- a/runtime/flang/findfileqq3f.c ++++ b/runtime/flang/findfileqq3f.c +@@ -16,7 +16,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + extern char *__fstr2cstr(); + int ENT3F(FINDFILEQQ, findfileqq)(DCHAR(fname), DCHAR(fvarname), +diff --git a/runtime/flang/fioMacros.h b/runtime/flang/fioMacros.h +index d57a2cff71b..aaacc9742ae 100644 +--- a/runtime/flang/fioMacros.h ++++ b/runtime/flang/fioMacros.h +@@ -208,7 +208,7 @@ void __fort_set_second(double d); + #define __DIST_ENTRY_AWAIT(reqn) + #define __DIST_ENTRY_AWAIT_DONE(reqn) + +-#ifdef WINNT ++#if defined(_WIN64) + /* prototypes for HPF */ + + /* The PG compilers cannot yet create dlls that share data. For +@@ -1716,4 +1716,4 @@ void ENTF90(TEMPLATE1, template1)(F90_Desc *dd, __INT_T *p_flags, __INT_T *p_kin + void ENTF90(TEMPLATE2, template2)(F90_Desc *dd, __INT_T *p_flags, __INT_T *p_kind, __INT_T *p_len, __INT_T *p_l1, __INT_T *p_u1, __INT_T *p_l2, __INT_T *p_u2); + void ENTF90(TEMPLATE3, template3)(F90_Desc *dd, __INT_T *p_flags, __INT_T *p_kind, __INT_T *p_len, __INT_T *p_l1, __INT_T *p_u1, __INT_T *p_l2, __INT_T *p_u2, __INT_T *p_l3, __INT_T *p_u3); + +-#endif /*_PGHPF_H_*/ ++#endif /*_PGHPF_H_*/ +\ No newline at end of file +diff --git a/runtime/flang/fiodf.c b/runtime/flang/fiodf.c +index 07fbae8548d..1d6602dbcd2 100644 +--- a/runtime/flang/fiodf.c ++++ b/runtime/flang/fiodf.c +@@ -13,7 +13,7 @@ + + FIO_TBL fioFcbTbls = {0}; + +-#ifdef WINNT ++#if defined(_WIN64) + FIO_FCB * + __get_hpfio_fcbs(void) + { +diff --git a/runtime/flang/fmtwrite.c b/runtime/flang/fmtwrite.c +index e15ed57c2da..92e1eb68cfc 100644 +--- a/runtime/flang/fmtwrite.c ++++ b/runtime/flang/fmtwrite.c +@@ -2687,7 +2687,7 @@ fw_write_record(void) + f->nonadvance = FALSE; /* do it now */ + if (!(g->suppress_crlf)) { + /* append carriage return */ +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +diff --git a/runtime/flang/fork3f.c b/runtime/flang/fork3f.c +index bddb99108ac..4081cf4b589 100644 +--- a/runtime/flang/fork3f.c ++++ b/runtime/flang/fork3f.c +@@ -9,7 +9,7 @@ + + /* fork3f.c - Implements LIB3F fork subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -33,4 +33,4 @@ int ENT3F(FORK, fork)() + return pid; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/fortDt.h b/runtime/flang/fortDt.h +index 28e1eb0c675..75daa3dac09 100644 +--- a/runtime/flang/fortDt.h ++++ b/runtime/flang/fortDt.h +@@ -265,7 +265,7 @@ typedef __CPLX16_T __BIGCPLX_T; + + /* pointer-sized integer */ + +-#if defined(WIN64) ++#if defined(_WIN64) + + typedef long long __POINT_T; + +diff --git a/runtime/flang/fpcvt.c b/runtime/flang/fpcvt.c +index b72fba9ebca..59cedaeaa02 100644 +--- a/runtime/flang/fpcvt.c ++++ b/runtime/flang/fpcvt.c +@@ -7,7 +7,7 @@ + + #include + #include +-#if !defined(WIN64) ++#if !defined(_WIN64) + #include + #endif + #include "fioMacros.h" +@@ -731,7 +731,7 @@ __fortio_strtod(char *s, char **p) + * (0 is before first digit). *sign is sign. + */ + +-#if defined(WIN64) ++#if defined(_WIN64) + #define FE_TONEAREST 0 + #define FE_DOWNWARD 1024 + #define FE_UPWARD 2048 +diff --git a/runtime/flang/fstat3f.c b/runtime/flang/fstat3f.c +index ff3279753b1..b27c2e1e74b 100644 +--- a/runtime/flang/fstat3f.c ++++ b/runtime/flang/fstat3f.c +@@ -17,7 +17,7 @@ + + int ENT3F(FSTAT, fstat)(int *lu, int *statb) + { +-#ifdef _WIN64 ++#if defined(_WIN64) + struct _stat32 b; + char *p; + int i; +@@ -99,7 +99,7 @@ int ENT3F(FSTAT, fstat)(int *lu, int *statb) + statb[8] = b.st_atime; + statb[9] = b.st_mtime; + statb[10] = b.st_ctime; +-#if !defined(WINNT) ++#if !defined(_WIN64) + statb[11] = b.st_blksize; + statb[12] = b.st_blocks; + #else +diff --git a/runtime/flang/fstat643f.c b/runtime/flang/fstat643f.c +index 01e87acf74a..4cd52e55edd 100644 +--- a/runtime/flang/fstat643f.c ++++ b/runtime/flang/fstat643f.c +@@ -17,7 +17,7 @@ + + int ENT3F(FSTAT64, fstat64)(int *lu, long long *statb) + { +-#if defined(TARGET_WIN) || defined(WIN32) || defined(WIN64) ++#if defined(TARGET_WIN) || defined(_WIN64) + /* + * The __int64_t members in the _stat64 are 8-byte aligned, thus the + * st_size member is at offset 24. On WIN32, 64-bit ints are 4-byte +diff --git a/runtime/flang/fsync3f.c b/runtime/flang/fsync3f.c +index dad1748a88f..6eb3f739251 100644 +--- a/runtime/flang/fsync3f.c ++++ b/runtime/flang/fsync3f.c +@@ -20,7 +20,7 @@ void ENT3F(FSYNC, fsync)(lu) int *lu; + + f = __getfile3f(*lu); + if (f) +- #ifndef _WIN64 ++ #if !defined(_WIN64) + fsync(__io_getfd(f)); + #else + fflush(f); +diff --git a/runtime/flang/ftni64.h b/runtime/flang/ftni64.h +index ff57e3f8d30..d6660b55d0d 100644 +--- a/runtime/flang/ftni64.h ++++ b/runtime/flang/ftni64.h +@@ -46,7 +46,7 @@ typedef union { + I64_LSH(int64d.i) = l; \ + return int64d.lv; \ + } +-#elif defined(WIN64) ++#elif defined(_WIN64) + /* Someday, should only care if TM_I8 is defined */ + #define __I8RET_T long long + #define UTL_I_I64RET(m, l) \ +diff --git a/runtime/flang/fullpathqq3f.c b/runtime/flang/fullpathqq3f.c +index 29044e5f653..1cf6c2344a4 100644 +--- a/runtime/flang/fullpathqq3f.c ++++ b/runtime/flang/fullpathqq3f.c +@@ -15,7 +15,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + extern char *__fstr2cstr(); + int ENT3F(FULLPATHQQ, fullpathqq)(DCHAR(fname), +diff --git a/runtime/flang/gerror3f.c b/runtime/flang/gerror3f.c +index 9d5ee44aa60..b4c11446337 100644 +--- a/runtime/flang/gerror3f.c ++++ b/runtime/flang/gerror3f.c +@@ -17,7 +17,7 @@ + + #define Ftn_errmsg __fortio_errmsg + +-#if !defined(WIN64) && !defined(WIN32) ++#if !defined(_WIN64) + extern char *strerror(); /* SVR4 only ? */ + #endif + +diff --git a/runtime/flang/getcwd3f.c b/runtime/flang/getcwd3f.c +index f8462c801c5..ce5943313b7 100644 +--- a/runtime/flang/getcwd3f.c ++++ b/runtime/flang/getcwd3f.c +@@ -15,7 +15,7 @@ + #include "utils3f.h" + #include "mpalloc.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #define GETCWDM _getcwd /* getcwd deprecated in Windows in VC 2005 */ + #else + #define GETCWDM getcwd +diff --git a/runtime/flang/getdat3f.c b/runtime/flang/getdat3f.c +index 8f79a7a5473..6a90c9e3b93 100644 +--- a/runtime/flang/getdat3f.c ++++ b/runtime/flang/getdat3f.c +@@ -9,7 +9,7 @@ + + /* getdat3f.c - Implements getdat subroutine. */ + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + #include "ent3f.h" +diff --git a/runtime/flang/getdrivedirqq3f.c b/runtime/flang/getdrivedirqq3f.c +index 20069833821..c1e2214b413 100644 +--- a/runtime/flang/getdrivedirqq3f.c ++++ b/runtime/flang/getdrivedirqq3f.c +@@ -16,7 +16,7 @@ + #include "utils3f.h" + #include "mpalloc.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #define GETCWDM _getcwd /* getcwd deprecated in Windows in VC 2005 */ + #else + #define GETCWDM getcwd +diff --git a/runtime/flang/getfileinfoqq3f.c b/runtime/flang/getfileinfoqq3f.c +index 953adc8d859..bbed385430c 100644 +--- a/runtime/flang/getfileinfoqq3f.c ++++ b/runtime/flang/getfileinfoqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* getfileinfoqq3f.c - Implements DFLIB getfileinfoqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, + unsigned int *out); +diff --git a/runtime/flang/getfileinfoqqi83f.c b/runtime/flang/getfileinfoqqi83f.c +index 51dedfaed36..a4b9336c4d1 100644 +--- a/runtime/flang/getfileinfoqqi83f.c ++++ b/runtime/flang/getfileinfoqqi83f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* getfileinfoqq3f.c - Implements DFLIB getfileinfoqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -21,7 +21,7 @@ + #define FILE$LAST -2 + #define FILE$ERROR -3 + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, + unsigned int *out); +diff --git a/runtime/flang/getgid3f.c b/runtime/flang/getgid3f.c +index d5cd4373d2c..cf4ebe9559b 100644 +--- a/runtime/flang/getgid3f.c ++++ b/runtime/flang/getgid3f.c +@@ -9,11 +9,11 @@ + + /* getgid3f.c - Implements LIB3F getgid subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include + #include "ent3f.h" + + int ENT3F(GETGID, getgid)() { return getgid(); } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/getlog3f.c b/runtime/flang/getlog3f.c +index f52b2a58417..b3693adcdba 100644 +--- a/runtime/flang/getlog3f.c ++++ b/runtime/flang/getlog3f.c +@@ -9,7 +9,7 @@ + + /* getlog3f.c - Implements LIB3F getlog subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include "ent3f.h" + #include "utils3f.h" +@@ -24,4 +24,4 @@ void ENT3F(GETLOG, getlog)(DCHAR(nm) DCLEN(nm)) + __fcp_cstr(CADR(nm), CLEN(nm), p); + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/getpid3f.c b/runtime/flang/getpid3f.c +index f46d2061fae..c178db6038d 100644 +--- a/runtime/flang/getpid3f.c ++++ b/runtime/flang/getpid3f.c +@@ -10,7 +10,7 @@ + /* getpid3f.c - Implements LIB3F getpid subprogram. */ + + #include "ent3f.h" +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #else + #include +diff --git a/runtime/flang/gettim3f.c b/runtime/flang/gettim3f.c +index 122ea8ebb23..8ff554a9956 100644 +--- a/runtime/flang/gettim3f.c ++++ b/runtime/flang/gettim3f.c +@@ -9,7 +9,7 @@ + + /* gettim3f.c - Implements gettim subroutine. */ + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + #include "ent3f.h" +diff --git a/runtime/flang/getuid3f.c b/runtime/flang/getuid3f.c +index 105fd181b74..cb3ed4899ab 100644 +--- a/runtime/flang/getuid3f.c ++++ b/runtime/flang/getuid3f.c +@@ -9,11 +9,11 @@ + + /* getuid3f.c - Implements LIB3F getuid subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include "ent3f.h" + #include + + int ENT3F(GETUID, getuid)() { return getuid(); } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/getvolinfo3f.c b/runtime/flang/getvolinfo3f.c +index 7ddf734aadf..7e4ef2ef1eb 100644 +--- a/runtime/flang/getvolinfo3f.c ++++ b/runtime/flang/getvolinfo3f.c +@@ -18,18 +18,11 @@ + typedef char *LPSTR; + typedef int DWORD; + +-#if defined(WIN64) || defined(WIN32) +-#if defined(WIN64) ++#if defined(_WIN64) + typedef long long LDWORD; + extern int GetVolumeInformationA(); + #define ENTNAM(ss) _##ss + +-#else +-typedef long LDWORD; +-extern int __stdcall GetVolumeInformationA(); +-#define ENTNAM(ss) ss +-#endif +- + typedef LDWORD *LPDWORD; + + static void fill(LPSTR, int, int); +diff --git a/runtime/flang/global.h b/runtime/flang/global.h +index 8c93a23a52c..9fa68104ac4 100644 +--- a/runtime/flang/global.h ++++ b/runtime/flang/global.h +@@ -363,11 +363,7 @@ extern int __fortio_check_format(void); + extern int __fortio_eor_crlf(void); + extern VOID __fortio_fmtinit(void); + extern VOID __fortio_fmtend(void); +-#if defined(WINNT) +-#define EOR_CRLF 1 +-#else + #define EOR_CRLF __fortio_eor_crlf() +-#endif + extern int __fortio_no_minus_zero(void); + int __fortio_new_fp_formatter(void); + +diff --git a/runtime/flang/hand.c b/runtime/flang/hand.c +index 60b1a12f99a..91e639a7d0d 100644 +--- a/runtime/flang/hand.c ++++ b/runtime/flang/hand.c +@@ -5,12 +5,12 @@ + * + */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include "stdioInterf.h" + #include "fioMacros.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #endif + +@@ -85,7 +85,7 @@ static void sighand(s) int s; + + lcpu = __fort_myprocnum(); + __fort_psignal(lcpu, s); /* print message */ +-#if !defined(WIN64) && !defined(WIN32) ++#if !defined(_WIN64) + sleep(1); /* wait for message to clear */ + #endif + __fort_abort(NULL); /* abort */ +diff --git a/runtime/flang/heapinit.c b/runtime/flang/heapinit.c +index fdbbcb5249d..9ae1866f9e7 100644 +--- a/runtime/flang/heapinit.c ++++ b/runtime/flang/heapinit.c +@@ -30,14 +30,14 @@ int val; + void (*save)(); + int *pi; + +-#ifndef _WIN64 ++#if !defined(_WIN64) + save = signal(SIGBUS, sighand); + #endif + pi = (int *)beg; + while (pi < (int *)end) { + *pi++ = val; + } +-#ifndef _WIN64 ++#if !defined(_WIN64) + signal(SIGBUS, save); + #endif + } +diff --git a/runtime/flang/hostnm3f.c b/runtime/flang/hostnm3f.c +index a4a4c3e93f8..ff4af930971 100644 +--- a/runtime/flang/hostnm3f.c ++++ b/runtime/flang/hostnm3f.c +@@ -9,7 +9,7 @@ + + /* hostnm3f.c - Implements LIB3F hostnm subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -43,4 +43,4 @@ int ENT3F(HOSTNM, hostnm)(DCHAR(nm) DCLEN(nm)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/init.c b/runtime/flang/init.c +index 63f59da979d..e8f0b6f1f9d 100644 +--- a/runtime/flang/init.c ++++ b/runtime/flang/init.c +@@ -18,7 +18,7 @@ static int tid = 0; + + const char *__fort_transnam = "rpm1"; + +-#ifdef WINNT ++#if defined(_WIN64) + + /* pg access routines for data shared between windows dlls */ + +diff --git a/runtime/flang/initpar.c b/runtime/flang/initpar.c +index b02b502e96d..2b4f212c144 100644 +--- a/runtime/flang/initpar.c ++++ b/runtime/flang/initpar.c +@@ -15,7 +15,7 @@ + #include + #include + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + +@@ -89,8 +89,7 @@ __fort_ncpus() + return __fort_tcpus; + } + +-#if defined(WINNT) +-#if !defined(WIN64) && !defined(WIN32) ++#if defined(_WIN64) + __INT_T *CORMEM; + + /* special argument pointer access routines */ +@@ -152,7 +151,6 @@ __get_fort_np_addr(void) + { + return (char *)ENTCOMN(NP, np); + } +-#endif /* !WIN64 || !WIN32 */ + + /* access routines for data shared between windows dlls */ + +@@ -300,7 +298,7 @@ __set_fort_tids_elem(int idx, int val) + __fort_tids[idx] = val; + } + +-#endif /* WINNT */ ++#endif /* _WIN64 */ + + int + __fort_getioproc() +@@ -848,4 +846,3 @@ f90_compiled() + inited.atexit = 1; + } + } +- +diff --git a/runtime/flang/inquire.c b/runtime/flang/inquire.c +index 396c876992d..7a3f6251941 100644 +--- a/runtime/flang/inquire.c ++++ b/runtime/flang/inquire.c +@@ -16,7 +16,7 @@ + #include "global.h" + #include "async.h" + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define access _access + #endif + +diff --git a/runtime/flang/io3f.h b/runtime/flang/io3f.h +index 9071dcac9e3..1fcd08ba880 100644 +--- a/runtime/flang/io3f.h ++++ b/runtime/flang/io3f.h +@@ -16,11 +16,11 @@ + #define __fio_close(f, s) __fortio_close(f, s) + #define __fio_find_unit(u) __fortio_find_unit(u) + #define fio_fileno(f) __fort_getfd(f) +-#ifndef WINNT ++#if !defined(_WIN64) + #define pgi_fio fioFcbTbl + #endif + +-#if defined(WINNT) ++#if defined(_WIN64) + #define __PC_DOS 1 + #else + #define __PC_DOS 0 +diff --git a/runtime/flang/irand3f.c b/runtime/flang/irand3f.c +index 619f5c8720a..28c9daebc66 100644 +--- a/runtime/flang/irand3f.c ++++ b/runtime/flang/irand3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + extern int rand(); +-#ifdef WIN64 ++#if defined(_WIN64) + int ENT3F(IRAND1, irand1)() { return rand(); } + int ENT3F(IRAND2, irand2)(int *flag) + { +diff --git a/runtime/flang/irandm3f.c b/runtime/flang/irandm3f.c +index 51c64786552..5376fac050a 100644 +--- a/runtime/flang/irandm3f.c ++++ b/runtime/flang/irandm3f.c +@@ -11,7 +11,7 @@ + + #include "ent3f.h" + +-#ifdef WINNT ++#if defined(_WIN64) + + int ENT3F(IRANDM, irandm)(int *flag) + { +diff --git a/runtime/flang/kill3f.c b/runtime/flang/kill3f.c +index 860a5d634e7..d6153345079 100644 +--- a/runtime/flang/kill3f.c ++++ b/runtime/flang/kill3f.c +@@ -9,7 +9,7 @@ + + /* kill3f.c - Implements LIB3F kill subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #define POSIX 1 + #include +@@ -29,4 +29,4 @@ int *sig; + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/ldread.c b/runtime/flang/ldread.c +index dbaf1e55930..cf1bfa5eea4 100644 +--- a/runtime/flang/ldread.c ++++ b/runtime/flang/ldread.c +@@ -1707,7 +1707,7 @@ skip_record(void) + } + return __io_errno(); + } +-#if defined(WINNT) ++#if defined(_WIN64) + if (ch == '\r') { + ch = __io_fgetc(fcb->fp); + if (ch == '\n') +diff --git a/runtime/flang/ldwrite.c b/runtime/flang/ldwrite.c +index 1dbfc37d259..565a798af4d 100644 +--- a/runtime/flang/ldwrite.c ++++ b/runtime/flang/ldwrite.c +@@ -869,7 +869,7 @@ write_record(void) + return __io_errno(); + } + } else { /* sequential write: append carriage return */ +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(fcb->fp)) + if (FWRITE("\r", 1, 1, fcb->fp) != 1) + return __io_errno(); +diff --git a/runtime/flang/link3f.c b/runtime/flang/link3f.c +index 7ac8b360010..2f0f7f83ca9 100644 +--- a/runtime/flang/link3f.c ++++ b/runtime/flang/link3f.c +@@ -9,7 +9,7 @@ + + /* link3f.c - Implements LIB3F link subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -35,4 +35,4 @@ int ENT3F(LINK, link)(DCHAR(n1), DCHAR(n2) DCLEN(n1) DCLEN(n2)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/lstat3f.c b/runtime/flang/lstat3f.c +index 3fe47e94822..ce3becada72 100644 +--- a/runtime/flang/lstat3f.c ++++ b/runtime/flang/lstat3f.c +@@ -9,7 +9,7 @@ + + /* lstat3f.c - Implements LIB3F lstat subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include +@@ -45,4 +45,4 @@ int ENT3F(LSTAT, lstat)(DCHAR(nm), int *statb DCLEN(nm)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/lstat643f.c b/runtime/flang/lstat643f.c +index d912bdbb3dc..ee821eb2679 100644 +--- a/runtime/flang/lstat643f.c ++++ b/runtime/flang/lstat643f.c +@@ -9,7 +9,7 @@ + + /* lstat3f.c - Implements 64-bit LIB3F lstat subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include +@@ -45,4 +45,4 @@ int ENT3F(LSTAT64, lstat64)(DCHAR(nm), long long *statb DCLEN(nm)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/map.c b/runtime/flang/map.c +index 0decde62461..940029237f4 100644 +--- a/runtime/flang/map.c ++++ b/runtime/flang/map.c +@@ -9,7 +9,7 @@ + #include "fioMacros.h" + #include + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + +diff --git a/runtime/flang/mclock3f.c b/runtime/flang/mclock3f.c +index 49ce09606c6..ecabbf8bdca 100644 +--- a/runtime/flang/mclock3f.c ++++ b/runtime/flang/mclock3f.c +@@ -12,7 +12,7 @@ + + /* assumes the Unix times system call */ + +-#if defined(WINNT) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/misc.c b/runtime/flang/misc.c +index d3d88873c5a..ae0ecbffef3 100644 +--- a/runtime/flang/misc.c ++++ b/runtime/flang/misc.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(PARAMID) && !defined(WINNT) ++#if !defined(PARAMID) && !defined(_WIN64) + #include + #include + #include +diff --git a/runtime/flang/miscsup_com.c b/runtime/flang/miscsup_com.c +index 09d018e32c6..9b300463dcd 100644 +--- a/runtime/flang/miscsup_com.c ++++ b/runtime/flang/miscsup_com.c +@@ -15,7 +15,7 @@ + + #include + #include +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #else +diff --git a/runtime/flang/nmlwrite.c b/runtime/flang/nmlwrite.c +index 34dde490592..e12f1e6e60b 100644 +--- a/runtime/flang/nmlwrite.c ++++ b/runtime/flang/nmlwrite.c +@@ -306,12 +306,12 @@ ENTCRF90IO(NMLW_INTERN_INIT, nmlw_intern_init)( + static int + emit_eol(void) + { +-#if defined(WINNT) ++#if defined(_WIN64) + int ret_err; + #endif + + if (!internal_file) { +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) { + ret_err = write_char('\r'); + if (ret_err) +diff --git a/runtime/flang/open.c b/runtime/flang/open.c +index 3ad20dea42c..b0efac293f2 100644 +--- a/runtime/flang/open.c ++++ b/runtime/flang/open.c +@@ -20,7 +20,7 @@ + #include "async.h" + #include + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define access _access + #define unlink _unlink + #endif +@@ -94,7 +94,7 @@ __fortio_open(int unit, int action_flag, int status_flag, int dispose_flag, + for (i = 0; i < namelen; i++) + filename[i] = name[i]; + filename[namelen] = '\0'; +-#if defined(WINNT) ++#if defined(_WIN64) + if (filename[0] == '/' && filename[1] == '/' && filename[3] == '/') { + /* convert posix format to win32 format */ + filename[0] = filename[2]; /* drive letter */ +diff --git a/runtime/flang/packtimeqq3f.c b/runtime/flang/packtimeqq3f.c +index 3e665802487..c89a5ee7b15 100644 +--- a/runtime/flang/packtimeqq3f.c ++++ b/runtime/flang/packtimeqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* packtimeqq3f.c - Implements DFLIB packtimeqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -17,7 +17,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, + unsigned int *out); +diff --git a/runtime/flang/perror3f.c b/runtime/flang/perror3f.c +index 2450a115161..f8fca431c49 100644 +--- a/runtime/flang/perror3f.c ++++ b/runtime/flang/perror3f.c +@@ -13,7 +13,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if !defined(WIN64) && !defined(WIN32) ++#if !defined(_WIN64) + extern char *strerror(); /* SVR4 only ? */ + #endif + extern FILE *__getfile3f(); +diff --git a/runtime/flang/rand3f.c b/runtime/flang/rand3f.c +index a0940fe1818..c7edd5ddea8 100644 +--- a/runtime/flang/rand3f.c ++++ b/runtime/flang/rand3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + /* drand48 is not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/random3f.c b/runtime/flang/random3f.c +index f8d23fe10f5..ba2820f3999 100644 +--- a/runtime/flang/random3f.c ++++ b/runtime/flang/random3f.c +@@ -12,7 +12,7 @@ + #include "ent3f.h" + + /* drand48, srand48 are not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/rewind.c b/runtime/flang/rewind.c +index 66cc87df2e2..1030d77bcef 100644 +--- a/runtime/flang/rewind.c ++++ b/runtime/flang/rewind.c +@@ -44,7 +44,7 @@ _f90io_rewind(__INT_T *unit, __INT_T *bitv, __INT_T *iostat) + + if (f->nonadvance) { + f->nonadvance = FALSE; +-#if defined(WINNT) ++#if defined(_WIN64) + if (__io_binary_mode(f->fp)) + __io_fputc('\r', f->fp); + #endif +diff --git a/runtime/flang/setfileaccessqq3f.c b/runtime/flang/setfileaccessqq3f.c +index 92441b67846..2f7b2e92c9c 100644 +--- a/runtime/flang/setfileaccessqq3f.c ++++ b/runtime/flang/setfileaccessqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* setfileaccessqq3f.c - Implements DFLIB setfileaccessqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -22,7 +22,7 @@ + #define FILE$ERROR -3 + #define FILE$CURTIME -1 + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + + int ENT3F(SETFILEACCESSQQ, setfileaccessqq)(DCHAR(ffile), +diff --git a/runtime/flang/setfiletimeqq3f.c b/runtime/flang/setfiletimeqq3f.c +index efcbe5a7d91..d19be2069ff 100644 +--- a/runtime/flang/setfiletimeqq3f.c ++++ b/runtime/flang/setfiletimeqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* setfiletimeqq3f.c - Implements DFLIB setfiletimeqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -22,7 +22,7 @@ + #define FILE$ERROR -3 + #define FILE$CURTIME -1 + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __UnpackTime(unsigned int secsSince1970, ULARGE_INTEGER *fileTime); + extern int __GETFILEINFOQQ(DCHAR(ffiles), char *buffer, +diff --git a/runtime/flang/signalqq3f.c b/runtime/flang/signalqq3f.c +index 29d04b539c6..038dfbce8b0 100644 +--- a/runtime/flang/signalqq3f.c ++++ b/runtime/flang/signalqq3f.c +@@ -14,7 +14,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || !defined(WINNT) ++#if defined(_WIN64) + + #define LONGINTSIZE unsigned long long + +@@ -30,4 +30,4 @@ ENT3F(SIGNALQQ, signalqq)(short *signum, void (*proc)(int)) + return (LONGINTSIZE)p; + } + +-#endif /* WIN64 or !WINNT */ ++#endif /* _WIN64 */ +diff --git a/runtime/flang/sleep3f.c b/runtime/flang/sleep3f.c +index 9f501998a3a..2ffbc14d5d7 100644 +--- a/runtime/flang/sleep3f.c ++++ b/runtime/flang/sleep3f.c +@@ -9,12 +9,12 @@ + + /* sleep3f.c - Implements LIB3F sleep subprogram. */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/sleepqq3f.c b/runtime/flang/sleepqq3f.c +index c74b71f1214..836971faa29 100644 +--- a/runtime/flang/sleepqq3f.c ++++ b/runtime/flang/sleepqq3f.c +@@ -9,12 +9,12 @@ + + /* sleep3f.c - Implements DFPORT SLEEPQQ subprogram. */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #endif + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #include + +diff --git a/runtime/flang/splitpathqq3f.c b/runtime/flang/splitpathqq3f.c +index 1a479034d90..dd43a6549a1 100644 +--- a/runtime/flang/splitpathqq3f.c ++++ b/runtime/flang/splitpathqq3f.c +@@ -15,7 +15,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + extern char *__fstr2cstr(); + int ENT3F(SPLITPATHQQ, splitpathqq)(DCHAR(fpath), DCHAR(fdrive), DCHAR(fdir), +diff --git a/runtime/flang/srand3f.c b/runtime/flang/srand3f.c +index 1e93c4d188d..e112831c3fa 100644 +--- a/runtime/flang/srand3f.c ++++ b/runtime/flang/srand3f.c +@@ -13,7 +13,7 @@ + #include "ent3f.h" + + /* srand48 is not currently available on win64 */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + void ENT3F(SRAND1, srand1)(int *iseed) { srand(*iseed); } + +diff --git a/runtime/flang/stat.c b/runtime/flang/stat.c +index 34ea477590a..23a03282db3 100644 +--- a/runtime/flang/stat.c ++++ b/runtime/flang/stat.c +@@ -13,7 +13,7 @@ + #include + #include + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define write _write + #endif + +diff --git a/runtime/flang/stat3f.c b/runtime/flang/stat3f.c +index 2fe309e510c..655baad06d5 100644 +--- a/runtime/flang/stat3f.c ++++ b/runtime/flang/stat3f.c +@@ -19,7 +19,7 @@ extern void __cstr_free(); + + int ENT3F(STAT, stat)(DCHAR(nm), int *statb DCLEN(nm)) + { +-#ifdef _WIN64 ++#if defined(_WIN64) + struct _stat32 b; + char *p; + int i; +@@ -62,7 +62,7 @@ int ENT3F(STAT, stat)(DCHAR(nm), int *statb DCLEN(nm)) + statb[8] = b.st_atime; + statb[9] = b.st_mtime; + statb[10] = b.st_ctime; +-#if !defined(WINNT) ++#if !defined(_WIN64) + statb[11] = b.st_blksize; + statb[12] = b.st_blocks; + #else +diff --git a/runtime/flang/stat643f.c b/runtime/flang/stat643f.c +index 360743b71e1..a47fcbcf595 100644 +--- a/runtime/flang/stat643f.c ++++ b/runtime/flang/stat643f.c +@@ -19,7 +19,7 @@ extern void __cstr_free(); + + int ENT3F(STAT64, stat64)(DCHAR(nm), long long *statb DCLEN(nm)) + { +-#if defined(TARGET_WIN) || defined(WIN32) || defined(WIN64) ++#if defined(TARGET_WIN) || defined(_WIN64) + /* + * The __int64_t members in the _stat64 are 8-byte aligned, thus the + * st_size member is at offset 24. On WIN32, 64-bit ints are 4-byte +diff --git a/runtime/flang/stat_linux.c b/runtime/flang/stat_linux.c +index 2b696791621..a4f3d34c0b8 100644 +--- a/runtime/flang/stat_linux.c ++++ b/runtime/flang/stat_linux.c +@@ -9,7 +9,7 @@ + * \brief Fill in statistics structure (Linux version) + */ + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + #include + #include +@@ -36,7 +36,7 @@ __fort_setarg(void) + // TODO: Implement functions for WIN32 + static void nodename(s) char *s; + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct utsname u0; + + uname(&u0); +@@ -46,7 +46,7 @@ static void nodename(s) char *s; + + void __fort_gettb(t) struct tb *t; + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct timeval tv0; + struct timezone tz0; + struct rusage rs0, rc0; +@@ -102,7 +102,7 @@ static double first = 0.0; + double + __fort_second() + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + struct timeval v; + struct timezone t; + double d; +diff --git a/runtime/flang/symlnk3f.c b/runtime/flang/symlnk3f.c +index af8e2c534e8..e79713e1d5e 100644 +--- a/runtime/flang/symlnk3f.c ++++ b/runtime/flang/symlnk3f.c +@@ -9,7 +9,7 @@ + + /* symlnk3f.c - Implements LIB3F symlnk subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include "io3f.h" + #include "ent3f.h" +@@ -34,4 +34,4 @@ int ENT3F(SYMLNK, symlnk)(DCHAR(n1), DCHAR(n2) DCLEN(n1) DCLEN(n2)) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/time3f.c b/runtime/flang/time3f.c +index becd13a6866..e3f46d21373 100644 +--- a/runtime/flang/time3f.c ++++ b/runtime/flang/time3f.c +@@ -12,7 +12,7 @@ + #include + #include "ent3f.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #endif + +diff --git a/runtime/flang/timef3f.c b/runtime/flang/timef3f.c +index d6e928b54c2..ec5e9601779 100644 +--- a/runtime/flang/timef3f.c ++++ b/runtime/flang/timef3f.c +@@ -13,7 +13,7 @@ + /* how do we do this for WINNT */ + #include "ent3f.h" + +-#ifndef _WIN64 ++#if !defined(_WIN64) + #define _LIBC_LIMITS_H_ + #include + #include +@@ -21,7 +21,7 @@ + #include + #include + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include "wintimes.h" + #endif + +diff --git a/runtime/flang/times3f.c b/runtime/flang/times3f.c +index 352f3334f42..aebe2bc8a51 100644 +--- a/runtime/flang/times3f.c ++++ b/runtime/flang/times3f.c +@@ -9,7 +9,7 @@ + + /* times3f.c - Implements LIB3F times subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include + #include "io3f.h" +@@ -27,4 +27,4 @@ int ENT3F(TIMES, times)(int *buff) + return i; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/ttynam3f.c b/runtime/flang/ttynam3f.c +index 79e75b7612f..8369d2f73f1 100644 +--- a/runtime/flang/ttynam3f.c ++++ b/runtime/flang/ttynam3f.c +@@ -9,7 +9,7 @@ + + /* ttynam3f.c - Implements LIB3F ttynam subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + /* must include ent3f.h AFTER io3f.h */ + #include "io3f.h" +@@ -48,4 +48,4 @@ void ENT3F(TTYNAM, ttynam)(DCHAR(nm) DCLEN(nm), int *lu) + return; + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/type.c b/runtime/flang/type.c +index a0b55a0f096..1560a524e16 100644 +--- a/runtime/flang/type.c ++++ b/runtime/flang/type.c +@@ -1076,7 +1076,7 @@ get_source_and_dest_sizes(F90_Desc *ad, F90_Desc *bd, int *dest_sz, int *src_sz, + } + } else if (bd && !flag && ISSCALAR(bd) && bd->tag != __POLY && + bd->tag != __STR && bd->tag < __NTYPES) { +-#if defined(WINNT) ++#if defined(_WIN64) + *src_sz = __get_fort_size_of(bd->tag); + #else + *src_sz = __fort_size_of[bd->tag]; +diff --git a/runtime/flang/unpacktimeqq3f.c b/runtime/flang/unpacktimeqq3f.c +index f9a7f080ec0..92daf4b17e6 100644 +--- a/runtime/flang/unpacktimeqq3f.c ++++ b/runtime/flang/unpacktimeqq3f.c +@@ -8,7 +8,7 @@ + /* clang-format off */ + + /* unpacktimeqq3f.c - Implements DFLIB packtimeqq subprogram. */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include +@@ -18,7 +18,7 @@ + #include "io3f.h" + #include "ent3f.h" + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + extern char *__fstr2cstr(); + extern void __UnpackTime(unsigned int secsSince1970, ULARGE_INTEGER *fileTime); + +diff --git a/runtime/flang/usrio_smp.c b/runtime/flang/usrio_smp.c +index fd21e37a7d9..bd7eef48ab2 100644 +--- a/runtime/flang/usrio_smp.c ++++ b/runtime/flang/usrio_smp.c +@@ -10,7 +10,7 @@ + * a common system buffer pool and that the buffers are kept consistent. + * It also works for some other systems such as the Paragon. + */ +-#ifndef _WIN64 ++#if !defined(_WIN64) + #include + + #include +diff --git a/runtime/flang/utils.c b/runtime/flang/utils.c +index 63ce88ccae0..04e12165a87 100644 +--- a/runtime/flang/utils.c ++++ b/runtime/flang/utils.c +@@ -9,7 +9,7 @@ + * \brief Utility functions for fortran i.o. + */ + +-#ifdef _WIN64 ++#if defined(_WIN64) + #include + #include + #include +@@ -594,7 +594,7 @@ __fortio_trunc(FIO_FCB *p, seekoffx_t length) + return 0; + } + +-#ifdef _WIN64 ++#if defined(_WIN64) + void + sincos(double x, double *sine, double *cosine) { + *sine = sin(x); +diff --git a/runtime/flang/utils3f.c b/runtime/flang/utils3f.c +index 1cc588b8858..f19f38edf1b 100644 +--- a/runtime/flang/utils3f.c ++++ b/runtime/flang/utils3f.c +@@ -6,7 +6,7 @@ + */ + + /* */ +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + #include + #endif + #include "io3f.h" +@@ -109,7 +109,7 @@ extern FILE *__getfile3f(unit) int unit; + } + } + +-#if defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + void + __GetTimeToSecondsSince1970(ULARGE_INTEGER *fileTime, unsigned int *out) + { +diff --git a/runtime/flang/utilsi64.c b/runtime/flang/utilsi64.c +index 0205a78803f..fd9b0cee9ef 100644 +--- a/runtime/flang/utilsi64.c ++++ b/runtime/flang/utilsi64.c +@@ -26,7 +26,7 @@ extern int __fort_atoxi64(); + extern void __fort_i64toax(); + + /* has native support for 8-byte integers*/ +-#if !defined(WIN64) ++#if !defined(_WIN64) + typedef long I8_T; + typedef unsigned long UI8_T; + #else +diff --git a/runtime/flang/wait.c b/runtime/flang/wait.c +index 8b3676a9ea4..4488b170650 100644 +--- a/runtime/flang/wait.c ++++ b/runtime/flang/wait.c +@@ -14,7 +14,7 @@ + #include "global.h" + #include "async.h" + +-#ifdef _WIN64 ++#if defined(_WIN64) + #define access _access + #endif + +diff --git a/runtime/flang/wait3f.c b/runtime/flang/wait3f.c +index c09badd9ae3..21284fef35f 100644 +--- a/runtime/flang/wait3f.c ++++ b/runtime/flang/wait3f.c +@@ -9,7 +9,7 @@ + + /* wait3f.c - Implements LIB3F wait subprogram. */ + +-#ifndef WINNT ++#if !defined(_WIN64) + + #include + #include +@@ -26,4 +26,4 @@ int ENT3F(WAIT, wait)(int *st) + return wait(wst); + } + +-#endif /* !WINNT */ ++#endif /* !_WIN64 */ +diff --git a/runtime/flang/xfer_heap_dum.c b/runtime/flang/xfer_heap_dum.c +index 562f6d6ec23..06389b18e63 100644 +--- a/runtime/flang/xfer_heap_dum.c ++++ b/runtime/flang/xfer_heap_dum.c +@@ -16,7 +16,7 @@ extern char *sbrk(int); + char * + __fort_sbrk(int len) + { +-#ifndef _WIN64 ++#if !defined(_WIN64) + return (sbrk(len)); + #endif + } diff --git a/ports/vcpkg-tool-flang/1165.diff b/ports/vcpkg-tool-flang/1165.diff new file mode 100644 index 00000000000000..ea26cdeb0a1cdb --- /dev/null +++ b/ports/vcpkg-tool-flang/1165.diff @@ -0,0 +1,158 @@ +diff --git a/runtime/flangrti/iostdinit.c b/runtime/flangrti/iostdinit.c +index 00b101f3c1c..41061f2a3e3 100644 +--- a/runtime/flangrti/iostdinit.c ++++ b/runtime/flangrti/iostdinit.c +@@ -6,7 +6,7 @@ + */ + + #include +-#if !defined(WINNT) && !defined(ST100) ++#if !defined(_WIN64) && !defined(ST100) + #include + #include + #endif +@@ -15,7 +15,7 @@ + + /* get environ */ + +-#if defined(WIN64) ++#if defined(_WIN64) + char * * * __cdecl __p__environ(void); + /* + * enclose _fileno within parens to ensure calling the function rather than +@@ -24,7 +24,7 @@ char * * * __cdecl __p__environ(void); + #define fileno(x) (_fileno)(x) + #endif + +-#if defined(WINNT) ++#if defined(_WIN64) + #include + extern char **environ; + #elif defined(TARGET_OSX) +@@ -83,7 +83,7 @@ __io_stderr(void) + + /* convert macros to routines */ + +-#if defined(TARGET_WIN) || defined(WIN32) ++#if defined(TARGET_WIN) || defined(_WIN64) + #include + int + __io_fgetc(FILE *p) +@@ -169,13 +169,9 @@ __io_isatty(int fd) + int + __io_binary_mode(void *fp) + { +-#if defined(WINNT) ++#if defined(_WIN64) + #include + +-#if defined(WIN64) || defined(WIN32) +-#define O_BINARY _O_BINARY +-#endif +- + int mode; + + mode = setmode(fileno((FILE *)fp), O_BINARY); +@@ -196,13 +192,9 @@ __io_binary_mode(void *fp) + int + __io_setmode_binary(void *fp) + { +-#if defined(WINNT) ++#if defined(_WIN64) + #include + +-#if defined(WIN64) || defined(WIN32) +-#define O_BINARY _O_BINARY +-#endif +- + int mode; + + return setmode(fileno((FILE *)fp), O_BINARY); +@@ -214,7 +206,7 @@ __io_setmode_binary(void *fp) + int + __io_ispipe(void *f) + { +-#if !defined(WINNT) && !defined(ST100) ++#if !defined(_WIN64) && !defined(ST100) + struct stat st; + + fstat(fileno((FILE *)f), &st); +@@ -254,7 +246,7 @@ __io_fwrite(char *ptr, size_t size, size_t nitems, FILE *stream) + #endif + } + +-#if defined(WINNT) || defined(WIN64) || defined(WIN32) ++#if defined(_WIN64) + + #if defined(PGI_CRTDLL) + extern long *_imp___timezone_dll; /* for crtdll.dll */ +@@ -263,7 +255,7 @@ extern long *_imp___timezone_dll; /* for crtdll.dll */ + #define timezone _timezone /* cygnus, timezone is usually a function */ + #endif + +-#elif !defined(DEC) && !defined(IBM) && !defined(ST100_V1_2) && !defined(OSX86) /* !defined(WINNT) */ ++#elif !defined(DEC) && !defined(IBM) && !defined(ST100_V1_2) && !defined(OSX86) /* !defined(_WIN64) */ + extern time_t timezone; /* for the rest */ + #endif + +@@ -272,14 +264,14 @@ __io_timezone(void *tm) + { + #if defined(SUN4) || defined(PPC) || defined(OSX86) + return ((struct tm *)tm)->tm_gmtoff; +-#elif defined(WINNT) || defined(WIN64) || defined(WIN32) ++#elif defined(_WIN64) + return (0); + #else + return -(timezone - (((struct tm *)tm)->tm_isdst ? 3600 : 0)); + #endif + } + +-#if (defined(WIN32) || defined(WIN64)) ++#if defined(_WIN64) + /* wrappers for stderr, stdin, stdout : include + pgc/port/pgi_iobuf.h after stdio.h + */ +diff --git a/runtime/flangrti/tempnam.c b/runtime/flangrti/tempnam.c +index 7eff4860431..ddc5c8c607f 100644 +--- a/runtime/flangrti/tempnam.c ++++ b/runtime/flangrti/tempnam.c +@@ -5,7 +5,7 @@ + * + */ + +-#if !defined(WINNT) && !defined(USETEMPNAM) /* { */ ++#if !defined(_WIN64) && !defined(USETEMPNAM) /* { */ + #include + #include + +@@ -146,7 +146,7 @@ extern char *tempnam(char *, char *); + char * + __io_tempnam(char *dir, char *pfx) + { +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + return (_tempnam(dir, pfx)); + #else + return (tempnam(dir, pfx)); +diff --git a/runtime/flangrti/trace.c b/runtime/flangrti/trace.c +index dcb33b77f3a..6ae0be90556 100644 +--- a/runtime/flangrti/trace.c ++++ b/runtime/flangrti/trace.c +@@ -56,7 +56,7 @@ dbg_stop_before_exit(void) + * 3 - traceback (signal) + */ + +-#if defined(WIN32) || defined(WIN64) ++#if defined(_WIN64) + #define getpid _getpid + #define _Exit _exit + #endif +@@ -133,7 +133,7 @@ __abort_init(char *path) + int n; + int neg; + +-#if defined(WINNT) ++#if defined(_WIN64) + fn = path; + #endif + p = getenv("TRACE_TERM"); diff --git a/ports/vcpkg-tool-flang/1166.diff b/ports/vcpkg-tool-flang/1166.diff new file mode 100644 index 00000000000000..1700e54a43c703 --- /dev/null +++ b/ports/vcpkg-tool-flang/1166.diff @@ -0,0 +1,50 @@ +diff --git a/runtime/flangmain/flangmain.c b/runtime/flangmain/flangmain.c +index d564d2696f4e..5645990e93ec 100644 +--- a/runtime/flangmain/flangmain.c ++++ b/runtime/flangmain/flangmain.c +@@ -17,30 +17,6 @@ extern char **__io_environ(); + extern void __io_set_argc(int); + extern void __io_set_argv(char **); + +-#if defined(PGDLL) && defined(WINNT) && !defined(WIN64) +-struct { +- char *pghpf_01p; +- char *pghpf_02p; +- char *pghpf_03p; +- char *pghpf_04p; +-} pghpf_0; +- +-struct { +- char *pghpf_0cp; +-} pghpf_0c; +- +-struct { +- char *pg_typep; +-} pg_type; +- +-char *__get_fort_01_addr(void); +-char *__get_fort_02_addr(void); +-char *__get_fort_03_addr(void); +-char *__get_fort_04_addr(void); +-char *__get_fort_0c_addr(void); +-char *__get_fort_type_addr(void); +-#endif +- + int main(int argc, char** argv) + { + int i = 0; +@@ -48,14 +24,6 @@ int main(int argc, char** argv) + __io_set_argc(argc); + __io_set_argv(argv); + +-#if defined(PGDLL) && defined(WINNT) && !defined(WIN64) +- pghpf_0.pghpf_01p = __get_fort_01_addr(); +- pghpf_0.pghpf_02p = __get_fort_02_addr(); +- pghpf_0.pghpf_03p = __get_fort_03_addr(); +- pghpf_0.pghpf_04p = __get_fort_04_addr(); +- pghpf_0c.pghpf_0cp = __get_fort_0c_addr(); +- pg_type.pg_typep = __get_fort_type_addr(); +-#endif + MAIN_(argc, argv, __io_environ()); + ENTF90(EXIT, exit)(&i); + } diff --git a/ports/vcpkg-tool-flang/1168.diff b/ports/vcpkg-tool-flang/1168.diff new file mode 100644 index 00000000000000..88be181a297147 --- /dev/null +++ b/ports/vcpkg-tool-flang/1168.diff @@ -0,0 +1,13 @@ +diff --git a/runtime/ompstub/init_nomp.c b/runtime/ompstub/init_nomp.c +index 8c99f5da741..310b4df0d3d 100644 +--- a/runtime/ompstub/init_nomp.c ++++ b/runtime/ompstub/init_nomp.c +@@ -15,7 +15,7 @@ + * is available in pgc lib. + */ + +-#if !defined(WIN64) ++#if !defined(_WIN64) + /* get max avail cpus */ + + int diff --git a/ports/vcpkg-tool-flang/1177.diff b/ports/vcpkg-tool-flang/1177.diff new file mode 100644 index 00000000000000..6c79ebe4cc849e --- /dev/null +++ b/ports/vcpkg-tool-flang/1177.diff @@ -0,0 +1,18 @@ +diff --git a/tools/flang2/flang2exe/llassem.cpp b/tools/flang2/flang2exe/llassem.cpp +index 7c15e7338cb..6c6a953fc79 100644 +--- a/tools/flang2/flang2exe/llassem.cpp ++++ b/tools/flang2/flang2exe/llassem.cpp +@@ -1164,8 +1164,13 @@ assemble_end(void) + tdefsym = find_ag(gname); + typed = AG_TYPENAME(tdefsym); + fprintf(ASMFIL, "%%struct%s = type < { %s } > \n", name, typed); ++#if defined (_WIN64) ++ fprintf(ASMFIL, "@%s = %s global %%struct%s ", name, ++ AG_ISMOD(gblsym) ? "external dllimport" : "common", name); ++#else + fprintf(ASMFIL, "@%s = %s global %%struct%s ", name, + AG_ISMOD(gblsym) ? "external" : "common", name); ++#endif + fprintf(ASMFIL, "%s, align %d", + AG_ISMOD(gblsym) ? "" : " zeroinitializer", align_value); + for (llObjtodbgFirst(listp, &i); !llObjtodbgAtEnd(&i); diff --git a/ports/vcpkg-tool-flang/1178.diff b/ports/vcpkg-tool-flang/1178.diff new file mode 100644 index 00000000000000..7d88539cd2b141 --- /dev/null +++ b/ports/vcpkg-tool-flang/1178.diff @@ -0,0 +1,47 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8308d5461d6..e9ec6c67e6a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -287,13 +287,16 @@ endif() + if (LLVM_COMPILER_IS_GCC_COMPATIBLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") + option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" ON) +- if (WITH_WERROR) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") +- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-but-set-variable") +- endif() ++elseif (MSVC) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14 -Woverloaded-virtual -Wno-long-long -Wno-unused-parameter -Wwrite-strings") ++ option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" OFF) ++endif () ++if (WITH_WERROR) ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wno-error=sign-compare -Wno-error=pointer-sign -Wno-error=incompatible-pointer-types -Wno-error=string-conversion -Wno-error=c99-extensions -Wno-error=deprecated-register -Wno-error=format -Wno-error=format-pedantic -Wno-error=tautological-constant-out-of-range-compare -Wno-error=switch -Wno-error=covered-switch-default -Wno-error=enum-compare -Wno-error=char-subscripts -Wno-error=parentheses -Wno-error=array-bounds -Wno-error=fortify-source -Wno-error=comment") ++ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 13) ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=unused-but-set-variable") + endif () + endif () + +diff --git a/tools/flang1/flang1exe/CMakeLists.txt b/tools/flang1/flang1exe/CMakeLists.txt +index 7298861d3cc..a3367870013 100644 +--- a/tools/flang1/flang1exe/CMakeLists.txt ++++ b/tools/flang1/flang1exe/CMakeLists.txt +@@ -111,9 +111,11 @@ set(INCLUDE_DIRS + ${TOOLS_SHARED_DIR} + ) + +-set(COMPILE_OPTS +- -std=c11 +- ) ++if(NOT MSVC) ++ set(COMPILE_OPTS ++ -std=c11 ++ ) ++endif() + + add_flang_executable(flang1 + ${SOURCES} ${SHARED_SOURCES} diff --git a/ports/vcpkg-tool-flang/1210.diff b/ports/vcpkg-tool-flang/1210.diff new file mode 100644 index 00000000000000..3c566d2b1fc12f --- /dev/null +++ b/ports/vcpkg-tool-flang/1210.diff @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 93dd957888f..88c574b823a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -46,12 +46,14 @@ if (${TARGET_ARCHITECTURE} MATCHES "^(x86_64|AMD64|amd64)$") + set(TARGET_ARCHITECTURE x86_64) + set(ARCHNAME x86-64) + set(ARCH X86) +-elseif (${TARGET_ARCHITECTURE} MATCHES "^(aarch64|arm64)$") ++elseif (${TARGET_ARCHITECTURE} MATCHES "^(aarch64|arm64|ARM64)$") + set(TARGET_ARCHITECTURE aarch64) + set(ARCHNAME aarch64) + set(ARCH ARM) +- add_definitions(-DTARGET_SUPPORTS_QUADFP) +- set(TARGET_SUPPORTS_QUADFP True) ++ if (NOT ${TARGET_OS} STREQUAL "Windows") ++ add_definitions(-DTARGET_SUPPORTS_QUADFP) ++ set(TARGET_SUPPORTS_QUADFP True) ++ endif() + elseif( ${TARGET_ARCHITECTURE} STREQUAL "ppc64le" ) + set(ARCHNAME ppc64le) + set(ARCH POWER) diff --git a/ports/vcpkg-tool-flang/awk.patch b/ports/vcpkg-tool-flang/awk.patch new file mode 100644 index 00000000000000..211e73ea8d7dfb --- /dev/null +++ b/ports/vcpkg-tool-flang/awk.patch @@ -0,0 +1,129 @@ +diff --git a/runtime/libpgmath/lib/common/CMakeLists.txt b/runtime/libpgmath/lib/common/CMakeLists.txt +index 59454c9de..caea12be3 100644 +--- a/runtime/libpgmath/lib/common/CMakeLists.txt ++++ b/runtime/libpgmath/lib/common/CMakeLists.txt +@@ -309,10 +309,11 @@ set(DEFINITIONS_CMPLX ${DEFINITIONS} MTH_CMPLX_C99_ABI) + libmath_add_object_library("${MTH_CMPLX_SRCS}" "${FLAGS}" "${DEFINITIONS_CMPLX}" "common_mth_cmplx") + + if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENERIC}) ++ find_program(AWK_COMMAND NAMES awk) + # Generate mth_128mask.c + set(TARGET_NAME "mth_128mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2") +@@ -325,7 +326,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=core2") +@@ -338,7 +339,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_256mask.c + set(TARGET_NAME "mth_256mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge") +@@ -351,7 +352,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_256generic.c + set(TARGET_NAME "mth_256generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=256 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-march=sandybridge") +@@ -364,7 +365,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_512mask.c + set(TARGET_NAME "mth_512mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") +@@ -378,7 +379,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_512generic.c + set(TARGET_NAME "mth_512generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl") +@@ -391,7 +392,7 @@ if(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "x86_64" AND NOT ${LIBPGMATH_WITH_GENER + # Generate mth_z2yy.c + set(TARGET_NAME "mth_z2yy") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=512 -v TARGET=X8664 -f ${LIBPGMATH_TOOLS_DIR}/mth_z2yy.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Linux") + set_property(SOURCE ${TARGET_NAME}.c APPEND_STRING PROPERTY COMPILE_FLAGS "-mtune=knl -march=knl") +@@ -404,7 +405,7 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "ppc64le") + # Generate mth_128mask.c + set(TARGET_NAME "mth_128mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -412,7 +413,7 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "ppc64le") + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=POWER -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -421,10 +422,10 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "aarch64") + set(TARGET_NAME "mth_128mask") + if(${LIBPGMATH_SYSTEM_NAME} MATCHES "Windows") + add_custom_command(OUTPUT ${TARGET_NAME}.cpp DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -v TARGET_OS=WIN -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -v TARGET_OS=WIN -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) + else() + add_custom_command(OUTPUT ${TARGET_NAME}.cpp DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.cpp) + endif() + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.cpp") + libmath_add_object_library("${TARGET_NAME}.cpp" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") +@@ -433,7 +434,7 @@ elseif(${LIBPGMATH_SYSTEM_PROCESSOR} MATCHES "aarch64") + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=ARM64 -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -441,7 +442,7 @@ else() + # Generate mth_128mask.c + set(TARGET_NAME "mth_128mask") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_mask.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) +@@ -449,7 +450,7 @@ else() + # Generate mth_128generic.c + set(TARGET_NAME "mth_128generic") + add_custom_command(OUTPUT ${TARGET_NAME}.c DEPENDS ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk PRE_BUILD +- COMMAND awk -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) ++ COMMAND ${AWK_COMMAND} -v MAX_VREG_SIZE=128 -v TARGET=GENERIC -f ${LIBPGMATH_TOOLS_DIR}/mth_generic_frp.awk > ${TARGET_NAME}.c) + add_custom_target(${TARGET_NAME} ALL DEPENDS "${TARGET_NAME}.c") + libmath_add_object_library("${TARGET_NAME}.c" "${FLAGS}" "${DEFINITIONS}" "${TARGET_NAME}_build") + add_dependencies("${TARGET_NAME}_build" ${TARGET_NAME}) diff --git a/ports/vcpkg-tool-flang/cross.patch b/ports/vcpkg-tool-flang/cross.patch new file mode 100644 index 00000000000000..7d107408e1db0a --- /dev/null +++ b/ports/vcpkg-tool-flang/cross.patch @@ -0,0 +1,50 @@ +diff --git a/runtime/flang/CMakeLists.txt b/runtime/flang/CMakeLists.txt +index 850942b32..3ec95760e 100644 +--- a/runtime/flang/CMakeLists.txt ++++ b/runtime/flang/CMakeLists.txt +@@ -430,7 +430,7 @@ add_custom_command( + > "${I8_FILES_DIR}/ieee_arithmetic.F95" + COMMENT "Preprocessing ieee_arithmetic.F95" + VERBATIM +- DEPENDS flang1 flang2 ++ #DEPENDS flang1 flang2 + ) + + add_custom_command( +@@ -440,7 +440,7 @@ add_custom_command( + > "${I8_FILES_DIR}/ieee_exceptions.F95" + COMMENT "Preprocessing ieee_exceptions.F95" + VERBATIM +- DEPENDS flang1 flang2 ++ #DEPENDS flang1 flang2 + ) + + add_custom_command( +@@ -450,7 +450,7 @@ add_custom_command( + COMMAND "${CMAKE_Fortran_COMPILER}" -E -DPGFLANG -cpp ${SEPARATED_CMAKE_Fortran_FLAGS} + ${CMAKE_CURRENT_SOURCE_DIR}/norm2.F95 > "norm2_1.F95" + VERBATIM +- DEPENDS flang1 flang2 ++ #DEPENDS flang1 flang2 + ) + + # The files lists FTN_INTRINSICS_DESC_DEP and FTN_SUPPORT_DESC_DEP need to be compiled twice (with and without 'DESC_I8' compile definition). So an actual copy is made in a temp file on which this is done. +@@ -662,18 +662,6 @@ target_include_directories(flang_shared + ${CMAKE_CURRENT_BINARY_DIR} + ) + +-# Make sure the compiler is built before we bootstrap +-add_dependencies(flang_static +- flang1 +- flang2 +- ) +- +-# Make sure the compiler is built before we bootstrap +-add_dependencies(flang_shared +- flang1 +- flang2 +- ) +- + if (NOT MSVC) + target_compile_options(flang_static PRIVATE -fPIC) + target_compile_options(flang_shared PRIVATE -fPIC) diff --git a/ports/vcpkg-tool-flang/move_flang2.patch b/ports/vcpkg-tool-flang/move_flang2.patch new file mode 100644 index 00000000000000..4ce4584c47f0a7 --- /dev/null +++ b/ports/vcpkg-tool-flang/move_flang2.patch @@ -0,0 +1,28 @@ +diff --git a/tools/flang2/flang2exe/CMakeLists.txt b/tools/flang2/flang2exe/CMakeLists.txt +index a9649e996..5aeeb0480 100644 +--- a/tools/flang2/flang2exe/CMakeLists.txt ++++ b/tools/flang2/flang2exe/CMakeLists.txt +@@ -160,7 +160,7 @@ target_include_directories(flang2 + + # Install flang2 executable + install(TARGETS flang2 +- RUNTIME DESTINATION ${LLVM_TOOLS_BINARY_DIR}) ++ RUNTIME DESTINATION bin) + + # Local Variables: + # mode: cmake +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f6513a04c..000055e73 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -390,8 +390,10 @@ add_definitions( -DPGFLANG ) + + add_subdirectory(lib) + add_subdirectory(runtime) ++if( FLANG_BUILD_TOOLS ) + add_subdirectory(utils) + add_subdirectory(tools) ++endif() + #add_subdirectory(test) + + #option(FLANG_BUILD_EXAMPLES "Build FLANG example programs by default." OFF) diff --git a/ports/vcpkg-tool-flang/portfile.cmake b/ports/vcpkg-tool-flang/portfile.cmake new file mode 100644 index 00000000000000..dc8f393fc8c70c --- /dev/null +++ b/ports/vcpkg-tool-flang/portfile.cmake @@ -0,0 +1,99 @@ +vcpkg_check_linkage(ONLY_STATIC_LIBRARY) # unresolved symbol interr +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO flang-compiler/flang + REF 5a60d344443e38715b7c837de53d9ce2ed78b0d6 + SHA512 aff012c3cf9756d84b8bb5d0c369a1fd78d51af4cb2734183640e7fdcc16f6e6ab2ab78a56cc4b750f1571f7842b2b76b255e442df98e0aacd5e07db6a9d6a82 + PATCHES awk.patch + 1163.diff + 1165.diff + 1166.diff + 1168.diff + 1177.diff + 1178.diff + 1210.diff + move_flang2.patch + cross.patch + sep_runtime_from_compiler.patch +) + +set(NINJA "${CURRENT_HOST_INSTALLED_DIR}/tools/ninja/ninja${VCPKG_HOST_EXECUTABLE_SUFFIX}") +vcpkg_find_acquire_program(PYTHON3) +get_filename_component(PYTHON3_DIR "${PYTHON3}" DIRECTORY) +vcpkg_add_to_path(${PYTHON3_DIR}) + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + vcpkg_cmake_get_vars(cmake_vars_file) + include("${cmake_vars_file}") + if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + vcpkg_list(SET OPTIONS + "-DCMAKE_C_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/vcpkg-tool-llvm/bin/clang-cl.exe" + "-DCMAKE_CXX_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/vcpkg-tool-llvm/bin/clang-cl.exe" + "-DCMAKE_AR=${VCPKG_DETECTED_CMAKE_AR}" + "-DCMAKE_LINKER=${VCPKG_DETECTED_CMAKE_LINKER}" + "-DCMAKE_MT=${VCPKG_DETECTED_CMAKE_MT}" + "-DCMAKE_RC=${VCPKG_DETECTED_CMAKE_RC}" + ) + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + string(APPEND VCPKG_C_FLAGS " --target=aarch64-win32-msvc") + string(APPEND VCPKG_CXX_FLAGS " --target=aarch64-win32-msvc") + endif() + endif() + vcpkg_acquire_msys(MSYS_ROOT PACKAGES gawk bash sed) + vcpkg_add_to_path("${MSYS_ROOT}/usr/bin") + if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + vcpkg_list(APPEND OPTIONS -DCMAKE_SYSTEM_PROCESSOR=AMD64) + elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") + vcpkg_list(APPEND OPTIONS -DCMAKE_CROSSCOMPILING=ON -DCMAKE_SYSTEM_PROCESSOR:STRING=ARM64 -DCMAKE_SYSTEM_NAME:STRING=Windows) + endif() +endif() + +set(VCPKG_BUILD_TYPE release) + +# Búild AMD64 compiler +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + #"-DLLVM_TARGETS_TO_BUILD=X86;AArch64" + "-DFLANG_BUILD_RUNTIME=OFF" + "-DTARGET_ARCHITECTURE=AMD64" + "-DFLANG_LLVM_EXTENSIONS=ON" + "-DFLANG_INCLUDE_DOCS=OFF" + "-DLLVM_INCLUDE_TESTS=OFF" + "-DFLANG_BUILD_TOOLS=ON" + "-DVCPKG_HOST_TRIPLET=${_HOST_TRIPLET}" + "-DLLVM_CONFIG=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/llvm-config.exe" + "-DLLVM_CMAKE_PATH=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/lib/cmake/llvm" # Flang does not link against anything in llvm + #"-DCMAKE_Fortran_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/flang.exe" + #"-DCMAKE_Fortran_COMPILER_ID=Flang" + ${OPTIONS} +) +vcpkg_cmake_install(ADD_BIN_TO_PATH) + +# Búild ARM compiler +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + #"-DLLVM_TARGETS_TO_BUILD=X86;AArch64" + "-DFLANG_BUILD_RUNTIME=OFF" + "-DTARGET_ARCHITECTURE=ARM64" + "-DFLANG_LLVM_EXTENSIONS=ON" + "-DFLANG_BUILD_TOOLS=ON" + "-DVCPKG_HOST_TRIPLET=${_HOST_TRIPLET}" + "-DLLVM_CONFIG=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/llvm-config.exe" + "-DLLVM_CMAKE_PATH=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/lib/cmake/llvm" # Flang does not link against anything in llvm + #"-DCMAKE_Fortran_COMPILER=${CURRENT_HOST_INSTALLED_DIR}/manual-tools/llvm-flang/bin/flang.exe" + #"-DCMAKE_Fortran_COMPILER_ID=Flang" + ${OPTIONS} +) +vcpkg_cmake_install(ADD_BIN_TO_PATH) + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/") +file(RENAME "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/bin" ) +file(RENAME "${CURRENT_PACKAGES_DIR}/lib" "${CURRENT_PACKAGES_DIR}/manual-tools/llvm-flang/lib" ) + +file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) + +set(VCPKG_POLICY_DLLS_IN_STATIC_LIBRARY enabled) \ No newline at end of file diff --git a/ports/vcpkg-tool-flang/sep_runtime_from_compiler.patch b/ports/vcpkg-tool-flang/sep_runtime_from_compiler.patch new file mode 100644 index 00000000000000..f1b29916a5e6f4 --- /dev/null +++ b/ports/vcpkg-tool-flang/sep_runtime_from_compiler.patch @@ -0,0 +1,66 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 000055e73..28a738269 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -292,7 +292,7 @@ endif() + # Add appropriate flags for GCC + if (LLVM_COMPILER_IS_GCC_COMPATIBLE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-common -Woverloaded-virtual -Wcast-qual -fno-strict-aliasing -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings") +- option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" ON) ++ option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" OFF) + elseif (MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++14 -Woverloaded-virtual -Wno-long-long -Wno-unused-parameter -Wwrite-strings") + option(WITH_WERROR "Compile with '-Werror' C/C++ compiler flag" OFF) +@@ -350,6 +350,7 @@ include_directories(BEFORE + set(CMAKE_Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include) + + # Install Fortran module files ++if( FLANG_BUILD_RUNTIME ) + install(DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}/ + DESTINATION include + ) +@@ -360,6 +361,7 @@ get_filename_component(OMP_LIB_H_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include/omp_li + install(FILES ${OMP_LIB_H_PATH} + DESTINATION include + ) ++endif() + + add_definitions( -D_GNU_SOURCE ) + +@@ -389,7 +391,9 @@ set(FLANG_RTE_LIB_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib) + add_definitions( -DPGFLANG ) + +-add_subdirectory(lib) ++if( FLANG_BUILD_RUNTIME ) + add_subdirectory(runtime) ++endif() + if( FLANG_BUILD_TOOLS ) ++add_subdirectory(lib) + add_subdirectory(utils) + add_subdirectory(tools) +diff --git a/tools/flang1/flang1exe/CMakeLists.txt b/tools/flang1/flang1exe/CMakeLists.txt +index a33678700..b6967227b 100644 +--- a/tools/flang1/flang1exe/CMakeLists.txt ++++ b/tools/flang1/flang1exe/CMakeLists.txt +@@ -166,7 +166,7 @@ endif() + + # Install flang1 executable + install(TARGETS flang1 +- RUNTIME DESTINATION bin) ++ RUNTIME DESTINATION bin/${ARCH}) + + # Local Variables: + # mode: cmake +diff --git a/tools/flang2/flang2exe/CMakeLists.txt b/tools/flang2/flang2exe/CMakeLists.txt +index 5aeeb0480..105143325 100644 +--- a/tools/flang2/flang2exe/CMakeLists.txt ++++ b/tools/flang2/flang2exe/CMakeLists.txt +@@ -160,7 +160,7 @@ target_include_directories(flang2 + + # Install flang2 executable + install(TARGETS flang2 +- RUNTIME DESTINATION bin) ++ RUNTIME DESTINATION bin/${ARCH}) + + # Local Variables: + # mode: cmake diff --git a/ports/vcpkg-tool-flang/vcpkg.json b/ports/vcpkg-tool-flang/vcpkg.json new file mode 100644 index 00000000000000..fd63195a0211bc --- /dev/null +++ b/ports/vcpkg-tool-flang/vcpkg.json @@ -0,0 +1,37 @@ +{ + "name": "vcpkg-tool-flang", + "version-date": "2022-04-23", + "description": "The LLVM Compiler Infrastructure.", + "homepage": "https://llvm.org", + "license": "Apache-2.0", + "supports": "native", + "dependencies": [ + "libxml2", + "pgmath", + { + "name": "pkgconf", + "host": true + }, + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-tool-flang-llvm", + "host": true + }, + { + "name": "vcpkg-tool-llvm", + "host": true + }, + { + "name": "vcpkg-tool-ninja", + "host": true + }, + "zlib" + ] +} diff --git a/ports/vcpkg-tool-llvm/portfile.cmake b/ports/vcpkg-tool-llvm/portfile.cmake new file mode 100644 index 00000000000000..5ee1ba9fcbd6fe --- /dev/null +++ b/ports/vcpkg-tool-llvm/portfile.cmake @@ -0,0 +1,31 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +file(READ "${CURRENT_PORT_DIR}/vcpkg.json" manifest_contents) +string(JSON version GET "${manifest_contents}" version) + +if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86") + set(name LLVM-${version}-win32.exe) + set(url "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/${name}") + set(hash 6df7b992d4c382c3e1c71ff30e43b9fa0311c33adfebc9feaa4ea7e2f50fdb836b04dbad529aac1a6f7bf0135b98ecf3291d0386152afbcaf5ac7cb4592a94fa) +elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64") + set(name LLVM-${version}-win64.exe) + set(url "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/${name}") + set(hash 56e8871898fc2d62383b76b75ce7852a0179d70a1d327e95e73a115f1e09db5ceec1ae950279ddb0779de417eca9cdf7517d9c6a5498c7c17de6550aef16073d) +endif() +vcpkg_download_distfile(archive_path + URLS "${url}" + FILENAME "${name}" + SHA512 "${hash}" +) + +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}") +vcpkg_find_acquire_program(7Z) +vcpkg_execute_in_download_mode( + COMMAND "${7Z}" x "${archive_path}" "-o${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}" "-y" "-bso0" "-bsp0" + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}" + ) +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/$PLUGINSDIR") + +set(details "set(program_version \"${program_version}\")\n") +string(APPEND details "set(paths_to_search \"\${CURRENT_HOST_INSTALLED_DIR}/manual-tools/${PORT}/bin\")\n") +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/details.cmake" "${details}") \ No newline at end of file diff --git a/ports/vcpkg-tool-llvm/vcpkg.json b/ports/vcpkg-tool-llvm/vcpkg.json new file mode 100644 index 00000000000000..a38d2640dbfeeb --- /dev/null +++ b/ports/vcpkg-tool-llvm/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-tool-llvm", + "version": "13.0.1", + "description": "The LLVM Project is a collection of modular and reusable compiler and toolchain technologies. Note: the repository does not accept github pull requests at this moment. Please submit your patches at http://reviews.llvm.org. ", + "homepage": "https://github.com/llvm/llvm-project", + "license": null, + "supports": "windows & (x64 | x86)", + "dependencies": [ + { + "name": "vcpkg-tool-7zip", + "host": true + } + ] +} diff --git a/ports/vcpkg-tool-ninja/PR2056.diff b/ports/vcpkg-tool-ninja/PR2056.diff new file mode 100644 index 00000000000000..110cfa0e43d4ba --- /dev/null +++ b/ports/vcpkg-tool-ninja/PR2056.diff @@ -0,0 +1,1062 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 57ae548f5b..3fdde943cc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,10 +17,16 @@ endif() + + # --- compiler flags + if(MSVC) ++ option(BUILD_UNICODE "Build with Unicode support. This enables long path support on windows." ON) ++ + set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + add_compile_options(/W4 /wd4100 /wd4267 /wd4706 /wd4702 /wd4244 /GR- /Zc:__cplusplus) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) ++ ++ if(BUILD_UNICODE) ++ add_compile_definitions(UNICODE _UNICODE) ++ endif() + else() + include(CheckCXXCompilerFlag) + check_cxx_compiler_flag(-Wno-deprecated flag_no_deprecated) +diff --git a/src/build_log.cc b/src/build_log.cc +index 4dcd6cee53..b069bfaa5a 100644 +--- a/src/build_log.cc ++++ b/src/build_log.cc +@@ -186,7 +186,7 @@ bool BuildLog::OpenForWriteIfNeeded() { + if (log_file_ || log_file_path_.empty()) { + return true; + } +- log_file_ = fopen(log_file_path_.c_str(), "ab"); ++ log_file_ = fopen(ToPathWidth(log_file_path_).c_str(), "ab"); + if (!log_file_) { + return false; + } +@@ -260,7 +260,7 @@ struct LineReader { + + LoadStatus BuildLog::Load(const string& path, string* err) { + METRIC_RECORD(".ninja_log load"); +- FILE* file = fopen(path.c_str(), "r"); ++ FILE* file = fopen(ToPathWidth(path).c_str(), "r"); + if (!file) { + if (errno == ENOENT) + return LOAD_NOT_FOUND; +@@ -283,7 +283,7 @@ LoadStatus BuildLog::Load(const string& path, string* err) { + *err = ("build log version invalid, perhaps due to being too old; " + "starting over"); + fclose(file); +- unlink(path.c_str()); ++ unlink(ToPathWidth(path).c_str()); + // Don't report this as a failure. An empty build log will cause + // us to rebuild the outputs anyway. + return LOAD_SUCCESS; +@@ -393,7 +393,7 @@ bool BuildLog::Recompact(const string& path, const BuildLogUser& user, + + Close(); + string temp_path = path + ".recompact"; +- FILE* f = fopen(temp_path.c_str(), "wb"); ++ FILE* f = fopen(ToPathWidth(temp_path).c_str(), "wb"); + if (!f) { + *err = strerror(errno); + return false; +@@ -423,7 +423,7 @@ bool BuildLog::Recompact(const string& path, const BuildLogUser& user, + entries_.erase(dead_outputs[i]); + + fclose(f); +- if (unlink(path.c_str()) < 0) { ++ if (unlink(ToPathWidth(path).c_str()) < 0) { + *err = strerror(errno); + return false; + } +@@ -444,7 +444,7 @@ bool BuildLog::Restat(const StringPiece path, + + Close(); + std::string temp_path = path.AsString() + ".restat"; +- FILE* f = fopen(temp_path.c_str(), "wb"); ++ FILE* f = fopen(ToPathWidth(temp_path).c_str(), "wb"); + if (!f) { + *err = strerror(errno); + return false; +@@ -480,7 +480,7 @@ bool BuildLog::Restat(const StringPiece path, + } + + fclose(f); +- if (unlink(path.str_) < 0) { ++ if (unlink(ToPathWidth(path.str_).c_str()) < 0) { + *err = strerror(errno); + return false; + } +diff --git a/src/build_log_perftest.cc b/src/build_log_perftest.cc +index 5a936198fb..2547cabac1 100644 +--- a/src/build_log_perftest.cc ++++ b/src/build_log_perftest.cc +@@ -144,7 +144,7 @@ int main() { + printf("min %dms max %dms avg %.1fms\n", + min, max, total / times.size()); + +- unlink(kTestFilename); ++ unlink(ToPathWidth(kTestFilename).c_str()); + + return 0; + } +diff --git a/src/build_log_test.cc b/src/build_log_test.cc +index 37182994d2..010ea3921a 100644 +--- a/src/build_log_test.cc ++++ b/src/build_log_test.cc +@@ -31,15 +31,15 @@ using namespace std; + + namespace { + +-const char kTestFilename[] = "BuildLogTest-tempfile"; ++const file_string kTestFilename(TEXT("BuildLogTest-tempfile")); + + struct BuildLogTest : public StateTestWithBuiltinRules, public BuildLogUser { + virtual void SetUp() { + // In case a crashing test left a stale file behind. +- unlink(kTestFilename); ++ unlink(kTestFilename.c_str()); + } + virtual void TearDown() { +- unlink(kTestFilename); ++ unlink(kTestFilename.c_str()); + } + virtual bool IsPathDead(StringPiece s) const { return false; } + }; +@@ -135,7 +135,7 @@ TEST_F(BuildLogTest, Truncate) { + } + + struct stat statbuf; +- ASSERT_EQ(0, stat(kTestFilename, &statbuf)); ++ ASSERT_EQ(0, stat(NarrowPath(kTestFilename).c_str(), &statbuf)); + ASSERT_GT(statbuf.st_size, 0); + + // For all possible truncations of the input file, assert that we don't +@@ -256,12 +256,13 @@ TEST_F(BuildLogTest, Restat) { + TestDiskInterface testDiskInterface; + char out2[] = { 'o', 'u', 't', '2', 0 }; + char* filter2[] = { out2 }; +- EXPECT_TRUE(log.Restat(kTestFilename, testDiskInterface, 1, filter2, &err)); ++ EXPECT_TRUE(log.Restat(NarrowPath(kTestFilename), testDiskInterface, 1, filter2, &err)); + ASSERT_EQ("", err); + e = log.LookupByOutput("out"); + ASSERT_EQ(3, e->mtime); // unchanged, since the filter doesn't match + +- EXPECT_TRUE(log.Restat(kTestFilename, testDiskInterface, 0, NULL, &err)); ++ EXPECT_TRUE( ++ log.Restat(NarrowPath(kTestFilename), testDiskInterface, 0, NULL, &err)); + ASSERT_EQ("", err); + e = log.LookupByOutput("out"); + ASSERT_EQ(4, e->mtime); +diff --git a/src/clean_test.cc b/src/clean_test.cc +index e99909c0d0..e1de421a6b 100644 +--- a/src/clean_test.cc ++++ b/src/clean_test.cc +@@ -469,11 +469,11 @@ TEST_F(CleanTest, CleanDepFileAndRspFileWithSpaces) { + struct CleanDeadTest : public CleanTest, public BuildLogUser{ + virtual void SetUp() { + // In case a crashing test left a stale file behind. +- unlink(kTestFilename); ++ unlink(ToPathWidth(kTestFilename).c_str()); + CleanTest::SetUp(); + } + virtual void TearDown() { +- unlink(kTestFilename); ++ unlink(ToPathWidth(kTestFilename).c_str()); + } + virtual bool IsPathDead(StringPiece) const { return false; } + }; +diff --git a/src/deps_log.cc b/src/deps_log.cc +index 7e48b38513..e194c42e12 100644 +--- a/src/deps_log.cc ++++ b/src/deps_log.cc +@@ -152,7 +152,7 @@ void DepsLog::Close() { + LoadStatus DepsLog::Load(const string& path, State* state, string* err) { + METRIC_RECORD(".ninja_deps load"); + char buf[kMaxRecordSize + 1]; +- FILE* f = fopen(path.c_str(), "rb"); ++ FILE* f = fopen(ToPathWidth(path).c_str(), "rb"); + if (!f) { + if (errno == ENOENT) + return LOAD_NOT_FOUND; +@@ -175,7 +175,7 @@ LoadStatus DepsLog::Load(const string& path, State* state, string* err) { + else + *err = "bad deps log signature or version; starting over"; + fclose(f); +- unlink(path.c_str()); ++ unlink(ToPathWidth(path).c_str()); + // Don't report this as a failure. An empty deps log will cause + // us to rebuild the outputs anyway. + return LOAD_SUCCESS; +@@ -316,7 +316,7 @@ bool DepsLog::Recompact(const string& path, string* err) { + + // OpenForWrite() opens for append. Make sure it's not appending to a + // left-over file from a previous recompaction attempt that crashed somehow. +- unlink(temp_path.c_str()); ++ unlink(ToPathWidth(temp_path).c_str()); + + DepsLog new_log; + if (!new_log.OpenForWrite(temp_path, err)) +@@ -348,7 +348,7 @@ bool DepsLog::Recompact(const string& path, string* err) { + deps_.swap(new_log.deps_); + nodes_.swap(new_log.nodes_); + +- if (unlink(path.c_str()) < 0) { ++ if (unlink(ToPathWidth(path).c_str()) < 0) { + *err = strerror(errno); + return false; + } +@@ -420,7 +420,7 @@ bool DepsLog::OpenForWriteIfNeeded() { + if (file_path_.empty()) { + return true; + } +- file_ = fopen(file_path_.c_str(), "ab"); ++ file_ = fopen(ToPathWidth(file_path_).c_str(), "ab"); + if (!file_) { + return false; + } +diff --git a/src/deps_log_test.cc b/src/deps_log_test.cc +index 13fcc788b6..e8d9ca2be9 100644 +--- a/src/deps_log_test.cc ++++ b/src/deps_log_test.cc +@@ -32,10 +32,10 @@ const char kTestFilename[] = "DepsLogTest-tempfile"; + struct DepsLogTest : public testing::Test { + virtual void SetUp() { + // In case a crashing test left a stale file behind. +- unlink(kTestFilename); ++ unlink(ToPathWidth(kTestFilename).c_str()); + } + virtual void TearDown() { +- unlink(kTestFilename); ++ unlink(ToPathWidth(kTestFilename).c_str()); + } + }; + +@@ -335,7 +335,7 @@ TEST_F(DepsLogTest, InvalidHeader) { + }; + for (size_t i = 0; i < sizeof(kInvalidHeaders) / sizeof(kInvalidHeaders[0]); + ++i) { +- FILE* deps_log = fopen(kTestFilename, "wb"); ++ FILE* deps_log = fopen(ToPathWidth(kTestFilename).c_str(), "wb"); + ASSERT_TRUE(deps_log != NULL); + ASSERT_EQ( + strlen(kInvalidHeaders[i]), +diff --git a/src/disk_interface.cc b/src/disk_interface.cc +index a37c5703ba..4c87b19ea5 100644 +--- a/src/disk_interface.cc ++++ b/src/disk_interface.cc +@@ -56,7 +56,7 @@ string DirName(const string& path) { + + int MakeDir(const string& path) { + #ifdef _WIN32 +- return _mkdir(path.c_str()); ++ return mkdir(ToPathWidth(path).c_str()); + #else + return mkdir(path.c_str(), 0777); + #endif +@@ -75,7 +75,7 @@ TimeStamp TimeStampFromFileTime(const FILETIME& filetime) { + + TimeStamp StatSingleFile(const string& path, string* err) { + WIN32_FILE_ATTRIBUTE_DATA attrs; +- if (!GetFileAttributesExA(path.c_str(), GetFileExInfoStandard, &attrs)) { ++ if (!GetFileAttributesEx(ToPathWidth(path).c_str(), GetFileExInfoStandard, &attrs)) { + DWORD win_err = GetLastError(); + if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND) + return 0; +@@ -104,28 +104,28 @@ bool StatAllFilesInDir(const string& dir, map* stamps, + static_cast(1); + FINDEX_INFO_LEVELS level = + can_use_basic_info ? kFindExInfoBasic : FindExInfoStandard; +- WIN32_FIND_DATAA ffd; +- HANDLE find_handle = FindFirstFileExA((dir + "\\*").c_str(), level, &ffd, ++ WIN32_FIND_DATA ffd; ++ HANDLE find_handle = FindFirstFileEx(ToPathWidth((dir + "\\*")).c_str(), level, &ffd, + FindExSearchNameMatch, NULL, 0); + + if (find_handle == INVALID_HANDLE_VALUE) { + DWORD win_err = GetLastError(); + if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND) + return true; +- *err = "FindFirstFileExA(" + dir + "): " + GetLastErrorString(); ++ *err = "FindFirstFileExW(" + dir + "): " + GetLastErrorString(); + return false; + } + do { +- string lowername = ffd.cFileName; ++ file_string lowername = ffd.cFileName; + if (lowername == "..") { + // Seems to just copy the timestamp for ".." from ".", which is wrong. + // This is the case at least on NTFS under Windows 7. + continue; + } + transform(lowername.begin(), lowername.end(), lowername.begin(), ::tolower); +- stamps->insert(make_pair(lowername, ++ stamps->insert(make_pair(NarrowPath(lowername), + TimeStampFromFileTime(ffd.ftLastWriteTime))); +- } while (FindNextFileA(find_handle, &ffd)); ++ } while (FindNextFile(find_handle, &ffd)); + FindClose(find_handle); + return true; + } +@@ -162,9 +162,9 @@ TimeStamp RealDiskInterface::Stat(const string& path, string* err) const { + #ifdef _WIN32 + // MSDN: "Naming Files, Paths, and Namespaces" + // http://msdn.microsoft.com/en-us/library/windows/desktop/aa365247(v=vs.85).aspx +- if (!path.empty() && path[0] != '\\' && path.size() > MAX_PATH) { ++ if (!path.empty() && path[0] != '\\' && path.size() > PATH_MAX) { + ostringstream err_stream; +- err_stream << "Stat(" << path << "): Filename longer than " << MAX_PATH ++ err_stream << "Stat(" << path << "): Filename longer than " << PATH_MAX + << " characters"; + *err = err_stream.str(); + return -1; +@@ -220,7 +220,7 @@ TimeStamp RealDiskInterface::Stat(const string& path, string* err) const { + } + + bool RealDiskInterface::WriteFile(const string& path, const string& contents) { +- FILE* fp = fopen(path.c_str(), "w"); ++ FILE* fp = fopen(ToPathWidth(path).c_str(), "w"); + if (fp == NULL) { + Error("WriteFile(%s): Unable to create file. %s", + path.c_str(), strerror(errno)); +@@ -266,7 +266,8 @@ FileReader::Status RealDiskInterface::ReadFile(const string& path, + + int RealDiskInterface::RemoveFile(const string& path) { + #ifdef _WIN32 +- DWORD attributes = GetFileAttributes(path.c_str()); ++ const file_string pathT = ToPathWidth(path); ++ DWORD attributes = GetFileAttributes(pathT.c_str()); + if (attributes == INVALID_FILE_ATTRIBUTES) { + DWORD win_err = GetLastError(); + if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND) { +@@ -277,7 +278,7 @@ int RealDiskInterface::RemoveFile(const string& path) { + // On Windows Ninja should behave the same: + // https://github.com/ninja-build/ninja/issues/1886 + // Skip error checking. If this fails, accept whatever happens below. +- SetFileAttributes(path.c_str(), attributes & ~FILE_ATTRIBUTE_READONLY); ++ SetFileAttributes(pathT.c_str(), attributes & ~FILE_ATTRIBUTE_READONLY); + } + if (attributes & FILE_ATTRIBUTE_DIRECTORY) { + // remove() deletes both files and directories. On Windows we have to +@@ -285,7 +286,7 @@ int RealDiskInterface::RemoveFile(const string& path) { + // used on a directory) + // This fixes the behavior of ninja -t clean in some cases + // https://github.com/ninja-build/ninja/issues/828 +- if (!RemoveDirectory(path.c_str())) { ++ if (!RemoveDirectory(pathT.c_str())) { + DWORD win_err = GetLastError(); + if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND) { + return 1; +@@ -295,7 +296,7 @@ int RealDiskInterface::RemoveFile(const string& path) { + return -1; + } + } else { +- if (!DeleteFile(path.c_str())) { ++ if (!DeleteFile(pathT.c_str())) { + DWORD win_err = GetLastError(); + if (win_err == ERROR_FILE_NOT_FOUND || win_err == ERROR_PATH_NOT_FOUND) { + return 1; +diff --git a/src/disk_interface_test.cc b/src/disk_interface_test.cc +index 5e952edde5..575204f1b8 100644 +--- a/src/disk_interface_test.cc ++++ b/src/disk_interface_test.cc +@@ -38,7 +38,7 @@ struct DiskInterfaceTest : public testing::Test { + } + + bool Touch(const char* path) { +- FILE *f = fopen(path, "w"); ++ FILE *f = fopen(ToPathWidth(path).c_str(), "w"); + if (!f) + return false; + return fclose(f) == 0; +@@ -178,7 +178,7 @@ TEST_F(DiskInterfaceTest, ReadFile) { + err.clear(); + + const char* kTestFile = "testfile"; +- FILE* f = fopen(kTestFile, "wb"); ++ FILE* f = fopen(ToPathWidth(kTestFile).c_str(), "wb"); + ASSERT_TRUE(f); + const char* kTestContent = "test content\nok"; + fprintf(f, "%s", kTestContent); +@@ -193,13 +193,13 @@ TEST_F(DiskInterfaceTest, ReadFile) { + TEST_F(DiskInterfaceTest, MakeDirs) { + string path = "path/with/double//slash/"; + EXPECT_TRUE(disk_.MakeDirs(path)); +- FILE* f = fopen((path + "a_file").c_str(), "w"); ++ FILE* f = fopen(ToPathWidth((path + "a_file")).c_str(), "w"); + EXPECT_TRUE(f); + EXPECT_EQ(0, fclose(f)); + #ifdef _WIN32 + string path2 = "another\\with\\back\\\\slashes\\"; + EXPECT_TRUE(disk_.MakeDirs(path2.c_str())); +- FILE* f2 = fopen((path2 + "a_file").c_str(), "w"); ++ FILE* f2 = fopen(ToPathWidth((path2 + "a_file")).c_str(), "w"); + EXPECT_TRUE(f2); + EXPECT_EQ(0, fclose(f2)); + #endif +diff --git a/src/file_path.h b/src/file_path.h +new file mode 100644 +index 0000000000..c11ab9d94d +--- /dev/null ++++ b/src/file_path.h +@@ -0,0 +1,123 @@ ++// Copyright 2021 Google Inc. All Rights Reserved. ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#ifndef NINJA_FILE_PATH_H_ ++#define NINJA_FILE_PATH_H_ ++ ++#include ++ ++#ifndef TEXT ++#ifdef UNICODE ++#define __TEXT(quote) L##quote ++#else /* UNICODE */ ++#define __TEXT(quote) quote ++#endif /* UNICODE */ ++#define TEXT(quote) __TEXT(quote) ++#endif ++ ++#ifndef _TCHAR_DEFINED ++#ifdef UNICODE ++typedef wchar_t TCHAR, *PTCHAR; ++#else ++typedef char TCHAR, *PTCHAR; ++#endif ++#define _TCHAR_DEFINED ++#endif /* !_TCHAR_DEFINED */ ++ ++#ifdef UNICODE ++typedef std::wstring file_string_t; ++#else ++typedef std::string file_string_t; ++#endif ++ ++inline std::string NarrowPath(const std::wstring& path) { ++ return std::string(path.begin(), path.end()); ++} ++ ++inline std::string NarrowPath(const std::string& path) { ++ return path; ++} ++ ++inline std::wstring WidenPath(const std::string& path) { ++ return std::wstring(path.begin(), path.end()); ++} ++ ++inline std::wstring WidenPath(const std::wstring& path) { ++ return path; ++} ++ ++#ifdef UNICODE ++inline std::wstring ToPathWidth(const std::string& path) { ++ return WidenPath(path); ++} ++ ++inline std::wstring ToPathWidth(const std::wstring& path) { ++ return path; ++} ++#else ++inline std::string ToPathWidth(const std::string& path) { ++ return path; ++} ++ ++inline std::string ToPathWidth(const std::wstring& path) { ++ return NarrowPath(path); ++} ++#endif ++ ++struct file_string : public file_string_t { ++ file_string() : file_string_t() {} ++ file_string(const std::string& path) : file_string_t(ToPathWidth(path)) {} ++ file_string(const std::wstring& path) : file_string_t(ToPathWidth(path)) {} ++ file_string(const char* path) : file_string_t(ToPathWidth(path)) {} ++ file_string(const wchar_t* path) : file_string_t(ToPathWidth(path)) {} ++ ++ operator const TCHAR*() const { return c_str(); } ++ ++#ifdef UNICODE ++ operator std::string() const { return NarrowPath(*this); } ++#endif ++ file_string operator+(const std::string& r) { ++ return this->append(ToPathWidth(r)); ++ } ++ ++ file_string operator+(const std::wstring& r) { ++ return this->append(ToPathWidth(r)); ++ } ++ ++ file_string operator+(const char* r) { ++ return this->append(ToPathWidth(r)); ++ } ++ ++ file_string operator+(const wchar_t* r) { ++ return this->append(ToPathWidth(r)); ++ } ++ ++ bool operator==(const std::string& r) { ++ return this->compare(ToPathWidth(r)) == 0; ++ } ++ ++ bool operator==(const std::wstring& r) { ++ return this->compare(ToPathWidth(r)) == 0; ++ } ++ ++ bool operator==(const char* r) { ++ return this->compare(ToPathWidth(r)) == 0; ++ } ++ ++ bool operator==(const wchar_t* r) { ++ return this->compare(ToPathWidth(r)) == 0; ++ } ++}; ++ ++#endif // NINJA_FILE_PATH_H_ +diff --git a/src/includes_normalize-win32.cc b/src/includes_normalize-win32.cc +index 081e364ac3..ba5031fed6 100644 +--- a/src/includes_normalize-win32.cc ++++ b/src/includes_normalize-win32.cc +@@ -28,12 +28,12 @@ using namespace std; + + namespace { + +-bool InternalGetFullPathName(const StringPiece& file_name, char* buffer, ++bool InternalGetFullPathName(const StringPiece& file_name, TCHAR* buffer, + size_t buffer_length, string *err) { +- DWORD result_size = GetFullPathNameA(file_name.AsString().c_str(), ++ DWORD result_size = GetFullPathName(ToPathWidth(file_name.AsString()).c_str(), + buffer_length, buffer, NULL); + if (result_size == 0) { +- *err = "GetFullPathNameA(" + file_name.AsString() + "): " + ++ *err = "GetFullPathName(" + file_name.AsString() + "): " + + GetLastErrorString(); + return false; + } else if (result_size > buffer_length) { +@@ -76,19 +76,19 @@ bool SameDrive(StringPiece a, StringPiece b, string* err) { + return true; + } + +- char a_absolute[_MAX_PATH]; +- char b_absolute[_MAX_PATH]; +- if (!InternalGetFullPathName(a, a_absolute, sizeof(a_absolute), err)) { ++ TCHAR a_absolute[PATH_MAX]; ++ TCHAR b_absolute[PATH_MAX]; ++ if (!InternalGetFullPathName(a, a_absolute, _countof(a_absolute), err)) { + return false; + } +- if (!InternalGetFullPathName(b, b_absolute, sizeof(b_absolute), err)) { ++ if (!InternalGetFullPathName(b, b_absolute, _countof(b_absolute), err)) { + return false; + } +- char a_drive[_MAX_DIR]; +- char b_drive[_MAX_DIR]; +- _splitpath(a_absolute, a_drive, NULL, NULL, NULL); +- _splitpath(b_absolute, b_drive, NULL, NULL, NULL); +- return _stricmp(a_drive, b_drive) == 0; ++ TCHAR a_drive[_MAX_DIR]; ++ TCHAR b_drive[_MAX_DIR]; ++ t_splitpath(a_absolute, a_drive, NULL, NULL, NULL); ++ t_splitpath(b_absolute, b_drive, NULL, NULL, NULL); ++ return t_stricmp(a_drive, b_drive) == 0; + } + + // Check path |s| is FullPath style returned by GetFullPathName. +@@ -146,14 +146,14 @@ string IncludesNormalize::AbsPath(StringPiece s, string* err) { + return result; + } + +- char result[_MAX_PATH]; +- if (!InternalGetFullPathName(s, result, sizeof(result), err)) { ++ TCHAR result[PATH_MAX]; ++ if (!InternalGetFullPathName(s, result, _countof(result), err)) { + return ""; + } +- for (char* c = result; *c; ++c) +- if (*c == '\\') +- *c = '/'; +- return result; ++ for (TCHAR* c = result; *c; ++c) ++ if (*c == TEXT('\\')) ++ *c = TEXT('/'); ++ return NarrowPath(result); + } + + string IncludesNormalize::Relativize( +@@ -183,9 +183,9 @@ string IncludesNormalize::Relativize( + + bool IncludesNormalize::Normalize(const string& input, + string* result, string* err) const { +- char copy[_MAX_PATH + 1]; ++ char copy[PATH_MAX + 1]; + size_t len = input.size(); +- if (len > _MAX_PATH) { ++ if (len > PATH_MAX) { + *err = "path too long"; + return false; + } +diff --git a/src/includes_normalize_test.cc b/src/includes_normalize_test.cc +index 9214f53495..d0e2efb03c 100644 +--- a/src/includes_normalize_test.cc ++++ b/src/includes_normalize_test.cc +@@ -27,9 +27,10 @@ using namespace std; + namespace { + + string GetCurDir() { +- char buf[_MAX_PATH]; +- _getcwd(buf, sizeof(buf)); +- vector parts = SplitStringPiece(buf, '\\'); ++ TCHAR buf[PATH_MAX]; ++ getcwd(buf, _countof(buf)); ++ string narrowPath = NarrowPath(buf); ++ vector parts = SplitStringPiece(narrowPath, '\\'); + return parts[parts.size() - 1].AsString(); + } + +@@ -106,42 +107,47 @@ TEST(IncludesNormalize, LongInvalidPath) { + "pdb (for example, mspdb110.dll) could not be found on your path. This " + "is usually a configuration error. Compilation will continue using /Z7 " + "instead of /Zi, but expect a similar error when you link your program."; ++ ++ string longInputString(kLongInputString); ++ while (longInputString.size() <= PATH_MAX) { ++ longInputString += kLongInputString; ++ } ++ + // Too long, won't be canonicalized. Ensure doesn't crash. + string result, err; + IncludesNormalize normalizer("."); +- EXPECT_FALSE( +- normalizer.Normalize(kLongInputString, &result, &err)); ++ EXPECT_FALSE(normalizer.Normalize(longInputString, &result, &err)); + EXPECT_EQ("path too long", err); + + + // Construct max size path having cwd prefix. + // kExactlyMaxPath = "$cwd\\a\\aaaa...aaaa\0"; +- char kExactlyMaxPath[_MAX_PATH + 1]; +- ASSERT_NE(_getcwd(kExactlyMaxPath, sizeof kExactlyMaxPath), NULL); ++ TCHAR kExactlyMaxPath[PATH_MAX + 1]; ++ ASSERT_NE(getcwd(kExactlyMaxPath, _countof(kExactlyMaxPath)), NULL); + +- int cwd_len = strlen(kExactlyMaxPath); +- ASSERT_LE(cwd_len + 3 + 1, _MAX_PATH) ++ int cwd_len = t_strlen(kExactlyMaxPath); ++ ASSERT_LE(cwd_len + 3 + 1, PATH_MAX) + kExactlyMaxPath[cwd_len] = '\\'; + kExactlyMaxPath[cwd_len + 1] = 'a'; + kExactlyMaxPath[cwd_len + 2] = '\\'; + + kExactlyMaxPath[cwd_len + 3] = 'a'; + +- for (int i = cwd_len + 4; i < _MAX_PATH; ++i) { +- if (i > cwd_len + 4 && i < _MAX_PATH - 1 && i % 10 == 0) ++ for (int i = cwd_len + 4; i < PATH_MAX; ++i) { ++ if (i > cwd_len + 4 && i < PATH_MAX - 1 && i % 10 == 0) + kExactlyMaxPath[i] = '\\'; + else + kExactlyMaxPath[i] = 'a'; + } + +- kExactlyMaxPath[_MAX_PATH] = '\0'; +- EXPECT_EQ(strlen(kExactlyMaxPath), _MAX_PATH); ++ kExactlyMaxPath[PATH_MAX] = '\0'; ++ EXPECT_EQ(t_strlen(kExactlyMaxPath), PATH_MAX); + +- string forward_slashes(kExactlyMaxPath); ++ file_string forward_slashes(kExactlyMaxPath); + replace(forward_slashes.begin(), forward_slashes.end(), '\\', '/'); +- // Make sure a path that's exactly _MAX_PATH long is canonicalized. +- EXPECT_EQ(forward_slashes.substr(cwd_len + 1), +- NormalizeAndCheckNoError(kExactlyMaxPath)); ++ // Make sure a path that's exactly PATH_MAX long is canonicalized. ++ EXPECT_EQ(NarrowPath(forward_slashes.substr(cwd_len + 1)), ++ NormalizeAndCheckNoError(NarrowPath(kExactlyMaxPath))); + } + + TEST(IncludesNormalize, ShortRelativeButTooLongAbsolutePath) { +@@ -153,17 +159,22 @@ TEST(IncludesNormalize, ShortRelativeButTooLongAbsolutePath) { + + // Construct max size path having cwd prefix. + // kExactlyMaxPath = "aaaa\\aaaa...aaaa\0"; +- char kExactlyMaxPath[_MAX_PATH + 1]; +- for (int i = 0; i < _MAX_PATH; ++i) { +- if (i < _MAX_PATH - 1 && i % 10 == 4) ++ char kExactlyMaxPath[PATH_MAX + 1]; ++ for (int i = 0; i < PATH_MAX; ++i) { ++ if (i < PATH_MAX - 1 && i % 10 == 4) + kExactlyMaxPath[i] = '\\'; + else + kExactlyMaxPath[i] = 'a'; + } +- kExactlyMaxPath[_MAX_PATH] = '\0'; +- EXPECT_EQ(strlen(kExactlyMaxPath), _MAX_PATH); ++ kExactlyMaxPath[PATH_MAX] = '\0'; ++ EXPECT_EQ(strlen(kExactlyMaxPath), PATH_MAX); + +- // Make sure a path that's exactly _MAX_PATH long fails with a proper error. ++ // Make sure a path that's exactly PATH_MAX long fails with a proper error. + EXPECT_FALSE(normalizer.Normalize(kExactlyMaxPath, &result, &err)); ++ ++#ifdef UNICODE ++ EXPECT_TRUE(err.find("path too long") != string::npos); ++#else + EXPECT_TRUE(err.find("GetFullPathName") != string::npos); ++#endif + } +diff --git a/src/manifest_parser_perftest.cc b/src/manifest_parser_perftest.cc +index 853d8e0d5d..98952632c9 100644 +--- a/src/manifest_parser_perftest.cc ++++ b/src/manifest_parser_perftest.cc +@@ -103,7 +103,7 @@ int main(int argc, char* argv[]) { + return 1; + } + +- if (chdir(kManifestDir) < 0) ++ if (chdir(ToPathWidth(kManifestDir).c_str()) < 0) + Fatal("chdir: %s", strerror(errno)); + + const int kNumRepetitions = 5; +diff --git a/src/minidump-win32.cc b/src/minidump-win32.cc +index 9aea7678b9..6c59088520 100644 +--- a/src/minidump-win32.cc ++++ b/src/minidump-win32.cc +@@ -62,7 +62,7 @@ void CreateWin32MiniDump(_EXCEPTION_POINTERS* pep) { + HANDLE hFile = CreateFileA(temp_file, GENERIC_READ | GENERIC_WRITE, 0, NULL, + CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == NULL) { +- Error("failed to create minidump: CreateFileA(%s): %s", ++ Error("failed to create minidump: CreateFile(%s): %s", + temp_file, GetLastErrorString().c_str()); + return; + } +diff --git a/src/msvc_helper-win32.cc b/src/msvc_helper-win32.cc +index 1148ae52a5..be9db63653 100644 +--- a/src/msvc_helper-win32.cc ++++ b/src/msvc_helper-win32.cc +@@ -46,7 +46,7 @@ int CLWrapper::Run(const string& command, string* output) { + + // Must be inheritable so subprocesses can dup to children. + HANDLE nul = +- CreateFileA("NUL", GENERIC_READ, ++ CreateFile(TEXT("NUL"), GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + &security_attributes, OPEN_EXISTING, 0, NULL); + if (nul == INVALID_HANDLE_VALUE) +@@ -60,14 +60,14 @@ int CLWrapper::Run(const string& command, string* output) { + Win32Fatal("SetHandleInformation"); + + PROCESS_INFORMATION process_info = {}; +- STARTUPINFOA startup_info = {}; +- startup_info.cb = sizeof(STARTUPINFOA); ++ STARTUPINFO startup_info = {}; ++ startup_info.cb = sizeof(STARTUPINFO); + startup_info.hStdInput = nul; + startup_info.hStdError = ::GetStdHandle(STD_ERROR_HANDLE); + startup_info.hStdOutput = stdout_write; + startup_info.dwFlags |= STARTF_USESTDHANDLES; + +- if (!CreateProcessA(NULL, (char*)command.c_str(), NULL, NULL, ++ if (!CreateProcess(NULL, (TCHAR*)ToPathWidth(command).c_str(), NULL, NULL, + /* inherit handles */ TRUE, 0, + env_block_, NULL, + &startup_info, &process_info)) { +diff --git a/src/msvc_helper_main-win32.cc b/src/msvc_helper_main-win32.cc +index 7d593071f9..b295f34fa6 100644 +--- a/src/msvc_helper_main-win32.cc ++++ b/src/msvc_helper_main-win32.cc +@@ -50,9 +50,9 @@ void PushPathIntoEnvironment(const string& env_block) { + } + } + +-void WriteDepFileOrDie(const char* object_path, const CLParser& parse) { +- string depfile_path = string(object_path) + ".d"; +- FILE* depfile = fopen(depfile_path.c_str(), "w"); ++void WriteDepFileOrDie(const TCHAR* object_path, const CLParser& parse) { ++ file_string depfile_path = file_string(object_path) + TEXT(".d"); ++ FILE* depfile = fopen(ToPathWidth(depfile_path).c_str(), "w"); + if (!depfile) { + unlink(object_path); + Fatal("opening %s: %s", depfile_path.c_str(), +@@ -133,7 +133,7 @@ int MSVCHelperMain(int argc, char** argv) { + string err; + if (!parser.Parse(output, deps_prefix, &output, &err)) + Fatal("%s\n", err.c_str()); +- WriteDepFileOrDie(output_filename, parser); ++ WriteDepFileOrDie(ToPathWidth(output_filename).c_str(), parser); + } + + if (output.empty()) +diff --git a/src/ninja.cc b/src/ninja.cc +index 89580ae94f..a93fa06238 100644 +--- a/src/ninja.cc ++++ b/src/ninja.cc +@@ -871,11 +871,11 @@ int NinjaMain::ToolCompilationDatabase(const Options* options, int argc, + argc -= optind; + + bool first = true; +- vector cwd; +- char* success = NULL; ++ vector cwd; ++ TCHAR* success = NULL; + + do { +- cwd.resize(cwd.size() + 1024); ++ cwd.resize(cwd.size() + PATH_MAX); + errno = 0; + success = getcwd(&cwd[0], cwd.size()); + } while (!success && errno == ERANGE); +@@ -893,7 +893,7 @@ int NinjaMain::ToolCompilationDatabase(const Options* options, int argc, + if (!first) { + putchar(','); + } +- printCompdb(&cwd[0], *e, eval_mode); ++ printCompdb(NarrowPath(&cwd[0]).c_str(), *e, eval_mode); + first = false; + } else { + for (int i = 0; i != argc; ++i) { +@@ -901,7 +901,7 @@ int NinjaMain::ToolCompilationDatabase(const Options* options, int argc, + if (!first) { + putchar(','); + } +- printCompdb(&cwd[0], *e, eval_mode); ++ printCompdb(NarrowPath(&cwd[0]).c_str(), *e, eval_mode); + first = false; + } + } +@@ -1442,7 +1442,7 @@ NORETURN void real_main(int argc, char** argv) { + // can be piped into a file without this string showing up. + if (!options.tool && config.verbosity != BuildConfig::NO_STATUS_UPDATE) + status->Info("Entering directory `%s'", options.working_dir); +- if (chdir(options.working_dir) < 0) { ++ if (chdir(ToPathWidth(options.working_dir).c_str()) < 0) { + Fatal("chdir to '%s' - %s", options.working_dir, strerror(errno)); + } + } +diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc +index ff3baaca7f..8f5faccdac 100644 +--- a/src/subprocess-win32.cc ++++ b/src/subprocess-win32.cc +@@ -39,11 +39,11 @@ Subprocess::~Subprocess() { + } + + HANDLE Subprocess::SetupPipe(HANDLE ioport) { +- char pipe_name[100]; +- snprintf(pipe_name, sizeof(pipe_name), +- "\\\\.\\pipe\\ninja_pid%lu_sp%p", GetCurrentProcessId(), this); ++ TCHAR pipe_name[100]; ++ t_snprintf(pipe_name, sizeof(pipe_name), ++ TEXT("\\\\.\\pipe\\ninja_pid%lu_sp%p"), GetCurrentProcessId(), this); + +- pipe_ = ::CreateNamedPipeA(pipe_name, ++ pipe_ = ::CreateNamedPipe(pipe_name, + PIPE_ACCESS_INBOUND | FILE_FLAG_OVERLAPPED, + PIPE_TYPE_BYTE, + PIPE_UNLIMITED_INSTANCES, +@@ -62,7 +62,7 @@ HANDLE Subprocess::SetupPipe(HANDLE ioport) { + + // Get the write end of the pipe as a handle inheritable across processes. + HANDLE output_write_handle = +- CreateFileA(pipe_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); ++ CreateFile(pipe_name, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); + HANDLE output_write_child; + if (!DuplicateHandle(GetCurrentProcess(), output_write_handle, + GetCurrentProcess(), &output_write_child, +@@ -83,13 +83,13 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { + security_attributes.bInheritHandle = TRUE; + // Must be inheritable so subprocesses can dup to children. + HANDLE nul = +- CreateFileA("NUL", GENERIC_READ, ++ CreateFile(TEXT("NUL"), GENERIC_READ, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + &security_attributes, OPEN_EXISTING, 0, NULL); + if (nul == INVALID_HANDLE_VALUE) + Fatal("couldn't open nul"); + +- STARTUPINFOA startup_info; ++ STARTUPINFO startup_info; + memset(&startup_info, 0, sizeof(startup_info)); + startup_info.cb = sizeof(STARTUPINFO); + if (!use_console_) { +@@ -109,7 +109,7 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) { + + // Do not prepend 'cmd /c' on Windows, this breaks command + // lines greater than 8,191 chars. +- if (!CreateProcessA(NULL, (char*)command.c_str(), NULL, NULL, ++ if (!CreateProcess(NULL, (TCHAR*)ToPathWidth(command).c_str(), NULL, NULL, + /* inherit handles */ TRUE, process_flags, + NULL, NULL, + &startup_info, &process_info)) { +diff --git a/src/test.cc b/src/test.cc +index 11b1c9ebf0..ec3e522797 100644 +--- a/src/test.cc ++++ b/src/test.cc +@@ -56,7 +56,7 @@ char* mkdtemp(char* name_template) { + return NULL; + } + +- err = _mkdir(name_template); ++ err = mkdir(ToPathWidth(name_template).c_str()); + if (err < 0) { + perror("mkdir"); + return NULL; +@@ -68,8 +68,8 @@ char* mkdtemp(char* name_template) { + + string GetSystemTempDir() { + #ifdef _WIN32 +- char buf[1024]; +- if (!GetTempPath(sizeof(buf), buf)) ++ char buf[MAX_PATH + 1]; ++ if (!GetTempPathA(sizeof(buf), buf)) + return ""; + return buf; + #else +@@ -200,7 +200,7 @@ void ScopedTempDir::CreateAndEnter(const string& name) { + start_dir_ = GetSystemTempDir(); + if (start_dir_.empty()) + Fatal("couldn't get system temp dir"); +- if (chdir(start_dir_.c_str()) < 0) ++ if (chdir(ToPathWidth(start_dir_).c_str()) < 0) + Fatal("chdir: %s", strerror(errno)); + + // Create a temporary subdirectory of that. +@@ -213,7 +213,7 @@ void ScopedTempDir::CreateAndEnter(const string& name) { + temp_dir_name_ = tempname; + + // chdir into the new temporary directory. +- if (chdir(temp_dir_name_.c_str()) < 0) ++ if (chdir(ToPathWidth(temp_dir_name_).c_str()) < 0) + Fatal("chdir: %s", strerror(errno)); + } + +@@ -222,7 +222,7 @@ void ScopedTempDir::Cleanup() { + return; // Something went wrong earlier. + + // Move out of the directory we're about to clobber. +- if (chdir(start_dir_.c_str()) < 0) ++ if (chdir(ToPathWidth(start_dir_).c_str()) < 0) + Fatal("chdir: %s", strerror(errno)); + + #ifdef _WIN32 +diff --git a/src/util.cc b/src/util.cc +index 080883e066..c92dcfe3de 100644 +--- a/src/util.cc ++++ b/src/util.cc +@@ -140,7 +140,7 @@ void CanonicalizePath(char* path, size_t* len, uint64_t* slash_bits) { + return; + } + +- const int kMaxPathComponents = 60; ++ const int kMaxPathComponents = _MAX_DIR; + char* components[kMaxPathComponents]; + int component_count = 0; + +@@ -332,12 +332,12 @@ void GetWin32EscapedString(const string& input, string* result) { + result->push_back(kQuote); + } + +-int ReadFile(const string& path, string* contents, string* err) { ++int ReadFile(const std::string& path, string* contents, string* err) { + #ifdef _WIN32 + // This makes a ninja run on a set of 1500 manifest files about 4% faster + // than using the generic fopen code below. + err->clear(); +- HANDLE f = ::CreateFileA(path.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, ++ HANDLE f = ::CreateFile(ToPathWidth(path).c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); + if (f == INVALID_HANDLE_VALUE) { + err->assign(GetLastErrorString()); +diff --git a/src/util.h b/src/util.h +index 4a7fea2258..4d110b4a8e 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -17,6 +17,7 @@ + + #ifdef _WIN32 + #include "win32port.h" ++#include + #else + #include + #endif +@@ -26,6 +27,8 @@ + #include + #include + ++#include "file_path.h" ++ + #ifdef _MSC_VER + #define NORETURN __declspec(noreturn) + #else +@@ -113,13 +116,50 @@ bool Truncate(const std::string& path, size_t size, std::string* err); + #ifdef _MSC_VER + #define snprintf _snprintf + #define fileno _fileno ++#define strtoull _strtoui64 ++ ++#ifdef UNICODE ++#define unlink _wunlink ++#define fopen(path, mode) _wfopen(path, TEXT(mode)) ++#define chdir _wchdir ++#define getcwd _wgetcwd ++#define mkdir _wmkdir ++ ++#define t_snprintf _snwprintf ++#define t_splitpath _wsplitpath ++#define t_stricmp _wcsicmp ++#define t_strlen wcslen ++ ++#define PATH_MAX 2048 ++#else // !UNICODE + #define unlink _unlink ++#define fopen(path, mode) fopen(path, TEXT(mode)) + #define chdir _chdir +-#define strtoull _strtoui64 + #define getcwd _getcwd ++#define mkdir _mkdir ++ ++#define t_snprintf snprintf ++#define t_splitpath _splitpath ++#define t_stricmp _stricmp ++#define t_strlen strlen ++ ++#define PATH_MAX _MAX_PATH ++#endif // !UNICODE ++#else // !_MSC_VER ++#define t_snprintf snprintf ++#define t_splitpath _splitpath ++#define t_stricmp _stricmp ++#define t_strlen strlen ++ ++#ifndef PATH_MAX + #define PATH_MAX _MAX_PATH + #endif + ++#ifndef _MAX_DIR ++#define _MAX_DIR 256 ++#endif ++#endif // !_MSC_VER ++ + #ifdef _WIN32 + /// Convert the value returned by GetLastError() into a string. + std::string GetLastErrorString(); +diff --git a/windows/ninja.manifest b/windows/ninja.manifest +index dab929e151..aaa0bd362e 100644 +--- a/windows/ninja.manifest ++++ b/windows/ninja.manifest +@@ -3,6 +3,7 @@ + + + UTF-8 ++ true + + + diff --git a/ports/vcpkg-tool-ninja/portfile.cmake b/ports/vcpkg-tool-ninja/portfile.cmake new file mode 100644 index 00000000000000..cc615bdbfd2c9c --- /dev/null +++ b/ports/vcpkg-tool-ninja/portfile.cmake @@ -0,0 +1,81 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +set(program NINJA) +set(program_version 1.10.2) +set(program_name "ninja") +set(search_names "ninja") +set(apt_package_name "ninja-build") +set(brew_package_name "ninja-build") +set(paths_to_search "${CURRENT_PACKAGES_DIR}/tools/ninja") +set(supported_on_unix ON) +set(version_command --version) +set(extra_search_args EXACT_VERSION_MATCH) + +if(NOT "${program}") + vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ninja-build/ninja + REF 170c387a7461d476523ae29c115a58f16e4d3430 + SHA512 75c0f263ad325d14c99c9a1d85e571832407b481271a2733e78183a478f7ecd22d84451fc8d7ce16ab20d641ce040761d7ab266695d66bbac5b2b9a3a29aa521 + HEAD_REF master + PATCHES PR2056.diff # Long path support windows +) + # This copied from vcpkg_configure_cmake to find a generator which is not ninja! + set(generator_arch "") + if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + if("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v120" AND NOT "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64") + set(generator "Visual Studio 12 2013") + elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v140" AND NOT "${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64") + set(generator "Visual Studio 14 2015") + elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v141") + set(generator "Visual Studio 15 2017") + elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v142") + set(generator "Visual Studio 16 2019") + elseif("${VCPKG_PLATFORM_TOOLSET}" STREQUAL "v143") + set(generator "Visual Studio 17 2022") + endif() + + if("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x86") + set(generator_arch "Win32") + elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "x64") + set(generator_arch "x64") + elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm") + set(generator_arch "ARM") + elseif("${VCPKG_TARGET_ARCHITECTURE}" STREQUAL "arm64") + set(generator_arch "ARM64") + endif() + if("${generator}" STREQUAL "" OR "${generator_arch}" STREQUAL "") + message(FATAL_ERROR + "Unable to determine appropriate generator for triplet ${TARGET_TRIPLET}: + platform toolset: ${VCPKG_PLATFORM_TOOLSET} + architecture : ${VCPKG_TARGET_ARCHITECTURE}") + endif() + vcpkg_list(APPEND cmake_options "-DBUILD_UNICODE:BOOL=ON") + else() + set(generator "Unix Makefiles") + endif() + if(NOT "${generator_arch}" STREQUAL "") + vcpkg_list(APPEND cmake_options "-A${generator_arch}") + endif() + + set(VCPKG_BUILD_TYPE release) #we only need release here! + vcpkg_configure_cmake( + DISABLE_PARALLEL_CONFIGURE + SOURCE_PATH "${SOURCE_PATH}" + GENERATOR "${generator}" + OPTIONS ${cmake_options} + ) + vcpkg_install_cmake() + set(PORT ninja) # to trick vcpkg_copy_tools + vcpkg_copy_tools(TOOL_NAMES ninja AUTO_CLEAN) + set(PORT vcpkg-tool-ninja) + configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-port-config.cmake" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-port-config.cmake" @ONLY) +endif() + +z_vcpkg_find_acquire_program_find_internal("${program}" + INTERPRETER "${interpreter}" + PATHS ${paths_to_search} + NAMES ${search_names} +) +message(STATUS "Using ninja: ${NINJA}") + diff --git a/ports/vcpkg-tool-ninja/vcpkg-port-config.cmake b/ports/vcpkg-tool-ninja/vcpkg-port-config.cmake new file mode 100644 index 00000000000000..333cf3fe0f433b --- /dev/null +++ b/ports/vcpkg-tool-ninja/vcpkg-port-config.cmake @@ -0,0 +1 @@ +set(NINJA "${CURRENT_HOST_INSTALLED_DIR}/tools/ninja@VCPKG_TARGET_EXECUTABLE_SUFFIX@") \ No newline at end of file diff --git a/ports/vcpkg-tool-ninja/vcpkg.json b/ports/vcpkg-tool-ninja/vcpkg.json new file mode 100644 index 00000000000000..d9d00e1fdb5b1c --- /dev/null +++ b/ports/vcpkg-tool-ninja/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "vcpkg-tool-ninja", + "version-date": "2022-03-31", + "description": "Ninja is a small build system with a focus on speed.", + "homepage": "https://ninja-build.org/", + "license": "Apache-2.0", + "supports": "native" +} diff --git a/scripts/buildsystems/vcpkg.cmake b/scripts/buildsystems/vcpkg.cmake index 0ae8473ffd2e2a..4074dfb87144ae 100644 --- a/scripts/buildsystems/vcpkg.cmake +++ b/scripts/buildsystems/vcpkg.cmake @@ -563,6 +563,41 @@ cmake_policy(POP) # Any policies applied to the below macros and functions appear to leak into consumers +list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES VCPKG_CHAINLOAD_TOOLCHAIN_FILE VCPKG_TARGET_TRIPLET VCPKG_HOST_TRIPLET VCPKG_INSTALLED_DIR VCPKG_PREFER_SYSTEM_LIBS) +# Need to override try_compile and try_run to pass some variables in project mode vs src mode +get_property(in_try_compile GLOBAL PROPERTY IN_TRY_COMPILE) +if(NOT in_try_compile) + function(try_compile resultVar bindir srcdir) + z_vcpkg_function_arguments(ARGS) + if(IS_DIRECTORY "${srcdir}") # project try_compile + cmake_parse_arguments(PARSE_ARGV 2 "arg" "" "OUTPUT_VARIABLE" "CMAKE_FLAGS") + if(DEFINED arg_CMAKE_FLAGS) + list(REMOVE_ITEM ARGS CMAKE_FLAGS ${arg_CMAKE_FLAGS}) + endif() + foreach(try_compile_var IN LISTS CMAKE_TRY_COMPILE_PLATFORM_VARIABLES) + if(${try_compile_var}) + list(APPEND arg_CMAKE_FLAGS "-D${try_compile_var}=${${try_compile_var}}") + endif() + endforeach() + if(arg_OUTPUT_VARIABLE) + list(REMOVE_ITEM ARGS OUTPUT_VARIABLE ${arg_OUTPUT_VARIABLE}) + _try_compile(${ARGS} CMAKE_FLAGS ${arg_CMAKE_FLAGS} OUTPUT_VARIABLE ${arg_OUTPUT_VARIABLE}) + else() + _try_compile(${ARGS} CMAKE_FLAGS ${arg_CMAKE_FLAGS}) + endif() + else() # source based try_compile + _try_compile(${ARGS}) + cmake_parse_arguments(PARSE_ARGV 2 "arg" "" "OUTPUT_VARIABLE" "") + endif() + + if(DEFINED arg_OUTPUT_VARIABLE) + set(${arg_OUTPUT_VARIABLE} ${${arg_OUTPUT_VARIABLE}} PARENT_SCOPE) + endif() + set(${resultVar} ${${resultVar}} PARENT_SCOPE) + endfunction() +endif() +unset(in_try_compile) + function(add_executable) z_vcpkg_function_arguments(ARGS) _add_executable(${ARGS}) diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 59ab14591ea0cc..bb05e7da6473ee 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -818,8 +818,6 @@ ompl:x64-osx=fail ompl:x64-linux=fail openal-soft:arm-uwp=fail openal-soft:x64-uwp=fail -openblas:arm64-windows=fail -openblas:arm-uwp=fail # opencc/deps/rapidjson-1.1.0/rapidjson.h: Unknown machine endianess detected opencc:arm64-windows=fail # opencc/deps/marisa-0.2.5/lib/marisa/grimoire/io/mapper.cc currently doesn't support UWP. @@ -1286,9 +1284,9 @@ clapack:x64-windows-static=skip clapack:x64-windows-static-md=skip clapack:x64-windows=skip clapack:x86-windows=skip -lapack-reference:arm64-windows=skip +clapack:arm64-windows=skip +clapack:x64-uwp=skip lapack-reference:arm-uwp=skip -lapack-reference:x64-uwp=skip # failures for x64-windows-static-md ace:x64-windows-static-md=fail diff --git a/scripts/cmake/vcpkg_build_cmake.cmake b/scripts/cmake/vcpkg_build_cmake.cmake index b3015ae29e8865..48689b1d87662f 100644 --- a/scripts/cmake/vcpkg_build_cmake.cmake +++ b/scripts/cmake/vcpkg_build_cmake.cmake @@ -64,8 +64,12 @@ function(vcpkg_build_cmake) vcpkg_list(SET parallel_param "/m") elseif("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "NMake Makefiles") # No options are currently added for nmake builds + elseif("${Z_VCPKG_CMAKE_GENERATOR}" STREQUAL "Unix Makefiles") + vcpkg_list(SET build_param "VERBOSE=1") + vcpkg_list(SET parallel_param "-j${VCPKG_CONCURRENCY}") + vcpkg_list(SET no_parallel_param "-j1") else() - message(FATAL_ERROR "Unrecognized GENERATOR setting from vcpkg_configure_cmake(). Valid generators are: Ninja, Visual Studio, and NMake Makefiles") + message(FATAL_ERROR "Unrecognized GENERATOR setting from vcpkg_configure_cmake(). Valid generators are: 'Ninja', 'Visual Studio', 'Unix Makefiles' and 'NMake Makefiles'") endif() vcpkg_list(SET target_param) diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake index 2fac4922deacf7..b4485f4bbe6ccd 100644 --- a/scripts/toolchains/linux.cmake +++ b/scripts/toolchains/linux.cmake @@ -1,4 +1,10 @@ if(NOT _VCPKG_LINUX_TOOLCHAIN) +list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES VCPKG_CRT_LINKAGE VCPKG_TARGET_ARCHITECTURE + VCPKG_C_FLAGS VCPKG_CXX_FLAGS + VCPKG_C_FLAGS_DEBUG VCPKG_CXX_FLAGS_DEBUG + VCPKG_C_FLAGS_RELEASE VCPKG_CXX_FLAGS_RELEASE + VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG + ) set(_VCPKG_LINUX_TOOLCHAIN 1) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") @@ -46,24 +52,21 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") endif() endif() -get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) -if(NOT _CMAKE_IN_TRY_COMPILE) - string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") - string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") - string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") - string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") - string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") - string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") +string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") +string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") +string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") +string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") +string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") +string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") - if(VCPKG_CRT_LINKAGE STREQUAL "static") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT "-static ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-static ") - endif() - string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +if(VCPKG_CRT_LINKAGE STREQUAL "static") + string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT "-static ") + string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-static ") endif() +string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") endif() diff --git a/scripts/toolchains/osx.cmake b/scripts/toolchains/osx.cmake index efad6c5fedaca8..2d68a859f18ee2 100644 --- a/scripts/toolchains/osx.cmake +++ b/scripts/toolchains/osx.cmake @@ -1,4 +1,10 @@ if(NOT _VCPKG_OSX_TOOLCHAIN) +list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES VCPKG_CRT_LINKAGE VCPKG_TARGET_ARCHITECTURE + VCPKG_C_FLAGS VCPKG_CXX_FLAGS + VCPKG_C_FLAGS_DEBUG VCPKG_CXX_FLAGS_DEBUG + VCPKG_C_FLAGS_RELEASE VCPKG_CXX_FLAGS_RELEASE + VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG + ) set(_VCPKG_OSX_TOOLCHAIN 1) if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "") @@ -22,20 +28,19 @@ if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR) endif() endif() -get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) -if(NOT _CMAKE_IN_TRY_COMPILE) - string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") - string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") - string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") - string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") - string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") - string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") -endif() +string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ") +string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ") +string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ") +string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ") +string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ") +string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ") + +string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ") + endif() diff --git a/scripts/toolchains/uwp.cmake b/scripts/toolchains/uwp.cmake index 9e76d4512dc723..95bdc8ed157385 100644 --- a/scripts/toolchains/uwp.cmake +++ b/scripts/toolchains/uwp.cmake @@ -1,4 +1,11 @@ if(NOT _VCPKG_WINDOWS_TOOLCHAIN) +list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES VCPKG_CRT_LINKAGE VCPKG_TARGET_ARCHITECTURE VCPKG_SET_CHARSET_FLAG + VCPKG_C_FLAGS VCPKG_CXX_FLAGS + VCPKG_C_FLAGS_DEBUG VCPKG_CXX_FLAGS_DEBUG + VCPKG_C_FLAGS_RELEASE VCPKG_CXX_FLAGS_RELEASE + VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG + VCPKG_PLATFORM_TOOLSET) + set(_VCPKG_WINDOWS_TOOLCHAIN 1) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" CACHE STRING "") @@ -34,60 +41,56 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") endif() endif() -get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) -if(NOT _CMAKE_IN_TRY_COMPILE) - - if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD") - elseif(VCPKG_CRT_LINKAGE STREQUAL "static") - set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT") - else() - message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") - endif() +if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD") +elseif(VCPKG_CRT_LINKAGE STREQUAL "static") + set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT") +else() + message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") +endif() - set(_vcpkg_charset "/utf-8") - if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120") - # VS 2013 does not support /utf-8 - set(_vcpkg_charset "") - endif() +set(_vcpkg_charset "/utf-8") +if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120") + # VS 2013 does not support /utf-8 + set(_vcpkg_charset "") +endif() - set(_vcpkg_cpp_flags "/DWIN32 /D_WINDOWS /D_UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB__" ) # VS adds /D "_WINDLL" for DLLs; - set(_vcpkg_common_flags "/nologo /Z7 /MP /GS /Gd /Gm- /W3 /WX- /Zc:wchar_t /Zc:inline /Zc:forScope /fp:precise /Oy- /EHsc") - #/ZW:nostdlib -> ZW is added by CMake # VS also normally adds /sdl but not cmake MSBUILD - set(_vcpkg_winmd_flag "") - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}" _vcpkg_vctools) - set(ENV{_CL_} "/FU\"${_vcpkg_vctools}/lib/x86/store/references/platform.winmd\" $ENV{_CL_}") - # CMake has problems to correctly pass this in the compiler test so probably need special care in get_cmake_vars - #set(_vcpkg_winmd_flag "/FU\\\\\"${_vcpkg_vctools}/lib/x86/store/references/platform.winmd\\\\\"") # VS normally passes /ZW for Apps +set(_vcpkg_cpp_flags "/DWIN32 /D_WINDOWS /D_UNICODE /DUNICODE /DWINAPI_FAMILY=WINAPI_FAMILY_APP /D__WRL_NO_DEFAULT_LIB__" ) # VS adds /D "_WINDLL" for DLLs; +set(_vcpkg_common_flags "/nologo /Z7 /MP /GS /Gd /Gm- /W3 /WX- /Zc:wchar_t /Zc:inline /Zc:forScope /fp:precise /Oy- /EHsc") +#/ZW:nostdlib -> ZW is added by CMake # VS also normally adds /sdl but not cmake MSBUILD +set(_vcpkg_winmd_flag "") +file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}" _vcpkg_vctools) +set(ENV{_CL_} "/FU\"${_vcpkg_vctools}/lib/x86/store/references/platform.winmd\" $ENV{_CL_}") +# CMake has problems to correctly pass this in the compiler test so probably need special care in get_cmake_vars +#set(_vcpkg_winmd_flag "/FU\\\\\"${_vcpkg_vctools}/lib/x86/store/references/platform.winmd\\\\\"") # VS normally passes /ZW for Apps - set(CMAKE_CXX_FLAGS "${_vcpkg_cpp_flags} ${_vcpkg_common_flags} ${_vcpkg_winmd_flag} ${_vcpkg_charset} ${VCPKG_CXX_FLAGS}" CACHE STRING "") - set(CMAKE_C_FLAGS "${_vcpkg_cpp_flags} ${_vcpkg_common_flags} ${_vcpkg_winmd_flag} ${_vcpkg_charset} ${VCPKG_C_FLAGS}" CACHE STRING "") - set(CMAKE_RC_FLAGS "-c65001 ${_vcpkg_cpp_flags}" CACHE STRING "") +set(CMAKE_CXX_FLAGS "${_vcpkg_cpp_flags} ${_vcpkg_common_flags} ${_vcpkg_winmd_flag} ${_vcpkg_charset} ${VCPKG_CXX_FLAGS}" CACHE STRING "") +set(CMAKE_C_FLAGS "${_vcpkg_cpp_flags} ${_vcpkg_common_flags} ${_vcpkg_winmd_flag} ${_vcpkg_charset} ${VCPKG_C_FLAGS}" CACHE STRING "") +set(CMAKE_RC_FLAGS "-c65001 ${_vcpkg_cpp_flags}" CACHE STRING "") - unset(_vcpkg_charset) - unset(_vcpkg_cpp_flags) - unset(_vcpkg_common_flags) - unset(_vcpkg_winmd_flag) +unset(_vcpkg_charset) +unset(_vcpkg_cpp_flags) +unset(_vcpkg_common_flags) +unset(_vcpkg_winmd_flag) - set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /RTC1 ${VCPKG_CRT_LINK_FLAG_PREFIX}d ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /RTC1 ${VCPKG_CRT_LINK_FLAG_PREFIX}d ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") +set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG /Od /RTC1 ${VCPKG_CRT_LINK_FLAG_PREFIX}d ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") +set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG /Od /RTC1 ${VCPKG_CRT_LINK_FLAG_PREFIX}d ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_CXX_FLAGS_RELEASE "/Gy /O2 /Oi /DNDEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX} ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") # VS adds /GL - set(CMAKE_C_FLAGS_RELEASE "/Gy /O2 /Oi /DNDEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX} ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELEASE "/Gy /O2 /Oi /DNDEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX} ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") # VS adds /GL +set(CMAKE_C_FLAGS_RELEASE "/Gy /O2 /Oi /DNDEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX} ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") - string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT " /nologo ") # VS adds /LTCG +string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT " /nologo ") # VS adds /LTCG - if(CMAKE_GENERATOR MATCHES "Ninja") - set(additional_exe_flags "/WINMD") # VS Generator chokes on this in the compiler detection - endif() - string(APPEND CMAKE_SHARED_LINKER_FLAGS " /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}") - # VS adds /DEBUG:FULL /TLBID:1. WindowsApp.lib is in CMAKE_C|CXX_STANDARD_LIBRARIES - string(APPEND CMAKE_EXE_LINKER_FLAGS " /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG ${additional_exe_flags} /APPCONTAINER /MANIFESTUAC:NO ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}") - - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF " CACHE STRING "") # VS uses /LTCG:incremental - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF " CACHE STRING "") - string(APPEND CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT " /nologo ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " /nologo ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ") +if(CMAKE_GENERATOR MATCHES "Ninja") + set(additional_exe_flags "/WINMD") # VS Generator chokes on this in the compiler detection endif() +string(APPEND CMAKE_SHARED_LINKER_FLAGS " /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG /WINMD:NO /APPCONTAINER /SUBSYSTEM:CONSOLE /MANIFESTUAC:NO ${VCPKG_LINKER_FLAGS}") +# VS adds /DEBUG:FULL /TLBID:1. WindowsApp.lib is in CMAKE_C|CXX_STANDARD_LIBRARIES +string(APPEND CMAKE_EXE_LINKER_FLAGS " /MANIFEST:NO /NXCOMPAT /DYNAMICBASE /DEBUG ${additional_exe_flags} /APPCONTAINER /MANIFESTUAC:NO ${VCPKG_LINKER_FLAGS}") + +set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "") # VS uses /LTCG:incremental +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "") +string(APPEND CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT " /nologo ") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " /nologo ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS_DEBUG} ") endif() diff --git a/scripts/toolchains/windows.cmake b/scripts/toolchains/windows.cmake index 7c8a54989d532f..01bcdab1a24fdf 100644 --- a/scripts/toolchains/windows.cmake +++ b/scripts/toolchains/windows.cmake @@ -1,4 +1,10 @@ if(NOT _VCPKG_WINDOWS_TOOLCHAIN) +list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES VCPKG_CRT_LINKAGE VCPKG_TARGET_ARCHITECTURE VCPKG_SET_CHARSET_FLAG + VCPKG_C_FLAGS VCPKG_CXX_FLAGS + VCPKG_C_FLAGS_DEBUG VCPKG_CXX_FLAGS_DEBUG + VCPKG_C_FLAGS_RELEASE VCPKG_CXX_FLAGS_RELEASE + VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG + VCPKG_PLATFORM_TOOLSET) set(_VCPKG_WINDOWS_TOOLCHAIN 1) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>$<$:DLL>" CACHE STRING "") @@ -34,40 +40,36 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows") endif() endif() -get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE ) -if(NOT _CMAKE_IN_TRY_COMPILE) - - if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD") - elseif(VCPKG_CRT_LINKAGE STREQUAL "static") - set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT") - else() - message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") - endif() +if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") + set(VCPKG_CRT_LINK_FLAG_PREFIX "/MD") +elseif(VCPKG_CRT_LINKAGE STREQUAL "static") + set(VCPKG_CRT_LINK_FLAG_PREFIX "/MT") +else() + message(FATAL_ERROR "Invalid setting for VCPKG_CRT_LINKAGE: \"${VCPKG_CRT_LINKAGE}\". It must be \"static\" or \"dynamic\"") +endif() - set(CHARSET_FLAG "/utf-8") - if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120") - # VS 2013 does not support /utf-8 - set(CHARSET_FLAG) - endif() +set(CHARSET_FLAG "/utf-8") +if (NOT VCPKG_SET_CHARSET_FLAG OR VCPKG_PLATFORM_TOOLSET MATCHES "v120") + # VS 2013 does not support /utf-8 + set(CHARSET_FLAG) +endif() - set(CMAKE_CXX_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "") - set(CMAKE_C_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "") - set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "") +set(CMAKE_CXX_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /GR /EHsc /MP ${VCPKG_CXX_FLAGS}" CACHE STRING "") +set(CMAKE_C_FLAGS " /nologo /DWIN32 /D_WINDOWS /W3 ${CHARSET_FLAG} /MP ${VCPKG_C_FLAGS}" CACHE STRING "") +set(CMAKE_RC_FLAGS "-c65001 /DWIN32" CACHE STRING "") - unset(CHARSET_FLAG) +unset(CHARSET_FLAG) - set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") - set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") - set(CMAKE_C_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") +set(CMAKE_CXX_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_CXX_FLAGS_DEBUG}" CACHE STRING "") +set(CMAKE_C_FLAGS_DEBUG "/D_DEBUG ${VCPKG_CRT_LINK_FLAG_PREFIX}d /Z7 /Ob0 /Od /RTC1 ${VCPKG_C_FLAGS_DEBUG}" CACHE STRING "") +set(CMAKE_CXX_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_CXX_FLAGS_RELEASE}" CACHE STRING "") +set(CMAKE_C_FLAGS_RELEASE "${VCPKG_CRT_LINK_FLAG_PREFIX} /O2 /Oi /Gy /DNDEBUG /Z7 ${VCPKG_C_FLAGS_RELEASE}" CACHE STRING "") - string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT " /nologo ") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "") +string(APPEND CMAKE_STATIC_LINKER_FLAGS_RELEASE_INIT " /nologo ") +set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "") +set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/nologo /DEBUG /INCREMENTAL:NO /OPT:REF /OPT:ICF ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_RELEASE}" CACHE STRING "") - string(APPEND CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT " /nologo ") - string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ") - string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ") -endif() +string(APPEND CMAKE_STATIC_LINKER_FLAGS_DEBUG_INIT " /nologo ") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ") +string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " /nologo ${VCPKG_LINKER_FLAGS} ${VCPKG_LINKER_FLAGS_DEBUG} ") endif() diff --git a/versions/b-/blas.json b/versions/b-/blas.json index c8b3ade64a24bc..31e95f4a2dbd35 100644 --- a/versions/b-/blas.json +++ b/versions/b-/blas.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cc69a0e5e94d7e9d9efa4ba0c68d795547636739", + "version-date": "2022-04-10", + "port-version": 0 + }, { "git-tree": "0d105be9337f4a6f294a7eced2da18e8cdb99051", "version-string": "1", diff --git a/versions/baseline.json b/versions/baseline.json index d24eaa5d93ee9e..0d568293baeffc 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -489,8 +489,8 @@ "port-version": 0 }, "blas": { - "baseline": "1", - "port-version": 1 + "baseline": "2022-04-10", + "port-version": 0 }, "blaze": { "baseline": "3.8", @@ -2224,6 +2224,10 @@ "baseline": "2022.03.21.00", "port-version": 1 }, + "flang-fortran-runtime": { + "baseline": "2022-04-23", + "port-version": 0 + }, "flann": { "baseline": "2019-04-07", "port-version": 5 @@ -2390,7 +2394,7 @@ }, "g2o": { "baseline": "2020-02-07", - "port-version": 2 + "port-version": 3 }, "g3log": { "baseline": "1.3.4", @@ -3325,12 +3329,12 @@ "port-version": 0 }, "lapack": { - "baseline": "2022-02-22", + "baseline": "2022-04-23", "port-version": 0 }, "lapack-reference": { "baseline": "3.10.0", - "port-version": 0 + "port-version": 1 }, "lastools": { "baseline": "2020-05-09", @@ -5057,8 +5061,8 @@ "port-version": 4 }, "openblas": { - "baseline": "0.3.19", - "port-version": 1 + "baseline": "0.3.20", + "port-version": 0 }, "opencascade": { "baseline": "7.6.0", @@ -5384,6 +5388,10 @@ "baseline": "2019-05-14", "port-version": 1 }, + "pgmath": { + "baseline": "2022-04-23", + "port-version": 0 + }, "phnt": { "baseline": "2020-12-21", "port-version": 0 @@ -7316,6 +7324,10 @@ "baseline": "2022-02-06", "port-version": 0 }, + "vcpkg-fortran-flang": { + "baseline": "2022-02-22", + "port-version": 0 + }, "vcpkg-get-python-packages": { "baseline": "2022-04-11", "port-version": 0 @@ -7336,6 +7348,18 @@ "baseline": "2022-02-14", "port-version": 0 }, + "vcpkg-tool-7zip": { + "baseline": "21.07", + "port-version": 0 + }, + "vcpkg-tool-flang": { + "baseline": "2022-04-23", + "port-version": 0 + }, + "vcpkg-tool-flang-llvm": { + "baseline": "2022-04-23", + "port-version": 0 + }, "vcpkg-tool-gn": { "baseline": "2022-04-16", "port-version": 0 @@ -7348,6 +7372,10 @@ "baseline": "1.10.0", "port-version": 0 }, + "vcpkg-tool-llvm": { + "baseline": "13.0.1", + "port-version": 0 + }, "vcpkg-tool-meson": { "baseline": "0.60.2", "port-version": 2 @@ -7356,6 +7384,10 @@ "baseline": "3.3", "port-version": 0 }, + "vcpkg-tool-ninja": { + "baseline": "2022-03-31", + "port-version": 0 + }, "vcpkg-tool-nodejs": { "baseline": "14.17.4", "port-version": 0 diff --git a/versions/f-/flang-fortran-runtime.json b/versions/f-/flang-fortran-runtime.json new file mode 100644 index 00000000000000..f2f3c71318b86a --- /dev/null +++ b/versions/f-/flang-fortran-runtime.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "5386439d21a84e9f3ddb2dfeaffd5347f171477b", + "version-date": "2022-04-23", + "port-version": 0 + } + ] +} diff --git a/versions/g-/g2o.json b/versions/g-/g2o.json index 34e9d0dfa836f5..aa110dea1e51db 100644 --- a/versions/g-/g2o.json +++ b/versions/g-/g2o.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "cec947eb9d3d71e22eee58e6c4f9eecd674b9a07", + "version-date": "2020-02-07", + "port-version": 3 + }, { "git-tree": "4fb8813de02bd243b25d9ed93065f9f9cba09e93", "version-string": "2020-02-07", diff --git a/versions/l-/lapack-reference.json b/versions/l-/lapack-reference.json index 999e4f135ff049..7b786b95dd4f92 100644 --- a/versions/l-/lapack-reference.json +++ b/versions/l-/lapack-reference.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "0bf954c241dd2db8fdadf3c89ebd26a00360b63f", + "version": "3.10.0", + "port-version": 1 + }, { "git-tree": "14b5e3ab7315ce36951f759c6254712ed41cc0af", "version": "3.10.0", diff --git a/versions/l-/lapack.json b/versions/l-/lapack.json index 5803b592258a71..cbfa7eaa518a1e 100644 --- a/versions/l-/lapack.json +++ b/versions/l-/lapack.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "9a34adc8f5076eb28d37ac1f04da218dc678590f", + "version-date": "2022-04-23", + "port-version": 0 + }, { "git-tree": "3a9c5b51e3480db058719db223df981e0e679819", "version-date": "2022-02-22", diff --git a/versions/o-/openblas.json b/versions/o-/openblas.json index 8b7301aa54fd11..799dfc8c24254c 100644 --- a/versions/o-/openblas.json +++ b/versions/o-/openblas.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "646a3f8bb58fcf2cb1a64b29e49dd5acfff4bd3a", + "version": "0.3.20", + "port-version": 0 + }, { "git-tree": "90e2cde7fda025b587d6c41e699c98c263cf41eb", "version": "0.3.19", diff --git a/versions/p-/pgmath.json b/versions/p-/pgmath.json new file mode 100644 index 00000000000000..8858ced43c6ce4 --- /dev/null +++ b/versions/p-/pgmath.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "764d6ef440ada5cb622285913acb0ba92435e0ac", + "version-date": "2022-04-23", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vcpkg-fortran-flang.json b/versions/v-/vcpkg-fortran-flang.json new file mode 100644 index 00000000000000..6ab2b736ac005c --- /dev/null +++ b/versions/v-/vcpkg-fortran-flang.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "10f2eb558c59c5c5d94e0e18be4f79aa1061dfc7", + "version-date": "2022-02-22", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vcpkg-tool-7zip.json b/versions/v-/vcpkg-tool-7zip.json new file mode 100644 index 00000000000000..ababbffc81c2ef --- /dev/null +++ b/versions/v-/vcpkg-tool-7zip.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "4f835111b322eb0d5598e14831f46be49b4e444a", + "version-string": "21.07", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vcpkg-tool-flang-llvm.json b/versions/v-/vcpkg-tool-flang-llvm.json new file mode 100644 index 00000000000000..828525adf4286c --- /dev/null +++ b/versions/v-/vcpkg-tool-flang-llvm.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "e54e7f3911cc8ca21f10e3d8b8af8c789b01e2ae", + "version-date": "2022-04-23", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vcpkg-tool-flang.json b/versions/v-/vcpkg-tool-flang.json new file mode 100644 index 00000000000000..df81b730bb6a53 --- /dev/null +++ b/versions/v-/vcpkg-tool-flang.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "207a7cfcab108c153a1cf6cfe5f536eed33790bd", + "version-date": "2022-04-23", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vcpkg-tool-llvm.json b/versions/v-/vcpkg-tool-llvm.json new file mode 100644 index 00000000000000..1e3843f4b96a8b --- /dev/null +++ b/versions/v-/vcpkg-tool-llvm.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "33809fddf62b7af8f188a82ad8a2121d51207757", + "version": "13.0.1", + "port-version": 0 + } + ] +} diff --git a/versions/v-/vcpkg-tool-ninja.json b/versions/v-/vcpkg-tool-ninja.json new file mode 100644 index 00000000000000..3299e7f767f8bd --- /dev/null +++ b/versions/v-/vcpkg-tool-ninja.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "f68e5b1ee9a97b2d0b414e767a37ed7a2a63a133", + "version-date": "2022-03-31", + "port-version": 0 + } + ] +}