Explorar o código

- 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://svn.code.sf.net/p/rathena/svn/trunk@15737 54d463be-8e91-2dee-dedb-b68131a5f0ec

flaviojs %!s(int64=13) %!d(string=hai) anos
pai
achega
083ff3d160

+ 4 - 1
3rdparty/libconfig/CMakeLists.txt

@@ -23,4 +23,7 @@ set( LIBCONFIG_SOURCES
 	"${CMAKE_CURRENT_SOURCE_DIR}/scanctx.c"
 	"${CMAKE_CURRENT_SOURCE_DIR}/scanner.c"
 	"${CMAKE_CURRENT_SOURCE_DIR}/strbuf.c"
-	CACHE INTERNAL "libconfig sources" )
+	CACHE INTERNAL "libconfig sources" )
+set( LIBCONFIG_DEFINITIONS
+	"-DLIBCONFIG_STATIC"
+	CACHE INTERNAL "libconfig definitions" )

+ 2 - 2
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} )

+ 14 - 3
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} )

+ 1 - 1
src/common/conf.c

@@ -2,7 +2,7 @@
 // For more information, see LICENCE in the main folder
 
 #include "conf.h"
-#include <libconfig.h>
+#include "libconfig.h"
 
 #include "../common/showmsg.h" // ShowError
 

+ 1 - 1
src/common/conf.h

@@ -5,7 +5,7 @@
 #define _CONF_H_
 
 #include "../common/cbasetypes.h"
-#include <libconfig.h>
+#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);

+ 1 - 1
src/common/showmsg.h

@@ -4,7 +4,7 @@
 #ifndef _SHOWMSG_H_
 #define _SHOWMSG_H_
 
-#include <libconfig.h>
+#include "libconfig.h"
 
 // for help with the console colors look here:
 // http://www.edoceo.com/liberum/?doc=printf-with-color

+ 2 - 2
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} )

+ 3 - 3
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} )

+ 1 - 7
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} )

+ 4 - 5
src/plugins/sig.c

@@ -7,7 +7,6 @@
 #include <string.h>
 #include <time.h>
 #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);
 	}

+ 1 - 1
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} )