From 0c69d7e13a3539c93e03351af9d633e1e78ab68e Mon Sep 17 00:00:00 2001 From: Mahesh Maddineni Date: Thu, 12 Sep 2024 11:45:54 -0700 Subject: [PATCH] Fixed Windows Environment Path Issue and Relocated all msvc files from modules to common directory and Fixed __attribute__ issue in glocale.h(MSVC) --- CMakeLists.txt | 6 +++--- include/grass/defs/glocale.h | 5 +++++ lib/db/CMakeLists.txt | 4 ++-- {lib/db/dbmi_base/msvc => msvc}/dirent.c | 0 {lib/db/dbmi_base/msvc => msvc}/dirent.h | 0 {utils/timer/msvc => msvc}/gettimeofday.c | 0 python/grass/script/core.py | 2 +- utils/CMakeLists.txt | 2 +- 8 files changed, 12 insertions(+), 7 deletions(-) rename {lib/db/dbmi_base/msvc => msvc}/dirent.c (100%) rename {lib/db/dbmi_base/msvc => msvc}/dirent.h (100%) rename {utils/timer/msvc => msvc}/gettimeofday.c (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15e4672be2b..7232494e7eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -215,14 +215,14 @@ set(HTML2MAN VERSION_NUMBER=${GRASS_VERSION_NUMBER} ${PYTHON_EXECUTABLE} if(WIN32) set(sep "\;") - set(env_path "") else() set(sep ":") - set(env_path ":$ENV{PATH}") endif() +set(env_path "$ENV{PATH}") + set(grass_env_command - ${CMAKE_COMMAND} -E env "PATH=${BIN_DIR}${sep}${SCRIPTS_DIR}${env_path}" + ${CMAKE_COMMAND} -E env "PATH=${BIN_DIR}${sep}${SCRIPTS_DIR}${sep}${env_path}" "PYTHONPATH=${ETC_PYTHON_DIR}${sep}${GUI_WXPYTHON_DIR}${sep}$ENV{PYTHONPATH}" "LD_LIBRARY_PATH=${LIB_DIR}${sep}$ENV{LD_LIBRARY_PATH}" "GISBASE=${RUN_GISBASE_NATIVE}" "GISRC=${GISRC}" "LC_ALL=C" "LANG=C" diff --git a/include/grass/defs/glocale.h b/include/grass/defs/glocale.h index a14b2e4cebe..b153afe21d5 100644 --- a/include/grass/defs/glocale.h +++ b/include/grass/defs/glocale.h @@ -1,6 +1,11 @@ #ifndef GRASS_GLOCALEDEFS_H #define GRASS_GLOCALEDEFS_H +#if !defined __GNUC__ || __GNUC__ < 2 +#undef __attribute__ +#define __attribute__(x) +#endif + extern void G_init_locale(void); extern char *G_gettext(const char *, const char *) __attribute__((format_arg(2))); diff --git a/lib/db/CMakeLists.txt b/lib/db/CMakeLists.txt index e7d4a96b7f7..fb61243b6f2 100644 --- a/lib/db/CMakeLists.txt +++ b/lib/db/CMakeLists.txt @@ -1,7 +1,7 @@ file(GLOB dbmibase_SRCS "./dbmi_base/*.c") if(MSVC) - set(dbmibase_INCLUDES "./dbmi_base" "./dbmi_base/msvc") - list(APPEND dbmibase_SRCS "./dbmi_base/msvc/dirent.c") + set(dbmibase_INCLUDES "./dbmi_base" "../../msvc") + list(APPEND dbmibase_SRCS "../../msvc/dirent.c") endif() build_library_in_subdir( diff --git a/lib/db/dbmi_base/msvc/dirent.c b/msvc/dirent.c similarity index 100% rename from lib/db/dbmi_base/msvc/dirent.c rename to msvc/dirent.c diff --git a/lib/db/dbmi_base/msvc/dirent.h b/msvc/dirent.h similarity index 100% rename from lib/db/dbmi_base/msvc/dirent.h rename to msvc/dirent.h diff --git a/utils/timer/msvc/gettimeofday.c b/msvc/gettimeofday.c similarity index 100% rename from utils/timer/msvc/gettimeofday.c rename to msvc/gettimeofday.c diff --git a/python/grass/script/core.py b/python/grass/script/core.py index 20d3f358a82..3724ee92bba 100644 --- a/python/grass/script/core.py +++ b/python/grass/script/core.py @@ -56,7 +56,7 @@ def __init__(self, args, **kwargs): ): 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'))) args = [cmd] + args[1:] name, ext = os.path.splitext(cmd) if ext.lower() not in self._builtin_exts: diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 38039185f83..41aff9466c8 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -7,7 +7,7 @@ file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/generate_last_commit_file.py set(current_time_s_ms_SRCS "timer/main.c") if(MSVC) - list(APPEND current_time_s_ms_SRCS "timer/msvc/gettimeofday.c") + list(APPEND current_time_s_ms_SRCS "../msvc/gettimeofday.c") endif() build_program_in_subdir( timer