Skip to content

Commit f57ffff

Browse files
committed
Add Windows Visual Studio CMake Instructions
1 parent bc7cdc5 commit f57ffff

File tree

2 files changed

+43
-18
lines changed

2 files changed

+43
-18
lines changed

README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ Initially generated with [xmlpg](https://github.com/open-dis/xmlpg).
1111
It can be downloaded and installed from http://cmake.org/
1212

1313
* SDL2 and SDL2_net are required libraries to compile the examples.
14-
These can usually be install via linux package managers.
14+
These can usually be install via Linux package managers.
1515
More details, and instructions for Windows are included [below](#SDL2-and-SDL2_net-Install-Instructions).
16-
**NOTE:** Windows users will need to either add the DLL folders to their path, or copy the DLLs to the output directory (`Debug`).
16+
17+
**NOTE:** Windows users will need to either add the DLL folders to their path, or copy the DLLs to the output directory (`Debug`).
1718

1819
### Linux / GNU Makefiles
1920

@@ -23,13 +24,41 @@ Initially generated with [xmlpg](https://github.com/open-dis/xmlpg).
2324
1. Optionally, `-DCMAKE_INSTALL_PREFIX=<custom-path-to-install>` to set a custom directory to install the bin, include, and lib output directories.
2425
1. Run `make` - this will output the libOpenDIS6.so, and libOpenDIS7.so libraries in the build directory along with the Example Applications.
2526
1. The below steps are optional
26-
1. Run `make package` to build linux package files. Currently this will produce a RedHat RPM package, Debian DEB package, and 2 compressed tarball (XZ, GZ).
27+
1. Run `make package` to build Linux package files. Currently this will produce a Red Hat RPM package, Debian DEB package, and 2 compressed tarball (XZ, GZ).
2728
1. Run `make install` to install bin, lib, and dir, into `CMAKE_INSTALL_PREFIX`
2829
WARNING: `CMAKE_INSTALL_PREFIX` default can to somewhere `/usr/local/`, if not specified with the `-D` flag as shown in Step 3.1.
2930
If you're unsure where to install, and want to keep your `/usr/local/` directory clean, run `cmake .. -DCMAKE_INSTALL_PREFIX=./install`.
3031
This will cause `make install` to create a local install directory, from which you can move files elsewhere at a later date.
3132

32-
33+
#### Windows with Visual Studio
34+
1. Open `CMake (cmake-gui)` via the the start menu.
35+
2. Enter the open-dis-cpp directory path into the Source and Build fields.
36+
3. Click the `+ Add Entry` button and enter the following details:
37+
Name: `SDL_INC_DIR`
38+
Type: `PATH`
39+
Value: `<SDL2-install-folder>/include`
40+
(if you follow the below [SDL2 Windows Install Instruction](#Windows-Install-Instructions) this will be `C:/SDL2/include`)
41+
3. Click the `+ Add Entry` button and enter the following details:
42+
Name: `SDL_LIB_DIR`
43+
Type: `PATH`
44+
Value: `<SDL2-install-folder>/lib/x64` (64 bit) or `<SDL2-install-folder>/lib/x86` (32 bit)
45+
(if you follow the below [SDL2 Windows Install Instruction](#Windows-Install-Instructions) this will be `C:/SDL2/lib/x64`)
46+
4. Click Configure and follow the prompts, selecting the correct generator (i.e. Visual Studio version).
47+
5. Click Generate
48+
6. Click Open Project - This should open the generates solution file in Visual Studio
49+
7. Build the Solution (`Ctrl + Shift + B`)
50+
51+
These steps were tested with Visual Studio 16 2019 (Community Edition).
52+
Currently, only OpenDIS 6 and the Example Applications compile.
53+
The library and executable files are output to a `Debug` directory.
54+
55+
To run the executables, either the value of the `SDL_LIB_DIR` variable should be added to your path,
56+
or `SDL2.dll` and `SDL2_net.dll` need to be copied to the `Debug` directory.
57+
58+
### Cleaning CMake files
59+
60+
To quickly clean up CMake output files, use `git clean -xdf`.
61+
**Note:** Use with care if you are actually developing open-dis-cpp, as `git clean` removes untracked files.
3362

3463
### Old Pre-make build instructions
3564

@@ -60,7 +89,7 @@ Ubuntu: ```sudo apt-get install libsdl2-dev libsdl2-net-dev```
6089

6190
If you're unable to install the correct packages, try [installing from source](#POSIX-Source-Installation)
6291

63-
### Windows Instructions
92+
### Windows Install Instructions
6493

6594
These are the installation steps that have been tested with open-dis-cpp, however there are other methods for installation.
6695
Experienced users should feel free to customise their install.
@@ -90,17 +119,23 @@ Experienced users should feel free to customise their install.
90119
#### (Core) SDL2
91120
Run the following commands:
92121
1. `wget http://libsdl.org/release/SDL2-2.0.12.tar.gz`
122+
93123
Or, Download via your favourite web browser.
124+
94125
**NOTE:** check the [download](https://www.libsdl.org/download-2.0.php) page for new releases
126+
95127
2. `tar -xvf SDL2-2.0.9.tar.gz`
96128
3. `pushd SDL2-2.0.9/`
97129
4. `./configure --prefix=/usr && make && sudo make install`
98130
5. `popd`
99131

100132
#### SDL2_net
101133
1. `wget https://www.libsdl.org/projects/SDL_net/release/SDL2_net-2.0.1.tar.gz`
134+
102135
Or, Download via your favourite web browser.
136+
103137
**NOTE:** check [https://www.libsdl.org/projects/SDL_net](project) page for new releases
138+
104139
2. `tar -xvf SDL2_net-2.0.1.tar.gz`
105140
3. `pushd SDL2_net-2.0.1/`
106141
4. `./configure --prefix=/usr && make && sudo make install`

examples/Readme.txt

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,8 @@ library. Please visit https://www.libsdl.org/ for information about how to
1111
SDL2 also provides timing functionality. I.e. calculating delta between frames
1212
and for sleep delays.
1313

14-
The current `#include` are written with the prefix "SDL2/" because the
15-
contributor was unfamiliar with premake5.
16-
Normally it is recommended to add the output of `sdl2-config --cflags` and
17-
`sdl2-config --libs` to the build process, however it was unclear if this
18-
work across different systems.
19-
2014
Build instructions:
21-
1. cd to the repo root
22-
2. run `premake5 gmake` (If not done already)
23-
3. run `make`
24-
Files will be located in ./Build/lib/Debug
15+
See project README.md, in repo root directory.
16+
2517
Running instructions:
26-
1. open up 2 terminals in the git repo root:
27-
2. Run `./Build/lib/Debug/ExampleReceiver` in one terminal
28-
3. Run `./Build/lib/Debug/ExampleSender` in the other terminal
18+
Run `ExampleReceiver` and `ExampleSender` in seperate terminals

0 commit comments

Comments
 (0)