* CMake: src/common builds static libraries common_base/common_sql, that are used as dependencies by the other targets.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14889 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
flaviojs
2011-07-06 20:40:38 +00:00
parent 0394156c54
commit 9be2d9dbbd
14 changed files with 596 additions and 439 deletions

View File

@@ -2,72 +2,7 @@
#
# 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
"${CMAKE_CURRENT_SOURCE_DIR}/atcommand.c"
"${CMAKE_CURRENT_SOURCE_DIR}/battle.c"
"${CMAKE_CURRENT_SOURCE_DIR}/battleground.c"
"${CMAKE_CURRENT_SOURCE_DIR}/buyingstore.c"
"${CMAKE_CURRENT_SOURCE_DIR}/chat.c"
"${CMAKE_CURRENT_SOURCE_DIR}/chrif.c"
"${CMAKE_CURRENT_SOURCE_DIR}/clif.c"
"${CMAKE_CURRENT_SOURCE_DIR}/date.c"
"${CMAKE_CURRENT_SOURCE_DIR}/duel.c"
"${CMAKE_CURRENT_SOURCE_DIR}/guild.c"
"${CMAKE_CURRENT_SOURCE_DIR}/homunculus.c"
"${CMAKE_CURRENT_SOURCE_DIR}/instance.c"
"${CMAKE_CURRENT_SOURCE_DIR}/intif.c"
"${CMAKE_CURRENT_SOURCE_DIR}/itemdb.c"
"${CMAKE_CURRENT_SOURCE_DIR}/log.c"
"${CMAKE_CURRENT_SOURCE_DIR}/mail.c"
"${CMAKE_CURRENT_SOURCE_DIR}/map.c"
"${CMAKE_CURRENT_SOURCE_DIR}/mercenary.c"
"${CMAKE_CURRENT_SOURCE_DIR}/mob.c"
"${CMAKE_CURRENT_SOURCE_DIR}/npc.c"
"${CMAKE_CURRENT_SOURCE_DIR}/npc_chat.c"
"${CMAKE_CURRENT_SOURCE_DIR}/party.c"
"${CMAKE_CURRENT_SOURCE_DIR}/path.c"
"${CMAKE_CURRENT_SOURCE_DIR}/pc.c"
"${CMAKE_CURRENT_SOURCE_DIR}/pet.c"
"${CMAKE_CURRENT_SOURCE_DIR}/quest.c"
"${CMAKE_CURRENT_SOURCE_DIR}/script.c"
"${CMAKE_CURRENT_SOURCE_DIR}/searchstore.c"
"${CMAKE_CURRENT_SOURCE_DIR}/skill.c"
"${CMAKE_CURRENT_SOURCE_DIR}/status.c"
"${CMAKE_CURRENT_SOURCE_DIR}/storage.c"
"${CMAKE_CURRENT_SOURCE_DIR}/trade.c"
"${CMAKE_CURRENT_SOURCE_DIR}/unit.c"
"${CMAKE_CURRENT_SOURCE_DIR}/vending.c"
)
set( MAP_TXT_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/mapreg_txt.c"
)
set( MAP_SQL_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/mapreg_sql.c"
)
set( MAP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
#

View File

@@ -2,38 +2,108 @@
#
# 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} )
if( HAVE_common_sql )
message( STATUS "Creating target map-server_sql" )
set( SQL_MAP_HEADERS
"${MAP_SOURCE_DIR}/atcommand.h"
"${MAP_SOURCE_DIR}/battle.h"
"${MAP_SOURCE_DIR}/battleground.h"
"${MAP_SOURCE_DIR}/buyingstore.h"
"${MAP_SOURCE_DIR}/chat.h"
"${MAP_SOURCE_DIR}/chrif.h"
"${MAP_SOURCE_DIR}/clif.h"
"${MAP_SOURCE_DIR}/date.h"
"${MAP_SOURCE_DIR}/duel.h"
"${MAP_SOURCE_DIR}/guild.h"
"${MAP_SOURCE_DIR}/homunculus.h"
"${MAP_SOURCE_DIR}/instance.h"
"${MAP_SOURCE_DIR}/intif.h"
"${MAP_SOURCE_DIR}/itemdb.h"
"${MAP_SOURCE_DIR}/log.h"
"${MAP_SOURCE_DIR}/mail.h"
"${MAP_SOURCE_DIR}/map.h"
"${MAP_SOURCE_DIR}/mapreg.h"
"${MAP_SOURCE_DIR}/mercenary.h"
"${MAP_SOURCE_DIR}/mob.h"
"${MAP_SOURCE_DIR}/npc.h"
"${MAP_SOURCE_DIR}/party.h"
"${MAP_SOURCE_DIR}/path.h"
"${MAP_SOURCE_DIR}/pc.h"
"${MAP_SOURCE_DIR}/pet.h"
"${MAP_SOURCE_DIR}/quest.h"
"${MAP_SOURCE_DIR}/script.h"
"${MAP_SOURCE_DIR}/searchstore.h"
"${MAP_SOURCE_DIR}/skill.h"
"${MAP_SOURCE_DIR}/status.h"
"${MAP_SOURCE_DIR}/storage.h"
"${MAP_SOURCE_DIR}/trade.h"
"${MAP_SOURCE_DIR}/unit.h"
"${MAP_SOURCE_DIR}/vending.h"
)
set( SQL_MAP_SOURCES
"${MAP_SOURCE_DIR}/atcommand.c"
"${MAP_SOURCE_DIR}/battle.c"
"${MAP_SOURCE_DIR}/battleground.c"
"${MAP_SOURCE_DIR}/buyingstore.c"
"${MAP_SOURCE_DIR}/chat.c"
"${MAP_SOURCE_DIR}/chrif.c"
"${MAP_SOURCE_DIR}/clif.c"
"${MAP_SOURCE_DIR}/date.c"
"${MAP_SOURCE_DIR}/duel.c"
"${MAP_SOURCE_DIR}/guild.c"
"${MAP_SOURCE_DIR}/homunculus.c"
"${MAP_SOURCE_DIR}/instance.c"
"${MAP_SOURCE_DIR}/intif.c"
"${MAP_SOURCE_DIR}/itemdb.c"
"${MAP_SOURCE_DIR}/log.c"
"${MAP_SOURCE_DIR}/mail.c"
"${MAP_SOURCE_DIR}/map.c"
"${MAP_SOURCE_DIR}/mapreg_sql.c"
"${MAP_SOURCE_DIR}/mercenary.c"
"${MAP_SOURCE_DIR}/mob.c"
"${MAP_SOURCE_DIR}/npc.c"
"${MAP_SOURCE_DIR}/npc_chat.c"
"${MAP_SOURCE_DIR}/party.c"
"${MAP_SOURCE_DIR}/path.c"
"${MAP_SOURCE_DIR}/pc.c"
"${MAP_SOURCE_DIR}/pet.c"
"${MAP_SOURCE_DIR}/quest.c"
"${MAP_SOURCE_DIR}/script.c"
"${MAP_SOURCE_DIR}/searchstore.c"
"${MAP_SOURCE_DIR}/skill.c"
"${MAP_SOURCE_DIR}/status.c"
"${MAP_SOURCE_DIR}/storage.c"
"${MAP_SOURCE_DIR}/trade.c"
"${MAP_SOURCE_DIR}/unit.c"
"${MAP_SOURCE_DIR}/vending.c"
)
set( DEPENDENCIES common_sql )
set( LIBRARIES ${GLOBAL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_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} )
list( APPEND DEFINITIONS PCRE_SUPPORT )
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} )
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} )
add_executable( map-server_sql ${SOURCE_FILES} )
target_link_libraries( map-server_sql ${LIBRARIES} )
add_dependencies( map-server_sql ${DEPENDENCIES} )
target_link_libraries( map-server_sql ${LIBRARIES} ${DEPENDENCIES} )
set_target_properties( map-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS map-server_sql
DESTINATION ${CMAKE_INSTALL_PREFIX}
COMPONENT "map-server_sql" )
endif()
message ( STATUS "Creating target map-server_sql - done" )
message( STATUS "Creating target map-server_sql - done" )
set( HAVE_map-server_sql ON CACHE BOOL "map-server_sql target is available" )
mark_as_advanced( HAVE_map-server_sql )
else()
message ( STATUS "Skipping target map-server_sql (requires ZLIB and MYSQL; optional PCRE)" )
message( STATUS "Skipping target map-server_sql (requires common_sql; optional PCRE)" )
unset( HAVE_map-server_sql CACHE )
endif()

View File

@@ -2,38 +2,108 @@
#
# 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} )
if( HAVE_common_base )
message( STATUS "Creating target map-server" )
set( TXT_MAP_HEADERS
"${MAP_SOURCE_DIR}/atcommand.h"
"${MAP_SOURCE_DIR}/battle.h"
"${MAP_SOURCE_DIR}/battleground.h"
"${MAP_SOURCE_DIR}/buyingstore.h"
"${MAP_SOURCE_DIR}/chat.h"
"${MAP_SOURCE_DIR}/chrif.h"
"${MAP_SOURCE_DIR}/clif.h"
"${MAP_SOURCE_DIR}/date.h"
"${MAP_SOURCE_DIR}/duel.h"
"${MAP_SOURCE_DIR}/guild.h"
"${MAP_SOURCE_DIR}/homunculus.h"
"${MAP_SOURCE_DIR}/instance.h"
"${MAP_SOURCE_DIR}/intif.h"
"${MAP_SOURCE_DIR}/itemdb.h"
"${MAP_SOURCE_DIR}/log.h"
"${MAP_SOURCE_DIR}/mail.h"
"${MAP_SOURCE_DIR}/map.h"
"${MAP_SOURCE_DIR}/mapreg.h"
"${MAP_SOURCE_DIR}/mercenary.h"
"${MAP_SOURCE_DIR}/mob.h"
"${MAP_SOURCE_DIR}/npc.h"
"${MAP_SOURCE_DIR}/party.h"
"${MAP_SOURCE_DIR}/path.h"
"${MAP_SOURCE_DIR}/pc.h"
"${MAP_SOURCE_DIR}/pet.h"
"${MAP_SOURCE_DIR}/quest.h"
"${MAP_SOURCE_DIR}/script.h"
"${MAP_SOURCE_DIR}/searchstore.h"
"${MAP_SOURCE_DIR}/skill.h"
"${MAP_SOURCE_DIR}/status.h"
"${MAP_SOURCE_DIR}/storage.h"
"${MAP_SOURCE_DIR}/trade.h"
"${MAP_SOURCE_DIR}/unit.h"
"${MAP_SOURCE_DIR}/vending.h"
)
set( TXT_MAP_SOURCES
"${MAP_SOURCE_DIR}/atcommand.c"
"${MAP_SOURCE_DIR}/battle.c"
"${MAP_SOURCE_DIR}/battleground.c"
"${MAP_SOURCE_DIR}/buyingstore.c"
"${MAP_SOURCE_DIR}/chat.c"
"${MAP_SOURCE_DIR}/chrif.c"
"${MAP_SOURCE_DIR}/clif.c"
"${MAP_SOURCE_DIR}/date.c"
"${MAP_SOURCE_DIR}/duel.c"
"${MAP_SOURCE_DIR}/guild.c"
"${MAP_SOURCE_DIR}/homunculus.c"
"${MAP_SOURCE_DIR}/instance.c"
"${MAP_SOURCE_DIR}/intif.c"
"${MAP_SOURCE_DIR}/itemdb.c"
"${MAP_SOURCE_DIR}/log.c"
"${MAP_SOURCE_DIR}/mail.c"
"${MAP_SOURCE_DIR}/map.c"
"${MAP_SOURCE_DIR}/mapreg_txt.c"
"${MAP_SOURCE_DIR}/mercenary.c"
"${MAP_SOURCE_DIR}/mob.c"
"${MAP_SOURCE_DIR}/npc.c"
"${MAP_SOURCE_DIR}/npc_chat.c"
"${MAP_SOURCE_DIR}/party.c"
"${MAP_SOURCE_DIR}/path.c"
"${MAP_SOURCE_DIR}/pc.c"
"${MAP_SOURCE_DIR}/pet.c"
"${MAP_SOURCE_DIR}/quest.c"
"${MAP_SOURCE_DIR}/script.c"
"${MAP_SOURCE_DIR}/searchstore.c"
"${MAP_SOURCE_DIR}/skill.c"
"${MAP_SOURCE_DIR}/status.c"
"${MAP_SOURCE_DIR}/storage.c"
"${MAP_SOURCE_DIR}/trade.c"
"${MAP_SOURCE_DIR}/unit.c"
"${MAP_SOURCE_DIR}/vending.c"
)
set( DEPENDENCIES common_base )
set( LIBRARIES ${GLOBAL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_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} )
list( APPEND DEFINITIONS PCRE_SUPPORT )
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} )
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_MAP_HEADERS} ${TXT_MAP_SOURCES} )
source_group( common FILES ${COMMON_BASE_HEADERS} )
source_group( map FILES ${TXT_MAP_HEADERS} ${TXT_MAP_SOURCES} )
include_directories( ${INCLUDE_DIRS} )
add_executable( map-server ${SOURCE_FILES} )
target_link_libraries( map-server ${LIBRARIES} )
add_dependencies( map-server ${DEPENDENCIES} )
target_link_libraries( map-server ${LIBRARIES} ${DEPENDENCIES} )
set_target_properties( map-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
if( INSTALL_RUN_DATA )
install( TARGETS map-server
DESTINATION ${CMAKE_INSTALL_PREFIX}
COMPONENT "map-server" )
endif()
message ( STATUS "Creating target map-server - done" )
message( STATUS "Creating target map-server - done" )
set( HAVE_map-server ON CACHE BOOL "map-server target is available" )
mark_as_advanced( HAVE_map-server )
else()
message ( STATUS "Skipping target map-server (requires ZLIB; optional PCRE)" )
message( STATUS "Skipping target map-server (requires common_base; optional PCRE)" )
unset( HAVE_map-server CACHE )
endif()