summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
Diffstat (limited to 'src/login')
-rw-r--r--src/login/CMakeLists.txt4
-rw-r--r--src/login/account_txt.c8
-rw-r--r--src/login/sql/CMakeLists.txt34
-rw-r--r--src/login/txt/CMakeLists.txt34
4 files changed, 37 insertions, 43 deletions
diff --git a/src/login/CMakeLists.txt b/src/login/CMakeLists.txt
index afa4e5f20..eabc47eac 100644
--- a/src/login/CMakeLists.txt
+++ b/src/login/CMakeLists.txt
@@ -2,7 +2,9 @@
#
# setup
#
-set( LOGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
+set( LOGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
+set( TXT_LOGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
+set( SQL_LOGIN_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "" )
#
diff --git a/src/login/account_txt.c b/src/login/account_txt.c
index 821e26df5..79e22ac3b 100644
--- a/src/login/account_txt.c
+++ b/src/login/account_txt.c
@@ -283,7 +283,7 @@ static bool account_db_txt_create(AccountDB* self, struct mmo_account* acc)
return false;
// check if the account_id is free
- tmp = idb_get(accounts, account_id);
+ tmp = (struct mmo_account*)idb_get(accounts, account_id);
if( tmp != NULL )
{// error condition - entry already present
ShowError("account_db_txt_create: cannot create account %d:'%s', this id is already occupied by %d:'%s'!\n", account_id, acc->userid, account_id, tmp->userid);
@@ -316,7 +316,7 @@ static bool account_db_txt_remove(AccountDB* self, const int account_id)
DBMap* accounts = db->accounts;
//TODO: find out if this really works
- struct mmo_account* tmp = idb_remove(accounts, account_id);
+ struct mmo_account* tmp = (struct mmo_account*)idb_remove(accounts, account_id);
if( tmp == NULL )
{// error condition - entry not present
ShowError("account_db_txt_remove: no such account with id %d\n", account_id);
@@ -337,7 +337,7 @@ static bool account_db_txt_save(AccountDB* self, const struct mmo_account* acc)
int account_id = acc->account_id;
// retrieve previous data
- struct mmo_acount* tmp = idb_get(accounts, account_id);
+ struct mmo_account* tmp = (struct mmo_account*)idb_get(accounts, account_id);
if( tmp == NULL )
{// error condition - entry not found
return false;
@@ -360,7 +360,7 @@ static bool account_db_txt_load_num(AccountDB* self, struct mmo_account* acc, co
DBMap* accounts = db->accounts;
// retrieve data
- struct mmo_account* tmp = idb_get(accounts, account_id);
+ struct mmo_account* tmp = (struct mmo_account*)idb_get(accounts, account_id);
if( tmp == NULL )
{// entry not found
return false;
diff --git a/src/login/sql/CMakeLists.txt b/src/login/sql/CMakeLists.txt
index ac7d464c9..f452823ec 100644
--- a/src/login/sql/CMakeLists.txt
+++ b/src/login/sql/CMakeLists.txt
@@ -2,24 +2,24 @@
#
# login sql
#
-if( HAVE_common_sql )
+if( BUILD_SQL_SERVERS )
message( STATUS "Creating target login-server_sql" )
set( SQL_LOGIN_HEADERS
- "${LOGIN_SOURCE_DIR}/account.h"
- "${LOGIN_SOURCE_DIR}/ipban.h"
- "${LOGIN_SOURCE_DIR}/login.h"
- "${LOGIN_SOURCE_DIR}/loginlog.h"
+ "${SQL_LOGIN_SOURCE_DIR}/account.h"
+ "${SQL_LOGIN_SOURCE_DIR}/ipban.h"
+ "${SQL_LOGIN_SOURCE_DIR}/login.h"
+ "${SQL_LOGIN_SOURCE_DIR}/loginlog.h"
)
set( SQL_LOGIN_SOURCES
- "${LOGIN_SOURCE_DIR}/account_sql.c"
- "${LOGIN_SOURCE_DIR}/ipban_sql.c"
- "${LOGIN_SOURCE_DIR}/login.c"
- "${LOGIN_SOURCE_DIR}/loginlog_sql.c"
+ "${SQL_LOGIN_SOURCE_DIR}/account_sql.c"
+ "${SQL_LOGIN_SOURCE_DIR}/ipban_sql.c"
+ "${SQL_LOGIN_SOURCE_DIR}/login.c"
+ "${SQL_LOGIN_SOURCE_DIR}/loginlog_sql.c"
)
set( DEPENDENCIES common_sql )
set( LIBRARIES ${GLOBAL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} )
-set( DEFINITIONS ${GLOBAL_DEFINITIONS} WITH_SQL )
+set( DEFINITIONS "${GLOBAL_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} )
@@ -27,17 +27,13 @@ include_directories( ${INCLUDE_DIRS} )
add_executable( login-server_sql ${SOURCE_FILES} )
add_dependencies( login-server_sql ${DEPENDENCIES} )
target_link_libraries( login-server_sql ${LIBRARIES} ${DEPENDENCIES} )
-set_target_properties( login-server_sql PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
-if( WITH_COMPONENT_RUNTIME )
+set_target_properties( login-server_sql PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
+if( INSTALL_COMPONENT_RUNTIME )
cpack_add_component( Runtime_loginserver_sql DESCRIPTION "login-server (sql version)" DISPLAY_NAME "login-server_sql" GROUP Runtime )
install( TARGETS login-server_sql
DESTINATION "."
COMPONENT Runtime_loginserver_sql )
-endif()
+endif( INSTALL_COMPONENT_RUNTIME )
+set( TARGET_LIST ${TARGET_LIST} login-server_sql CACHE INTERNAL "" )
message( STATUS "Creating target login-server_sql - done" )
-set( HAVE_login-server_sql ON CACHE BOOL "login-server_sql target is available" )
-mark_as_advanced( HAVE_login-server_sql )
-else()
-message( STATUS "Skipping target login-server_sql (requires common_sql)" )
-unset( HAVE_login-server_sql CACHE )
-endif()
+endif( BUILD_SQL_SERVERS )
diff --git a/src/login/txt/CMakeLists.txt b/src/login/txt/CMakeLists.txt
index 9d57103e9..1df5b32a9 100644
--- a/src/login/txt/CMakeLists.txt
+++ b/src/login/txt/CMakeLists.txt
@@ -2,24 +2,24 @@
#
# login txt
#
-if( HAVE_common_base )
+if( BUILD_TXT_SERVERS )
message( STATUS "Creating target login-server" )
set( TXT_LOGIN_HEADERS
- "${LOGIN_SOURCE_DIR}/account.h"
- "${LOGIN_SOURCE_DIR}/ipban.h"
- "${LOGIN_SOURCE_DIR}/login.h"
- "${LOGIN_SOURCE_DIR}/loginlog.h"
+ "${TXT_LOGIN_SOURCE_DIR}/account.h"
+ "${TXT_LOGIN_SOURCE_DIR}/ipban.h"
+ "${TXT_LOGIN_SOURCE_DIR}/login.h"
+ "${TXT_LOGIN_SOURCE_DIR}/loginlog.h"
)
set( TXT_LOGIN_SOURCES
- "${LOGIN_SOURCE_DIR}/account_txt.c"
- "${LOGIN_SOURCE_DIR}/ipban_txt.c"
- "${LOGIN_SOURCE_DIR}/login.c"
- "${LOGIN_SOURCE_DIR}/loginlog_txt.c"
+ "${TXT_LOGIN_SOURCE_DIR}/account_txt.c"
+ "${TXT_LOGIN_SOURCE_DIR}/ipban_txt.c"
+ "${TXT_LOGIN_SOURCE_DIR}/login.c"
+ "${TXT_LOGIN_SOURCE_DIR}/loginlog_txt.c"
)
set( DEPENDENCIES common_base )
set( LIBRARIES ${GLOBAL_LIBRARIES} )
set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} )
-set( DEFINITIONS ${GLOBAL_DEFINITIONS} WITH_TXT )
+set( DEFINITIONS "${GLOBAL_DEFINITIONS} -DWITH_TXT" )
set( SOURCE_FILES ${COMMON_BASE_HEADERS} ${TXT_LOGIN_HEADERS} ${TXT_LOGIN_SOURCES} )
source_group( common FILES ${COMMON_BASE_HEADERS} )
source_group( login FILES ${TXT_LOGIN_HEADERS} ${TXT_LOGIN_SOURCES} )
@@ -27,17 +27,13 @@ include_directories( ${INCLUDE_DIRS} )
add_executable( login-server ${SOURCE_FILES} )
add_dependencies( login-server ${DEPENDENCIES} )
target_link_libraries( login-server ${LIBRARIES} ${DEPENDENCIES} )
-set_target_properties( login-server PROPERTIES COMPILE_DEFINITIONS "${DEFINITIONS}" )
-if( WITH_COMPONENT_RUNTIME )
+set_target_properties( login-server PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" )
+if( INSTALL_COMPONENT_RUNTIME )
cpack_add_component( Runtime_loginserver_txt DESCRIPTION "login-server (txt version)" DISPLAY_NAME "login-server" GROUP Runtime )
install( TARGETS login-server
DESTINATION "."
COMPONENT Runtime_loginserver_txt )
-endif()
+endif( INSTALL_COMPONENT_RUNTIME )
+set( TARGET_LIST ${TARGET_LIST} login-server CACHE INTERNAL "" )
message( STATUS "Creating target login-server - done" )
-set( HAVE_login-server ON CACHE BOOL "login-server target is available" )
-mark_as_advanced( HAVE_login-server )
-else()
-message( STATUS "Skipping target login-server (requires common_base)" )
-unset( HAVE_login-server CACHE )
-endif()
+endif( BUILD_TXT_SERVERS )