Skip to content

Commit

Permalink
Merge pull request #17: Compile and run on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanma committed Oct 9, 2018
2 parents bdab761 + 481de91 commit 2bb303c
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "StormLib"]
path = StormLib
url = git://github.com/stormlib/StormLib.git
[submodule "dirent"]
path = dirent
url = git://github.com/tronkko/dirent.git
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ include_directories("${MPQEXTRACTOR_SOURCE_DIR}/StormLib/src/"
"${MPQEXTRACTOR_SOURCE_DIR}/include/"
)

# Replacement for dirent.h and unistd.h
if (WIN32)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/dirent/include")
endif()

add_executable(MPQExtractor main.cpp)
target_link_libraries(MPQExtractor storm)

Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

A command-line tool to extract files from MPQ archives (used by Blizzard games).

Works on MacOS X and Linux.
Works on MacOS X, Linux and Windows.


## Dependencies

The following libraries are necessary to build the extractor:

* StormLib (http://www.zezula.net/en/mpq/stormlib.html), no license, free to use -
* StormLib (http://www.zezula.net/en/mpq/stormlib.html), MIT License, free to use -
included as a GIT submodule
* SimpleOpt 3.4 (http://code.jellycan.com/simpleopt/), MIT License - part of the
distribution
Expand All @@ -28,10 +28,18 @@ Requires <a href="http://www.cmake.org/">cmake</a> to build:
$ mkdir build
$ cd build
$ cmake <path/to/the/source/of/MPQExtractor>
$ make
$ cmake --build .

The executable will be put in build/bin/

**Windows**:
To specify the compiler and build in Release mode:

mkdir build
cd build
cmake <path/to/the/source/of/MPQExtractor> -G "Visual Studio 15 2017 Win64"
cmake --build . --config Release


## Usage

Expand Down
2 changes: 1 addition & 1 deletion StormLib
Submodule StormLib updated from fd430b to bd203c
1 change: 1 addition & 0 deletions dirent
Submodule dirent added at 65a555
11 changes: 9 additions & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@
#include <string>
#include <vector>
#include <algorithm>
#include <unistd.h>
#include <dirent.h>
#include <stdlib.h>
#include <stdio.h>
#include <dirent.h>
#ifdef WIN32
#include <io.h>
#include <direct.h>
#define mkdir(dirname, acl) _mkdir(dirname)
#else
#include <unistd.h>
#endif
#include <sys/stat.h>


Expand Down

0 comments on commit 2bb303c

Please sign in to comment.