mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-11-24 22:11:04 +00:00
Print server version when starting up.
Also added -ldl to fix cmake compilation on Unix systems.
This commit is contained in:
parent
f7571607ba
commit
efda6673b5
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,3 +11,4 @@ build/
|
|||||||
.vs/
|
.vs/
|
||||||
.idea/
|
.idea/
|
||||||
*.db
|
*.db
|
||||||
|
version.h
|
||||||
|
@ -3,6 +3,8 @@ project(OpenFusion)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
execute_process(COMMAND git describe --tags OUTPUT_VARIABLE GIT_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
# OpenFusion supports multiple packet/struct versions
|
# OpenFusion supports multiple packet/struct versions
|
||||||
# 104 is the default version to build which can be changed
|
# 104 is the default version to build which can be changed
|
||||||
# For example: cmake -B build -DPROTOCOL_VERSION=728
|
# For example: cmake -B build -DPROTOCOL_VERSION=728
|
||||||
@ -33,10 +35,14 @@ endif()
|
|||||||
|
|
||||||
include_directories(src)
|
include_directories(src)
|
||||||
|
|
||||||
file(GLOB_RECURSE SOURCES src/**.cpp src/**.hpp src/**.c src/**.h)
|
file(GLOB_RECURSE SOURCES src/**.cpp src/**.hpp src/**.c src/**.h version.h)
|
||||||
|
|
||||||
|
configure_file(version.h.in ${CMAKE_SOURCE_DIR}/version.h @ONLY)
|
||||||
|
|
||||||
add_executable(openfusion ${SOURCES})
|
add_executable(openfusion ${SOURCES})
|
||||||
|
|
||||||
|
target_link_libraries(openfusion dl)
|
||||||
|
|
||||||
set_target_properties(openfusion PROPERTIES OUTPUT_NAME ${BIN_NAME})
|
set_target_properties(openfusion PROPERTIES OUTPUT_NAME ${BIN_NAME})
|
||||||
|
|
||||||
# Use pthreads if not generating a VS solution or MinGW makefile (because MinGW will prefer Win32 threads)
|
# Use pthreads if not generating a VS solution or MinGW makefile (because MinGW will prefer Win32 threads)
|
||||||
|
12
Makefile
12
Makefile
@ -107,6 +107,8 @@ ifneq ($(shell $(WIN_CXX) --version | head -1 | egrep -o [0-9]+ | tail -3 | head
|
|||||||
WIN_CXX_OPT_DISABLES=$(WIN_CXX_VANILLA_MINGW_OPT_DISABLES)
|
WIN_CXX_OPT_DISABLES=$(WIN_CXX_VANILLA_MINGW_OPT_DISABLES)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
CXXFLAGS+= -DGIT_VERSION=\"$(shell git describe --tags)\"
|
||||||
|
|
||||||
.SUFFIX: .o .c .cpp .h .hpp
|
.SUFFIX: .o .c .cpp .h .hpp
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@ -122,13 +124,19 @@ $(SERVER): $(OBJ) $(CHDR) $(CXXHDR)
|
|||||||
mkdir -p bin
|
mkdir -p bin
|
||||||
$(CXX) $(OBJ) $(LDFLAGS) -o $(SERVER)
|
$(CXX) $(OBJ) $(LDFLAGS) -o $(SERVER)
|
||||||
|
|
||||||
|
# compatibility with how cmake injects GIT_VERSION
|
||||||
|
version.h:
|
||||||
|
touch version.h
|
||||||
|
|
||||||
|
src/main.o: version.h
|
||||||
|
|
||||||
.PHONY: all windows clean nuke
|
.PHONY: all windows clean nuke
|
||||||
|
|
||||||
# only gets rid of OpenFusion objects, so we don't need to
|
# only gets rid of OpenFusion objects, so we don't need to
|
||||||
# recompile the libs every time
|
# recompile the libs every time
|
||||||
clean:
|
clean:
|
||||||
rm -f src/*.o $(SERVER) $(WIN_SERVER)
|
rm -f src/*.o $(SERVER) $(WIN_SERVER) version.h
|
||||||
|
|
||||||
# gets rid of all compiled objects, including the libraries
|
# gets rid of all compiled objects, including the libraries
|
||||||
nuke:
|
nuke:
|
||||||
rm -f $(OBJ) $(SERVER) $(WIN_SERVER)
|
rm -f $(OBJ) $(SERVER) $(WIN_SERVER) version.h
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
|
|
||||||
#include "settings.hpp"
|
#include "settings.hpp"
|
||||||
|
|
||||||
|
#include "../version.h"
|
||||||
|
|
||||||
#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
|
#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
|
||||||
#include "mingw/mingw.thread.h"
|
#include "mingw/mingw.thread.h"
|
||||||
#else
|
#else
|
||||||
@ -84,6 +86,7 @@ int main() {
|
|||||||
initsignals();
|
initsignals();
|
||||||
#endif
|
#endif
|
||||||
settings::init();
|
settings::init();
|
||||||
|
std::cout << "[INFO] OpenFusion v" GIT_VERSION << std::endl;
|
||||||
std::cout << "[INFO] Protocol version: " << PROTOCOL_VERSION << std::endl;
|
std::cout << "[INFO] Protocol version: " << PROTOCOL_VERSION << std::endl;
|
||||||
std::cout << "[INFO] Intializing Packet Managers..." << std::endl;
|
std::cout << "[INFO] Intializing Packet Managers..." << std::endl;
|
||||||
TableData::init();
|
TableData::init();
|
||||||
|
1
version.h.in
Normal file
1
version.h.in
Normal file
@ -0,0 +1 @@
|
|||||||
|
#define GIT_VERSION "@GIT_VERSION@"
|
Loading…
Reference in New Issue
Block a user