fix MSVC warning levels, move _CRT_SECURE_NO_WARNINGS define to sources

This commit is contained in:
Enno Rehling 2021-02-20 23:22:10 +01:00
parent 0af9fd18ef
commit e0e82c5fa5
62 changed files with 214 additions and 150 deletions

View File

@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 2.9) cmake_minimum_required(VERSION 3.13)
if (WIN32) if (WIN32)
file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH ) file(TO_CMAKE_PATH "${CMAKE_MODULE_PATH}" CMAKE_MODULE_PATH )
file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH ) file(TO_CMAKE_PATH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH )
@ -17,7 +18,6 @@ set (HAVE_STRLCAT 0)
set (HAVE_LIBBSD 0) set (HAVE_LIBBSD 0)
set (HAVE_SIGNAL_H 0) set (HAVE_SIGNAL_H 0)
set (HAVE_EXECINFO_H 0) set (HAVE_EXECINFO_H 0)
include (MSVC)
else (MSVC) else (MSVC)
include (CheckIncludeFile) include (CheckIncludeFile)
@ -41,6 +41,7 @@ if (NOT CURSES_FOUND)
find_package (Curses) find_package (Curses)
endif (NOT CURSES_FOUND) endif (NOT CURSES_FOUND)
#find_package (BerkeleyDB REQUIRED)
find_package (SQLite3 REQUIRED) find_package (SQLite3 REQUIRED)
find_package (IniParser REQUIRED) find_package (IniParser REQUIRED)
find_package (CJSON REQUIRED) find_package (CJSON REQUIRED)

2
clibs

@ -1 +1 @@
Subproject commit 6cdcdd62d167e0159d10d4e95b5def97d785fdef Subproject commit 8c3ce73e861c952d04a28949b4a80e68c2cce8fd

View File

@ -1,19 +0,0 @@
MACRO (MSVC_CRT_SECURE_NO_WARNINGS)
IF (MSVC)
FOREACH (target ${ARGN})
SET_TARGET_PROPERTIES (${target} PROPERTIES
COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS
)
ENDFOREACH (target)
ENDIF (MSVC)
ENDMACRO (MSVC_CRT_SECURE_NO_WARNINGS)
MACRO (MSVC_SET_WARNING_LEVEL level)
IF (MSVC)
IF(CMAKE_C_FLAGS MATCHES "/W[0-4]")
STRING(REGEX REPLACE "/W[0-4]" "/W${level}" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
ELSE()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W${level}")
ENDIF()
ENDIF(MSVC)
ENDMACRO (MSVC_SET_WARNING_LEVEL)

View File

@ -1,3 +1,5 @@
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0092 NEW)
project (server C) project (server C)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}) include_directories (${CMAKE_CURRENT_SOURCE_DIR})
@ -19,14 +21,13 @@ COMPILE_DEFINITIONS ERESSEA_BUILDNO="${ERESSEA_BUILDNO}")
ENDIF() ENDIF()
IF (CMAKE_COMPILER_IS_GNUCC) IF (CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wvla") add_compile_options(-Wvla)
ENDIF() ENDIF()
IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") IF (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion") add_compile_options(-Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
# SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c89")
ELSEIF(MSVC) ELSEIF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES") add_compile_options(/WX /MP)
# set(EXTRA_C_FLAGS /WX /MP /D_CRT_SECURE_NO_WARNINGS /D_USE_MATH_DEFINES)
set(CMAKE_EXE_LINKER_FLAGS_DEBUG set(CMAKE_EXE_LINKER_FLAGS_DEBUG
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib") "${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE set(CMAKE_EXE_LINKER_FLAGS_RELEASE
@ -46,6 +47,8 @@ ELSEIF(CMAKE_COMPILER_IS_GCC)
ENDIF() ENDIF()
ENDIF(CMAKE_COMPILER_IS_CLANG) ENDIF(CMAKE_COMPILER_IS_CLANG)
string(REGEX REPLACE "/W[3|4]" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_subdirectory(util) add_subdirectory(util)
add_subdirectory(kernel) add_subdirectory(kernel)
add_subdirectory(items) add_subdirectory(items)
@ -311,24 +314,24 @@ if (SQLite3_FOUND)
target_include_directories (game PRIVATE ${SQLite3_INCLUDE_DIRS}) target_include_directories (game PRIVATE ${SQLite3_INCLUDE_DIRS})
target_link_libraries(eressea ${SQLite3_LIBRARIES}) target_link_libraries(eressea ${SQLite3_LIBRARIES})
target_link_libraries(test_eressea ${SQLite3_LIBRARIES}) target_link_libraries(test_eressea ${SQLite3_LIBRARIES})
add_compile_definitions(game PRIVATE USE_SQLITE) target_compile_definitions(game PRIVATE USE_SQLITE)
elseif (DB_FOUND) elseif (DB_FOUND)
#include_directories (${DB_INCLUDE_DIR}) #include_directories (${DB_INCLUDE_DIR})
target_link_libraries(eressea ${DB_LIBRARIES}) target_link_libraries(eressea ${DB_LIBRARIES})
target_link_libraries(test_eressea ${DB_LIBRARIES}) target_link_libraries(test_eressea ${DB_LIBRARIES})
add_compile_definitions(game PRIVATE USE_DB) target_compile_definitions(game PRIVATE USE_DB)
endif(SQLite3_FOUND) endif(SQLite3_FOUND)
if (READLINE_FOUND) if (READLINE_FOUND)
#include_directories (${READLINE_INCLUDE_DIR}) #include_directories (${READLINE_INCLUDE_DIR})
target_link_libraries(eressea ${READLINE_LIBRARY}) target_link_libraries(eressea ${READLINE_LIBRARY})
add_compile_definitions(eressea PRIVATE DUSE_READLINE) target_compile_definitions(eressea PRIVATE DUSE_READLINE)
endif (READLINE_FOUND) endif (READLINE_FOUND)
if (CURSES_FOUND) if (CURSES_FOUND)
target_include_directories (eressea PRIVATE ${CURSES_INCLUDE_DIRS}) target_include_directories (eressea PRIVATE ${CURSES_INCLUDE_DIRS})
target_link_libraries(eressea ${CURSES_LIBRARIES}) target_link_libraries(eressea ${CURSES_LIBRARIES})
add_compile_definitions(eressea PRIVATE USE_CURSES) target_compile_definitions(eressea PRIVATE USE_CURSES)
endif(CURSES_FOUND) endif(CURSES_FOUND)
if (EXPAT_FOUND) if (EXPAT_FOUND)

View File

@ -145,7 +145,7 @@ static int read_ext(variant *var, void *owner, gamedata *data)
UNUSED_ARG(var); UNUSED_ARG(var);
READ_INT(data->store, &len); READ_INT(data->store, &len);
data->store->api->r_bin(data->store->handle, NULL, (size_t)len); data->store->api->r_str(data->store->handle, NULL, (size_t)len);
return AT_READ_OK; return AT_READ_OK;
} }

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "key.h" #include "key.h"

View File

@ -1,4 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#include <platform.h> #include <platform.h>
#endif #endif

View File

@ -1,4 +1,8 @@
#include <platform.h> #ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "battle.h" #include "battle.h"

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "bind_config.h" #include "bind_config.h"
#include "jsonconf.h" #include "jsonconf.h"

View File

@ -1,5 +1,7 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "bind_eressea.h" #include "bind_eressea.h"

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "bind_storage.h" #include "bind_storage.h"
#include <kernel/save.h> #include <kernel/save.h>

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "bindings.h" #include "bindings.h"
#include "bind_tolua.h" #include "bind_tolua.h"

View File

@ -1,7 +1,6 @@
#ifdef _MSV_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "util/order_parser.h" #include "util/order_parser.h"
#include "util/keyword.h" #include "util/keyword.h"
#include "util/language.h" #include "util/language.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/version.h> #include <kernel/version.h>
#include "creport.h" #include "creport.h"

View File

@ -1,4 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#include <platform.h> #include <platform.h>
#endif #endif

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "exparse.h" #include "exparse.h"

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include <curses.h> #include <curses.h>
#include "gmtool.h" #include "gmtool.h"

View File

@ -1,5 +1,6 @@
#include "platform.h" #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "json.h" #include "json.h"
#include <util/base36.h> #include <util/base36.h>

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "jsonconf.h" #include "jsonconf.h"
/* kernel includes */ /* kernel includes */
@ -47,22 +49,37 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
static int json_flags(cJSON *json, const char *flags[]) { static void json_map(void* object, void (*mapfun)(void* child, void* udata), void* udata)
cJSON *entry; {
int result = 0; cJSON *child, *json = (cJSON*)object;
assert(json->type == cJSON_Array); for (child = json->child; child; child = child->next) {
for (entry = json->child; entry; entry = entry->next) { mapfun(child, udata);
if (entry->type == cJSON_String) { }
int i; }
for (i = 0; flags[i]; ++i) {
if (strcmp(flags[i], entry->valuestring) == 0) { struct flags {
result |= (1 << i); const char** names;
break; int result;
} };
}
static void cb_flags(void* json, struct flags* flags)
{
cJSON* entry = (cJSON*)json;
int i;
for (i = 0; flags->names[i]; ++i) {
if (strcmp(flags->names[i], entry->valuestring) == 0) {
flags->result |= (1 << i);
break;
} }
} }
return result; }
static int json_flags(cJSON *json, const char *flags[]) {
struct flags ctx = { flags, 0 };
assert(json->type == cJSON_Array);
json_map(json, cb_flags, &ctx);
return ctx.result;
} }
static void json_requirements(cJSON *json, requirement **matp) { static void json_requirements(cJSON *json, requirement **matp) {

View File

@ -1,5 +1,7 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "kernel/types.h" #include "kernel/types.h"

View File

@ -1,4 +1,6 @@
#include "platform.h" #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "config.h" #include "config.h"
#include "ally.h" #include "ally.h"

View File

@ -94,33 +94,18 @@ void a_writechars(const variant * var, const void *owner, struct storage *store)
int a_readstring(variant * var, void *owner, struct gamedata *data) int a_readstring(variant * var, void *owner, struct gamedata *data)
{ {
char buf[DISPLAYSIZE]; char buf[DISPLAYSIZE];
char * result = 0;
int e; READ_STR(data->store, buf, sizeof(buf));
size_t len = 0; var->v = str_strdup(buf);
do {
e = READ_STR(data->store, buf, sizeof(buf));
if (result) {
char *tmp = realloc(result, len + DISPLAYSIZE - 1);
if (!tmp) {
free(result);
abort();
}
result = tmp;
strcpy(result + len, buf);
len += DISPLAYSIZE - 1;
}
else {
result = str_strdup(buf);
}
} while (e == ENOMEM);
var->v = result;
return AT_READ_OK; return AT_READ_OK;
} }
void a_writestring(const variant * var, const void *owner, struct storage *store) void a_writestring(const variant * var, const void *owner, struct storage *store)
{ {
const char* str = (const char*)var->v;
assert(var && var->v); assert(var && var->v);
WRITE_STR(store, (const char *)var->v); assert(strlen(str) < DISPLAYSIZE);
WRITE_STR(store, str);
} }
void a_finalizestring(variant * var) void a_finalizestring(variant * var)

View File

@ -1,7 +1,6 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "config.h" #include "config.h"
/* kernel includes */ /* kernel includes */

View File

@ -1,5 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include <util/log.h> #include <util/log.h>

View File

@ -1,5 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "faction.h" #include "faction.h"
#include "calendar.h" #include "calendar.h"

View File

@ -1,5 +1,8 @@
#include <platform.h> #ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/ally.h> #include <kernel/ally.h>
#include <kernel/alliance.h> #include <kernel/alliance.h>
#include <kernel/calendar.h> #include <kernel/calendar.h>

View File

@ -1,5 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "gamedata.h" #include "gamedata.h"
#include <util/log.h> #include <util/log.h>

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "item.h" #include "item.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "messages.h" #include "messages.h"
/* kernel includes */ /* kernel includes */

View File

@ -1,7 +1,6 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include <kernel/config.h> #include <kernel/config.h>
#include "order.h" #include "order.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "race.h" #include "race.h"

View File

@ -1,4 +1,8 @@
#include <platform.h> #ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "faction.h" #include "faction.h"
#include "unit.h" #include "unit.h"
#include "race.h" #include "race.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/version.h> #include <kernel/version.h>
#include "save.h" #include "save.h"

View File

@ -1,4 +1,8 @@
#include <platform.h> #ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/race.h> #include <kernel/race.h>
#include <attributes/key.h> #include <attributes/key.h>

View File

@ -1,3 +1,8 @@
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/ally.h> #include <kernel/ally.h>
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/curse.h> #include <kernel/curse.h>

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "version.h" #include "version.h"

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include <kernel/config.h> #include <kernel/config.h>
#include "laws.h" #include "laws.h"

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "magic.h" #include "magic.h"

View File

@ -1,3 +1,9 @@
#ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/calendar.h> #include <kernel/calendar.h>
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/messages.h> #include <kernel/messages.h>

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "autoseed.h" #include "autoseed.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "score.h" #include "score.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "names.h" #include "names.h"

View File

@ -1,4 +1,8 @@
#include <platform.h> #ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "orderfile.h" #include "orderfile.h"

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "report.h" #include "report.h"

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "reports.h" #include "reports.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "skill.h" #include "skill.h"

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include <kernel/config.h> #include <kernel/config.h>
#include "study.h" #include "study.h"

View File

@ -1,5 +1,5 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include <kernel/config.h> #include <kernel/config.h>

View File

@ -1,4 +1,8 @@
#include <platform.h> #ifdef _MSC_VER
#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#include "tests.h" #include "tests.h"
#include "prefix.h" #include "prefix.h"
#include "creport.h" #include "creport.h"

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "crmessage.h" #include "crmessage.h"
#include "macros.h" #include "macros.h"

View File

@ -1,26 +1,28 @@
cmake_minimum_required(VERSION 2.9)
project (crypto C) project (crypto C)
IF (MSVC) if (MSVC)
include (MSVC) #add_compile_definitions (_CRT_SECURE_NO_WARNINGS)
MSVC_SET_WARNING_LEVEL(3) add_compile_options(/WX)
ENDIF (MSVC) if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W3" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else()
add_compile_options(/W3)
endif()
endif (MSVC)
SET (LIB_SRC set (LIB_SRC
crypto.c crypto.c
crypt_blowfish/wrapper.c crypt_blowfish/wrapper.c
crypt_blowfish/crypt_blowfish.c crypt_blowfish/crypt_blowfish.c
crypt_blowfish/crypt_gensalt.c crypt_blowfish/crypt_gensalt.c
) )
ADD_LIBRARY (crypto ${LIB_SRC}) add_library (crypto ${LIB_SRC})
set (CRYPTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "crypto headers") set (CRYPTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "crypto headers")
set (CRYPTO_LIBRARIES crypto CACHE INTERNAL "crypto libraries") set (CRYPTO_LIBRARIES crypto CACHE INTERNAL "crypto libraries")
IF(WIN32) if(WIN32)
SET(CRYPTO_LIBRARIES ${CRYPTO_LIBRARIES} bcrypt CACHE set(CRYPTO_LIBRARIES ${CRYPTO_LIBRARIES} bcrypt CACHE
INTERNAL "crypto libraries") INTERNAL "crypto libraries")
ENDIF() endif()
IF (MSVC)
MSVC_CRT_SECURE_NO_WARNINGS (crypto)
ENDIF (MSVC)

View File

@ -1,4 +1,6 @@
#include <platform.h> #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <kernel/config.h> #include <kernel/config.h>
#include "keyword.h" #include "keyword.h"

View File

@ -1,7 +1,6 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "language.h" #include "language.h"
#include "log.h" #include "log.h"

View File

@ -1,3 +1,6 @@
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "log.h" #include "log.h"
#include "path.h" #include "path.h"

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "log.h" #include "log.h"
#include "stats.h" #include "stats.h"
#include "macros.h" #include "macros.h"

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "order_parser.h" #include "order_parser.h"
#include "strings.h" #include "strings.h"

View File

@ -1,7 +1,6 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #define _CRT_SECURE_NO_WARNINGS
#endif #endif
#include "pofile.h" #include "pofile.h"
#include "log.h" #include "log.h"
#include "strings.h" #include "strings.h"

View File

@ -1,5 +1,7 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include <CuTest.h> #include <CuTest.h>

View File

@ -1,7 +1,8 @@
#ifdef _MSC_VER #ifdef _MSC_VER
#include <platform.h> #ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#endif #endif
#include "unicode.h" #include "unicode.h"
#include <CuTest.h> #include <CuTest.h>

@ -1 +1 @@
Subproject commit 1f558529f7393c743c346a679d050d5f4ed19f14 Subproject commit 629e578a7f912580933da26d8dc2c27804992fb3

2
tolua

@ -1 +1 @@
Subproject commit a3dec42d329dabcfe0a19c9bba506f7074883dba Subproject commit 7c73f64e0a0001f49f04c51921e4c15167e4e67b

View File

@ -1,7 +1,5 @@
@ECHO OFF @ECHO OFF
IF "%WIN32_DEV%" == "" SET WIN32_DEV="C:\Libraries"
SET CMAKE_ROOT=%ProgramFiles%\CMake SET CMAKE_ROOT=%ProgramFiles%\CMake
IF "%LUA_DEV%" == "" SET LUA_DEV="%ProgramFiles(x86)%/Lua/5.1"
SET VSVERSION=16 SET VSVERSION=16
SET SRCDIR=%CD% SET SRCDIR=%CD%
REM CD .. REM CD ..
@ -17,5 +15,5 @@ cd build-vs%VSVERSION%
IF NOT EXIST CMakeCache.txt GOTO NOCACHE IF NOT EXIST CMakeCache.txt GOTO NOCACHE
DEL CMakeCache.txt DEL CMakeCache.txt
:NOCACHE :NOCACHE
"%CMAKE_ROOT%\bin\cmake.exe" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -A Win32 -G "Visual Studio %VSVERSION%" -DCMAKE_PREFIX_PATH="%LUA_DEV%;%WIN32_DEV%" -DCMAKE_MODULE_PATH="%CMAKE_MODULES%" -DCMAKE_SUPPRESS_REGENERATION=TRUE .. "%CMAKE_ROOT%\bin\cmake.exe" -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -A x64 -G "Visual Studio %VSVERSION%" -DCMAKE_MODULE_PATH="%CMAKE_MODULES%" -DCMAKE_SUPPRESS_REGENERATION=TRUE ..
PAUSE PAUSE