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

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

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;
}