Changes for linux compile.
This commit is contained in:
@@ -6,3 +6,68 @@ stand in your way. The fate of your empire depends on your ability to master
|
|||||||
the economy, field a military, influence galactic politics, and learn what you
|
the economy, field a military, influence galactic politics, and learn what you
|
||||||
can about the universe.
|
can about the universe.
|
||||||
|
|
||||||
|
## What is this?
|
||||||
|
This repository contains the full source code needed to build Star Ruler 2, and
|
||||||
|
all secondary scripts, data files and assets required to run it.
|
||||||
|
|
||||||
|
Blind Mind Studios has been inactive for a few years now, so we decided to
|
||||||
|
open-source the game as a whole and allow anyone interested in how its engine works
|
||||||
|
to tinker with it.
|
||||||
|
|
||||||
|
## Building the Game
|
||||||
|
The Star Ruler 2.exe contained in the main folder is just a launcher. To run
|
||||||
|
the game you will need to build the binary for your platform from source.
|
||||||
|
|
||||||
|
### Building on Windows
|
||||||
|
You will need Visual Studio 2017 to build Star Ruler 2 on windows. Simply open the
|
||||||
|
visual studio solution in source/msvc/Star Ruler 2/, and build the "Star Ruler 2" project
|
||||||
|
in either Debug or Non-Steam Release configuration.
|
||||||
|
|
||||||
|
Please note that while the built exe ends up in the bin/win64/ directory, it expects to be
|
||||||
|
started with its working directory set to the main direcotry (where the
|
||||||
|
launcher exe is). So when debugging from visual studio, make sure the 'Working
|
||||||
|
Directory' configuration property is set to ../.../..
|
||||||
|
|
||||||
|
### Building on Linux
|
||||||
|
The equivalent launcher on linux is StarRuler2.sh. To build the binary files on linux,
|
||||||
|
make sure your working directory is set to the main directory (the one with StarRuler2.sh in it),
|
||||||
|
then run `make -f source/linux/Makefile compile` to compile the binary.
|
||||||
|
|
||||||
|
Afterward, run the `StarRuler2.sh` shell script to start the game.
|
||||||
|
|
||||||
|
Several dependencies are required to build on linux, including libpng, zlib,
|
||||||
|
GLEW, GLU, freetype2, libvorbisfile, libvorbis, libogg, libopenal, libbz2,
|
||||||
|
libXRandR, and libcurl.
|
||||||
|
|
||||||
|
|
||||||
|
## Differences with Commercial Version
|
||||||
|
* The music is not part of the open source release of Star Ruler 2. The data/music/ directory from the commercial
|
||||||
|
release can be copied directly into the data/ directory of an open-source build. The music will be detected and played.
|
||||||
|
* All code for accessing the SteamWorks API has been removed. The game platform abstraction layer game\_platform.h has
|
||||||
|
been kept intact, so other mod-sharing platforms could potentially be integrated into the game.
|
||||||
|
* Code for the automatic game patcher that is part of the GOG.com release is part of the repository, but the functionality
|
||||||
|
is disabled, since it relies on delta updates and will not work with modified open source versions.
|
||||||
|
* While the actual source code is probably still compatible with 32-bit platforms, project files and external dependencies for
|
||||||
|
32-bit builds are not included in this repository.
|
||||||
|
|
||||||
|
## FAQ
|
||||||
|
### Can I Play Multiplayer with Steam/GOG versions?
|
||||||
|
Yes. The base open source version is multiplayer-compatible with the commercial versions. If you make multiplayer-incompatible
|
||||||
|
changes to the open source version, please remember to change the MP\_VERSION identifier in scripts/definitions/version.as,
|
||||||
|
so things do not break from people with incompatible versions trying to join each other.
|
||||||
|
|
||||||
|
### Does this have the Wake of the Heralds DLC Expansion?
|
||||||
|
Yes. The code has been modified to bypass all DLC checks and unlock it by default. The Wake of the Heralds content
|
||||||
|
is always available in the open-source version.
|
||||||
|
|
||||||
|
### Is there a Community?
|
||||||
|
Most Star Ruler 2 community activity is centered around the [Steam Forums](https://steamcommunity.com/app/282590/discussions/)
|
||||||
|
(it is possible to post without owning the game on steam), and the [Discord Server for Rising Stars](https://discord.gg/9YyXgbh),
|
||||||
|
one of the largest SR2 mod projects.
|
||||||
|
|
||||||
|
## Licensing
|
||||||
|
Star Ruler 2 source code is licensed as MIT, art assets are licensed as CC-BY-NC 2.0.
|
||||||
|
|
||||||
|
Some third party code is contained in this repository as dependencies. Licenses for those projects are contained in the appropriate source folders.
|
||||||
|
|
||||||
|
See the COPYING file for more information.
|
||||||
|
|||||||
@@ -64,11 +64,12 @@ struct DriverCallbacks_2 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Removes a callback previously added to the list
|
//Removes a callback previously added to the list
|
||||||
void remove(cb func) {
|
/*void remove(cb func) {
|
||||||
callbacks.remove_if([func](cb f) {
|
callbacks.remove_if([func](cb f) {
|
||||||
return func.template target<bool(Arg0,Arg1)>() == f.template target<bool(Arg0,Arg1)>();
|
return func.template target<bool(Arg0,Arg1)>() == f.template target<bool(Arg0,Arg1)>();
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//Calls each callback in order, stopping if true is returned
|
//Calls each callback in order, stopping if true is returned
|
||||||
void operator()(Arg0 arg0, Arg1 arg1) {
|
void operator()(Arg0 arg0, Arg1 arg1) {
|
||||||
for(auto i = callbacks.begin(), end = callbacks.end(); i != end; ++i)
|
for(auto i = callbacks.begin(), end = callbacks.end(); i != end; ++i)
|
||||||
@@ -91,11 +92,11 @@ struct DriverCallbacks_1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Removes a callback previously added to the list
|
//Removes a callback previously added to the list
|
||||||
void remove(cb func) {
|
/*void remove(cb func) {
|
||||||
callbacks.remove_if([func](cb f) {
|
callbacks.remove_if([func](cb f) {
|
||||||
return func.template target<bool(Arg0)>() == f.template target<bool(Arg0)>();
|
return func.template target<bool(Arg0)>() == f.template target<bool(Arg0)>();
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
//Calls each callback in order, stopping if true is returned
|
//Calls each callback in order, stopping if true is returned
|
||||||
void operator()(Arg0 arg0) {
|
void operator()(Arg0 arg0) {
|
||||||
for(auto i = callbacks.begin(), end = callbacks.end(); i != end; ++i)
|
for(auto i = callbacks.begin(), end = callbacks.end(); i != end; ++i)
|
||||||
@@ -117,11 +118,11 @@ struct DriverCallbacks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Removes a callback previously added to the list
|
//Removes a callback previously added to the list
|
||||||
void remove(cb func) {
|
/*void remove(cb func) {
|
||||||
callbacks.remove_if([func](cb f) {
|
callbacks.remove_if([func](cb f) {
|
||||||
return func.template target<bool()>() == f.template target<bool()>();
|
return func.template target<bool()>() == f.template target<bool()>();
|
||||||
});
|
});
|
||||||
}
|
}*/
|
||||||
|
|
||||||
//Calls each callback in order, stopping if true is returned
|
//Calls each callback in order, stopping if true is returned
|
||||||
void operator()() {
|
void operator()() {
|
||||||
|
|||||||
+9
-24
@@ -84,11 +84,8 @@ CXXFLAGS += -I./source/libircclient/include
|
|||||||
CXXFLAGS += -I./source/util/include -I./source/network/include
|
CXXFLAGS += -I./source/util/include -I./source/network/include
|
||||||
CXXFLAGS += -I./source/rapidjson/include
|
CXXFLAGS += -I./source/rapidjson/include
|
||||||
|
|
||||||
ifdef NSTEAM
|
NSTEAM=1
|
||||||
CXXFLAGS += -DNSTEAM
|
CXXFLAGS += -DNSTEAM
|
||||||
else
|
|
||||||
CXXFLAGS += -I./source/steam
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifndef GCC48
|
ifndef GCC48
|
||||||
CXXFLAGS += -fdiagnostics-color=auto
|
CXXFLAGS += -fdiagnostics-color=auto
|
||||||
@@ -108,8 +105,6 @@ ifeq ($(UNAME), Darwin)
|
|||||||
CXXFLAGS += -framework OpenGL -framework Cocoa -framework IOKit
|
CXXFLAGS += -framework OpenGL -framework Cocoa -framework IOKit
|
||||||
CXXFLAGS += -framework OpenAL
|
CXXFLAGS += -framework OpenAL
|
||||||
|
|
||||||
STEAMLIBDIR = ./source/osx/lib
|
|
||||||
|
|
||||||
LDFLAGS += -lcurl
|
LDFLAGS += -lcurl
|
||||||
else
|
else
|
||||||
ifndef DEBUG
|
ifndef DEBUG
|
||||||
@@ -117,11 +112,6 @@ else
|
|||||||
endif
|
endif
|
||||||
LDFLAGS += -lGL -lGLU -lX11 -lXrandr -lXxf86vm -lXi -lopenal -lcurl
|
LDFLAGS += -lGL -lGLU -lX11 -lXrandr -lXxf86vm -lXi -lopenal -lcurl
|
||||||
|
|
||||||
ifeq ($(ARCH), 32)
|
|
||||||
STEAMLIBDIR = ./source/linux/lib32
|
|
||||||
else
|
|
||||||
STEAMLIBDIR = ./source/linux/lib64
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#Libraries
|
#Libraries
|
||||||
@@ -129,10 +119,6 @@ LDFLAGS += -lstdc++ -lGLEW -lpng -lz -lpthread
|
|||||||
LDFLAGS += -lm -lfreetype
|
LDFLAGS += -lm -lfreetype
|
||||||
LDFLAGS += -lvorbisfile
|
LDFLAGS += -lvorbisfile
|
||||||
|
|
||||||
ifndef NSTEAM
|
|
||||||
LDFLAGS += -L$(STEAMLIBDIR) -lsteam_api
|
|
||||||
endif
|
|
||||||
|
|
||||||
LIB_FILES += $(LIBDIR)/libangelscript.a
|
LIB_FILES += $(LIBDIR)/libangelscript.a
|
||||||
LIB_FILES += $(LIBDIR)/libglfw3.a
|
LIB_FILES += $(LIBDIR)/libglfw3.a
|
||||||
LIB_FILES += $(LIBDIR)/libsound.a
|
LIB_FILES += $(LIBDIR)/libsound.a
|
||||||
@@ -142,7 +128,8 @@ LIB_FILES += $(LIBDIR)/libos.a
|
|||||||
LIB_FILES += $(LIBDIR)/libnetwork.a
|
LIB_FILES += $(LIBDIR)/libnetwork.a
|
||||||
LIB_FILES += $(LIBDIR)/libutil.a
|
LIB_FILES += $(LIBDIR)/libutil.a
|
||||||
|
|
||||||
ifndef DEBUG
|
NOCOPYLIBS=1
|
||||||
|
ifndef NOCOPYLIBS
|
||||||
ifeq ($(UNAME), Darwin)
|
ifeq ($(UNAME), Darwin)
|
||||||
COPY_LIBS += lib/libGLEW.1.10.0.dylib
|
COPY_LIBS += lib/libGLEW.1.10.0.dylib
|
||||||
COPY_LIBS += opt/libpng/lib/libpng16.16.dylib
|
COPY_LIBS += opt/libpng/lib/libpng16.16.dylib
|
||||||
@@ -195,7 +182,6 @@ SOURCES = \
|
|||||||
main/tick.cpp \
|
main/tick.cpp \
|
||||||
main/console.cpp \
|
main/console.cpp \
|
||||||
main/save_load.cpp \
|
main/save_load.cpp \
|
||||||
main/steam_platform.cpp \
|
|
||||||
\
|
\
|
||||||
mods/mod_manager.cpp \
|
mods/mod_manager.cpp \
|
||||||
\
|
\
|
||||||
@@ -334,7 +320,6 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
|
|||||||
#Complete binary compile
|
#Complete binary compile
|
||||||
$(BINDIR)/$(BIN): makelibs $(OBJ_FILES) $(LIB_FILES) $(COPY_LIBS)
|
$(BINDIR)/$(BIN): makelibs $(OBJ_FILES) $(LIB_FILES) $(COPY_LIBS)
|
||||||
@mkdir -p $(BINDIR)
|
@mkdir -p $(BINDIR)
|
||||||
@cp $(STEAMLIBDIR)/libsteam_api.* $(BINDIR)/
|
|
||||||
@$(CC) $(CXXFLAGS) $(LDFLAGS) $(OBJ_FILES) $(LIB_FILES) -o $@
|
@$(CC) $(CXXFLAGS) $(LDFLAGS) $(OBJ_FILES) $(LIB_FILES) -o $@
|
||||||
|
|
||||||
makelibs:
|
makelibs:
|
||||||
@@ -361,14 +346,14 @@ patcher: $(LIB_FILES)
|
|||||||
@$(CC) $(CXXFLAGS) $(LDFLAGS) source/patcher/patcher/patcher.cpp $(LIB_FILES) -o $(BINDIR)/Patcher.bin
|
@$(CC) $(CXXFLAGS) $(LDFLAGS) source/patcher/patcher/patcher.cpp $(LIB_FILES) -o $(BINDIR)/Patcher.bin
|
||||||
|
|
||||||
version:
|
version:
|
||||||
./source/linux/build.sh version
|
bash /source/linux/build.sh version
|
||||||
|
|
||||||
#Library builds
|
#Library builds
|
||||||
$(LIBDIR)/libangelscript.a:
|
$(LIBDIR)/libangelscript.a:
|
||||||
./source/linux/build.sh $(ARCH) $(BUILDTYPE) angelscript
|
bash source/linux/build.sh $(ARCH) $(BUILDTYPE) angelscript
|
||||||
|
|
||||||
$(LIBDIR)/libglfw3.a:
|
$(LIBDIR)/libglfw3.a:
|
||||||
./source/linux/build.sh $(ARCH) $(BUILDTYPE) glfw
|
bash source/linux/build.sh $(ARCH) $(BUILDTYPE) glfw
|
||||||
|
|
||||||
#$(LIBDIR)/libbreakpad_client.a:
|
#$(LIBDIR)/libbreakpad_client.a:
|
||||||
#./source/linux/build.sh $(ARCH) $(BUILDTYPE) breakpad
|
#./source/linux/build.sh $(ARCH) $(BUILDTYPE) breakpad
|
||||||
@@ -395,12 +380,12 @@ $(LIBDIR)/libutil.a:
|
|||||||
clean_angelscript:
|
clean_angelscript:
|
||||||
rm -f $(LIBDIR)/libangelscript.a
|
rm -f $(LIBDIR)/libangelscript.a
|
||||||
angelscript: clean_angelscript
|
angelscript: clean_angelscript
|
||||||
./source/linux/build.sh $(ARCH) $(BUILDTYPE) angelscript
|
bash source/linux/build.sh $(ARCH) $(BUILDTYPE) angelscript
|
||||||
|
|
||||||
clean_glfw:
|
clean_glfw:
|
||||||
rm -f $(LIBDIR)/libglfw3.a
|
rm -f $(LIBDIR)/libglfw3.a
|
||||||
glfw:
|
glfw:
|
||||||
./source/linux/build.sh $(ARCH) $(BUILDTYPE) glfw
|
bash source/linux/build.sh $(ARCH) $(BUILDTYPE) glfw
|
||||||
|
|
||||||
#clean_breakpad:
|
#clean_breakpad:
|
||||||
#rm -f $(LIBDIR)/libbreakpad_client.a
|
#rm -f $(LIBDIR)/libbreakpad_client.a
|
||||||
|
|||||||
Reference in New Issue
Block a user