forked from metin2/server
1
0
Fork 0

Added build details, the executables no longer write VERSION.TXT

This commit is contained in:
Exynox 2022-03-21 10:27:28 +02:00
parent 8c40c9f92e
commit ef2aee6b6b
13 changed files with 79 additions and 61 deletions

View File

@ -19,17 +19,38 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Set environment variables
set(METIN2_OS_NAME ${CMAKE_SYSTEM})
set(METIN2_COMPILER_NAME ${CMAKE_CXX_COMPILER_ID})
set(METIN2_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
set(METIN2_CPU_TARGET ${CMAKE_SYSTEM_PROCESSOR})
# Git revision
include(FindGit)
find_package(Git)
if(GIT_FOUND)
GIT_WC_INFO(${PROJECT_SOURCE_DIR} Metin2)
set(METIN2_REVISION ${Metin2_WC_REVISION_NAME})
set(METIN2_LAST_CHANGED_DATE ${Metin2_WC_LAST_CHANGED_DATE})
if (${Metin2_WC_LATEST_TAG} NOT STREQUAL "")
set(METIN2_LATEST_TAG ${Metin2_WC_LATEST_TAG})
else()
set(METIN2_LATEST_TAG "unknown")
endif()
else()
set(METIN2_REVISION "unknown")
set(METIN2_LAST_CHANGED_DATE "\"unknown\"")
set(METIN2_LATEST_TAG "unknown")
endif()
message(STATUS "Current revision is ${METIN2_REVISION}")
# Generate the version header
configure_file (
"${PROJECT_SOURCE_DIR}/common/version.h.in"
"${PROJECT_BINARY_DIR}/common/version.h"
)
include_directories(${PROJECT_BINARY_DIR}/common/)
# Set the global include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

15
common/version.h.in Normal file
View File

@ -0,0 +1,15 @@
#ifndef __INC_METIN_II_VERSION_H__
#define __INC_METIN_II_VERSION_H__
#include <ostream>
#define __REVISION__ "@METIN2_REVISION@"
#define __COMMIT_DATE__ @METIN2_LAST_CHANGED_DATE@
#define __COMMIT_TAG__ "@METIN2_LATEST_TAG@"
#define __OS_NAME__ "@METIN2_OS_NAME@"
#define __COMPILER__ "@METIN2_COMPILER@"
#define __CPU_TARGET__ "@METIN2_CPU_TARGET@"
void WriteVersion(std::ostream& out);
#endif

View File

@ -6,9 +6,7 @@ file(GLOB_RECURSE sources
src/*.cpp src/*.h
)
include_directories(${PROJECT_BINARY_DIR}/src/)
# Add the src directory to the include path
include_directories(src/)
add_executable(${PROJECT_NAME} ${sources})

View File

@ -12,6 +12,7 @@
#include "Monarch.h"
#include "BlockCountry.h"
#include "ItemIDRangeManager.h"
#include <version.h>
#ifdef __AUCTION__
#include "AuctionManager.h"
#endif
@ -48,8 +49,6 @@ int g_iItemPriceListTableCacheFlushSeconds = 540;
extern const char * _malloc_options;
#endif
extern void WriteVersion();
void emergency_sig(int sig)
{
if (sig == SIGSEGV)
@ -63,7 +62,7 @@ void emergency_sig(int sig)
int main()
{
WriteVersion();
WriteVersion(std::cout);
#ifdef __FreeBSD__
_malloc_options = "A";

View File

@ -19,5 +19,6 @@
#include <memory>
#include <algorithm>
#include <iostream>
#endif

View File

@ -1,21 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
#include <version.h>
void WriteVersion()
{
#ifndef __WIN32__
FILE* fp(fopen("VERSION.txt", "w"));
void WriteVersion(std::ostream& out) {
out << "Metin2 DB Cache version " << __COMMIT_TAG__ << " "
<< "(rev. " << __REVISION__ << ", date: " << __COMMIT_DATE__ << ")"
<< std::endl;
if (NULL != fp)
{
fprintf(fp, "db\n");
fclose(fp);
}
else
{
fprintf(stderr, "cannot open VERSION.txt\n");
exit(0);
}
#endif
out << "OS: " << __OS_NAME__ << ", "
<< "target arch: " << __CPU_TARGET__ << ", "
<< "compiler: " << __COMPILER__
<< std::endl;
out << std::endl;
}

View File

@ -6,8 +6,7 @@ file(GLOB_RECURSE sources
src/*.cpp src/*.h
)
include_directories(${PROJECT_BINARY_DIR}/src/)
# Add the src directory to the include path
include_directories(src/)
# Find dependencies

View File

@ -3622,7 +3622,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
if (GetDesc())
{
struct packet_point_change pack;
TPacketGCPointChange pack;
pack.header = HEADER_GC_CHARACTER_POINT_CHANGE;
pack.dwVID = m_vid;
@ -3635,7 +3635,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
pack.amount = 0;
if (!bBroadcast)
GetDesc()->Packet(&pack, sizeof(struct packet_point_change));
GetDesc()->Packet(&pack, sizeof(TPacketGCPointChange));
else
PacketAround(&pack, sizeof(pack));
}

View File

@ -63,8 +63,6 @@ class CInputHandshake : public CInputProcessor
virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
protected:
void GuildMarkLogin(LPDESC d, const char* c_pData);
CPacketInfo * m_pMainPacketInfo;
};

View File

@ -58,6 +58,7 @@
#include "skill_power.h"
#include "SpeedServer.h"
#include "DragonSoul.h"
#include <version.h>
#include <event2/event.h>
#include <event2/listener.h>
#include <event2/dns.h>
@ -70,7 +71,6 @@
#include <execinfo.h>
#endif
extern void WriteVersion();
//extern const char * _malloc_options;
#if defined(__FreeBSD__) && defined(DEBUG_ALLOC)
extern void (*_malloc_message)(const char* p1, const char* p2, const char* p3, const char* p4);
@ -331,7 +331,7 @@ int main(int argc, char **argv)
ilInit(); // DevIL Initialize
WriteVersion();
WriteVersion(std::cout);
SECTREE_MANAGER sectree_manager;
CHARACTER_MANAGER char_manager;

View File

@ -931,7 +931,7 @@ typedef struct packet_char_additional_info
BYTE bEmpire;
DWORD dwGuildID;
DWORD dwLevel;
short sAlignment;
sh_int sAlignment;
BYTE bPKMode;
DWORD dwMountVnum;
} TPacketGCCharacterAdditionalInfo;
@ -950,7 +950,7 @@ typedef struct packet_char_additional_info
DWORD dwAffectFlag[2];
DWORD dwGuildID;
short sAlignment;
sh_int sAlignment;
BYTE bPKMode;
DWORD dwMountVnum;
} TPacketGCCharacterUpdateOld;
@ -969,7 +969,7 @@ typedef struct packet_update_char
DWORD dwAffectFlag[2];
DWORD dwGuildID;
short sAlignment;
sh_int sAlignment;
BYTE bPKMode;
DWORD dwMountVnum;
//WORD wRaceNum;
@ -1060,7 +1060,7 @@ typedef struct packet_skill_level
typedef struct packet_point_change
{
INT header;
BYTE header;
DWORD dwVID;
BYTE type;
LONG amount;
@ -1573,7 +1573,7 @@ typedef struct packet_party_update
DWORD pid;
BYTE role;
BYTE percent_hp;
short affects[7];
sh_int affects[7];
} TPacketGCPartyUpdate;
typedef struct packet_party_remove

View File

@ -6,14 +6,15 @@
#include "debug_allocator.h"
#include "../../libthecore/include/stdafx.h"
#include <libthecore/include/stdafx.h>
#include <common/singleton.h>
#include <common/utils.h>
#include <common/service.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <list>
#include <map>
#include <set>
@ -22,7 +23,7 @@
#include <vector>
#include <memory>
#include <float.h>
#include <cfloat>
#include <unordered_map>
#include <unordered_set>
@ -32,12 +33,5 @@
#define PASSES_PER_SEC(sec) ((sec) * passes_per_sec)
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661923 /* pi/2 */
#endif
#define IN
#define OUT

View File

@ -1,16 +1,15 @@
#include <stdio.h>
#include <version.h>
void WriteVersion()
{
#ifndef __WIN32__
FILE* fp = fopen("ver.txt", "w");
void WriteVersion(std::ostream& out) {
out << "Metin2 Game Server version " << __COMMIT_TAG__ << " "
<< "(rev. " << __REVISION__ << ", date: " << __COMMIT_DATE__ << ")"
<< std::endl;
if (fp)
{
fprintf(fp, "emulated game server\n");
//fprintf(fp, "%s@%s:%s\n", __USER__, __HOSTNAME__, __PWD__);
fclose(fp);
}
#endif
out << "OS: " << __OS_NAME__ << ", "
<< "target arch: " << __CPU_TARGET__ << ", "
<< "compiler: " << __COMPILER__
<< std::endl;
out << std::endl;
}