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 environment variables
set(METIN2_OS_NAME ${CMAKE_SYSTEM}) 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}) set(METIN2_CPU_TARGET ${CMAKE_SYSTEM_PROCESSOR})
# Git revision # Git revision
include(FindGit) include(FindGit)
find_package(Git) find_package(Git)
set(METIN2_REVISION "unknown") 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}") 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 # Set the global include directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) 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 src/*.cpp src/*.h
) )
# Add the src directory to the include path
include_directories(${PROJECT_BINARY_DIR}/src/)
include_directories(src/) include_directories(src/)
add_executable(${PROJECT_NAME} ${sources}) add_executable(${PROJECT_NAME} ${sources})

View File

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

View File

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

View File

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

View File

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

View File

@ -3622,7 +3622,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
if (GetDesc()) if (GetDesc())
{ {
struct packet_point_change pack; TPacketGCPointChange pack;
pack.header = HEADER_GC_CHARACTER_POINT_CHANGE; pack.header = HEADER_GC_CHARACTER_POINT_CHANGE;
pack.dwVID = m_vid; pack.dwVID = m_vid;
@ -3635,7 +3635,7 @@ void CHARACTER::PointChange(BYTE type, int amount, bool bAmount, bool bBroadcast
pack.amount = 0; pack.amount = 0;
if (!bBroadcast) if (!bBroadcast)
GetDesc()->Packet(&pack, sizeof(struct packet_point_change)); GetDesc()->Packet(&pack, sizeof(TPacketGCPointChange));
else else
PacketAround(&pack, sizeof(pack)); 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); virtual int Analyze(LPDESC d, BYTE bHeader, const char * c_pData);
protected: protected:
void GuildMarkLogin(LPDESC d, const char* c_pData);
CPacketInfo * m_pMainPacketInfo; CPacketInfo * m_pMainPacketInfo;
}; };

View File

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

View File

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

View File

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

View File

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