Skip to content

win: Enable Windows port in CMakefiles #1184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ if( ${TARGET_OS} STREQUAL "Linux" )
elseif( ${TARGET_OS} STREQUAL "Darwin" )
set(OS "OSX")
set(OSNAME "macOS")
elseif( ${TARGET_OS} STREQUAL "Windows" )
set(OS "WIN")
set(OSNAME "Windows")
add_definitions(-DWIN32 -DWIN64 -DWINNT -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
else()
message("Unsupported OS: ${TARGET_OS}" )
return()
Expand Down
2 changes: 1 addition & 1 deletion lib/scutil/host-fp-folding.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN64
#if defined(_WIN64) && !defined(_M_ARM64)
#include <mmintrin.h>
#endif

Expand Down
20 changes: 10 additions & 10 deletions runtime/flang/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* Fio_asy_close - called from close
*/

#if !defined(TARGET_WIN_X8664)
#if !defined(TARGET_WIN)
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
Expand All @@ -42,7 +42,7 @@ struct asy_transaction_data {
seekoffx_t off;
};

#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
struct asy {
FILE *fp;
int fd;
Expand Down Expand Up @@ -82,7 +82,7 @@ static int slime;

/* internal wait for asynch i/o */

#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
static int
asy_wait(struct asy *asy)
{
Expand Down Expand Up @@ -239,7 +239,7 @@ int
Fio_asy_open(FILE *fp, struct asy **pasy)
{
struct asy *asy;
#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
HANDLE temp_handle;
#endif
asy = (struct asy *)calloc(sizeof(struct asy), 1);
Expand All @@ -249,7 +249,7 @@ Fio_asy_open(FILE *fp, struct asy **pasy)
}
asy->fp = fp;
asy->fd = __io_getfd(fp);
#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
temp_handle = _get_osfhandle(asy->fd);
asy->handle =
ReOpenFile(temp_handle, GENERIC_READ | GENERIC_WRITE,
Expand All @@ -273,13 +273,13 @@ Fio_asy_read(struct asy *asy, void *adr, long len)
int n;
int tn;

#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
union Converter converter;
#endif
if (slime)
printf("--Fio_asy_read %d %p %ld\n", asy->fd, adr, len);

#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
if (asy->flags & ASY_IOACT) { /* i/o active? */
if (asy_wait(asy) == -1) { /* ..yes, wait */
return (-1);
Expand Down Expand Up @@ -326,14 +326,14 @@ Fio_asy_write(struct asy *asy, void *adr, long len)
{
int n;
int tn;
#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
union Converter converter;
#endif

if (slime)
printf("--Fio_asy_write %d %p %ld\n", asy->fd, adr, len);

#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
if (asy->flags & ASY_IOACT) { /* i/o active? */
if (asy_wait(asy) == -1) { /* ..yes, wait */
return (-1);
Expand Down Expand Up @@ -394,7 +394,7 @@ Fio_asy_close(struct asy *asy)
if (asy->flags & ASY_IOACT) { /* i/o active? */
n = asy_wait(asy);
}
#if defined(TARGET_WIN_X8664)
#if defined(TARGET_WIN)
/* Close the Re-opened handle that we created. */
CloseHandle(asy->handle);
#endif
Expand Down
2 changes: 1 addition & 1 deletion tools/flang2/flang2exe/upper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ gethexchar(FILE *file)
return val;
} /* gethexchar */

#if defined(TARGET_WIN_X86) && defined(PGFTN)
#if defined(TARGET_WIN) && defined(PGFTN)
/*
* convert to upper case
*/
Expand Down