Skip to content

Commit

Permalink
Fix Compile, Implement Revision and Built Date information
Browse files Browse the repository at this point in the history
  • Loading branch information
NTX authored and NTX committed Mar 9, 2012
1 parent 4e62a8a commit 4ff84ce
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 4 deletions.
6 changes: 6 additions & 0 deletions Application/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ debug(false), control(false), daemonize(false), libLoaded(false), terminate(fals
Daemonize(StringConfigs[CONFIG_STRING_PID_FILE].c_str(), StringConfigs[CONFIG_STRING_WORKING_DIRECTORY].c_str());

_initGlobals();
sLog->outString("Project Ikaros - framework based server");
sLog->outString("Revision hash: %s Revision Date: %s", __ShortCommitHash, __CommitDate);
sLog->outString("Built: %s %s", __DATE__, __TIME__);
sLog->outString();
sLog->outString("Using Protocol: %s", StringConfigs[CONFIG_STRING_PROTOCOL_NAME].c_str());
sLog->outString();
}

void Application::ParseParams()
Expand Down
3 changes: 2 additions & 1 deletion Application/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
#include "Handler.h"
#include "ConfigMgr.h"
#include "Daemon.h"
#include "revision.h"

#ifndef __App
#define __App

using Files::AsciiFile ;
using Files::AsciiFile;


typedef void (*onConnect)(in_addr, int);
Expand Down
51 changes: 49 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,48 @@ else ()
set (InstallDirectory ${CMAKE_BINARY_DIR}/bin/)
endif ()

find_program(_GIT_EXEC
NAMES
git git.cmd
HINTS
ENV PATH
DOC "git installation path"
)

set(_GIT_COMMIT_DATE "0000-00-00 00:00:00 +0000")
if (_GIT_EXEC)
execute_process(
COMMAND "${_GIT_EXEC}" log --pretty=%H -n 1
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE _GIT_LONG_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND "${_GIT_EXEC}" log --pretty=%h -n 1
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE _GIT_SHORT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
execute_process(
COMMAND "${_GIT_EXEC}" log --pretty=%aD -n 1
WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}"
OUTPUT_VARIABLE _GIT_COMMIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_QUIET
)
message("Commit ${_GIT_LONG_COMMIT_HASH} Short Commit ${_GIT_SHORT_COMMIT_HASH} Commit Date ${_GIT_COMMIT_DATE}")

endif(_GIT_EXEC)


configure_file(
"${CMAKE_SOURCE_DIR}/revision.h.in.cmake"
"${CMAKE_BINARY_DIR}/revision.h"
@ONLY
)

include_directories(
${PROJECT_SOURCE_DIR}/
${PROJECT_SOURCE_DIR}/Application/
Expand All @@ -25,13 +67,15 @@ include_directories(
${PROJECT_SOURCE_DIR}/Sockets/
${PROJECT_SOURCE_DIR}/Utilities/
${PROJECT_SOURCE_DIR}/Daemon/
${CMAKE_BINARY_DIR}
)

set(CMAKE_CXX_FLAGS "-W -Wall -O2 -ldl -rdynamic -pthread -g")
set(CMAKE_CXX_FLAGS " -W -Wall -O2 -ldl -rdynamic -pthread -g")
set(CMAKE_BUILD_TYPE debug)

set (MultiServer_LINK_FLAGS ${CMAKE_CXX_FLAGS})

add_definitions("-W -Wall -O2 -ldl -rdynamic -pthread -g")
add_definitions(${CMAKE_CXX_FLAGS})

set (STAT_CORE
Utilities/Utils.cpp
Expand All @@ -52,9 +96,12 @@ set (STAT_CORE
set (STAT_MAIN main.cpp)



add_library(Core STATIC ${STAT_CORE})
target_link_libraries(Core ${CMAKE_DL_LIBS} Core)

add_dependencies(Core revision.h)

add_executable(MultiServer ${STAT_MAIN})

set_target_properties(MultiServer PROPERTIES LINK_FLAGS ${MultiServer_LINK_FLAGS})
Expand Down
2 changes: 1 addition & 1 deletion DataArrays/binData.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ using namespace std;
#ifndef __BinnaryData
#define __BinnaryData

typedef unsigned char byt ;
typedef unsigned char byte;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long uint64;
Expand Down

0 comments on commit 4ff84ce

Please sign in to comment.