From 5738f6ae470b1525afdf5acf648d2e511d004ab1 Mon Sep 17 00:00:00 2001 From: sfb Date: Fri, 19 Aug 2011 07:50:05 -0500 Subject: [PATCH] Changed: Turned off zone painter, fixed nelns and snowballs CMake builds for gcc 4.4.3 --- code/CMakeLists.txt | 4 +- .../src/plugins/CMakeLists.txt | 8 +- code/nelns/CMakeLists.txt | 28 +- .../admin_executor_service/log_report.cpp | 1161 +++++++++-------- .../nel_launcher_qt/CMakeLists.txt | 77 +- code/snowballs2/CMakeLists.txt | 170 +-- code/snowballs2/CMakePackaging.txt | 113 ++ 7 files changed, 765 insertions(+), 796 deletions(-) create mode 100644 code/snowballs2/CMakePackaging.txt diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 630ff4414..4d429e693 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -143,11 +143,11 @@ IF(WITH_RYZOM) ENDIF(WITH_RYZOM) IF(WITH_NELNS) -# ADD_SUBDIRECTORY(nelns) + ADD_SUBDIRECTORY(nelns) ENDIF(WITH_NELNS) IF(WITH_SNOWBALLS) -# ADD_SUBDIRECTORY(snowballs2) + ADD_SUBDIRECTORY(snowballs2) ENDIF(WITH_SNOWBALLS) IF(WITH_TOOLS) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt index 66cbdb188..3babfdab1 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/CMakeLists.txt @@ -1,14 +1,16 @@ ADD_SUBDIRECTORY(core) ADD_SUBDIRECTORY(example) ADD_SUBDIRECTORY(ovqt_sheet_builder) -ADD_SUBDIRECTORY(landscape_editor) +ADD_SUBDIRECTORY(landscape_editor) ADD_SUBDIRECTORY(log) ADD_SUBDIRECTORY(disp_sheet_id) ADD_SUBDIRECTORY(object_viewer) -ADD_SUBDIRECTORY(zone_painter) ADD_SUBDIRECTORY(georges_editor) +# Note: Temporarily disabled until development continues. +#ADD_SUBDIRECTORY(zone_painter) + # Ryzom Specific Plugins IF(WITH_RYZOM AND WITH_RYZOM_TOOLS) ADD_SUBDIRECTORY(mission_compiler) -ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS) \ No newline at end of file +ENDIF(WITH_RYZOM AND WITH_RYZOM_TOOLS) diff --git a/code/nelns/CMakeLists.txt b/code/nelns/CMakeLists.txt index 9a8402fac..63916ba08 100644 --- a/code/nelns/CMakeLists.txt +++ b/code/nelns/CMakeLists.txt @@ -1,14 +1,14 @@ -FIND_PACKAGE(MySQL) -FIND_PACKAGE(CURL) - -IF(BUILD_SERVICES) - ADD_SUBDIRECTORY(admin_executor_service) - ADD_SUBDIRECTORY(admin_service) - ADD_SUBDIRECTORY(naming_service) - ADD_SUBDIRECTORY(login_service) - ADD_SUBDIRECTORY(welcome_service) -ENDIF(BUILD_SERVICES) - -IF(BUILD_LOGIN_SYSTEM) - ADD_SUBDIRECTORY(login_system) -ENDIF(BUILD_LOGIN_SYSTEM) +FIND_PACKAGE(MySQL) +FIND_PACKAGE(CURL) + +IF(WITH_NELNS_SERVER) + ADD_SUBDIRECTORY(admin_executor_service) + ADD_SUBDIRECTORY(admin_service) + ADD_SUBDIRECTORY(naming_service) + ADD_SUBDIRECTORY(login_service) + ADD_SUBDIRECTORY(welcome_service) +ENDIF(WITH_NELNS_SERVER) + +IF(WITH_NELNS_LOGIN_SYSTEM) + ADD_SUBDIRECTORY(login_system) +ENDIF(WITH_NELNS_LOGIN_SYSTEM) diff --git a/code/nelns/admin_executor_service/log_report.cpp b/code/nelns/admin_executor_service/log_report.cpp index eac5f83c3..7106fb9d1 100644 --- a/code/nelns/admin_executor_service/log_report.cpp +++ b/code/nelns/admin_executor_service/log_report.cpp @@ -1,580 +1,581 @@ -// NeLNS - MMORPG Framework -// Copyright (C) 2010 Winch Gate Property Limited -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -#include "log_report.h" -#include -#include "nel/misc/common.h" -#include "nel/misc/displayer.h" -#include "nel/misc/file.h" -#include "nel/misc/path.h" -#include "nel/misc/variable.h" - -using namespace NLMISC; -using namespace std; - - -CVariable LogPath( "LogReport","LogPath", "Path of the log files", ".", 0, true ); - -const uint MAX_LOG_LINE_SIZE = 1024; -//nlctassert(MAX_LOG_LINE_SIZE>0); - -enum TLogLineHeader { LHDate, LHTime, LHType, LHThread, LHService, LHCodeFile, LHCodeLine, LHSeparator, LH_NB_FIELDS }; - - -/// -bool isLogFile( const std::string& filename ) -{ - uint len = (uint)filename.size(); - return (len >= 4 ) && (filename.substr( len-4 ) == ".log"); -} - -/// -inline bool isNumberChar( char c ) -{ - return (c >= '0') && (c <= '9'); -} - -/// -void sortLogFiles( vector& filenames ) -{ - uint i; - for ( i=0; i!=filenames.size(); ++i ) - { - // Ensure that a log file without number comes *after* the ones with a number - string name = string(filenames[i]); - string::size_type dotpos = name.find_last_of('.'); - if ( (dotpos!=string::npos) && (dotpos > 2) ) - { - if ( ! (isNumberChar(name[dotpos-1]) && isNumberChar(name[dotpos-2]) && isNumberChar(name[dotpos-3])) ) - { - name = name.substr( 0, dotpos ) + "ZZZ" + name.substr( dotpos ); - filenames[i] = name.c_str(); - } - } - } - sort( filenames.begin(), filenames.end() ); - for ( i=0; i!=filenames.size(); ++i ) - { - // Set the original names back - string name = filenames[i]; - string::size_type tokenpos = name.find( "ZZZ." ); - if ( tokenpos != string::npos ) - { - name = name.substr( 0, tokenpos ) + name.substr( tokenpos + 3 ); - filenames[i] = name.c_str(); - } - } -} - -void CMakeLogTask::setLogPath(const std::string & logPath) -{ - _LogPaths.resize( 1 ); - _LogPaths[0] = logPath; -} - -void CMakeLogTask::setLogPaths(const std::vector& logPaths) -{ - _LogPaths = logPaths; -} - -void CMakeLogTask::setLogPathToDefault() -{ - setLogPath( LogPath.get() ); -} - -/* - * - */ -CMakeLogTask::~CMakeLogTask() -{ - if ( _Thread ) // implies && _OutputLogReport - { - if ( ! _Complete ) - { - pleaseStop(); - _Thread->wait(); - } - clear(); - } -} - - -/* - * - */ -void CMakeLogTask::start() -{ - if ( _Thread ) - { - if ( _Complete ) - clear(); - else - return; - } - _Stopping = false; - _Complete = false; - _Thread = NLMISC::IThread::create( this ); - _OutputLogReport = new CLogReport(); - _Thread->start(); -} - - -/* - * - */ -void CMakeLogTask::clear() -{ - if (_Thread) - { - delete _Thread; - _Thread = NULL; - } - if (_OutputLogReport) - { - delete _OutputLogReport; - _OutputLogReport = NULL; - } -} - -/* - * - */ -void CMakeLogTask::terminateTask() -{ - if (!_Thread) // _Thread _implies _OutputLogReport - return; - - pleaseStop(); - _Thread->wait(); - - clear(); -} - -// -bool isOfLogDotLogFamily( const std::string& filename ) -{ - return ((filename == "log.log") || - ((filename.size() == 10) && - (filename.substr( 0, 3 ) == "log") && - isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]) && - (filename.substr( 6, 4 ) == ".log")) ); -} - - -enum TVersionTargetMode { TTMAll, TTMMatchAllV, TTMMatchExactV, TTMMatchGreaterV, TTMMatchLowerV } targetMode; -const uint CurrentVersion = std::numeric_limits::max(); - -// Return true and logVersion, or false if not a log with version -bool getLogVersion( const std::string& filename, uint& logVersion ) -{ - uint len = (uint)filename.size(); - if ( (len > 4) && (filename.substr( len-4 ) == ".log") ) - { - if ( filename.substr(0, 3) == "log" ) - { - if ( (len == 7) || - ((len == 10) && (isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]))) ) - { - logVersion = CurrentVersion; - return true; - } - } - else if ( filename[0] == 'v' ) - { - string::size_type p = filename.find( "_", 1 ); - if ( p != string::npos ) - { - if ( (len == p + 8) || - ((len == p + 11) && (isNumberChar(filename[p+4]) && isNumberChar(filename[p+5]) && isNumberChar(filename[p+6]))) ) - { - NLMISC::fromString( filename.substr( 1, p-1 ), logVersion ); - return true; - } - } - } - } - return false; -} - -// Assumes filename is .log file -bool matchLogTarget( const std::string& filename, TVersionTargetMode targetMode, uint targetVersion ) -{ - if ( targetMode == TTMAll ) - return true; - - uint version; - - // Get version or exclude non-standard log files - if ( ! getLogVersion( filename, version ) ) - return false; - - // Exclude non-matching version - switch ( targetMode ) - { - case TTMMatchExactV: - return (version == targetVersion); // break; - case TTMMatchGreaterV: - return (version >= targetVersion); // break; - case TTMMatchLowerV: - return (version <= targetVersion); // break; - default: // TTMMatchAllV - return true; - } -} - -/* - * - */ -void CMakeLogTask::run() -{ - // Parse log target - uint targetVersion = CurrentVersion; - uint lts = (uint)_LogTarget.size(); - if ( _LogTarget.empty() || (_LogTarget == "v") ) - { - targetMode = TTMMatchExactV; - } - else if ( _LogTarget == "v*" ) - { - targetMode = TTMMatchAllV; - } - else if ( _LogTarget == "*" ) - { - targetMode = TTMAll; - } - else if ( (lts > 1) && (_LogTarget[0] == 'v') ) - { - uint additionalChars = 1; - if ( _LogTarget[lts-1] == '+' ) - targetMode = TTMMatchGreaterV; - else if ( _LogTarget[lts-1] == '-' ) - targetMode = TTMMatchLowerV; - else - { - targetMode = TTMMatchExactV; - additionalChars = 0; - } - - NLMISC::fromString( _LogTarget.substr( 1, lts-additionalChars-1 ), targetVersion ); - } - else - { - nlwarning( "Invalid log target argument: %s", _LogTarget.c_str() ); - _Complete = true; - return; - } - - // Get log files and sort them - vector filenames; - vector filenamesOfPath; - for ( vector::const_iterator ilf=_LogPaths.begin(); ilf!=_LogPaths.end(); ++ilf ) - { - string path = (*ilf); - if ( (! path.empty()) && (path[path.size()-1]!='/') ) - path += "/"; - filenamesOfPath.clear(); - CPath::getPathContent( path, false, false, true, filenamesOfPath, NULL, true ); - vector::iterator ilf2 = partition( filenamesOfPath.begin(), filenamesOfPath.end(), isLogFile ); - filenamesOfPath.erase( ilf2, filenamesOfPath.end() ); - sortLogFiles( filenamesOfPath ); - filenames.insert( filenames.end(), filenamesOfPath.begin(), filenamesOfPath.end() ); - } - - // Analyse log files - _OutputLogReport->reset(); - uint nbLines = 0; - char line [MAX_LOG_LINE_SIZE]; - - uint nbSkippedFiles = 0; - for ( vector::const_iterator ilf=filenames.begin(); ilf!=filenames.end(); ++ilf ) - { - string shortname = CFile::getFilename( *ilf ); - - // Filter log files based on filename before opening them - if ( ! matchLogTarget( shortname, targetMode, targetVersion ) ) - { - ++nbSkippedFiles; - continue; - } - - nlinfo( "Processing %s (%u/%u)", (*ilf).c_str(), ilf-filenames.begin(), filenames.size() ); - CIFile logfile; - if ( logfile.open( *ilf, true ) ) - { - _OutputLogReport->setProgress( (uint)(ilf-filenames.begin()), (uint)filenames.size() ); - while ( ! logfile.eof() ) - { - logfile.getline( line, MAX_LOG_LINE_SIZE ); - line[MAX_LOG_LINE_SIZE-1] = '\0'; // force valid end of line - _OutputLogReport->pushLine( line ); - ++nbLines; - - if ( isStopping() ) - return; - } - } - } - nlinfo( "%u lines processed", nbLines ); - if ( nbSkippedFiles != 0 ) - nlinfo( "%u log files skipped, not matching target %s", nbSkippedFiles, _LogTarget.c_str() ); - _Complete = true; -} - - -/* - * Add a log line to the report tree - */ -void CLogReport::pushLine( const std::string& line, NLMISC::CLog::TLogType onlyType, bool countOtherTypes ) -{ - // Ignore session title - if ( (line.size() > 14) && (line.substr( 0, 14 ) == "Log Starting [") ) - return; - - // Decode standard log line - vector lineTokens; - explode( line, string(" "), lineTokens ); - - if ( lineTokens.size() < LH_NB_FIELDS ) - return; - - // Filter log type - if ( onlyType != CLog::LOG_UNKNOWN ) - { - if ( lineTokens[LHType] != IDisplayer::logTypeToString( onlyType ) ) - { - if ( countOtherTypes ) - storeLine( lineTokens, true ); - return; - } - } - - // Store - storeLine( lineTokens, false ); -} - - -/* - * - */ -void CLogReportNode::storeLine( const std::vector& lineTokens, bool mainCountOnly ) -{ - // Get service name from "[machine/]serviceName-serviceId" - string service = lineTokens[LHService]; - string::size_type p = service.find( '/' ); - if ( p != string::npos ) - service = service.substr( p+1 ); - p = service.find( '-' ); - if ( p != string::npos ) - service = service.substr( 0, p ); - - // Store to appropriate child - CLogReportLeaf *child = getChild( service ); - if ( ! child ) - child = addChild( service ); - child->storeLine( lineTokens, mainCountOnly ); -} - - -/* - * - */ -void CLogReportLeaf::storeLine( const std::vector& lineTokens, bool mainCountOnly ) -{ - if ( ! mainCountOnly ) - { - // Build key from "codeFile codeLine" - string key = lineTokens[LHCodeFile] + ":" + lineTokens[LHCodeLine]; - _LogLineInfo[key].addAnOccurence( lineTokens ); - } - ++_Counts[lineTokens[LHType]]; - ++_TotalLines; -} - - -/* - * - */ -void CLogLineInfo::addAnOccurence( const std::vector& lineTokens ) -{ - if ( NbOccurences == 0 ) - { - for ( uint i=LH_NB_FIELDS; ireport( targetLog, true ); - } - else - { - targetLog->displayNL( "Nothing found for service %s", service.c_str() ); - } -} - - -/* - * Get results for a service (all distinct lines, sorted by occurence) - */ -void CLogReportLeaf::report( NLMISC::CLog *targetLog, bool ) -{ - // Sort it - typedef multimap< uint, pair< string, const CLogLineInfo * >, std::greater > CSortedByOccurenceLogLineInfoMap; - CSortedByOccurenceLogLineInfoMap sortedByOccurence; - for ( CLogLineInfoMap::const_iterator it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) - { - const string &key = (*it).first; - const CLogLineInfo& info = (*it).second; - sortedByOccurence.insert( make_pair( info.NbOccurences, make_pair( key, &info ) ) ); - } - - // Display it - for ( CSortedByOccurenceLogLineInfoMap::const_iterator iso=sortedByOccurence.begin(); iso!=sortedByOccurence.end(); ++iso ) - { - const string &key = (*iso).second.first; - const CLogLineInfo& info = *((*iso).second.second); - targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); - } -} - - -/* - * Return the number of lines displayed - */ -uint CLogReportLeaf::reportPart( uint beginIndex, uint maxNbLines, NLMISC::CLog *targetLog ) -{ - uint i = 0; - CLogLineInfoMap::const_iterator it; - for ( it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) - { - if ( i >= beginIndex ) - { - if ( i >= maxNbLines ) - return i - beginIndex; - - const string &key = (*it).first; - const CLogLineInfo& info = (*it).second; - targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); - } - ++i; - } - return i - beginIndex; -} - - -/* - * Get summary of results - */ -void CLogReportNode::report( NLMISC::CLog *targetLog, bool displayDetailsPerService ) -{ - uint nb1Sum=0, nb2Sum=0; - for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) - { - CLogReportLeaf *pt = (*it); - - // Get distinct warnings - uint nb1 = pt->getNbDistinctLines(); - nb1Sum += nb1; - - // Get total warnings, info... but filter out lines with no header - uint sumTotalLinesNotUnknown = 0; - uint nbTotalLines [CLog::LOG_UNKNOWN]; - for ( uint i=CLog::LOG_ERROR; i!=CLog::LOG_UNKNOWN; ++i ) - { - nbTotalLines[i] = pt->getNbTotalLines( (CLog::TLogType)i ); - sumTotalLinesNotUnknown += nbTotalLines[i]; - } - if ( sumTotalLinesNotUnknown != 0 ) - { - targetLog->displayRawNL( "%s: \t%u distinct WRN, %u total WRN, %u INF, %u DBG, %u STT, %u AST, %u ERR, %u TOTAL", - pt->service().c_str(), nb1, nbTotalLines[CLog::LOG_WARNING], - nbTotalLines[CLog::LOG_INFO], nbTotalLines[CLog::LOG_DEBUG], - nbTotalLines[CLog::LOG_STAT], nbTotalLines[CLog::LOG_ASSERT], - nbTotalLines[CLog::LOG_ERROR], pt->getNbTotalLines( CLog::LOG_UNKNOWN ) ); - nb2Sum += nbTotalLines[CLog::LOG_WARNING]; - } - } - targetLog->displayRawNL( "=> %u distinct, %u total WRN (%u pages)", nb1Sum, nb2Sum, nb1Sum / NB_LINES_PER_PAGE + 1 ); - - if ( displayDetailsPerService ) - { - for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) - { - (*it)->report( targetLog, true ); - } - } -} - - -/* - * Get partial results (pageNum>=1) - */ -void CLogReportNode::reportPage( uint pageNum, NLMISC::CLog *targetLog ) -{ - if ( _Children.empty() ) - { - targetLog->displayRawNL( "[END OF LOG]" ); - return; - } - - uint beginIndex = pageNum * NB_LINES_PER_PAGE; - uint lineCounter = 0, prevLineCounter; - for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) - { - CLogReportLeaf *pt = (*it); - prevLineCounter = lineCounter; - lineCounter += pt->getNbDistinctLines(); - if ( lineCounter >= beginIndex ) - { - uint remainingLines = pageNum - (lineCounter - beginIndex ); - pt->reportPart( beginIndex - prevLineCounter, remainingLines, targetLog ); // - while ( remainingLines != 0 ) - { - ++it; - if ( it == _Children.end() ) - { - targetLog->displayRawNL( "[END OF LOG]" ); - return; - } - pt = (*it); - remainingLines -= pt->reportPart( 0, remainingLines, targetLog ); - } - return; - } - } -} +// NeLNS - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +#include "log_report.h" +#include +#include +#include "nel/misc/common.h" +#include "nel/misc/displayer.h" +#include "nel/misc/file.h" +#include "nel/misc/path.h" +#include "nel/misc/variable.h" + +using namespace NLMISC; +using namespace std; + + +CVariable LogPath( "LogReport","LogPath", "Path of the log files", ".", 0, true ); + +const uint MAX_LOG_LINE_SIZE = 1024; +//nlctassert(MAX_LOG_LINE_SIZE>0); + +enum TLogLineHeader { LHDate, LHTime, LHType, LHThread, LHService, LHCodeFile, LHCodeLine, LHSeparator, LH_NB_FIELDS }; + + +/// +bool isLogFile( const std::string& filename ) +{ + uint len = (uint)filename.size(); + return (len >= 4 ) && (filename.substr( len-4 ) == ".log"); +} + +/// +inline bool isNumberChar( char c ) +{ + return (c >= '0') && (c <= '9'); +} + +/// +void sortLogFiles( vector& filenames ) +{ + uint i; + for ( i=0; i!=filenames.size(); ++i ) + { + // Ensure that a log file without number comes *after* the ones with a number + string name = string(filenames[i]); + string::size_type dotpos = name.find_last_of('.'); + if ( (dotpos!=string::npos) && (dotpos > 2) ) + { + if ( ! (isNumberChar(name[dotpos-1]) && isNumberChar(name[dotpos-2]) && isNumberChar(name[dotpos-3])) ) + { + name = name.substr( 0, dotpos ) + "ZZZ" + name.substr( dotpos ); + filenames[i] = name.c_str(); + } + } + } + sort( filenames.begin(), filenames.end() ); + for ( i=0; i!=filenames.size(); ++i ) + { + // Set the original names back + string name = filenames[i]; + string::size_type tokenpos = name.find( "ZZZ." ); + if ( tokenpos != string::npos ) + { + name = name.substr( 0, tokenpos ) + name.substr( tokenpos + 3 ); + filenames[i] = name.c_str(); + } + } +} + +void CMakeLogTask::setLogPath(const std::string & logPath) +{ + _LogPaths.resize( 1 ); + _LogPaths[0] = logPath; +} + +void CMakeLogTask::setLogPaths(const std::vector& logPaths) +{ + _LogPaths = logPaths; +} + +void CMakeLogTask::setLogPathToDefault() +{ + setLogPath( LogPath.get() ); +} + +/* + * + */ +CMakeLogTask::~CMakeLogTask() +{ + if ( _Thread ) // implies && _OutputLogReport + { + if ( ! _Complete ) + { + pleaseStop(); + _Thread->wait(); + } + clear(); + } +} + + +/* + * + */ +void CMakeLogTask::start() +{ + if ( _Thread ) + { + if ( _Complete ) + clear(); + else + return; + } + _Stopping = false; + _Complete = false; + _Thread = NLMISC::IThread::create( this ); + _OutputLogReport = new CLogReport(); + _Thread->start(); +} + + +/* + * + */ +void CMakeLogTask::clear() +{ + if (_Thread) + { + delete _Thread; + _Thread = NULL; + } + if (_OutputLogReport) + { + delete _OutputLogReport; + _OutputLogReport = NULL; + } +} + +/* + * + */ +void CMakeLogTask::terminateTask() +{ + if (!_Thread) // _Thread _implies _OutputLogReport + return; + + pleaseStop(); + _Thread->wait(); + + clear(); +} + +// +bool isOfLogDotLogFamily( const std::string& filename ) +{ + return ((filename == "log.log") || + ((filename.size() == 10) && + (filename.substr( 0, 3 ) == "log") && + isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]) && + (filename.substr( 6, 4 ) == ".log")) ); +} + + +enum TVersionTargetMode { TTMAll, TTMMatchAllV, TTMMatchExactV, TTMMatchGreaterV, TTMMatchLowerV } targetMode; +const uint CurrentVersion = std::numeric_limits::max(); + +// Return true and logVersion, or false if not a log with version +bool getLogVersion( const std::string& filename, uint& logVersion ) +{ + uint len = (uint)filename.size(); + if ( (len > 4) && (filename.substr( len-4 ) == ".log") ) + { + if ( filename.substr(0, 3) == "log" ) + { + if ( (len == 7) || + ((len == 10) && (isNumberChar(filename[3]) && isNumberChar(filename[4]) && isNumberChar(filename[5]))) ) + { + logVersion = CurrentVersion; + return true; + } + } + else if ( filename[0] == 'v' ) + { + string::size_type p = filename.find( "_", 1 ); + if ( p != string::npos ) + { + if ( (len == p + 8) || + ((len == p + 11) && (isNumberChar(filename[p+4]) && isNumberChar(filename[p+5]) && isNumberChar(filename[p+6]))) ) + { + NLMISC::fromString( filename.substr( 1, p-1 ), logVersion ); + return true; + } + } + } + } + return false; +} + +// Assumes filename is .log file +bool matchLogTarget( const std::string& filename, TVersionTargetMode targetMode, uint targetVersion ) +{ + if ( targetMode == TTMAll ) + return true; + + uint version; + + // Get version or exclude non-standard log files + if ( ! getLogVersion( filename, version ) ) + return false; + + // Exclude non-matching version + switch ( targetMode ) + { + case TTMMatchExactV: + return (version == targetVersion); // break; + case TTMMatchGreaterV: + return (version >= targetVersion); // break; + case TTMMatchLowerV: + return (version <= targetVersion); // break; + default: // TTMMatchAllV + return true; + } +} + +/* + * + */ +void CMakeLogTask::run() +{ + // Parse log target + uint targetVersion = CurrentVersion; + uint lts = (uint)_LogTarget.size(); + if ( _LogTarget.empty() || (_LogTarget == "v") ) + { + targetMode = TTMMatchExactV; + } + else if ( _LogTarget == "v*" ) + { + targetMode = TTMMatchAllV; + } + else if ( _LogTarget == "*" ) + { + targetMode = TTMAll; + } + else if ( (lts > 1) && (_LogTarget[0] == 'v') ) + { + uint additionalChars = 1; + if ( _LogTarget[lts-1] == '+' ) + targetMode = TTMMatchGreaterV; + else if ( _LogTarget[lts-1] == '-' ) + targetMode = TTMMatchLowerV; + else + { + targetMode = TTMMatchExactV; + additionalChars = 0; + } + + NLMISC::fromString( _LogTarget.substr( 1, lts-additionalChars-1 ), targetVersion ); + } + else + { + nlwarning( "Invalid log target argument: %s", _LogTarget.c_str() ); + _Complete = true; + return; + } + + // Get log files and sort them + vector filenames; + vector filenamesOfPath; + for ( vector::const_iterator ilf=_LogPaths.begin(); ilf!=_LogPaths.end(); ++ilf ) + { + string path = (*ilf); + if ( (! path.empty()) && (path[path.size()-1]!='/') ) + path += "/"; + filenamesOfPath.clear(); + CPath::getPathContent( path, false, false, true, filenamesOfPath, NULL, true ); + vector::iterator ilf2 = partition( filenamesOfPath.begin(), filenamesOfPath.end(), isLogFile ); + filenamesOfPath.erase( ilf2, filenamesOfPath.end() ); + sortLogFiles( filenamesOfPath ); + filenames.insert( filenames.end(), filenamesOfPath.begin(), filenamesOfPath.end() ); + } + + // Analyse log files + _OutputLogReport->reset(); + uint nbLines = 0; + char line [MAX_LOG_LINE_SIZE]; + + uint nbSkippedFiles = 0; + for ( vector::const_iterator ilf=filenames.begin(); ilf!=filenames.end(); ++ilf ) + { + string shortname = CFile::getFilename( *ilf ); + + // Filter log files based on filename before opening them + if ( ! matchLogTarget( shortname, targetMode, targetVersion ) ) + { + ++nbSkippedFiles; + continue; + } + + nlinfo( "Processing %s (%u/%u)", (*ilf).c_str(), ilf-filenames.begin(), filenames.size() ); + CIFile logfile; + if ( logfile.open( *ilf, true ) ) + { + _OutputLogReport->setProgress( (uint)(ilf-filenames.begin()), (uint)filenames.size() ); + while ( ! logfile.eof() ) + { + logfile.getline( line, MAX_LOG_LINE_SIZE ); + line[MAX_LOG_LINE_SIZE-1] = '\0'; // force valid end of line + _OutputLogReport->pushLine( line ); + ++nbLines; + + if ( isStopping() ) + return; + } + } + } + nlinfo( "%u lines processed", nbLines ); + if ( nbSkippedFiles != 0 ) + nlinfo( "%u log files skipped, not matching target %s", nbSkippedFiles, _LogTarget.c_str() ); + _Complete = true; +} + + +/* + * Add a log line to the report tree + */ +void CLogReport::pushLine( const std::string& line, NLMISC::CLog::TLogType onlyType, bool countOtherTypes ) +{ + // Ignore session title + if ( (line.size() > 14) && (line.substr( 0, 14 ) == "Log Starting [") ) + return; + + // Decode standard log line + vector lineTokens; + explode( line, string(" "), lineTokens ); + + if ( lineTokens.size() < LH_NB_FIELDS ) + return; + + // Filter log type + if ( onlyType != CLog::LOG_UNKNOWN ) + { + if ( lineTokens[LHType] != IDisplayer::logTypeToString( onlyType ) ) + { + if ( countOtherTypes ) + storeLine( lineTokens, true ); + return; + } + } + + // Store + storeLine( lineTokens, false ); +} + + +/* + * + */ +void CLogReportNode::storeLine( const std::vector& lineTokens, bool mainCountOnly ) +{ + // Get service name from "[machine/]serviceName-serviceId" + string service = lineTokens[LHService]; + string::size_type p = service.find( '/' ); + if ( p != string::npos ) + service = service.substr( p+1 ); + p = service.find( '-' ); + if ( p != string::npos ) + service = service.substr( 0, p ); + + // Store to appropriate child + CLogReportLeaf *child = getChild( service ); + if ( ! child ) + child = addChild( service ); + child->storeLine( lineTokens, mainCountOnly ); +} + + +/* + * + */ +void CLogReportLeaf::storeLine( const std::vector& lineTokens, bool mainCountOnly ) +{ + if ( ! mainCountOnly ) + { + // Build key from "codeFile codeLine" + string key = lineTokens[LHCodeFile] + ":" + lineTokens[LHCodeLine]; + _LogLineInfo[key].addAnOccurence( lineTokens ); + } + ++_Counts[lineTokens[LHType]]; + ++_TotalLines; +} + + +/* + * + */ +void CLogLineInfo::addAnOccurence( const std::vector& lineTokens ) +{ + if ( NbOccurences == 0 ) + { + for ( uint i=LH_NB_FIELDS; ireport( targetLog, true ); + } + else + { + targetLog->displayNL( "Nothing found for service %s", service.c_str() ); + } +} + + +/* + * Get results for a service (all distinct lines, sorted by occurence) + */ +void CLogReportLeaf::report( NLMISC::CLog *targetLog, bool ) +{ + // Sort it + typedef multimap< uint, pair< string, const CLogLineInfo * >, std::greater > CSortedByOccurenceLogLineInfoMap; + CSortedByOccurenceLogLineInfoMap sortedByOccurence; + for ( CLogLineInfoMap::const_iterator it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) + { + const string &key = (*it).first; + const CLogLineInfo& info = (*it).second; + sortedByOccurence.insert( make_pair( info.NbOccurences, make_pair( key, &info ) ) ); + } + + // Display it + for ( CSortedByOccurenceLogLineInfoMap::const_iterator iso=sortedByOccurence.begin(); iso!=sortedByOccurence.end(); ++iso ) + { + const string &key = (*iso).second.first; + const CLogLineInfo& info = *((*iso).second.second); + targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); + } +} + + +/* + * Return the number of lines displayed + */ +uint CLogReportLeaf::reportPart( uint beginIndex, uint maxNbLines, NLMISC::CLog *targetLog ) +{ + uint i = 0; + CLogLineInfoMap::const_iterator it; + for ( it=_LogLineInfo.begin(); it!=_LogLineInfo.end(); ++it ) + { + if ( i >= beginIndex ) + { + if ( i >= maxNbLines ) + return i - beginIndex; + + const string &key = (*it).first; + const CLogLineInfo& info = (*it).second; + targetLog->displayRawNL( "%s %6u %s : %s", _Service.c_str(), info.NbOccurences, key.c_str(), info.SampleLogText.c_str() ); + } + ++i; + } + return i - beginIndex; +} + + +/* + * Get summary of results + */ +void CLogReportNode::report( NLMISC::CLog *targetLog, bool displayDetailsPerService ) +{ + uint nb1Sum=0, nb2Sum=0; + for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) + { + CLogReportLeaf *pt = (*it); + + // Get distinct warnings + uint nb1 = pt->getNbDistinctLines(); + nb1Sum += nb1; + + // Get total warnings, info... but filter out lines with no header + uint sumTotalLinesNotUnknown = 0; + uint nbTotalLines [CLog::LOG_UNKNOWN]; + for ( uint i=CLog::LOG_ERROR; i!=CLog::LOG_UNKNOWN; ++i ) + { + nbTotalLines[i] = pt->getNbTotalLines( (CLog::TLogType)i ); + sumTotalLinesNotUnknown += nbTotalLines[i]; + } + if ( sumTotalLinesNotUnknown != 0 ) + { + targetLog->displayRawNL( "%s: \t%u distinct WRN, %u total WRN, %u INF, %u DBG, %u STT, %u AST, %u ERR, %u TOTAL", + pt->service().c_str(), nb1, nbTotalLines[CLog::LOG_WARNING], + nbTotalLines[CLog::LOG_INFO], nbTotalLines[CLog::LOG_DEBUG], + nbTotalLines[CLog::LOG_STAT], nbTotalLines[CLog::LOG_ASSERT], + nbTotalLines[CLog::LOG_ERROR], pt->getNbTotalLines( CLog::LOG_UNKNOWN ) ); + nb2Sum += nbTotalLines[CLog::LOG_WARNING]; + } + } + targetLog->displayRawNL( "=> %u distinct, %u total WRN (%u pages)", nb1Sum, nb2Sum, nb1Sum / NB_LINES_PER_PAGE + 1 ); + + if ( displayDetailsPerService ) + { + for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) + { + (*it)->report( targetLog, true ); + } + } +} + + +/* + * Get partial results (pageNum>=1) + */ +void CLogReportNode::reportPage( uint pageNum, NLMISC::CLog *targetLog ) +{ + if ( _Children.empty() ) + { + targetLog->displayRawNL( "[END OF LOG]" ); + return; + } + + uint beginIndex = pageNum * NB_LINES_PER_PAGE; + uint lineCounter = 0, prevLineCounter; + for ( std::vector::const_iterator it=_Children.begin(); it!=_Children.end(); ++it ) + { + CLogReportLeaf *pt = (*it); + prevLineCounter = lineCounter; + lineCounter += pt->getNbDistinctLines(); + if ( lineCounter >= beginIndex ) + { + uint remainingLines = pageNum - (lineCounter - beginIndex ); + pt->reportPart( beginIndex - prevLineCounter, remainingLines, targetLog ); // + while ( remainingLines != 0 ) + { + ++it; + if ( it == _Children.end() ) + { + targetLog->displayRawNL( "[END OF LOG]" ); + return; + } + pt = (*it); + remainingLines -= pt->reportPart( 0, remainingLines, targetLog ); + } + return; + } + } +} diff --git a/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt b/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt index bf2096b9a..1183a7b74 100644 --- a/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt +++ b/code/nelns/login_system/nel_launcher_qt/CMakeLists.txt @@ -1,37 +1,40 @@ -INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR}/login_system/nel_launcher_qt/ ) -INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/login_system/nel_launcher_qt/ ) -INCLUDE( ${QT_USE_FILE} ) - -FILE(GLOB NEL_LAUNCHER_SRC *.cpp) -SET(NEL_LAUNCHER_HDR nel_launcher_dlg.h) -SET(NEL_LAUNCHER_UIS nel_launcher_dlg.ui) -SET(NEL_LAUNCHER_RCS ) - -SET( QT_USE_QT3SUPPORT TRUE) -SET( QT_USE_QTXML TRUE) - -QT4_ADD_RESOURCES( NEL_LAUNCHER_RC_SRCS ${NEL_LAUNCHER_RCS} ) -QT4_WRAP_UI( NEL_LAUNCHER_UI_HDRS ${NEL_LAUNCHER_UIS} ) -QT4_WRAP_CPP( NEL_LAUNCHER_MOC_SRCS ${NEL_LAUNCHER_HDR}) - -ADD_EXECUTABLE(nel_launcher_qt WIN32 ${NEL_LAUNCHER_SRC} ${NEL_LAUNCHER_MOC_SRCS} ${NEL_LAUNCHER_RC_SRCS} ${NEL_LAUNCHER_UI_HDRS}) - -INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${QT_INCLUDES}) - -TARGET_LINK_LIBRARIES(nel_launcher_qt - ${LIBXML2_LIBRARIES} - ${QT_LIBRARIES} - nelmisc - nelnet) - -NL_DEFAULT_PROPS(nel_launcher_qt "NelNS, Launcher: NeL Launcher Qt") -NL_ADD_RUNTIME_FLAGS(nel_launcher_qt) - -ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) - -INSTALL(TARGETS nel_launcher_qt RUNTIME DESTINATION bin COMPONENT launcher) -IF(WIN32) - INSTALL(FILES nel_launcher.cfg DESTINATION bin COMPONENT launcher) -ELSE(WIN32) - INSTALL(FILES nel_launcher.cfg DESTINATION etc/nel/nelns COMPONENT launcher) -ENDIF(WIN32) \ No newline at end of file +INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${QT_INCLUDES}) + +INCLUDE( ${QT_USE_FILE} ) + +FILE(GLOB NEL_LAUNCHER_SRC *.cpp) +SET(NEL_LAUNCHER_HDR nel_launcher_dlg.h) +SET(NEL_LAUNCHER_UIS nel_launcher_dlg.ui) +SET(NEL_LAUNCHER_RCS ) + +SET( QT_USE_QT3SUPPORT TRUE) +SET( QT_USE_QTXML TRUE) + +QT4_ADD_RESOURCES( NEL_LAUNCHER_RC_SRCS ${NEL_LAUNCHER_RCS} ) +QT4_WRAP_UI( NEL_LAUNCHER_UI_HDRS ${NEL_LAUNCHER_UIS} ) +QT4_WRAP_CPP( NEL_LAUNCHER_MOC_SRCS ${NEL_LAUNCHER_HDR}) + +ADD_EXECUTABLE(nel_launcher_qt WIN32 ${NEL_LAUNCHER_SRC} ${NEL_LAUNCHER_MOC_SRCS} ${NEL_LAUNCHER_RC_SRCS} ${NEL_LAUNCHER_UI_HDRS}) + +INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR} ${QT_INCLUDES}) + +TARGET_LINK_LIBRARIES(nel_launcher_qt + ${LIBXML2_LIBRARIES} + ${QT_LIBRARIES} + nelmisc + nelnet) + +NL_DEFAULT_PROPS(nel_launcher_qt "NelNS, Launcher: NeL Launcher Qt") +NL_ADD_RUNTIME_FLAGS(nel_launcher_qt) + +ADD_DEFINITIONS(${LIBXML2_DEFINITIONS} ${QT_DEFINITIONS}) + +INSTALL(TARGETS nel_launcher_qt RUNTIME DESTINATION bin COMPONENT launcher) +IF(WIN32) + INSTALL(FILES nel_launcher.cfg DESTINATION bin COMPONENT launcher) +ELSE(WIN32) + INSTALL(FILES nel_launcher.cfg DESTINATION etc/nel/nelns COMPONENT launcher) +ENDIF(WIN32) diff --git a/code/snowballs2/CMakeLists.txt b/code/snowballs2/CMakeLists.txt index 0f158fb88..0007259ee 100644 --- a/code/snowballs2/CMakeLists.txt +++ b/code/snowballs2/CMakeLists.txt @@ -1,177 +1,27 @@ -#-----------------------------------------------------------------------------^M -# Set CMake 2.6 Policies. -IF(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -ENDIF(COMMAND cmake_policy) - - -#----------------------------------------------------------------------------- -# Set default config options -# -NL_SETUP_DEFAULT_OPTIONS() -NL_SETUP_PREFIX_PATHS() - -#----------------------------------------------------------------------------- -# Override default options -OPTION(BUILD_CLIENT "Build the Snowballs Client" ON) -OPTION(ENABLE_SOUND "Enable sound in the Snowballs Client" OFF) - -OPTION(BUILD_SERVER "Build the Snowballs Servers" ON) SET(SNOWBALLS_CONFIG_FILE "${NL_ETC_PREFIX}/snowballs" CACHE FILEPATH "Snowballs config file location") SET(SNOWBALLS_DATA_FILE "${NL_SHARE_PREFIX}/games/snowballs" CACHE FILEPATH "Snowballs data file location") SET(SNOWBALLS_LOG_FILE "${NL_LOG_PREFIX}/snowballs" CACHE FILEPATH "Snowballs log file location") -INSTALL(CODE "FILE(MAKE_DIRECTORY ${SNOWBALLS_LOG_FILE})") + +# Note: Not sure if this is still the best way to do this... +#INSTALL(CODE "FILE(MAKE_DIRECTORY ${SNOWBALLS_LOG_FILE})") #----------------------------------------------------------------------------- #Platform specifics -FIND_PACKAGE(Threads REQUIRED) -FIND_PACKAGE(LibXml2 REQUIRED) -FIND_PACKAGE(PNG REQUIRED) - -NL_SETUP_BUILD() - -FIND_PACKAGE(NeL COMPONENTS nelmisc nelgeorges nel3d nelnet nelpacs REQUIRED) -FIND_PACKAGE(NeLNS COMPONENTS naming_service login_service welcome_service nel_launcher_qt) - ### # An example of finding NeL 3D and CEGUI Renderer. ### -IF(BUILD_CLIENT) - FIND_PACKAGE(FreeType) - FIND_PACKAGE(Jpeg) - - IF(ENABLE_SOUND) - FIND_PACKAGE(NeL COMPONENTS nelsound) - ENDIF(ENABLE_SOUND) -ENDIF(BUILD_CLIENT) - -IF(WIN32) - INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) - SET(WINSOCK2_LIB ws2_32.lib) -ENDIF(WIN32) - -NL_SETUP_BUILD_FLAGS() - ADD_DEFINITIONS(-DSNOWBALLS_CONFIG="${SNOWBALLS_CONFIG_FILE}/" -DSNOWBALLS_STATE="${SNOWBALLS_LOG_FILE}/" -DSNOWBALLS_LOGS="${SNOWBALLS_LOG_FILE}/") -IF(BUILD_CLIENT) +IF(WITH_SNOWBALLS_CLIENT) ADD_SUBDIRECTORY(client) -ENDIF(BUILD_CLIENT) +ENDIF(WITH_SNOWBALLS_CLIENT) -IF(BUILD_SERVER) +IF(WITH_SNOWBALLS_SERVER) ADD_SUBDIRECTORY(server) -ENDIF(BUILD_SERVER) +ENDIF(WITH_SNOWBALLS_SERVER) -# packaging information -SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework - Snowballs Demo") -SET(CPACK_PACKAGE_VENDOR "NeL") -SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README) -SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) -SET(CPACK_PACKAGE_VERSION_MAJOR "${SB_VERSION_MAJOR}") -SET(CPACK_PACKAGE_VERSION_MINOR "${SB_VERSION_MINOR}") -SET(CPACK_PACKAGE_VERSION_PATCH "${SB_VERSION_PATCH}") -SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};Snowballs;ALL;/") -SET(CPACK_PACKAGE_EXECUTABLES "snowballs-${SB_VERSION}" "snowballs") +IF(WITH_SNOWBALLS_PACKAGE) + INCLUDE(CMakePackaging.txt) +ENDIF(WITH_SNOWBALLS_PACKAGE) -# NSIS Specific Packing Setup -SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Snowballs") -SET(CPACK_NSIS_MODIFY_PATH "ON") -SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) -SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) -SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp) -SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Snowballs") -SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") -SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") -SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com") - -## Source Packages -SET(CPACK_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") -SET(CPACK_SOURCE_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") -IF(WIN32) - SET(CPACK_GENERATOR "NSIS") - SET(CPACK_SOURCE_GENERATOR "ZIP") -ELSE(WIN32) - SET(CPACK_GENERATOR "TGZ") - SET(CPACK_SOURCE_GENERATOR "TGZ") -ENDIF(WIN32) -set(CPACK_SOURCE_IGNORE_FILES - "~$" - "\\\\.cvsignore$" - "^${CMAKE_SOURCE_DIR}.*/CVS/" - "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/" - "^${CMAKE_SOURCE_DIR}/debian/" - "^${CMAKE_SOURCE_DIR}/old/") -IF(WIN32) - IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") - # Install "Debug" specific stuff here. - SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) - message(status "install debug libraries.") - ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release") - # Install "Release" Specific stuff here. - SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) - ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") - - IF(BUILD_CLIENT) - # Needed to find dependencies for nel_launcher_qt. - FIND_PACKAGE(Qt4 REQUIRED) - - # Install Qt dependencies for the launcher. - INCLUDE(${QT_USE_FILE}) - INSTALL(FILES - "${QT_LIBRARY_DIR}/QtGuid4.dll" - "${QT_LIBRARY_DIR}/QtXmld4.dll" - "${QT_LIBRARY_DIR}/QtCored4.dll" - DESTINATION bin) - - # Install the Qt Launcher. - INSTALL(FILES ${NELNS_NEL_LAUNCHER_BIN} DESTINATION bin COMPONENT snowballsclient) - - # Install the sound/video drivers - INSTALL(FILES ${NELDRVOPENGL_DLL} ${NELDRVDIRECT3D_DLL} DESTINATION bin COMPONENT snowballsclient) - ENDIF(BUILD_CLIENT) - - IF(BUILD_SERVER) - INSTALL(FILES - ${NELNS_NAMING_SERVICE_BIN} - ${NELNS_NAMING_SERVICE_CFG} - ${NELNS_LOGIN_SERVICE_BIN} - ${NELNS_LOGIN_SERVICE_CFG} - ${NELNS_WELCOME_SERVICE_BIN} - ${NELNS_WELCOME_SERVICE_CFG} - DESTINATION sbin - COMPONENT services) - ENDIF(BUILD_SERVER) - - INCLUDE(InstallRequiredSystemLibraries) -ENDIF(WIN32) - -INCLUDE(CPack) - -cpack_add_install_type(Full DISPLAY_NAME "Full Install") -cpack_add_component_group(Client - EXPANDED - DESCRPTION "Snowballs Client") -cpack_add_component_group(Server - EXPANDED - DESCRPTION "Snowballs Services") -cpack_add_component(snowballsclient - DISPLAY_NAME "Snowballs Client Runtime" - DESCRIPTION "Hello World Application" - GROUP Application - INSTALL_TYPES Full) -cpack_add_component(Unspecified - DISPLAY_NAME "Application Runtime Libraries" - DESCRIPTION "Hello World Application Libraries" - GROUP Client - INSTALL_TYPES Full) -cpack_add_component(snowballsdata - DISPLAY_NAME "Snowballs Application Data" - DESCRIPTION "Snowballs Application Data" - GROUP Client - INSTALL_TYPES Full) -cpack_add_component(services - DISPLAY_NAME "Snowballs Services" - DESCRIPTION "Snowballs Services" - GROUP Server - INSTALL_TYPES Full) \ No newline at end of file diff --git a/code/snowballs2/CMakePackaging.txt b/code/snowballs2/CMakePackaging.txt new file mode 100644 index 000000000..eb564ba3b --- /dev/null +++ b/code/snowballs2/CMakePackaging.txt @@ -0,0 +1,113 @@ +# packaging information +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "NeL MMORPG Framework - Snowballs Demo") +SET(CPACK_PACKAGE_VENDOR "NeL") +SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_SOURCE_DIR}/README) +SET(CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/COPYING) +SET(CPACK_PACKAGE_VERSION_MAJOR "${SB_VERSION_MAJOR}") +SET(CPACK_PACKAGE_VERSION_MINOR "${SB_VERSION_MINOR}") +SET(CPACK_PACKAGE_VERSION_PATCH "${SB_VERSION_PATCH}") +SET(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};Snowballs;ALL;/") +SET(CPACK_PACKAGE_EXECUTABLES "snowballs-${SB_VERSION}" "snowballs") + +# NSIS Specific Packing Setup +SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "Snowballs") +SET(CPACK_NSIS_MODIFY_PATH "ON") +SET(CPACK_NSIS_MUI_ICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) +SET(CPACK_NSIS_MUI_UNIICON ${CMAKE_SOURCE_DIR}/resources/nevraxpill.ico) +SET(CPACK_PACKAGE_ICON ${CMAKE_SOURCE_DIR}/resources\\\\nel.bmp) +SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} Snowballs") +SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") +SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\dev.ryzom.com\\\\projects\\\\nel") +SET(CPACK_NSIS_CONTACT "matt.raykowski@gmail.com") + +## Source Packages +SET(CPACK_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") +SET(CPACK_SOURCE_PACKAGE_FILE_NAME "snowballs-${SB_VERSION}") +IF(WIN32) + SET(CPACK_GENERATOR "NSIS") + SET(CPACK_SOURCE_GENERATOR "ZIP") +ELSE(WIN32) + SET(CPACK_GENERATOR "TGZ") + SET(CPACK_SOURCE_GENERATOR "TGZ") +ENDIF(WIN32) +set(CPACK_SOURCE_IGNORE_FILES + "~$" + "\\\\.cvsignore$" + "^${CMAKE_SOURCE_DIR}.*/CVS/" + "^${CMAKE_SOURCE_DIR}.*/\\\\.svn/" + "^${CMAKE_SOURCE_DIR}/debian/" + "^${CMAKE_SOURCE_DIR}/old/") +IF(WIN32) + IF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") + # Install "Debug" specific stuff here. + SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) + message(status "install debug libraries.") + ELSE(NOT CMAKE_BUILD_TYPE STREQUAL "Release") + # Install "Release" Specific stuff here. + SET(CMAKE_INSTALL_DEBUG_LIBRARIES TRUE) + ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "Release") + + IF(BUILD_CLIENT) + # Needed to find dependencies for nel_launcher_qt. + FIND_PACKAGE(Qt4 REQUIRED) + + # Install Qt dependencies for the launcher. + INCLUDE(${QT_USE_FILE}) + INSTALL(FILES + "${QT_LIBRARY_DIR}/QtGuid4.dll" + "${QT_LIBRARY_DIR}/QtXmld4.dll" + "${QT_LIBRARY_DIR}/QtCored4.dll" + DESTINATION bin) + + # Install the Qt Launcher. + INSTALL(FILES ${NELNS_NEL_LAUNCHER_BIN} DESTINATION bin COMPONENT snowballsclient) + + # Install the sound/video drivers + INSTALL(FILES ${NELDRVOPENGL_DLL} ${NELDRVDIRECT3D_DLL} DESTINATION bin COMPONENT snowballsclient) + ENDIF(BUILD_CLIENT) + + IF(BUILD_SERVER) + INSTALL(FILES + ${NELNS_NAMING_SERVICE_BIN} + ${NELNS_NAMING_SERVICE_CFG} + ${NELNS_LOGIN_SERVICE_BIN} + ${NELNS_LOGIN_SERVICE_CFG} + ${NELNS_WELCOME_SERVICE_BIN} + ${NELNS_WELCOME_SERVICE_CFG} + DESTINATION sbin + COMPONENT services) + ENDIF(BUILD_SERVER) + + INCLUDE(InstallRequiredSystemLibraries) +ENDIF(WIN32) + +INCLUDE(CPack) + +cpack_add_install_type(Full DISPLAY_NAME "Full Install") +cpack_add_component_group(Client + EXPANDED + DESCRPTION "Snowballs Client") +cpack_add_component_group(Server + EXPANDED + DESCRPTION "Snowballs Services") +cpack_add_component(snowballsclient + DISPLAY_NAME "Snowballs Client Runtime" + DESCRIPTION "Hello World Application" + GROUP Application + INSTALL_TYPES Full) +cpack_add_component(Unspecified + DISPLAY_NAME "Application Runtime Libraries" + DESCRIPTION "Hello World Application Libraries" + GROUP Client + INSTALL_TYPES Full) +cpack_add_component(snowballsdata + DISPLAY_NAME "Snowballs Application Data" + DESCRIPTION "Snowballs Application Data" + GROUP Client + INSTALL_TYPES Full) +cpack_add_component(services + DISPLAY_NAME "Snowballs Services" + DESCRIPTION "Snowballs Services" + GROUP Server + INSTALL_TYPES Full) +