* Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14872 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
flaviojs 2011-06-29 12:26:51 +00:00
parent f4d8ec2ff0
commit 27799f566d
17 changed files with 1133 additions and 1 deletions

6
3rdparty/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,6 @@
add_subdirectory( msinttypes )
add_subdirectory( mt19937ar )
add_subdirectory( mysql )
add_subdirectory( pcre )
add_subdirectory( zlib )

7
3rdparty/msinttypes/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,7 @@
if( WIN32 )
find_path( MSINTTYPES_INCLUDE_DIRS "inttypes.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
mark_as_advanced( MSINTTYPES_INCLUDE_DIRS )
endif()

9
3rdparty/mt19937ar/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,9 @@
find_path( MT19937AR_INCLUDE_DIRS "mt19937ar.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
NO_DEFAULT_PATH )
find_path( MT19937AR_SOURCE_DIR "mt19937ar.c"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}"
NO_DEFAULT_PATH )
mark_as_advanced( MT19937AR_INCLUDE_DIRS )
mark_as_advanced( MT19937AR_SOURCE_DIR )

110
3rdparty/mysql/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,110 @@
#
# local copy
#
if( WIN32 )
message( STATUS "Detecting local MYSQL" )
find_path( LOCAL_MYSQL_INCLUDE_DIRS "mysql.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
find_library( LOCAL_MYSQL_LIBRARIES
NAMES libmysql
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NO_DEFAULT_PATH )
mark_as_advanced( LOCAL_MYSQL_LIBRARIES )
mark_as_advanced( LOCAL_MYSQL_INCLUDE_DIRS )
if( LOCAL_MYSQL_LIBRARIES AND LOCAL_MYSQL_INCLUDE_DIRS )
if( EXISTS "${LOCAL_MYSQL_INCLUDE_DIRS}/mysql_version.h" )
file( STRINGS "${LOCAL_MYSQL_INCLUDE_DIRS}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" )
string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_SERVER_VERSION "${MYSQL_VERSION_H}" )
message( STATUS "Found MYSQL: ${LOCAL_MYSQL_LIBRARIES} (found version ${MYSQL_SERVER_VERSION})" )
else()
message( STATUS "Found MYSQL: ${LOCAL_MYSQL_LIBRARIES}" )
endif()
set( HAVE_LOCAL_MYSQL ON
CACHE BOOL "mysql client is available as a local copy")
else()
foreach( _VAR LOCAL_MYSQL_LIBRARIES LOCAL_MYSQL_INCLUDE_DIRS )
if( NOT "${_VAR}" )
set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
endif()
endforeach()
message( STATUS "Could NOT find MYSQL (missing: ${MISSING_VARS})" )
unset( HAVE_LOCAL_MYSQL CACHE )
endif()
message( STATUS "Detecting local MYSQL - done" )
endif( WIN32 )
#
# system
#
message( STATUS "Detecting system MYSQL" )
find_program( MYSQL_CONFIG_EXECUTABLE "mysql_config" )
mark_as_advanced( MYSQL_CONFIG_EXECUTABLE )
if( MYSQL_CONFIG_EXECUTABLE )
# use mysql_config data
message( "Found mysql_config: ${MYSQL_CONFIG_EXECUTABLE}" )
execute_process( COMMAND "${MYSQL_CONFIG_EXECUTABLE} --libs"
OUTPUT_VARIABLE MYSQL_LIBRARIES )
execute_process( COMMAND "${MYSQL_CONFIG_EXECUTABLE} --include"
OUTPUT_VARIABLE MYSQL_INCLUDE_DIRS )
execute_process( COMMAND "${MYSQL_CONFIG_EXECUTABLE} --version"
OUTPUT_VARIABLE MYSQL_VERSION )
message( STATUS "Found MYSQL: ${MYSQL_LIBRARIES} (found version ${MYSQL_VERSION})" )
else()
# find mysql package
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
find_package( MYSQL )
endif()
set( SYSTEM_MYSQL_LIBRARIES "${MYSQL_LIBRARIES}"
CACHE PATH "system mysql libraries" )
set( SYSTEM_MYSQL_INCLUDE_DIRS "${MYSQL_INCLUDE_DIRS}"
CACHE PATH "system mysql include directories" )
mark_as_advanced( SYSTEM_MYSQL_LIBRARIES )
mark_as_advanced( SYSTEM_MYSQL_INCLUDE_DIRS )
if( SYSTEM_MYSQL_LIBRARIES AND SYSTEM_MYSQL_INCLUDE_DIRS )
set( HAVE_SYSTEM_MYSQL ON
CACHE BOOL "mysql client is available on the system" )
endif()
message( STATUS "Detecting system MYSQL - done" )
# options
#
# configure
#
unset( MYSQL_LIBRARIES CACHE )
unset( MYSQL_INCLUDE_DIRS CACHE )
if( HAVE_LOCAL_MYSQL )
set( USE_LOCAL_MYSQL ON
CACHE BOOL "use local copy of mysql" )
else()
unset( USE_LOCAL_MYSQL CACHE )
endif()
if( USE_LOCAL_MYSQL )
message( STATUS "Configuring for local MYSQL" )
set( MYSQL_LIBRARIES ${LOCAL_MYSQL_LIBRARIES} )
set( MYSQL_INCLUDE_DIRS ${LOCAL_MYSQL_INCLUDE_DIRS} )
message( STATUS "Configuring for local MYSQL - done" )
elseif( HAVE_SYSTEM_MYSQL )
message( STATUS "Configuring for system MYSQL" )
set( MYSQL_LIBRARIES ${SYSTEM_MYSQL_LIBRARIES} )
set( MYSQL_INCLUDE_DIRS ${SYSTEM_MYSQL_INCLUDE_DIRS} )
message( STATUS "Configuring for system MYSQL - done" )
endif()
if( USE_LOCAL_MYSQL OR HAVE_SYSTEM_MYSQL )
set( USE_MYSQL ON
CACHE BOOL "use mysql" )
else()
unset( USE_MYSQL CACHE )
endif()
set( MYSQL_LIBRARIES ${MYSQL_LIBRARIES}
CACHE PATH "mysql libraries" )
set( MYSQL_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS}
CACHE PATH "mysql include directories" )
mark_as_advanced( MYSQL_LIBRARIES )
mark_as_advanced( MYSQL_INCLUDE_DIRS )

34
3rdparty/mysql/FindMYSQL.cmake vendored Normal file
View File

@ -0,0 +1,34 @@
# - Find mysqlclient
# Find the native MySQL includes and library
#
# MYSQL_INCLUDE_DIR - where to find mysql.h, etc.
# MYSQL_LIBRARIES - List of libraries when using MySQL.
# MYSQL_FOUND - True if MySQL found.
#
# Based on: http://www.itk.org/Wiki/CMakeUserFindMySQL
find_path( MYSQL_INCLUDE_DIR "mysql.h"
PATH_SUFFIXES "mysql" )
set( MYSQL_NAMES mysqlclient mysqlclient_r )
find_library( MYSQL_LIBRARY
NAMES ${MYSQL_NAMES}
PATH_SUFFIXES "mysql" )
mark_as_advanced( MYSQL_LIBRARY MYSQL_INCLUDE_DIR )
if( MYSQL_INCLUDE_DIR AND EXISTS "${MYSQL_INCLUDE_DIR}/mysql_version.h" )
file( STRINGS "${MYSQL_INCLUDE_DIR}/mysql_version.h" MYSQL_VERSION_H REGEX "^#define[ \t]+MYSQL_SERVER_VERSION[ \t]+\"[^\"]+\".*$" )
string( REGEX REPLACE "^.*MYSQL_SERVER_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" MYSQL_VERSION_STRING "${MYSQL_VERSION_H}" )
endif()
# handle the QUIETLY and REQUIRED arguments and set MYSQL_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( MYSQL
REQUIRED_VARS MYSQL_LIBRARY MYSQL_INCLUDE_DIR
VERSION_VAR MYSQL_VERSION_STRING )
if( MYSQL_FOUND )
set( MYSQL_LIBRARIES ${PCRE_LIBRARY} )
set( MYSQL_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} )
endif()

92
3rdparty/pcre/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,92 @@
#
# local copy
#
if( WIN32 )
message( STATUS "Detecting local PCRE" )
find_path( LOCAL_PCRE_INCLUDE_DIRS "pcre.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
find_library( LOCAL_PCRE_LIBRARIES
NAMES pcre
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NO_DEFAULT_PATH )
mark_as_advanced( LOCAL_PCRE_LIBRARIES )
mark_as_advanced( LOCAL_PCRE_INCLUDE_DIRS )
if( LOCAL_PCRE_LIBRARIES AND LOCAL_PCRE_INCLUDE_DIRS )
file( STRINGS "${LOCAL_PCRE_INCLUDE_DIRS}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" )
string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" )
string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" )
message( STATUS "Found PCRE: ${LOCAL_PCRE_LIBRARIES} (found version ${PCRE_MAJOR}.${PCRE_MINOR})" )
set( HAVE_LOCAL_PCRE ON
CACHE BOOL "pcre is available as a local copy" )
else()
foreach( _VAR LOCAL_PCRE_LIBRARIES LOCAL_PCRE_INCLUDE_DIRS )
if( NOT "${_VAR}" )
set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
endif()
endforeach()
message( STATUS "Could NOT find PCRE (missing: ${MISSING_VARS})" )
unset( HAVE_LOCAL_PCRE CACHE )
endif()
message( STATUS "Detecting local PCRE - done" )
endif( WIN32 )
#
# system
#
message( STATUS "Detecting system PCRE" )
set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_MODULE_PATH} )
find_package( PCRE )
set( SYSTEM_PCRE_LIBRARIES ${PCRE_LIBRARIES}
CACHE PATH "system pcre libraries" )
set( SYSTEM_PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS}
CACHE PATH "system pcre include directories" )
mark_as_advanced( SYSTEM_PCRE_LIBRARIES )
mark_as_advanced( SYSTEM_PCRE_INCLUDE_DIRS )
if( SYSTEM_PCRE_LIBRARIES AND SYSTEM_PCRE_INCLUDE_DIRS )
set( HAVE_SYSTEM_PCRE ON
CACHE BOOL "pcre is available on the system" )
else()
unset( HAVE_SYSTEM_PCRE CACHE )
endif()
message( STATUS "Detecting system PCRE - done" )
#
# configure
#
unset( PCRE_LIBRARIES CACHE )
unset( PCRE_INCLUDE_DIRS CACHE )
if( HAVE_LOCAL_PCRE )
set( USE_LOCAL_PCRE ON
CACHE BOOL "use local copy of pcre" )
else()
unset( USE_LOCAL_PCRE CACHE )
endif()
if( USE_LOCAL_PCRE )
message( STATUS "Configuring for local PCRE" )
set( PCRE_LIBRARIES ${LOCAL_PCRE_LIBRARIES} )
set( PCRE_INCLUDE_DIRS ${LOCAL_PCRE_INCLUDE_DIRS} )
message( STATUS "Configuring for local PCRE - done" )
elseif( HAVE_SYSTEM_PCRE )
message( STATUS "Configuring for system PCRE" )
set( PCRE_LIBRARIES ${SYSTEM_PCRE_LIBRARIES} )
set( PCRE_INCLUDE_DIRS ${SYSTEM_PCRE_INCLUDE_DIRS} )
message( STATUS "Configuring for system PCRE - done" )
endif()
if( USE_LOCAL_PCRE OR HAVE_SYSTEM_PCRE )
set( USE_PCRE ON
CACHE BOOL "use pcre" )
else()
unset( USE_PCRE CACHE )
endif()
set( PCRE_LIBRARIES ${PCRE_LIBRARIES}
CACHE PATH "pcre libraries" )
set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIRS}
CACHE PATH "pcre include directories" )
mark_as_advanced( PCRE_LIBRARIES )
mark_as_advanced( PCRE_INCLUDE_DIRS )

35
3rdparty/pcre/FindPCRE.cmake vendored Normal file
View File

@ -0,0 +1,35 @@
# - Find pcre
# Find the native PCRE includes and library
#
# PCRE_INCLUDE_DIRS - where to find pcre.h
# PCRE_LIBRARIES - List of libraries when using pcre.
# PCRE_FOUND - True if pcre found.
find_path( PCRE_INCLUDE_DIR pcre.h )
set( PCRE_NAMES pcre )
find_library( PCRE_LIBRARY NAMES ${PCRE_NAMES} )
mark_as_advanced( PCRE_LIBRARY PCRE_INCLUDE_DIR )
if( PCRE_INCLUDE_DIR AND EXISTS "${PCRE_INCLUDE_DIR}/pcre.h" )
file( STRINGS "${PCRE_INCLUDE_DIR}/pcre.h" PCRE_H REGEX "^#define[ \t]+PCRE_M[A-Z]+[ \t]+[0-9]+.*$" )
string( REGEX REPLACE "^.*PCRE_MAJOR[ \t]+([0-9]+).*$" "\\1" PCRE_MAJOR "${PCRE_H}" )
string( REGEX REPLACE "^.*PCRE_MINOR[ \t]+([0-9]+).*$" "\\1" PCRE_MINOR "${PCRE_H}" )
set( PCRE_VERSION_STRING "${PCRE_MAJOR}.${PCRE_MINOR}" )
set( PCRE_VERSION_MAJOR "${PCRE_MAJOR}" )
set( PCRE_VERSION_MINOR "${PCRE_MINOR}" )
endif()
# handle the QUIETLY and REQUIRED arguments and set PCRE_FOUND to TRUE if
# all listed variables are TRUE
include( FindPackageHandleStandardArgs )
FIND_PACKAGE_HANDLE_STANDARD_ARGS( PCRE
REQUIRED_VARS PCRE_LIBRARY PCRE_INCLUDE_DIR
VERSION_VAR PCRE_VERSION_STRING )
if( PCRE_FOUND )
set( PCRE_LIBRARIES ${PCRE_LIBRARY} )
set( PCRE_INCLUDE_DIRS ${PCRE_INCLUDE_DIR} )
endif()

90
3rdparty/zlib/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,90 @@
#
# local copy
#
if( WIN32 )
message( STATUS "Detecting local ZLIB" )
find_path( LOCAL_ZLIB_INCLUDE_DIRS "zlib.h"
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/include"
NO_DEFAULT_PATH )
find_library( LOCAL_ZLIB_LIBRARIES
NAMES zdll
PATHS "${CMAKE_CURRENT_SOURCE_DIR}/lib"
NO_DEFAULT_PATH )
mark_as_advanced( LOCAL_ZLIB_LIBRARIES )
mark_as_advanced( LOCAL_ZLIB_INCLUDE_DIRS )
if( LOCAL_ZLIB_LIBRARIES AND LOCAL_ZLIB_INCLUDE_DIRS )
file( STRINGS "${LOCAL_ZLIB_INCLUDE_DIRS}/zlib.h" ZLIB_H REGEX "^#define[ \t]+ZLIB_VERSION[ \t]+\"[^\"]+\".*$" )
string( REGEX REPLACE "^.*ZLIB_VERSION[ \t]+\"([^\"]+)\".*$" "\\1" ZLIB_VERSION "${ZLIB_H}" )
message( STATUS "Found local ZLIB: ${LOCAL_ZLIB_LIBRARIES} (found version ${ZLIB_VERSION})" )
set( HAVE_LOCAL_ZLIB ON
CACHE BOOL "zlib is available as a local copy" )
else()
foreach( _VAR LOCAL_ZLIB_LIBRARIES LOCAL_ZLIB_INCLUDE_DIRS )
if( NOT "${_VAR}" )
set( MISSING_VARS ${MISSING_VARS} ${_VAR} )
endif()
endforeach()
message( STATUS "Could NOT find local ZLIB (missing: ${MISSING_VARS})" )
unset( HAVE_LOCAL_ZLIB CACHE )
endif()
message( STATUS "Detecting local ZLIB - done" )
endif( WIN32 )
#
# system
#
message( STATUS "Detecting system ZLIB" )
find_package( ZLIB )
set( SYSTEM_ZLIB_LIBRARIES ${ZLIB_LIBRARIES}
CACHE PATH "system zlib libraries" )
set( SYSTEM_ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
CACHE PATH "system zlib include directories" )
mark_as_advanced( SYSTEM_ZLIB_LIBRARIES )
mark_as_advanced( SYSTEM_ZLIB_INCLUDE_DIRS )
if( SYSTEM_ZLIB_LIBRARIES AND SYSTEM_ZLIB_INCLUDE_DIRS )
set( HAVE_SYSTEM_ZLIB ON
CACHE BOOL "zlib is available on the system" )
else()
unset( HAVE_SYSTEM_ZLIB CACHE )
endif()
message( STATUS "Detecting system ZLIB - done" )
#
# configure
#
unset( ZLIB_LIBRARIES CACHE )
unset( ZLIB_INCLUDE_DIRS CACHE )
if( HAVE_LOCAL_ZLIB )
set( USE_LOCAL_ZLIB ON
CACHE BOOL "use local copy of zlib" )
else()
unset( USE_LOCAL_ZLIB CACHE )
endif()
if( USE_LOCAL_ZLIB )
message( STATUS "Configuring for local ZLIB" )
set( ZLIB_LIBRARIES ${LOCAL_ZLIB_LIBRARIES} )
set( ZLIB_INCLUDE_DIRS ${LOCAL_ZLIB_INCLUDE_DIRS} )
message( STATUS "Configuring for local ZLIB - done" )
elseif( HAVE_SYSTEM_ZLIB )
message( STATUS "Configuring for system ZLIB" )
set( ZLIB_LIBRARIES ${SYSTEM_ZLIB_LIBRARIES} )
set( ZLIB_INCLUDE_DIRS ${SYSTEM_ZLIB_INCLUDE_DIRS} )
message( STATUS "Configuring for system ZLIB - done" )
endif()
if( USE_LOCAL_ZLIB OR HAVE_SYSTEM_ZLIB )
set( USE_ZLIB ON
CACHE BOOL "use zlib" )
else()
unset( USE_ZLIB CACHE )
endif()
set( ZLIB_LIBRARIES ${ZLIB_LIBRARIES}
CACHE PATH "zlib libraries" )
set( ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}
CACHE PATH "zlib include directories" )
mark_as_advanced( ZLIB_LIBRARIES )
mark_as_advanced( ZLIB_INCLUDE_DIRS )

274
CMakeLists.txt Normal file
View File

@ -0,0 +1,274 @@
cmake_minimum_required( VERSION 2.8.4 )
project( eAthena )
#
# Prevent building in the source directory by default
#
if( ALLOW_SAME_DIRECTORY )
elseif( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" )
option( ALLOW_SAME_DIRECTORY "Allow CMake to build in the source directory." OFF )
message( FATAL_ERROR "Do not use the source directory to build your files, instead create a separate folder and build there.\nExample:\n mkdir build\n cd build\n cmake -G\"Unix Makefiles\" ..\n make install\nTo skip this check, set ALLOW_SAME_DIRECTORY to 1 or ON" )
endif()
#
# Debug stuff
#
if( NOT SKIP_DEBUG )
message( STATUS "DEBUG: # Variables That Change Behavior" )
message( STATUS "DEBUG: BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS}" )
message( STATUS "DEBUG: CMAKE_BACKWARDS_COMPATIBILITY=${CMAKE_BACKWARDS_COMPATIBILITY}" )
message( STATUS "DEBUG: CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}" )
message( STATUS "DEBUG: CMAKE_COLOR_MAKEFILE=${CMAKE_COLOR_MAKEFILE}" )
message( STATUS "DEBUG: CMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES}" )
message( STATUS "DEBUG: CMAKE_FIND_LIBRARY_PREFIXES=${CMAKE_FIND_LIBRARY_PREFIXES}" )
message( STATUS "DEBUG: CMAKE_FIND_LIBRARY_SUFFIXES=${CMAKE_FIND_LIBRARY_SUFFIXES}" )
message( STATUS "DEBUG: CMAKE_IGNORE_PATH=${CMAKE_IGNORE_PATH}" )
message( STATUS "DEBUG: CMAKE_INCLUDE_PATH=${CMAKE_INCLUDE_PATH}" )
message( STATUS "DEBUG: CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
message( STATUS "DEBUG: CMAKE_LIBRARY_PATH=${CMAKE_LIBRARY_PATH}" )
message( STATUS "DEBUG: CMAKE_MFC_FLAG=${CMAKE_MFC_FLAG}" )
message( STATUS "DEBUG: CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}" )
message( STATUS "DEBUG: CMAKE_NOT_USING_CONFIG_FLAGS=${CMAKE_NOT_USING_CONFIG_FLAGS}" )
message( STATUS "DEBUG: CMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}" )
message( STATUS "DEBUG: CMAKE_PROGRAM_PATH=${CMAKE_PROGRAM_PATH}" )
message( STATUS "DEBUG: CMAKE_SKIP_INSTALL_ALL_DEPENDENCY=${CMAKE_SKIP_INSTALL_ALL_DEPENDENCY}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_IGNORE_PATH=${CMAKE_SYSTEM_IGNORE_PATH}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_INCLUDE_PATH=${CMAKE_SYSTEM_INCLUDE_PATH}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_LIBRARY_PATH=${CMAKE_SYSTEM_LIBRARY_PATH}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_PREFIX_PATH=${CMAKE_SYSTEM_PREFIX_PATH}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_PROGRAM_PATH=${CMAKE_SYSTEM_PROGRAM_PATH}" )
message( STATUS "DEBUG: CMAKE_USER_MAKE_RULES_OVERRIDE=${CMAKE_USER_MAKE_RULES_OVERRIDE}" )
message( STATUS "DEBUG: # Variables That Describe the System" )
message( STATUS "DEBUG: APPLE=${APPLE}" )
message( STATUS "DEBUG: BORLAND=${BORLAND}" )
message( STATUS "DEBUG: CMAKE_CL_64=${CMAKE_CL_64}" )
message( STATUS "DEBUG: CMAKE_COMPILER_2005=${CMAKE_COMPILER_2005}" )
message( STATUS "DEBUG: CMAKE_HOST_APPLE=${CMAKE_HOST_APPLE}" )
message( STATUS "DEBUG: CMAKE_HOST_SYSTEM=${CMAKE_HOST_SYSTEM}" )
message( STATUS "DEBUG: CMAKE_HOST_SYSTEM_NAME=${CMAKE_HOST_SYSTEM_NAME}" )
message( STATUS "DEBUG: CMAKE_HOST_SYSTEM_PROCESSOR=${CMAKE_HOST_SYSTEM_PROCESSOR}" )
message( STATUS "DEBUG: CMAKE_HOST_SYSTEM_VERSION=${CMAKE_HOST_SYSTEM_VERSION}" )
message( STATUS "DEBUG: CMAKE_HOST_UNIX=${CMAKE_HOST_UNIX}" )
message( STATUS "DEBUG: CMAKE_HOST_WIN32=${CMAKE_HOST_WIN32}" )
message( STATUS "DEBUG: CMAKE_OBJECT_PATH_MAX=${CMAKE_OBJECT_PATH_MAX}" )
message( STATUS "DEBUG: CMAKE_SYSTEM=${CMAKE_SYSTEM}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_PROCESSOR=${CMAKE_SYSTEM_PROCESSOR}" )
message( STATUS "DEBUG: CMAKE_SYSTEM_VERSION=${CMAKE_SYSTEM_VERSION}" )
message( STATUS "DEBUG: CYGWIN=${CYGWIN}" )
message( STATUS "DEBUG: MSVC=${MSVC}" )
message( STATUS "DEBUG: MSVC80=${MSVC80}" )
message( STATUS "DEBUG: MSVC_IDE=${MSVC_IDE}" )
message( STATUS "DEBUG: MSVC_VERSION=${MSVC_VERSION}" )
message( STATUS "DEBUG: UNIX=${UNIX}" )
message( STATUS "DEBUG: WIN32=${WIN32}" )
message( STATUS "DEBUG: XCODE_VERSION=${XCODE_VERSION}" )
message( STATUS "DEBUG: # Variables that Control the Build" )
message( STATUS "DEBUG: CMAKE_ARCHIVE_OUTPUT_DIRECTORY=${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}" )
message( STATUS "DEBUG: CMAKE_BUILD_WITH_INSTALL_RPATH=${CMAKE_BUILD_WITH_INSTALL_RPATH}" )
message( STATUS "DEBUG: CMAKE_DEBUG_POSTFIX=${CMAKE_DEBUG_POSTFIX}" )
message( STATUS "DEBUG: CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" )
message( STATUS "DEBUG: CMAKE_INCLUDE_CURRENT_DIR=${CMAKE_INCLUDE_CURRENT_DIR}" )
message( STATUS "DEBUG: CMAKE_INSTALL_NAME_DIR=${CMAKE_INSTALL_NAME_DIR}" )
message( STATUS "DEBUG: CMAKE_INSTALL_RPATH=${CMAKE_INSTALL_RPATH}" )
message( STATUS "DEBUG: CMAKE_INSTALL_RPATH_USE_LINK_PATH=${CMAKE_INSTALL_RPATH_USE_LINK_PATH}" )
message( STATUS "DEBUG: CMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" )
message( STATUS "DEBUG: CMAKE_LIBRARY_PATH_FLAG=${CMAKE_LIBRARY_PATH_FLAG}" )
message( STATUS "DEBUG: CMAKE_LINK_DEF_FILE_FLAG=${CMAKE_LINK_DEF_FILE_FLAG}" )
message( STATUS "DEBUG: CMAKE_LINK_LIBRARY_FILE_FLAG=${CMAKE_LINK_LIBRARY_FILE_FLAG}" )
message( STATUS "DEBUG: CMAKE_LINK_LIBRARY_FLAG=${CMAKE_LINK_LIBRARY_FLAG}" )
message( STATUS "DEBUG: CMAKE_NO_BUILTIN_CHRPATH=${CMAKE_NO_BUILTIN_CHRPATH}" )
message( STATUS "DEBUG: CMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" )
message( STATUS "DEBUG: CMAKE_SKIP_BUILD_RPATH=${CMAKE_SKIP_BUILD_RPATH}" )
message( STATUS "DEBUG: CMAKE_TRY_COMPILE_CONFIGURATION=${CMAKE_TRY_COMPILE_CONFIGURATION}" )
message( STATUS "DEBUG: CMAKE_USE_RELATIVE_PATHS=${CMAKE_USE_RELATIVE_PATHS}" )
message( STATUS "DEBUG: EXECUTABLE_OUTPUT_PATH=${EXECUTABLE_OUTPUT_PATH}" )
message( STATUS "DEBUG: LIBRARY_OUTPUT_PATH=${LIBRARY_OUTPUT_PATH}" )
message( STATUS "DEBUG: # Variables that Provide Information" )
message( STATUS "DEBUG: CMAKE_AR=${CMAKE_AR}" )
message( STATUS "DEBUG: CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}" )
message( STATUS "DEBUG: CMAKE_BUILD_TOOL=${CMAKE_BUILD_TOOL}" )
message( STATUS "DEBUG: CMAKE_CACHEFILE_DIR=${CMAKE_CACHEFILE_DIR}" )
message( STATUS "DEBUG: CMAKE_CACHE_MAJOR_VERSION=${CMAKE_CACHE_MAJOR_VERSION}" )
message( STATUS "DEBUG: CMAKE_CACHE_MINOR_VERSION=${CMAKE_CACHE_MINOR_VERSION}" )
message( STATUS "DEBUG: CMAKE_CACHE_PATCH_VERSION=${CMAKE_CACHE_PATCH_VERSION}" )
message( STATUS "DEBUG: CMAKE_CFG_INTDIR=${CMAKE_CFG_INTDIR}" )
message( STATUS "DEBUG: CMAKE_COMMAND=${CMAKE_COMMAND}" )
message( STATUS "DEBUG: CMAKE_CROSSCOMPILING=${CMAKE_CROSSCOMPILING}" )
message( STATUS "DEBUG: CMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND}" )
message( STATUS "DEBUG: CMAKE_CURRENT_BINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}" )
message( STATUS "DEBUG: CMAKE_CURRENT_LIST_DIR=${CMAKE_CURRENT_LIST_DIR}" )
message( STATUS "DEBUG: CMAKE_CURRENT_LIST_FILE=${CMAKE_CURRENT_LIST_FILE}" )
message( STATUS "DEBUG: CMAKE_CURRENT_LIST_LINE=${CMAKE_CURRENT_LIST_LINE}" )
message( STATUS "DEBUG: CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}" )
message( STATUS "DEBUG: CMAKE_DL_LIBS=${CMAKE_DL_LIBS}" )
message( STATUS "DEBUG: CMAKE_EDIT_COMMAND=${CMAKE_EDIT_COMMAND}" )
message( STATUS "DEBUG: CMAKE_EXECUTABLE_SUFFIX=${CMAKE_EXECUTABLE_SUFFIX}" )
message( STATUS "DEBUG: CMAKE_EXTRA_GENERATOR=${CMAKE_EXTRA_GENERATOR}" )
message( STATUS "DEBUG: CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES=${CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES}" )
message( STATUS "DEBUG: CMAKE_GENERATOR=${CMAKE_GENERATOR}" )
message( STATUS "DEBUG: CMAKE_HOME_DIRECTORY=${CMAKE_HOME_DIRECTORY}" )
message( STATUS "DEBUG: CMAKE_IMPORT_LIBRARY_PREFIX=${CMAKE_IMPORT_LIBRARY_PREFIX}" )
message( STATUS "DEBUG: CMAKE_IMPORT_LIBRARY_SUFFIX=${CMAKE_IMPORT_LIBRARY_SUFFIX}" )
message( STATUS "DEBUG: CMAKE_LINK_LIBRARY_SUFFIX=${CMAKE_LINK_LIBRARY_SUFFIX}" )
message( STATUS "DEBUG: CMAKE_MAJOR_VERSION=${CMAKE_MAJOR_VERSION}" )
message( STATUS "DEBUG: CMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}" )
message( STATUS "DEBUG: CMAKE_MINOR_VERSION=${CMAKE_MINOR_VERSION}" )
message( STATUS "DEBUG: CMAKE_PARENT_LIST_FILE=${CMAKE_PARENT_LIST_FILE}" )
message( STATUS "DEBUG: CMAKE_PATCH_VERSION=${CMAKE_PATCH_VERSION}" )
message( STATUS "DEBUG: CMAKE_PROJECT_NAME=${CMAKE_PROJECT_NAME}" )
message( STATUS "DEBUG: CMAKE_RANLIB=${CMAKE_RANLIB}" )
message( STATUS "DEBUG: CMAKE_ROOT=${CMAKE_ROOT}" )
message( STATUS "DEBUG: CMAKE_SHARED_LIBRARY_PREFIX=${CMAKE_SHARED_LIBRARY_PREFIX}" )
message( STATUS "DEBUG: CMAKE_SHARED_LIBRARY_SUFFIX=${CMAKE_SHARED_LIBRARY_SUFFIX}" )
message( STATUS "DEBUG: CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}" )
message( STATUS "DEBUG: CMAKE_SHARED_MODULE_SUFFIX=${CMAKE_SHARED_MODULE_SUFFIX}" )
message( STATUS "DEBUG: CMAKE_SIZEOF_VOID_P=${CMAKE_SIZEOF_VOID_P}" )
message( STATUS "DEBUG: CMAKE_SKIP_RPATH=${CMAKE_SKIP_RPATH}" )
message( STATUS "DEBUG: CMAKE_SOURCE_DIR=${CMAKE_SOURCE_DIR}" )
message( STATUS "DEBUG: CMAKE_STANDARD_LIBRARIES=${CMAKE_STANDARD_LIBRARIES}" )
message( STATUS "DEBUG: CMAKE_STATIC_LIBRARY_PREFIX=${CMAKE_STATIC_LIBRARY_PREFIX}" )
message( STATUS "DEBUG: CMAKE_STATIC_LIBRARY_SUFFIX=${CMAKE_STATIC_LIBRARY_SUFFIX}" )
message( STATUS "DEBUG: CMAKE_TWEAK_VERSION=${CMAKE_TWEAK_VERSION}" )
message( STATUS "DEBUG: CMAKE_USING_VC_FREE_TOOLS=${CMAKE_USING_VC_FREE_TOOLS}" )
message( STATUS "DEBUG: CMAKE_VERBOSE_MAKEFILE=${CMAKE_VERBOSE_MAKEFILE}" )
message( STATUS "DEBUG: CMAKE_VERSION=${CMAKE_VERSION}" )
message( STATUS "DEBUG: PROJECT_BINARY_DIR=${PROJECT_BINARY_DIR}" )
message( STATUS "DEBUG: PROJECT_NAME=${PROJECT_NAME}" )
message( STATUS "DEBUG: PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" )
set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/install CACHE PATH "test install to dir" FORCE )
#set( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "test install to source dir" FORCE )
endif( NOT SKIP_DEBUG )
#
# Global stuff
#
set( GLOBAL_LIBRARIES "" CACHE INTERNAL "" )
set( GLOBAL_INCLUDE_DIRS "" CACHE INTERNAL "" )
set( GLOBAL_DEFINITIONS "" CACHE INTERNAL "" )
mark_as_advanced( GLOBAL_LIBRARIES GLOBAL_INCLUDE_DIRS GLOBAL_DEFINITIONS )
if( WIN32 )
list( APPEND GLOBAL_DEFINITIONS FD_SETSIZE=4096 )
endif()
if( MSVC )
list( APPEND GLOBAL_DEFINITIONS _CRT_SECURE_NO_DEPRECATE _CRT_NONSTDC_NO_DEPRECATE DB_MANUAL_CAST_TO_UNION )
endif()
#
# packetver
#
set( PACKETVER ""
CACHE STRING "Sets the PACKETVER define of the servers. (see src/common/mmo.h)" )
#
# install stuff
#
option( INSTALL_RUN_DATA "install files needed to run the project" ON )
option( INSTALL_BUILD_DATA "install files needed to build the project" OFF )
set( SVN_FOLDER_PATTERN "[\\.]svn"
CACHE PATH "pattern of svn folder that we exclude from instalations" )
mark_as_advanced( SVN_FOLDER_PATTERN )
if( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}" )
set( INSTALLING_TO_SOURCE ON
CACHE INTERNAL "we are installing to the source folder, skip uneeded stuff" )
else()
unset( INSTALLING_TO_SOURCE CACHE )
endif()
set( LOCAL_BUILD_FILES
"CMakeLists.txt"
"configure"
"configure.in"
"eAthena-6.dsw"
"eAthena-7.1.sln"
"eAthena-8.sln"
"eAthena-9.sln"
"eAthena-10.sln"
)
set( LOCAL_BUILD_DIRECTORIES
"3rdparty"
"src"
"vcproj-6"
"vcproj-7.1"
"vcproj-8"
"vcproj-9"
"vcproj-10"
)
set( LOCAL_RUN_FILES
"athena-start"
"Changelog-Trunk.txt"
"char-server.sh"
"charserv-sql.bat"
"charserv.bat"
"dbghelp.dll"
"LICENSE"
"login-server.sh"
"logserv-sql.bat"
"logserv.bat"
"map-server.sh"
"mapserv-sql.bat"
"mapserv.bat"
"notice.txt"
"readme.html"
"runserver-sql.bat"
"runserver.bat"
"serv.bat"
"start"
)
set( LOCAL_RUN_DIRECTORIES
"conf"
"db"
"doc"
"log"
"npc"
"plugins"
"readme"
"sql-files"
"tools"
)
if( USE_LOCAL_MYSQL )
list( APPEND LOCAL_RUN_FILES "libmysql.dll" )
endif()
if( USE_LOCAL_PCRE )
list( APPEND LOCAL_RUN_FILES "pcre3.dll" )
endif()
if( USE_LOCAL_ZLIB )
list( APPEND LOCAL_RUN_FILES "zlib1.dll" )
endif()
function( INSTALL_DIRECTORY DIR DEST EXCLUDE_PATTERN )
# warning: that slash(/) is important here, otherwise the whole directory (not its content) will be copied!
install( DIRECTORY ${DIR}/
DESTINATION ${DEST}
PATTERN ${SVN_FOLDER_PATTERN} EXCLUDE
PATTERN "${EXCLUDE_PATTERN}" EXCLUDE )
endfunction()
function( INSTALL_DIRECTORIES DIRS EXCLUDE_PATTERN )
foreach( DIR IN ITEMS ${DIRS} )
INSTALL_DIRECTORY( ${DIR} ${DIR} "${EXCLUDE_PATTERN}" )
endforeach()
endfunction()
if( NOT INSTALLING_TO_SOURCE )
if( INSTALL_RUN_DATA )
install( FILES ${LOCAL_RUN_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} )
INSTALL_DIRECTORIES( "${LOCAL_RUN_DIRECTORIES}" "conf/import-tmpl" )
endif()
if( INSTALL_BUILD_DATA )
install( FILES ${LOCAL_BUILD_FILES} DESTINATION ${CMAKE_INSTALL_PREFIX} )
INSTALL_DIRECTORIES( "${LOCAL_BUILD_DIRECTORIES}" "" )
endif()
endif()
if( INSTALL_RUN_DATA )
INSTALL_DIRECTORY( "save-tmpl" "save" "" )
INSTALL_DIRECTORY( "conf/import-tmpl" "conf/import" "" )
endif()
#
# subdirectories
#
add_subdirectory( 3rdparty )
add_subdirectory( src )

View File

@ -1,7 +1,9 @@
Date Added
2011/06/29
* Added experimental support for CMake. (for now: basic build, no extras, only tested with VS10 and cygwin) [FlavioJS]
2011/06/27
*Added common/random and 3rdparty/mt19937ar to project files, makefiles and configure script. [FlavioJS]
* Added common/random and 3rdparty/mt19937ar to project files, makefiles and configure script. [FlavioJS]
2011/06/26
* Fixed a signed literal being assigned to an unsigned variable and other minor cleanups in malloc (bugreport:4765). [Ai4rei]
* Fixed @mobinfo displaying mvp rewards with 'AegisName' although normal drops use 'Name' item db column (bugreport:4981, follow up to r6346). [Ai4rei]

9
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,9 @@
add_subdirectory( common )
add_subdirectory( login )
add_subdirectory( char )
add_subdirectory( char_sql )
add_subdirectory( map )
add_subdirectory( tool )
#add_subdirectory( txt-converter )
#add_subdirectory( plugins )

64
src/char/CMakeLists.txt Normal file
View File

@ -0,0 +1,64 @@
# setup
set( MT19937AR_SOURCES
# "${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
set( COMMON_SOURCES
"${COMMON_SOURCE_DIR}/core.c"
"${COMMON_SOURCE_DIR}/db.c"
"${COMMON_SOURCE_DIR}/ers.c"
# "${COMMON_SOURCE_DIR}/grfio.c"
"${COMMON_SOURCE_DIR}/lock.c"
"${COMMON_SOURCE_DIR}/malloc.c"
"${COMMON_SOURCE_DIR}/mapindex.c"
# "${COMMON_SOURCE_DIR}/md5calc.c"
# "${COMMON_SOURCE_DIR}/nullpo.c"
"${COMMON_SOURCE_DIR}/plugins.c"
# "${COMMON_SOURCE_DIR}/random.c"
"${COMMON_SOURCE_DIR}/showmsg.c"
"${COMMON_SOURCE_DIR}/socket.c"
"${COMMON_SOURCE_DIR}/strlib.c"
"${COMMON_SOURCE_DIR}/timer.c"
"${COMMON_SOURCE_DIR}/utils.c"
)
set( CHAR_SOURCES
"char.c"
"int_guild.c"
"int_homun.c"
"int_party.c"
"int_pet.c"
"int_status.c"
"int_storage.c"
"inter.c"
)
# char txt
if( USE_ZLIB )
message ( STATUS "Creating target char-server" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} TXT_ONLY )
if( PACKETVER )
message( STATUS "Using PACKETVER=${PACKETVER}" )
list( APPEND DEFINITIONS PACKETVER=${PACKETVER} )
endif()
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${MT19937AR_SOURCES} ${COMMON_SOURCES} ${CHAR_SOURCES} )
source_group( 3rdparty FILES ${MT19937AR_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} )
source_group( char FILES ${CHAR_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( char-server ${SOURCE_FILES} )
target_link_libraries( char-server ${LIBRARIES} )
set_target_properties( char-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS char-server DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target char-server - done" )
else()
message ( STATUS "Skipping target char-server (requires ZLIB)" )
endif()

View File

@ -0,0 +1,68 @@
# setup
set( MT19937AR_SOURCES
# "${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
set( COMMON_SOURCES
"${COMMON_SOURCE_DIR}/core.c"
"${COMMON_SOURCE_DIR}/db.c"
"${COMMON_SOURCE_DIR}/ers.c"
# "${COMMON_SOURCE_DIR}/grfio.c"
# "${COMMON_SOURCE_DIR}/lock.c"
"${COMMON_SOURCE_DIR}/malloc.c"
"${COMMON_SOURCE_DIR}/mapindex.c"
# "${COMMON_SOURCE_DIR}/md5calc.c"
# "${COMMON_SOURCE_DIR}/nullpo.c"
"${COMMON_SOURCE_DIR}/plugins.c"
# "${COMMON_SOURCE_DIR}/random.c"
"${COMMON_SOURCE_DIR}/showmsg.c"
"${COMMON_SOURCE_DIR}/socket.c"
"${COMMON_SOURCE_DIR}/sql.c"
"${COMMON_SOURCE_DIR}/strlib.c"
"${COMMON_SOURCE_DIR}/timer.c"
"${COMMON_SOURCE_DIR}/utils.c"
)
set( CHAR_SOURCES
"char.c"
"int_auction.c"
"int_guild.c"
"int_homun.c"
"int_mail.c"
"int_mercenary.c"
"int_party.c"
"int_pet.c"
"int_quest.c"
"int_storage.c"
"inter.c"
)
# char sql
if( USE_ZLIB AND USE_MYSQL )
message ( STATUS "Creating target char-server_sql" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ${COMMON_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} )
if( PACKETVER )
message( STATUS "Using PACKETVER=${PACKETVER}" )
list( APPEND DEFINITIONS PACKETVER=${PACKETVER} )
endif()
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${MT19937AR_SOURCES} ${COMMON_SOURCES} ${CHAR_SOURCES} )
source_group( 3rdparty FILES ${MT19937AR_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} )
source_group( char FILES ${CHAR_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( char-server_sql ${SOURCE_FILES} )
target_link_libraries( char-server_sql ${LIBRARIES} )
set_target_properties( char-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS char-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target char-server_sql - done" )
else()
message ( STATUS "Skipping target char-server_sql (requires ZLIB and MYSQL)" )
endif()

40
src/common/CMakeLists.txt Normal file
View File

@ -0,0 +1,40 @@
set( COMMON_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}"
CACHE PATH "common include directories" )
set( COMMON_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
CACHE PATH "common source directory" )
mark_as_advanced( COMMON_INCLUDE_DIRS )
mark_as_advanced( COMMON_SOURCE_DIR )
#
# Find svnversion
#
message( STATUS "Detecting svnversion" )
find_program( SVNVERSION_EXECUTABLE svnversion )
mark_as_advanced( SVNVERSION_EXECUTABLE )
message( STATUS "Detecting svnversion - done" )
#
# Create svnversion.h
#
message( STATUS "Creating svnversion.h" )
if( SVNVERSION_EXECUTABLE )
execute_process( COMMAND ${SVNVERSION_EXECUTABLE} ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE SVNVERSION
OUTPUT_STRIP_TRAILING_WHITESPACE )
endif()
if( SVNVERSION )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h
"#ifndef SVNVERSION\n#define SVNVERSION ${SVNVERSION}\n#endif\n" )
else()
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h "" )
endif()
set( GLOBAL_INCLUDE_DIRS "${GLOBAL_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "" )
set( SVNVERSION ${SVNVERSION}
CACHE STRING "SVN version of the source code" )
if( INSTALL_BUILD_DATA )
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/svnversion.h DESTINATION ${CMAKE_INSTALL_PREFIX}/src/common )
endif()
message( STATUS "Creating svnversion.h - done" )

103
src/login/CMakeLists.txt Normal file
View File

@ -0,0 +1,103 @@
# setup
set( MT19937AR_SOURCES
"${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
set( COMMON_SOURCES
"${COMMON_SOURCE_DIR}/core.c"
"${COMMON_SOURCE_DIR}/db.c"
"${COMMON_SOURCE_DIR}/ers.c"
# "${COMMON_SOURCE_DIR}/grfio.c"
"${COMMON_SOURCE_DIR}/lock.c"
"${COMMON_SOURCE_DIR}/malloc.c"
# "${COMMON_SOURCE_DIR}/mapindex.c"
"${COMMON_SOURCE_DIR}/md5calc.c"
# "${COMMON_SOURCE_DIR}/nullpo.c"
"${COMMON_SOURCE_DIR}/plugins.c"
"${COMMON_SOURCE_DIR}/random.c"
"${COMMON_SOURCE_DIR}/showmsg.c"
"${COMMON_SOURCE_DIR}/socket.c"
"${COMMON_SOURCE_DIR}/strlib.c"
"${COMMON_SOURCE_DIR}/timer.c"
"${COMMON_SOURCE_DIR}/utils.c"
)
set( COMMON_SQL_SOURCES
"${COMMON_SOURCE_DIR}/sql.c"
)
set( LOGIN_SOURCES
"login.c"
)
set( LOGIN_TXT_SOURCES
"account_txt.c"
"ipban_txt.c"
"loginlog_txt.c"
)
set( LOGIN_SQL_SOURCES
"account_sql.c"
"ipban_sql.c"
"loginlog_sql.c"
)
#
# login txt
#
if( USE_ZLIB )
message ( STATUS "Creating target login-server" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} WITH_TXT )
if( PACKETVER )
message( STATUS "Using PACKETVER=${PACKETVER}" )
list( APPEND DEFINITIONS PACKETVER=${PACKETVER} )
endif()
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${MT19937AR_SOURCES} ${COMMON_SOURCES} ${LOGIN_SOURCES} ${LOGIN_TXT_SOURCES} )
source_group( 3rdparty FILES ${MT19937AR_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} )
source_group( login FILES ${LOGIN_SOURCES} ${LOGIN_TXT_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( login-server ${SOURCE_FILES} )
target_link_libraries( login-server ${LIBRARIES} )
set_target_properties( login-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS login-server DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target login-server - done" )
else()
message ( STATUS "Skipping target login-server (requires ZLIB)" )
endif()
# login sql
if( USE_ZLIB AND USE_MYSQL )
message ( STATUS "Creating target login-server_sql" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ${COMMON_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} WITH_SQL )
if( PACKETVER )
message( STATUS "Using PACKETVER=${PACKETVER}" )
list( APPEND DEFINITIONS PACKETVER=${PACKETVER} )
endif()
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${MT19937AR_SOURCES} ${COMMON_SOURCES} ${COMMON_SQL_SOURCES} ${LOGIN_SOURCES} ${LOGIN_SQL_SOURCES} )
source_group( 3rdparty FILES ${MT19937AR_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} ${COMMON_SQL_SOURCES} )
source_group( login FILES ${LOGIN_SOURCES} ${LOGIN_SQL_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( login-server_sql ${SOURCE_FILES} )
target_link_libraries( login-server_sql ${LIBRARIES} )
set_target_properties( login-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS login-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target login-server_sql - done" )
else()
message ( STATUS "Skipping target login-server_sql (requires ZLIB and MYSQL)" )
endif()

140
src/map/CMakeLists.txt Normal file
View File

@ -0,0 +1,140 @@
# setup
set( MT19937AR_SOURCES
"${MT19937AR_SOURCE_DIR}/mt19937ar.c"
)
set( COMMON_SOURCES
"${COMMON_SOURCE_DIR}/core.c"
"${COMMON_SOURCE_DIR}/db.c"
"${COMMON_SOURCE_DIR}/ers.c"
"${COMMON_SOURCE_DIR}/grfio.c"
"${COMMON_SOURCE_DIR}/lock.c"
"${COMMON_SOURCE_DIR}/malloc.c"
"${COMMON_SOURCE_DIR}/mapindex.c"
"${COMMON_SOURCE_DIR}/md5calc.c"
"${COMMON_SOURCE_DIR}/nullpo.c"
"${COMMON_SOURCE_DIR}/plugins.c"
"${COMMON_SOURCE_DIR}/random.c"
"${COMMON_SOURCE_DIR}/showmsg.c"
"${COMMON_SOURCE_DIR}/socket.c"
"${COMMON_SOURCE_DIR}/strlib.c"
"${COMMON_SOURCE_DIR}/timer.c"
"${COMMON_SOURCE_DIR}/utils.c"
)
set( COMMON_SQL_SOURCES
"${COMMON_SOURCE_DIR}/sql.c"
)
set( MAP_SOURCES
"atcommand.c"
"battle.c"
"battleground.c"
"buyingstore.c"
"chat.c"
"chrif.c"
"clif.c"
"date.c"
"duel.c"
"guild.c"
"homunculus.c"
"instance.c"
"intif.c"
"itemdb.c"
"log.c"
"mail.c"
"map.c"
"mercenary.c"
"mob.c"
"npc.c"
"npc_chat.c"
"party.c"
"path.c"
"pc.c"
"pet.c"
"quest.c"
"script.c"
"searchstore.c"
"skill.c"
"status.c"
"storage.c"
"trade.c"
"unit.c"
"vending.c"
)
set( MAP_TXT_SOURCES
"mapreg_txt.c"
)
set( MAP_SQL_SOURCES
"mapreg_sql.c"
)
# map txt
if( USE_ZLIB )
message ( STATUS "Creating target map-server" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} TXT_ONLY )
if( USE_PCRE )
message( STATUS "Using PCRE" )
list( APPEND LIBRARIES ${PCRE_LIBRARIES} )
list( APPEND INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} )
endif()
if( PACKETVER )
message( STATUS "Using PACKETVER=${PACKETVER}" )
list( APPEND DEFINITIONS PACKETVER=${PACKETVER} )
endif()
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${MT19937AR_SOURCES} ${COMMON_SOURCES} ${MAP_SOURCES} ${MAP_TXT_SOURCES} )
source_group( 3rdparty FILES ${MT19937AR_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} )
source_group( map FILES ${MAP_SOURCES} ${MAP_TXT_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( map-server ${SOURCE_FILES} )
target_link_libraries( map-server ${LIBRARIES} )
set_target_properties( map-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS map-server DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target map-server - done" )
else()
message ( STATUS "Skipping target map-server (requires ZLIB; optional PCRE)" )
endif()
# map sql
if( USE_ZLIB AND USE_MYSQL )
message ( STATUS "Creating target map-server_sql" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} ${MYSQL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${MT19937AR_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${MYSQL_INCLUDE_DIRS} ${COMMON_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} )
if( USE_PCRE )
message( STATUS "Using PCRE" )
list( APPEND LIBRARIES ${PCRE_LIBRARIES} )
list( APPEND INCLUDE_DIRS ${PCRE_INCLUDE_DIRS} )
endif()
if( PACKETVER )
message( STATUS "Using PACKETVER=${PACKETVER}" )
list( APPEND DEFINITIONS PACKETVER=${PACKETVER} )
endif()
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${MT19937AR_SOURCES} ${COMMON_SOURCES} ${COMMON_SQL_SOURCES} ${MAP_SOURCES} ${MAP_SQL_SOURCES} )
source_group( 3rdparty FILES ${MT19937AR_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} ${COMMON_SQL_SOURCES} )
source_group( map FILES ${MAP_SOURCES} ${MAP_SQL_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( map-server_sql ${SOURCE_FILES} )
target_link_libraries( map-server_sql ${LIBRARIES} )
set_target_properties( map-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS map-server_sql DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target map-server_sql - done" )
else()
message ( STATUS "Skipping target map-server_sql (requires ZLIB and MYSQL; optional PCRE)" )
endif()

49
src/tool/CMakeLists.txt Normal file
View File

@ -0,0 +1,49 @@
# setup
set( COMMON_SOURCES
"${COMMON_SOURCE_DIR}/core.c"
# "${COMMON_SOURCE_DIR}/db.c"
# "${COMMON_SOURCE_DIR}/ers.c"
"${COMMON_SOURCE_DIR}/grfio.c"
# "${COMMON_SOURCE_DIR}/lock.c"
"${COMMON_SOURCE_DIR}/malloc.c"
# "${COMMON_SOURCE_DIR}/mapindex.c"
# "${COMMON_SOURCE_DIR}/md5calc.c"
# "${COMMON_SOURCE_DIR}/nullpo.c"
# "${COMMON_SOURCE_DIR}/plugins.c"
# "${COMMON_SOURCE_DIR}/random.c"
"${COMMON_SOURCE_DIR}/showmsg.c"
# "${COMMON_SOURCE_DIR}/socket.c"
"${COMMON_SOURCE_DIR}/strlib.c"
# "${COMMON_SOURCE_DIR}/timer.c"
"${COMMON_SOURCE_DIR}/utils.c"
)
set( MAPCACHE_SOURCES
mapcache.c
)
# mapcache
if( USE_ZLIB )
message ( STATUS "Creating target mapcache" )
set( LIBRARIES ${GLOBAL_LIBRARIES} ${ZLIB_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${COMMON_INCLUDE_DIRS} )
set( DEFINITIONS ${GLOBAL_DEFINITIONS} MINICORE )
if( WIN32 )
list( APPEND LIBRARIES "oldnames.lib" "ws2_32.lib" )
list( APPEND INCLUDE_DIRS ${MSINTTYPES_INCLUDE_DIRS} )
endif()
set( SOURCE_FILES ${COMMON_SOURCES} ${MAPCACHE_SOURCES} )
source_group( common FILES ${COMMON_SOURCES} )
source_group( mapcache FILES ${MAPCACHE_SOURCES} )
add_executable( mapcache ${SOURCE_FILES} )
include_directories( ${INCLUDE_DIRS} )
target_link_libraries( mapcache ${ZLIB_LIBRARIES} )
set_target_properties( mapcache PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS mapcache DESTINATION ${CMAKE_INSTALL_PREFIX} )
endif()
message ( STATUS "Creating target mapcache - done" )
else()
message ( STATUS "Skipping target mapcache (requires ZLIB)" )
endif()