Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Bazel as build engine #5

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
127 changes: 127 additions & 0 deletions Project/BUILD
@@ -0,0 +1,127 @@
cc_library(
name = "network",
srcs = ["network.cpp"],
hdrs = ["network.h"],
)

cc_library(
name = "viewdraw",
srcs = ["viewdraw.cpp"],
hdrs = ["viewdraw.h"],
deps = [
":things",
":cache",
":level"
],
)

cc_library(
name = "cache",
srcs = ["cache.cpp"],
hdrs = ["cache.h"],
deps = [
":texture",
],
)


cc_library(
name = "things",
srcs = ["things.cpp"],
hdrs = ["things.h"],
deps = [
":texture",
":cache"
],
)

cc_library(
name = "texture",
srcs = ["texture.cpp"],
hdrs = ["texture.h"],
deps = [
":vecmath",
],
)

cc_library(
name = "vecmath",
srcs = ["vecmath.cpp"],
hdrs = ["vecmath.h"],
)


cc_library(
name = "level",
srcs = ["level.cpp"],
hdrs = ["level.h"],
deps = [
":vecmath",
":things",
# ":physics",
":random"
],
)

cc_library(
name = "physics",
srcs = ["physics.cpp"],
hdrs = ["physics.h"],
deps = [
":things",
":level"
],
)

cc_library(
name = "random",
srcs = ["random.cpp"],
hdrs = ["random.h"],
)


cc_library(
name = "command",
srcs = ["command.cpp"],
hdrs = ["command.h"],
)

cc_library(
name = "events",
srcs = ["events.cpp"],
hdrs = ["events.h"],
deps = [
":viewdraw",
],
)

cc_library(name="glfw", linkopts=["-lglfw"])

cc_library(name="sdl2", linkopts=["-lSDL2"])

cc_library(name="sdl2_image", linkopts=["-lSDL2_image"])

cc_library(name="zmq", linkopts=["-lzmq"])

cc_library(name="gl", linkopts=["-lGL"])

cc_library(name="glu", linkopts=["-lGLU"])

cc_binary(
name = "MeshGlide",
srcs = ["main.cpp"],
deps = [
":network",
":viewdraw",
":things",
":command",
":physics",
":events",
":glfw",
":sdl2",
":sdl2_image",
":zmq",
":gl",
":glu"
],
)
4 changes: 2 additions & 2 deletions Project/level.cpp
Expand Up @@ -20,7 +20,7 @@
#include "vecmath.h" /* Float3, ComputeNormal */
#include "things.h" /* Player, Plane */
#include "cache.h" /* Cache */
#include "physics.h" /* AdjustPlayerToFloor */
// #include "physics.h" /* AdjustPlayerToFloor */
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not make changes to my source code.

#include "random.h" /* Rand() */

#include <vector>
Expand Down Expand Up @@ -149,7 +149,7 @@ void Level::LoadLevel(const string& LevelName, unsigned int numOfPlayers)
if (EndsWith(LevelName, ".obj"))
{
LoadObj(LevelName);
AdjustPlayerToFloor(play, this);
// AdjustPlayerToFloor(play, this);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not make changes to my source code.

}
else
{
Expand Down
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -22,6 +22,17 @@ Compile on Linux: `g++ *.cpp -std=c++11 -lglfw -lGL -lGLU -lSDL2 -lSDL2_image -l

It's preferable to compile and run the program using the `run.sh` script because it's tested, but this should work too.

#### To compile using bazel

1rst, install bazel https://docs.bazel.build/versions/master/install.html

Then :

```
bazel build //Project:MeshGlide
```


## Credits

The following files were taken from the [Freedoom](https://github.com/freedoom/freedoom) project. See their [license](https://github.com/freedoom/freedoom/blob/master/COPYING.adoc).
Expand Down
Empty file added WORKSPACE
Empty file.