From ee36fd725c890c5156f1d777368eeb84d5a3922e Mon Sep 17 00:00:00 2001 From: flaviojs Date: Tue, 20 Mar 2012 16:59:07 +0000 Subject: - Fixed CMake compilation (libconfig integrated into common_base). - Chanced libconfig.h include directives to double-quoted form (never use the system version of libconfig.h). - Removed ShowError/ShowNotice from sig plugin (showmsg.c depends on core.c). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15737 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char/CMakeLists.txt | 4 ++-- src/common/CMakeLists.txt | 17 ++++++++++++++--- src/common/conf.c | 2 +- src/common/conf.h | 2 +- src/common/showmsg.h | 2 +- src/login/sql/CMakeLists.txt | 4 ++-- src/map/sql/CMakeLists.txt | 6 +++--- src/plugins/CMakeLists.txt | 8 +------- src/plugins/sig.c | 9 ++++----- src/tool/CMakeLists.txt | 2 +- 10 files changed, 30 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/char/CMakeLists.txt b/src/char/CMakeLists.txt index ccb718141..7f8cf2cc7 100644 --- a/src/char/CMakeLists.txt +++ b/src/char/CMakeLists.txt @@ -38,8 +38,8 @@ set( SQL_CHAR_SOURCES ) set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) -set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${LIBCONFIG_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( char FILES ${SQL_CHAR_HEADERS} ${SQL_CHAR_SOURCES} ) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index f7acda740..effd0b2ab 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -40,14 +40,17 @@ set( COMMON_MINI_HEADERS "${COMMON_SOURCE_DIR}/malloc.h" "${COMMON_SOURCE_DIR}/showmsg.h" "${COMMON_SOURCE_DIR}/strlib.h" + ${LIBCONFIG_HEADERS} # needed by showmsg.h CACHE INTERNAL "" ) set( COMMON_MINI_SOURCES "${COMMON_SOURCE_DIR}/core.c" "${COMMON_SOURCE_DIR}/malloc.c" "${COMMON_SOURCE_DIR}/showmsg.c" "${COMMON_SOURCE_DIR}/strlib.c" + ${LIBCONFIG_SOURCES} # needed by showmsg.c CACHE INTERNAL "" ) -set( COMMON_MINI_DEFINITIONS "-DMINICORE" CACHE INTERNAL "" ) +set( COMMON_MINI_INCLUDE_DIRS ${LIBCONFIG_INCLUDE_DIRS} CACHE INTERNAL "" ) +set( COMMON_MINI_DEFINITIONS "-DMINICORE ${LIBCONFIG_DEFINITIONS}" CACHE INTERNAL "" ) # @@ -75,6 +78,7 @@ set( COMMON_BASE_HEADERS "${COMMON_SOURCE_DIR}/strlib.h" "${COMMON_SOURCE_DIR}/timer.h" "${COMMON_SOURCE_DIR}/utils.h" + ${LIBCONFIG_HEADERS} # needed by conf.h/showmsg.h CACHE INTERNAL "common_base headers" ) set( COMMON_BASE_SOURCES "${COMMON_SOURCE_DIR}/conf.c" @@ -95,10 +99,17 @@ set( COMMON_BASE_SOURCES "${COMMON_SOURCE_DIR}/strlib.c" "${COMMON_SOURCE_DIR}/timer.c" "${COMMON_SOURCE_DIR}/utils.c" + ${LIBCONFIG_SOURCES} # needed by conf.c/showmsg.c CACHE INTERNAL "common_base sources" ) +set( COMMON_BASE_INCLUDE_DIRS + ${LIBCONFIG_INCLUDE_DIRS} + CACHE INTERNAL "common_base include dirs" ) +set( COMMON_BASE_DEFINITIONS + ${LIBCONFIG_DEFINITIONS} + CACHE INTERNAL "common_base definitions" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) -set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${LIBCONFIG_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" ) set( SOURCE_FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} ) source_group( mt19937ar FILES ${MT19937AR_HEADERS} ${MT19937AR_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_BASE_SOURCES} ) diff --git a/src/common/conf.c b/src/common/conf.c index eed39d409..a5bfec159 100644 --- a/src/common/conf.c +++ b/src/common/conf.c @@ -2,7 +2,7 @@ // For more information, see LICENCE in the main folder #include "conf.h" -#include +#include "libconfig.h" #include "../common/showmsg.h" // ShowError diff --git a/src/common/conf.h b/src/common/conf.h index 0b70a0c79..4c3dec89f 100644 --- a/src/common/conf.h +++ b/src/common/conf.h @@ -5,7 +5,7 @@ #define _CONF_H_ #include "../common/cbasetypes.h" -#include +#include "libconfig.h" int conf_read_file(config_t *config, const char *config_filename); int config_setting_copy(config_setting_t *parent, const config_setting_t *src); diff --git a/src/common/showmsg.h b/src/common/showmsg.h index 839f1dc7e..302ba5cd0 100644 --- a/src/common/showmsg.h +++ b/src/common/showmsg.h @@ -4,7 +4,7 @@ #ifndef _SHOWMSG_H_ #define _SHOWMSG_H_ -#include +#include "libconfig.h" // for help with the console colors look here: // http://www.edoceo.com/liberum/?doc=printf-with-color diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt index f1f7c7f23..1355f17ee 100644 --- a/src/login/sql/CMakeLists.txt +++ b/src/login/sql/CMakeLists.txt @@ -18,8 +18,8 @@ set( SQL_LOGIN_SOURCES ) set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) -set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${LIBCONFIG_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DWITH_SQL" ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS} -DWITH_SQL" ) set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_LOGIN_HEADERS} ${SQL_LOGIN_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( login FILES ${SQL_LOGIN_HEADERS} ${SQL_LOGIN_SOURCES} ) diff --git a/src/map/sql/CMakeLists.txt b/src/map/sql/CMakeLists.txt index 20383e320..0d33cb419 100644 --- a/src/map/sql/CMakeLists.txt +++ b/src/map/sql/CMakeLists.txt @@ -81,8 +81,8 @@ set( SQL_MAP_SOURCES ) set( DEPENDENCIES common_sql ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) -set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${LIBCONFIG_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS}" ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${COMMON_BASE_INCLUDE_DIRS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_BASE_DEFINITIONS}" ) if( WITH_PCRE ) message( STATUS "Enabled PCRE code" ) set( LIBRARIES ${LIBRARIES} ${PCRE_LIBRARIES} ) @@ -91,7 +91,7 @@ if( WITH_PCRE ) else() message( STATUS "Disabled PCRE code" ) endif() -set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_MAP_HEADERS} ${SQL_MAP_SOURCES} ${LIBCONFIG_HEADERS} ${LIBCONFIG_SOURCES} ) +set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ${SQL_MAP_HEADERS} ${SQL_MAP_SOURCES} ) source_group( common FILES ${COMMON_BASE_HEADERS} ${COMMON_SQL_HEADERS} ) source_group( map FILES ${SQL_MAP_HEADERS} ${SQL_MAP_SOURCES} ) include_directories( ${INCLUDE_DIRS} ) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 903a1ec6e..21ffc3994 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -151,17 +151,11 @@ option( BUILD_PLUGIN_sig "build sig plugin" OFF ) if( BUILD_PLUGIN_sig ) message( STATUS "Creating target sig" ) set( SIG_SOURCES - "${COMMON_SOURCE_DIR}/malloc.c" - "${COMMON_SOURCE_DIR}/malloc.h" - "${COMMON_SOURCE_DIR}/showmsg.c" - "${COMMON_SOURCE_DIR}/showmsg.h" - "${COMMON_SOURCE_DIR}/strlib.c" - "${COMMON_SOURCE_DIR}/strlib.h" "${CMAKE_CURRENT_SOURCE_DIR}/sig.c" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ) set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) -set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} -DNO_MEMMGR" ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DNO_MEMMGR" ) set( SOURCE_FILES ${SIG_SOURCES} ) source_group( sig FILES ${SIG_SOURCES} ) include_directories( ${INCLUDE_DIRS} ) diff --git a/src/plugins/sig.c b/src/plugins/sig.c index 8f7dead4b..04d07a496 100644 --- a/src/plugins/sig.c +++ b/src/plugins/sig.c @@ -7,7 +7,6 @@ #include #include #include "../common/plugin.h" -#include "../common/showmsg.h" PLUGIN_INFO = { "Signals", @@ -28,14 +27,14 @@ PLUGIN_EVENTS_TABLE = { #if defined(_WIN32) || defined(MINGW) int sig_init() { - ShowError("sig: This plugin is not supported - Enable 'exchndl' instead!\n"); + printf("sig: This plugin is not supported - Enable 'exchndl' instead!\n"); return 0; } int sig_final() { return 0; } #elif defined (__NETBSD__) || defined (__FREEBSD__) int sig_init() { - ShowError("sig: This plugin is not supported!\n"); + printf("sig: This plugin is not supported!\n"); return 0; } int sig_final() { return 0; } @@ -117,7 +116,7 @@ void sig_dump(int sn) size_t size; #endif - ShowNotice ("Dumping stack to '"CL_WHITE"%s"CL_RESET"'...\n", file); + printf ("sig: Dumping stack to '%s'...\n", file); if ((revision = getrevision()) != NULL) fprintf(fp, "Version: svn%s \n", revision); fprintf(fp, "Exception: %s \n", strsignal(sn)); @@ -136,7 +135,7 @@ void sig_dump(int sn) free(stack); #endif - ShowNotice("%s Saved.\n", file); + printf("sig: %s Saved.\n", file); fflush(stdout); fclose(fp); } diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt index 76840a367..a54ffa0e2 100644 --- a/src/tool/CMakeLists.txt +++ b/src/tool/CMakeLists.txt @@ -25,7 +25,7 @@ set( MAPCACHE_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/mapcache.c" ) set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ) -set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${LIBCONFIG_INCLUDE_DIRS} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_MINI_INCLUDE_DIRS} ) set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS}" ) set( SOURCE_FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ${MAPCACHE_SOURCES} ) source_group( common FILES ${COMMON_HEADERS} ${COMMON_SOURCES} ) -- cgit v1.2.3-60-g2f50