Skip to content

Commit

Permalink
MSVC doesn't need boost-filesystem
Browse files Browse the repository at this point in the history
  • Loading branch information
SupSuper committed Mar 17, 2019
1 parent caa20a7 commit cc470a7
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ git submodule update --init --recursive
* All the other dependencies (Boost, SDL2) need to be supplied separately. Install [Vcpkg](https://github.com/Microsoft/vcpkg) and run the following command:

```cmd
vcpkg install sdl2 boost-locale boost-system boost-program-options boost-filesystem boost-uuid boost-crc
vcpkg install sdl2 boost-locale boost-program-options boost-uuid boost-crc
```

* Copy the original XCom:Apocalypse .iso file into the "data/" directory. This could also be a directory containing all the extracted files from the CD, and it should be named the same (IE the directory should be data/cd.iso/). This is used during the build to extract some data tables.
Expand All @@ -161,7 +161,7 @@ vcpkg install sdl2 boost-locale boost-system boost-program-options boost-filesys
* On Ubuntu, install the following packages:

```sh
sudo apt-get install libsdl2-dev cmake build-essential git libunwind8-dev libboost-locale-dev libboost-filesystem-dev libboost-system-dev libboost-program-options-dev
sudo apt-get install libsdl2-dev cmake build-essential git libunwind8-dev libboost-locale-dev libboost-filesystem-dev libboost-program-options-dev
```

* On Mageia, install the following packages as root:
Expand Down
2 changes: 1 addition & 1 deletion appveyor-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ init:
#clone_depth: 10
cache: c:\tools\vcpkg\installed
before_build:
- vcpkg install sdl2 boost-locale boost-system boost-program-options boost-filesystem boost-uuid boost-crc
- vcpkg install sdl2 boost-locale boost-program-options boost-uuid boost-crc
- vcpkg upgrade --no-dry-run
- git submodule update --init --recursive
- curl http://s2.jonnyh.net/pub/cd_minimal.iso.xz -o temp\cd.iso.xz
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ init:
#clone_depth: 10
cache: c:\tools\vcpkg\installed
before_build:
- vcpkg install sdl2 boost-locale boost-system boost-program-options boost-filesystem boost-uuid boost-crc
- vcpkg install sdl2 boost-locale boost-program-options boost-uuid boost-crc
- vcpkg upgrade --no-dry-run
- git submodule update --init --recursive
- curl http://s2.jonnyh.net/pub/cd_minimal.iso.xz -o temp\cd.iso.xz
Expand Down
15 changes: 10 additions & 5 deletions framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -214,16 +214,21 @@ set(BOOST_PACKAGES locale system program_options)
set(USE_EXPERIMENTAL_FILESYSTEM FALSE)

if(CMAKE_COMPILER_IS_GNUCC)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3 OR
CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.3)
set(USE_EXPERIMENTAL_FILESYSTEM TRUE)
endif()
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.3 OR
CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 5.3)
set(USE_EXPERIMENTAL_FILESYSTEM TRUE)
target_link_libraries(OpenApoc_Framework PUBLIC stdc++fs)
endif()
endif()
if(MSVC)
if (MSVC_VERSION GREATER_EQUAL 1900)
set(USE_EXPERIMENTAL_FILESYSTEM TRUE)
endif()
endif()

if (USE_EXPERIMENTAL_FILESYSTEM)
message(STATUS "Using <experimental/filesystem>")
target_compile_definitions(OpenApoc_Framework PUBLIC "-DUSE_EXPERIMENTAL_FILESYSTEM")
target_link_libraries(OpenApoc_Framework PUBLIC stdc++fs)
else()
message(STATUS "Using <boost/filesystem>")
set(BOOST_PACKAGES ${BOOST_PACKAGES} filesystem)
Expand Down
6 changes: 0 additions & 6 deletions framework/filesystem.h
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
#pragma once

// Enable <experimental/filesystem> by default on MSVC, as we only support 2015+ anyway
#if !defined(USE_BOOST_FILESYSTEM) && !defined(USE_EXPERIMENTAL_FILESYSTEM) && defined(_MSC_VER)
#define USE_EXPERIMENTAL_FILESYSTEM
#endif

#if defined(USE_BOOST_FILESYSTEM)

#define BOOST_ALL_NO_LIB
#include <boost/filesystem.hpp>
namespace fs = boost::filesystem;

Expand Down

0 comments on commit cc470a7

Please sign in to comment.