shithub: choc

Download patch

ref: 5b3b1bbab6c49148b9309d0a9de0ef33e1a63513
parent: af804990166f96c87bbd9fb317251f5fe79de56b
author: Max Waine <[email protected]>
date: Sun Dec 30 08:11:55 EST 2018

Fix i_glob.c compilation under MSVC (and CMake)

This fixes issue #1109, which I have commented on.

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -127,7 +127,7 @@
 endif()
 
 target_include_directories("${PROGRAM_PREFIX}doom"
-                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../" "${PROJECT_SOURCE_DIR}/win32/")
 target_link_libraries("${PROGRAM_PREFIX}doom" doom ${EXTRA_LIBS})
 
 if(MSVC)
@@ -142,7 +142,7 @@
 endif()
 
 target_include_directories("${PROGRAM_PREFIX}heretic"
-                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../" "${PROJECT_SOURCE_DIR}/win32/")
 target_link_libraries("${PROGRAM_PREFIX}heretic" heretic ${EXTRA_LIBS})
 
 if(MSVC)
@@ -157,7 +157,7 @@
 endif()
 
 target_include_directories("${PROGRAM_PREFIX}hexen"
-                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../" "${PROJECT_SOURCE_DIR}/win32/")
 target_link_libraries("${PROGRAM_PREFIX}hexen" hexen ${EXTRA_LIBS})
 
 if(MSVC)
@@ -172,7 +172,7 @@
 endif()
 
 target_include_directories("${PROGRAM_PREFIX}strife"
-                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../")
+                           PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/../" "${PROJECT_SOURCE_DIR}/win32/")
 target_link_libraries("${PROGRAM_PREFIX}strife" strife ${EXTRA_LIBS})
 
 if(MSVC)
--- a/src/i_glob.c
+++ b/src/i_glob.c
@@ -27,6 +27,8 @@
 #if defined(_MSC_VER)
 // For Visual C++, we need to include the win_opendir module.
 #include <win_opendir.h>
+#include <sys/stat.h>
+#define S_ISDIR(m)      (((m)& S_IFMT) == S_IFDIR)
 #elif defined(HAVE_DIRENT_H)
 #include <dirent.h>
 #include <sys/stat.h>