Skip to content

Commit

Permalink
Fix all platforms' build errors and instructions (#78)
Browse files Browse the repository at this point in the history
* Add exported binaries

* Add debug/

* CMakeLists DevIL hot fix

* Delete bloat binaries

* Revert debug ignores

* Update SETUP_LINUX.md

* Update SETUP_WINDOWS.md

* Update SETUP_LINUX.md

* Add cmake-gui instructions
  • Loading branch information
twaritwaikar authored Dec 21, 2018
1 parent 70f4e9a commit 950808d
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 68 deletions.
18 changes: 18 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"${vcpkgRoot}/x64-linux/include"
],
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++17",
"intelliSenseMode": "clang-x64",
"configurationProvider": "vector-of-bool.cmake-tools"
}
],
"version": 4
}
16 changes: 16 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "build Rubeus",
"type": "shell",
"command": "make",
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
2 changes: 1 addition & 1 deletion RubeusCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ endif(WIN32)
if(UNIX)
add_library(vorbis STATIC IMPORTED)

target_link_libraries(RubeusCore -ldl sfml-audio sfml-network sfml-graphics sfml-window sfml-system ${OPENGL_LIBRARIES} GLEW glfw openal ${IL_LIBRARIES} ${ILU_LIBRARIES})
target_link_libraries(RubeusCore -lILU -lIL -lILUT -ldl sfml-audio sfml-network sfml-graphics sfml-window sfml-system ${OPENGL_LIBRARIES} GLEW glfw openal ${IL_LIBRARIES} ${ILU_LIBRARIES} -lstdc++)
endif(UNIX)

# TODO: Add tests and install targets if needed.
50 changes: 17 additions & 33 deletions SETUP_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $ git clone https://github.com/sdslabs/Rubeus
1. The system package manager on Ubuntu can be commanded to get system specific libraries to run Rubeus. Run:
```shell
$ sudo apt install mesa-common-dev libxinerama-dev libxcursor-dev mesa-vulkan-drivers vulkan-utils cmake-gui libglew-dev
$ sudo apt-get install libgl-dev xorg-dev libglu1-mesa-dev libx11-dev libxrandr-dev libxi-dev libudev-dev mesa-common-dev libopenal-dev
$ sudo apt-get install libgl-dev xorg-dev libglu1-mesa-dev libx11-dev libxrandr-dev libxi-dev libudev-dev mesa-common-dev libopenal-dev libdevil1c2 libdevil-dev
$ hash -r
```

Expand All @@ -29,64 +29,48 @@ $ hash -r
```shell
$ path/to/vcpkg/vcpkg update
```
3. Install GLEW, OpenGL Extension Wrangler library (preferably glew:x64-linux) by running:
3. Install GLEW, GLFW3, DevIL, Boost.Any and SFML by running:
```shell
$ path/to/vcpkg/vcpkg install glew
$ path/to/vcpkg/vcpkg install glew glfw3 devil boost-any sfml
```
4. Install GLFW, OpenGL Graphics Framework (preferably glfw3:x64-linux) by running:
```shell
$ path/to/vcpkg/vcpkg install glfw3
```
5. Install DevIL, Developer Image Library (preferably devil:x64-linux) by running:
```shell
$ path/to/vcpkg/vcpkg install devil
```
6. Install Boost.Any, Boost::Any C++ utility library(boost-any:x64-linux) by running:
```shell
$ path/to/vcpkg/vcpkg install boost-any
```
7. Install SFML, Simple & Fast Media Library (sfml:x64-linux) by running:

*This may take several minutes*

4. Run the vcpkg integration:
```shell
$ path/to/vcpkg/vcpkg install sfml
$ path/to/vcpkg/vcpkg integrate install
```
8. SFML requires some external libraries acquired by the system package manager. Vcpkg shall remind you before building SFML to install these libraries using `apt-get`.
This command will output a string which is supposed to be appended to a future CMake command. Keep it handy.

## Initialising CMake with vcpkg
1. Open Terminal(Default: Ctrl+Alt+T). Open CMake GUI:
```shell
$ cmake-gui
```
2. Select `Unix Makefiles` from the drop down menu and set source code and build destination as the same as the repository directory. Click on Configure.
2. Select `Unix Makefiles` from the drop down menu and set source code and build destination same as the repository directory. Click on Configure.
3. Select 'Specify options for cross-compiling with CMake'. Specify the platform name (i.e. Linux) and specify the C and C++ compilers (`gcc` and `g++` preferably).
4. Click on `Configure`.
5. Navigate to the cloned repository.
6. To use libraries acquired by vcpkg, run:
```shell
$ path/to/vcpkg/vcpkg integrate install
```
7. Instruct CMake to acquire libraries already built by vcpkg, by running:
6. Instruct CMake to acquire libraries already built by vcpkg. For this we will require the string that we saved in the previous step. Type `cmake`, add a \<space\> and paste that string after. Effectively, you will be running:
```shell
$ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake ./
```
8. Run CMake by executing
```shell
$ cmake ./
$ cmake "-DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake"
```

## Setting up Rubeus source in your IDE/text-editor
1. Open the Rubeus root directory in your IDE/text-editor.
2. All `.h` files will be present in `/RubeusCore/Include` and all of their implementations(if any) will be present in `/RubeusCore/Source` as `.cpp` files. No need to edit CMakeLists.txt anywhere unless there are any linking errors popping up.
3. Use any CMake extensions available for your environment to ease building the project using CMake.
4. Add `/RubeusCore/Include` as your include directory, if it's not already.
4. Add `/RubeusCore/Include` as your include directory (if using an IDE and if it's not already added).

## Building Rubeus using Makefiles
1. After running `cmake ./` in the Rubeus root directory you will find that CMake has generated a Makefile. To use this Makefile to build Rubeus, just run:
1. After running CMake in the second last in the Rubeus root directory. you will find that CMake has generated a Makefile. To use this Makefile to build Rubeus, just run this in `Rubeus/`:
```shell
$ make
```
2. This will generate a binary in the `RubeusCore/` directory by the name `RubeusCore`. Run Rubeus using:
2. This will generate a binary in the `RubeusCore/` directory by the name `RubeusCore`. Run it using:
```shell
$ cd RubeusCore/
$ ./RubeusCore
```
Remember to go through the [contribution guidelines](CONTRIBUTING.md) for further guidance.

We are done! Remember to go through the [contribution guidelines](CONTRIBUTING.md) for further guidance.
48 changes: 14 additions & 34 deletions SETUP_WINDOWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,52 +21,32 @@ $ git clone https://github.com/sdslabs/Rubeus
```shell
$ path/to/vcpkg/vcpkg.exe update
```
3. Install GLEW, OpenGL Extension Wrangler library (preferably glew:x86-windows) by running:
```shell
$ path/to/vcpkg/vcpkg.exe install glew
```
4. Install GLFW, OpenGL Graphics Framework (preferably glfw3:x86-windows 3.2.1-2) by running:
```shell
$ path/to/vcpkg/vcpkg.exe install glfw3
```
5. Install DevIL, Developer Image Library (preferably devil:x86-windows) by running:
```shell
$ path/to/vcpkg/vcpkg.exe install devil
```
6. Install Boost.Any, Boost::Any C++ utility library(boost-any:x86-windows) by running:
```shell
$ path/to/vcpkg/vcpkg.exe install boost-any
```
7. Install SFML, Simple & Fast Media Library (sfml:x86-windows) by running:

3. Install GLEW, GLFW3, DevIL, Boost.Any and SFML by running:
```shell
$ path/to/vcpkg/vcpkg.exe install sfml
$ path/to/vcpkg/vcpkg.exe install glew glfw3 devil boost-any sfml
```
*This may take several minutes*

## Initialising CMake with vcpkg
1. For VS 2017 project files, press `⊞ Win + X` and choose `Command Prompt(Admin)` from the dialog box.
2. Open CMake GUI. Select `Visual Studio project files` from the drop down menu and set source code and build destination as the same as the repository directory.
3. Select 'Specify options for cross-compiling with CMake'. Specify the platform name (i.e. Windows) and specify the C and C++ compilers (`gcc.exe` and `g++.exe` preferably). Click on `Configure`.
4. Navigate to the cloned repository.
> Quick-tips: For CMD, `X:` command will navigate to the X: drive. `dir` command works the same as the Unix `ls -la` and `cd` still works the same. You can also use Git Bash for general navigation.
5. To use libraries acquired by vcpkg, run:
4. Run:
```shell
$ path/to/vcpkg/vcpkg.exe integrate install
```
6. Instruct CMake to acquire libraries already built by vcpkg, by running:
```shell
$ cmake -DCMAKE_TOOLCHAIN_FILE=path/to/vcpkg/scripts/buildsystems/vcpkg.cmake ./
```
7. Run CMake by executing:
```shell
$ cmake ./
```

## Initialising CMake with vcpkg
1. Press `⊞ + S` and search for "CMake GUI". Open CMake-GUI as admin.
2. Set source directory as the Rubeus repository root. Set the build directory as the same as source directory. Click on `Configure`.
3. Select `Visual Studio 15 2017` as the generator. Select `Specify native compilers`. Click on `Next`.
4. Specify the C and C++ MinGW compiler locations. Most probably they can be in `C:/MinGW/bin/`. Leave Fortran compiler location empty. Click `Finish`.
5. When CMake-GUI finishes the configuration, click `Generate`.
5. Now you will observe that there is a `RubeusCore.sln` file in `Rubeus/`.

## Setting up Rubeus source in Visual Studio 2017
1. Open `RubeusCore.sln` in VS and right click on `RubeusCore` and `Set as StartUp project`. [Screenshot](https://imgur.com/a/xadxwsG)
2. All `.h` files will be present in `/RubeusCore/Include` and all of their implementations(if any) will be present in `/RubeusCore/Source` as `.cpp` files. No need to edit CMakeLists.txt anywhere unless there are any linking errors popping up.

## Building Rubeus in Visual Studio 2017
1. Open `RubeusCore.sln` (generates after running CMake).
2. Check if you are running in Debug mode and press F5.
2. Check if you are running in Debug mode (Drop down in the top bar) and press F5.

We are done! All libraries are relatively linked thus your project is ready to boot up in Visual Studio. Remember to go through the [contribution guidelines](CONTRIBUTING.md) for further guidance.

0 comments on commit 950808d

Please sign in to comment.