mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2024-12-22 03:10:05 +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/
|
||||
.idea/
|
||||
*.db
|
||||
version.h
|
||||
|
@ -3,6 +3,8 @@ project(OpenFusion)
|
||||
|
||||
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
|
||||
# 104 is the default version to build which can be changed
|
||||
# For example: cmake -B build -DPROTOCOL_VERSION=728
|
||||
@ -33,10 +35,14 @@ endif()
|
||||
|
||||
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})
|
||||
|
||||
target_link_libraries(openfusion dl)
|
||||
|
||||
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)
|
||||
|
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)
|
||||
endif
|
||||
|
||||
CXXFLAGS+= -DGIT_VERSION=\"$(shell git describe --tags)\"
|
||||
|
||||
.SUFFIX: .o .c .cpp .h .hpp
|
||||
|
||||
.c.o:
|
||||
@ -122,13 +124,19 @@ $(SERVER): $(OBJ) $(CHDR) $(CXXHDR)
|
||||
mkdir -p bin
|
||||
$(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
|
||||
|
||||
# only gets rid of OpenFusion objects, so we don't need to
|
||||
# recompile the libs every time
|
||||
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
|
||||
nuke:
|
||||
rm -f $(OBJ) $(SERVER) $(WIN_SERVER)
|
||||
rm -f $(OBJ) $(SERVER) $(WIN_SERVER) version.h
|
||||
|
@ -13,6 +13,8 @@
|
||||
|
||||
#include "settings.hpp"
|
||||
|
||||
#include "../version.h"
|
||||
|
||||
#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
|
||||
#include "mingw/mingw.thread.h"
|
||||
#else
|
||||
@ -84,6 +86,7 @@ int main() {
|
||||
initsignals();
|
||||
#endif
|
||||
settings::init();
|
||||
std::cout << "[INFO] OpenFusion v" GIT_VERSION << std::endl;
|
||||
std::cout << "[INFO] Protocol version: " << PROTOCOL_VERSION << std::endl;
|
||||
std::cout << "[INFO] Intializing Packet Managers..." << std::endl;
|
||||
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