Skip to content
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

MSVC Cmake #6

Merged
merged 4 commits into from
Sep 15, 2024
Merged

Conversation

Mahesh1998
Copy link

@Mahesh1998 Mahesh1998 commented Sep 6, 2024

  1. MSVC cmake doesn't find conda libraries with prefix. So, we use conda cmake.
  2. MSVC cmake requires lot of changes to detect conda libraries. But conda cmake detected all conda libraries without any changes.
  3. The 2 changes are from the error message LIBM target and the missing gettimeoftheday c file. So, I copied the file from postgresql by following the commit message (add gettimeofday windowss implemenation from postgresql https://github.com/postgres/postgres/blob/master/src/port/win32gettimeofday.c).
  4. Conda cmake uses the same target as MSVC cmake (Visual Studio 17 2022).

How to build: msbuild GRASS.sln

Currently Fixing MSVC errors

  1. Environment path isn't added in Windows os. set Environment Path to all os.
  2. 'dirent.h' header in msvc can't be accessed and included in all modules due to scope issue. So, we Relocated all msvc files from modules to common directory.
  3. Unable to find __attribute__(format_arg) issue in glocale.h(MSVC). So, we are undefining attribute if os is not GNU and defined __attribute__(x).

@@ -56,7 +56,7 @@
):
cmd = shutil.which(args[0])
if cmd is None:
raise OSError(_("Cannot find the executable {0}").format(args[0]))
raise OSError(_("Cannot find the executable {0}, {1}, {2}").format(args[0], shutil.which(args[0]), os.getenv('PATH')))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[ruff] reported by reviewdog 🐶

Suggested change
raise OSError(_("Cannot find the executable {0}, {1}, {2}").format(args[0], shutil.which(args[0]), os.getenv('PATH')))
raise OSError(_("Cannot find the executable {0}, {1}, {2}").format(args[0], shutil.which(args[0]), os.getenv("PATH")))

* FILETIME represents the number of 100-nanosecond intervals since
* January 1, 1601 (UTC).
*/
#define FILETIME_UNITS_PER_SEC 10000000L

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
#define FILETIME_UNITS_PER_SEC 10000000L
#define FILETIME_UNITS_PER_SEC 10000000L

#define FILETIME_UNITS_PER_SEC 10000000L
#define FILETIME_UNITS_PER_USEC 10


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change

Comment on lines +52 to +53
int
gettimeofday(struct timeval *tp, void *tzp)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
int
gettimeofday(struct timeval *tp, void *tzp)
int gettimeofday(struct timeval *tp, void *tzp)

Comment on lines +55 to +56
FILETIME file_time;
ULARGE_INTEGER ularge;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
FILETIME file_time;
ULARGE_INTEGER ularge;
FILETIME file_time;
ULARGE_INTEGER ularge;

Comment on lines +58 to +64
/*
* POSIX declines to define what tzp points to, saying "If tzp is not a
* null pointer, the behavior is unspecified". Let's take this
* opportunity to verify that noplace in Postgres tries to use any
* unportable behavior.
*/
Assert(tzp == NULL);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
/*
* POSIX declines to define what tzp points to, saying "If tzp is not a
* null pointer, the behavior is unspecified". Let's take this
* opportunity to verify that noplace in Postgres tries to use any
* unportable behavior.
*/
Assert(tzp == NULL);
/*
* POSIX declines to define what tzp points to, saying "If tzp is not a
* null pointer, the behavior is unspecified". Let's take this
* opportunity to verify that noplace in Postgres tries to use any
* unportable behavior.
*/
Assert(tzp == NULL);

Comment on lines +66 to +68
GetSystemTimePreciseAsFileTime(&file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
GetSystemTimePreciseAsFileTime(&file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;
GetSystemTimePreciseAsFileTime(&file_time);
ularge.LowPart = file_time.dwLowDateTime;
ularge.HighPart = file_time.dwHighDateTime;

Comment on lines +70 to +72
tp->tv_sec = (long) ((ularge.QuadPart - epoch) / FILETIME_UNITS_PER_SEC);
tp->tv_usec = (long) (((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC)
/ FILETIME_UNITS_PER_USEC);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
tp->tv_sec = (long) ((ularge.QuadPart - epoch) / FILETIME_UNITS_PER_SEC);
tp->tv_usec = (long) (((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC)
/ FILETIME_UNITS_PER_USEC);
tp->tv_sec = (long)((ularge.QuadPart - epoch) / FILETIME_UNITS_PER_SEC);
tp->tv_usec = (long)(((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC) /
FILETIME_UNITS_PER_USEC);

tp->tv_usec = (long) (((ularge.QuadPart - epoch) % FILETIME_UNITS_PER_SEC)
/ FILETIME_UNITS_PER_USEC);

return 0;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[clang-format] reported by reviewdog 🐶

Suggested change
return 0;
return 0;

…m modules to common directory and Fixed __attribute__ issue in glocale.h(MSVC)
@HuidaeCho HuidaeCho merged commit 3ebded4 into HuidaeCho:cmake_build_work Sep 15, 2024
21 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants