Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix mingw32 build.

  • Loading branch information...
commit 3ebc8d6cb2df2cbdbc3cbd133b56be2bbe854ce8 1 parent 6078e47
@dscharrer dscharrer authored
Showing with 45 additions and 35 deletions.
  1. +11 −12 CMakeLists.txt
  2. +1 −0  src/io/FilesystemWindows.cpp
  3. +33 −23 tools/CMakeLists.txt
View
23 CMakeLists.txt
@@ -177,6 +177,8 @@ else(MSVC)
add_definitions(-D_POSIX_C_SOURCE=199309)
endif()
+ check_include_files("sys/stat.h;sys/errno.h;dirent.h" HAVE_POSIX_FILESYSTEM)
+
# Warning level
add_cxxflag("-Wall")
add_cxxflag("-Wextra")
@@ -231,18 +233,15 @@ else(MSVC)
endif(MSVC)
-if(MSVC)
- add_definitions(-DHAVE_WINDOWS_FILESYSTEM)
-else()
- check_include_files("sys/stat.h;sys/errno.h;dirent.h" HAVE_POSIX_FILESYSTEM)
- if(NOT DEFINED HAVE_POSIX_FILESYSTEM)
- if((Boost_MAJOR_VERSION GREATER 1) OR (NOT Boost_MINOR_VERSION LESS 44))
- find_package(Boost 1.44 REQUIRED COMPONENTS filesystem system)
- set(HAVE_BOOST_FILESYSTEM_V3 1)
- add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
- else()
- message(FATAL_ERROR "You need either Boost >= 1.44 or sys/stat.h, sys/errno.h and dirent.h; Found boost version ${Boost_VERSION}")
- endif()
+if(NOT HAVE_POSIX_FILESYSTEM)
+ if(HAVE_WINAPI)
+ add_definitions(-DHAVE_WINDOWS_FILESYSTEM)
+ elseif((Boost_MAJOR_VERSION GREATER 1) OR (NOT Boost_MINOR_VERSION LESS 44))
+ find_package(Boost 1.44 REQUIRED COMPONENTS filesystem system)
+ set(HAVE_BOOST_FILESYSTEM_V3 1)
+ add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
+ else()
+ message(FATAL_ERROR "You need either Boost >= 1.44 or windows api or sys/stat.h, sys/errno.h and dirent.h; Found boost version ${Boost_VERSION}")
endif()
endif()
View
1  src/io/FilesystemWindows.cpp
@@ -34,6 +34,7 @@ ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
#include "io/FilePath.h"
#include "io/FileStream.h"
+#include "io/Logger.h"
using std::string;
View
56 tools/CMakeLists.txt
@@ -17,36 +17,46 @@ endif(MSVC)
find_package(Boost REQUIRED)
if(MSVC)
- add_definitions(-DHAVE_WINDOWS_FILESYSTEM)
- set(FILESYSTEM_SRC "../src/io/FilesystemWindows.cpp")
-else()
- check_include_files("sys/stat.h;sys/errno.h;dirent.h" HAVE_POSIX_FILESYSTEM)
- if(DEFINED HAVE_POSIX_FILESYSTEM)
- set(FILESYSTEM_SRC "../src/io/FilesystemPOSIX.cpp")
+ set(HAVE_WINAPI 1)
+else(MSVC)
+
+ if(NOT CMAKE_TOOLCHAIN_FILE)
+ find_program(GXX_BINARY g++)
+ set(CMAKE_CXX_COMPILER "${GXX_BINARY}")
+ set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wformat=2 -Wundef -Wpointer-arith -Wlogical-op -Wcast-qual -O2 -fno-strict-aliasing -ggdb")
+ endif()
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set(HAVE_WINAPI 1)
else()
- if((Boost_MAJOR_VERSION GREATER 1) OR (NOT Boost_MINOR_VERSION LESS 44))
- find_package(Boost 1.44 REQUIRED COMPONENTS filesystem system)
- set(HAVE_BOOST_FILESYSTEM_V3 1)
- add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
- set(FILESYSTEM_SRC "../src/io/FilesystemBoost.cpp")
- else()
- message(FATAL_ERROR "You need either Boost >= 1.44 or sys/stat.h, sys/errno.h and dirent.h; Found boost version ${Boost_VERSION}")
- endif()
+ set(HAVE_WINAPI 0)
endif()
-endif()
-
-if(NOT MSVC AND NOT CMAKE_TOOLCHAIN_FILE)
- find_program(GXX_BINARY g++)
- set(CMAKE_CXX_COMPILER "${GXX_BINARY}")
- set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wformat=2 -Wundef -Wpointer-arith -Wlogical-op -Wcast-qual -O2 -fno-strict-aliasing -ggdb")
-endif()
-
-if(NOT MSVC)
+
if(ARX_FORCE_32BIT)
set(CMAKE_C_FLAGS "-m32 ${CMAKE_C_FLAGS}")
set(CMAKE_CXX_FLAGS "-m32 ${CMAKE_CXX_FLAGS}")
endif()
+
+ check_include_files("sys/stat.h;sys/errno.h;dirent.h" HAVE_POSIX_FILESYSTEM)
+
check_link_library(ZLIB ZLIB_LIBRARIES)
+endif(MSVC)
+
+if(HAVE_POSIX_FILESYSTEM)
+ set(FILESYSTEM_SRC "../src/io/FilesystemPOSIX.cpp")
+elseif(HAVE_WINAPI)
+ add_definitions(-DHAVE_WINDOWS_FILESYSTEM)
+ set(FILESYSTEM_SRC "../src/io/FilesystemWindows.cpp")
+elseif((Boost_MAJOR_VERSION GREATER 1) OR (NOT Boost_MINOR_VERSION LESS 44))
+ find_package(Boost 1.44 REQUIRED COMPONENTS filesystem system)
+ set(HAVE_BOOST_FILESYSTEM_V3 1)
+ add_definitions(-DBOOST_FILESYSTEM_VERSION=3)
+ set(FILESYSTEM_SRC "../src/io/FilesystemBoost.cpp")
+else()
+ message(FATAL_ERROR "You need either Boost >= 1.44 or windows api or sys/stat.h, sys/errno.h and dirent.h; Found boost version ${Boost_VERSION}")
+endif()
+
+if(NOT MSVC)
check_link_library(Boost Boost_LIBRARIES)
endif()
Please sign in to comment.
Something went wrong with that request. Please try again.