You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Windows build fixes
- use /MT flag instead of /MD - add debug libraries to package
This commit is contained in:
@@ -19,6 +19,8 @@ ENDIF()
|
||||
IF(NOT WIN32)
|
||||
OPTION(WITH_MYSQLCOMPAT "creates libmysql* symbolic links" ON)
|
||||
OPTION(WITH_OPENSSL "enables SSL support" ON)
|
||||
ELSE()
|
||||
OPTION(WITH_OPENSSL "enables SSL support" OFF)
|
||||
ENDIF()
|
||||
|
||||
OPTION(WITH_SQLITE "Enables Sqlite support" OFF)
|
||||
@@ -30,13 +32,22 @@ IF(WIN32)
|
||||
# Speedup system tests
|
||||
INCLUDE(${CMAKE_SOURCE_DIR}/cmake/WindowsCache.cmake)
|
||||
IF (MSVC)
|
||||
FOREACH(flag_var
|
||||
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||
IF(${flag_var} MATCHES "/MD")
|
||||
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
ENDIF()
|
||||
ENDFOREACH(flag_var)
|
||||
SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO")
|
||||
FOREACH(BUILD_TYPE ${CONFIG_TYPES})
|
||||
FOREACH(COMPILER CXX C)
|
||||
SET(COMPILER_FLAGS "${CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE}}")
|
||||
IF (NOT COMPILER_FLAGS STREQUAL "")
|
||||
STRING(REPLACE "/MD" "/MT" COMPILER_FLAGS ${COMPILER_FLAGS})
|
||||
IF (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
SET(COMPILER_FLAGS "${COMPILER_FLAGS} /RTC1 /RTCc")
|
||||
STRING(REPLACE "/Zi" "/ZI" COMPILER_FLAGS ${COMPILER_FLAGS})
|
||||
ENDIF()
|
||||
MESSAGE (STATUS "CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE}= ${COMPILER_FLAGS}")
|
||||
SET(CMAKE_${COMPILER}_FLAGS_${BUILD_TYPE} ${COMPILER_FLAGS} CACHE
|
||||
STRING "overwritten by libmariadb" FORCE)
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
@@ -264,4 +264,9 @@ inline double ulonglong2double(ulonglong value)
|
||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
||||
#define strcasecmp(A,B) _stricmp((A),(B))
|
||||
|
||||
#define close(A) _close((A))
|
||||
#define fdopen(A,B) _fdopen((A),(B))
|
||||
#define sopen(A,B,C,D) _sopen((A),(B),(C),(D))
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -38,16 +38,16 @@ extern "C" {
|
||||
/* we use the mysqlnd implementation */
|
||||
typedef struct charset_info_st
|
||||
{
|
||||
uint nr; /* so far only 1 byte for charset */
|
||||
uint state;
|
||||
unsigned int nr; /* so far only 1 byte for charset */
|
||||
unsigned int state;
|
||||
char *csname;
|
||||
char *name;
|
||||
char *dir;
|
||||
char *encoding;
|
||||
uint char_minlen;
|
||||
uint char_maxlen;
|
||||
uint (*mb_charlen)(uint c);
|
||||
uint (*mb_valid)(const char *start, const char *end);
|
||||
unsigned int char_minlen;
|
||||
unsigned int char_maxlen;
|
||||
unsigned int (*mb_charlen)(unsigned int c);
|
||||
unsigned int (*mb_valid)(const char *start, const char *end);
|
||||
} CHARSET_INFO;
|
||||
|
||||
extern const CHARSET_INFO compiled_charsets[];
|
||||
@@ -56,7 +56,7 @@ extern CHARSET_INFO *my_charset_bin;
|
||||
extern CHARSET_INFO *my_charset_latin1;
|
||||
extern CHARSET_INFO *my_charset_utf8_general_ci;
|
||||
|
||||
CHARSET_INFO *find_compiled_charset(uint cs_number);
|
||||
CHARSET_INFO *find_compiled_charset(unsigned int cs_number);
|
||||
CHARSET_INFO *find_compiled_charset_by_name(const char *name);
|
||||
|
||||
size_t mysql_cset_escape_quotes(const CHARSET_INFO *cset, char *newstr, const char *escapestr, size_t escapestr_len);
|
||||
|
@@ -155,8 +155,8 @@ IF(OPENSSL_FOUND)
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(libmariadb ws2_32)
|
||||
TARGET_LINK_LIBRARIES(mariadbclient ws2_32)
|
||||
TARGET_LINK_LIBRARIES(libmariadb ws2_32 advapi32 kernel32)
|
||||
TARGET_LINK_LIBRARIES(mariadbclient ws2_32 advapi32 kernel32)
|
||||
ELSE()
|
||||
TARGET_LINK_LIBRARIES(libmariadb m)
|
||||
TARGET_LINK_LIBRARIES(mariadbclient m)
|
||||
|
@@ -2050,7 +2050,11 @@ static void DBUGOpenFile(CODE_STATE *cs,
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef _WIN32
|
||||
if (fopen_s(&fp, name, append ? "a+" : "w"))
|
||||
#else
|
||||
if (!(fp= fopen(name, append ? "a+" : "w")))
|
||||
#endif
|
||||
{
|
||||
(void) fprintf(stderr, ERR_OPEN, cs->process, name);
|
||||
perror("");
|
||||
|
@@ -36,7 +36,11 @@ FILE *my_fopen(const char *FileName, int Flags, myf MyFlags)
|
||||
FileName, Flags, MyFlags));
|
||||
|
||||
make_ftype(type,Flags);
|
||||
#ifdef _WIN32
|
||||
if (fopen_s(&fd, FileName, type) == 0)
|
||||
#else
|
||||
if ((fd = fopen(FileName, type)) != 0)
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
The test works if MY_NFILE < 128. The problem is that fileno() is char
|
||||
|
@@ -55,7 +55,11 @@ int my_getwd(my_string buf, uint size, myf MyFlags)
|
||||
#endif
|
||||
{
|
||||
#if defined(HAVE_GETCWD)
|
||||
if (!getcwd(buf,size-2) && MyFlags & MY_WME)
|
||||
#ifdef _WIN32
|
||||
if (!(_getcwd(buf,size-2)) && MyFlags & MY_WME)
|
||||
#else
|
||||
if (!(getcwd(buf,size-2)) && MyFlags & MY_WME)
|
||||
#endif
|
||||
{
|
||||
my_errno=errno;
|
||||
my_error(EE_GETWD,MYF(ME_BELL+ME_WAITTANG),errno);
|
||||
@@ -151,7 +155,11 @@ int my_setwd(const char *dir, myf MyFlags)
|
||||
dir=buff;
|
||||
}
|
||||
#endif /* VMS */
|
||||
#ifdef _WIN32
|
||||
if ((res=_chdir((char*) dir)) != 0)
|
||||
#else
|
||||
if ((res=chdir((char*) dir)) != 0)
|
||||
#endif
|
||||
{
|
||||
my_errno=errno;
|
||||
if (MyFlags & MY_WME)
|
||||
|
@@ -1336,7 +1336,7 @@ int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt)
|
||||
|
||||
static int madb_alloc_stmt_fields(MYSQL_STMT *stmt)
|
||||
{
|
||||
int i;
|
||||
uint i;
|
||||
MEM_ROOT *fields_alloc_root= &((MADB_STMT_EXTENSION *)stmt->extension)->fields_alloc_root;
|
||||
|
||||
DBUG_ENTER("madb_alloc_stmt_fields");
|
||||
|
@@ -161,7 +161,8 @@ static int create_dyncol_num(MYSQL *mysql)
|
||||
|
||||
static int mdev_x1(MYSQL *mysql)
|
||||
{
|
||||
int i, rc;
|
||||
int rc;
|
||||
uint i;
|
||||
uint num_keys[5]= {1,2,3,4,5};
|
||||
char *strval[]= {"Val1", "Val2", "Val3", "Val4", "Val5"};
|
||||
DYNAMIC_COLUMN_VALUE vals[5];
|
||||
|
@@ -3798,6 +3798,7 @@ static int test_conc_5(MYSQL *mysql)
|
||||
|
||||
mysql_free_result(res);
|
||||
mysql_stmt_close(stmt);
|
||||
return OK;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
|
@@ -80,7 +80,7 @@ static int test_conc_27(MYSQL *mysql)
|
||||
#ifndef _WIN32
|
||||
pthread_create(&threads[i], NULL, (void *)thread_conc27, NULL);
|
||||
#else
|
||||
hthreads[i]= CreateThread(NULL, 0, thread_conc27, NULL, 0, &threads[i]);
|
||||
hthreads[i]= CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)thread_conc27, NULL, 0, &threads[i]);
|
||||
if (hthreads[i]==NULL)
|
||||
diag("error while starting thread");
|
||||
#endif
|
||||
|
@@ -1,4 +1,5 @@
|
||||
SET(CLIENT_LIB_DIR ${CMAKE_BINARY_DIR}/libmariadb/${CMAKE_BUILD_TYPE})
|
||||
SET(CLIENT_DBG_DIR ${CMAKE_BINARY_DIR}/libmariadb/Debug)
|
||||
SET(CLIENT_INC_DIR ${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
SET(PRODUCT_NAME "MariaDB C Client Library")
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
||||
|
||||
<MajorUpgrade DowngradeErrorMessage="A newer version of @PRODUCT_NAME@ is already installed." />
|
||||
<MediaTemplate />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
|
||||
<UIRef Id="WixUI_Mondo" />
|
||||
<WixVariable Id="WixUILicenseRtf" Value="@CMAKE_SOURCE_DIR@/win/packaging/license.rtf" />
|
||||
@@ -16,6 +16,7 @@
|
||||
<Feature Id="ProductFeature" Title="@PRODUCT_NAME@ @PRODUCT_VERSION@" Level="1">
|
||||
<ComponentRef Id="RegistryKeys" />
|
||||
<ComponentRef Id="Library"/>
|
||||
<ComponentRef Id="DebugLibrary" />
|
||||
<Feature Id="DebugFeature" Title="Debug Information" Level="2">
|
||||
<ComponentRef Id="Debug" />
|
||||
</Feature>
|
||||
@@ -30,7 +31,9 @@
|
||||
<Directory Id="ProgramFilesFolder">
|
||||
<Directory Id="Mariadb" Name="@PRODUCT_MANUFACTURER@">
|
||||
<Directory Id="INSTALLFOLDER" Name="@PRODUCT_NAME@" >
|
||||
<Directory Id="instlib" Name="lib" />
|
||||
<Directory Id="instlib" Name="lib">
|
||||
<Directory Id="instlib_debug" Name="debug"/>
|
||||
</Directory>
|
||||
<Directory Id="instinclude" Name="include" />
|
||||
</Directory>
|
||||
</Directory>
|
||||
@@ -50,6 +53,11 @@
|
||||
<File Id="libdllimp" Name="libmariadb.lib" DiskId="1" Source="@CLIENT_LIB_DIR@/libmariadb.lib" />
|
||||
<File Id="libstatic" Name="mariadbclient.lib" DiskId="1" Source="@CLIENT_LIB_DIR@/mariadbclient.lib" />
|
||||
</Component>
|
||||
<Component Id="DebugLibrary" Guid="1b8f741d-e7d9-48f1-9e11-9270216d1dc7" KeyPath="yes" DiskId="1" Directory="instlib_debug">
|
||||
<File Id="dlibdll" Name="libmariadb.dll" DiskId="1" Source="@CLIENT_DBG_DIR@/libmariadb.dll" />
|
||||
<File Id="dlibdllimp" Name="libmariadb.lib" DiskId="1" Source="@CLIENT_DBG_DIR@/libmariadb.lib" />
|
||||
<File Id="dlibstatic" Name="mariadbclient.lib" DiskId="1" Source="@CLIENT_DBG_DIR@/mariadbclient.lib" />
|
||||
</Component>
|
||||
<Component Id="Debug" Guid="FFAFCCCC-4E0C-4A87-840C-53B63C8A427A" KeyPath="yes" Directory="instlib" DiskId="1">
|
||||
<File Id="libdllpdb" Name="libmariadb.pdb" DiskId="1" Source="@CLIENT_LIB_DIR@/libmariadb.pdb" />
|
||||
<File Id="libstaticpdb" Name="mariadbclient.pdb" DiskId="1" Source="@CLIENT_LIB_DIR@/mariadbclient.pdb" />
|
||||
|
Reference in New Issue
Block a user