Commit bc64a03c authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

Windows - Fix CMAKE_INTERPROCEDURAL_OPTIMIZATION build with MSVC

If IPO is enabled, MSVC compiles with /GL  which is not
compatible with cmake's WINDOWS_EXPORT_ALL_SYMBOLS.

Since server.dll can't autoexport symbols from /GL compiled objects,
IPO must be disabled for dbug, string,mysys, and sql targets (in case we
build "plugin" DLLs that need server.dll's symbols)
parent f33e8e4a
......@@ -368,7 +368,12 @@ ENDFUNCTION()
# for some static libraries.
FUNCTION (MAYBE_DISABLE_IPO target)
IF(MSVC AND NOT CLANG_CL)
SET_TARGET_PROPERTIES(${target} PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)
IF(MSVC AND (NOT CLANG_CL) AND (NOT WITHOUT_DYNAMIC_PLUGINS))
SET_TARGET_PROPERTIES(${target} PROPERTIES
INTERPROCEDURAL_OPTIMIZATION OFF
INTERPROCEDURAL_OPTIMIZATION_DEBUG OFF
INTERPROCEDURAL_OPTIMIZATION_RELEASE OFF
INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO OFF
INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL OFF)
ENDIF()
ENDFUNCTION()
......@@ -187,7 +187,7 @@ IF ((CMAKE_SYSTEM_NAME MATCHES "Linux" OR
ENDIF()
IF(WIN32)
SET(SQL_SOURCE ${SQL_SOURCE} handle_connections_win.cc)
SET(SQL_SOURCE ${SQL_SOURCE} handle_connections_win.cc winmain.cc)
ENDIF()
MYSQL_ADD_PLUGIN(partition ha_partition.cc STORAGE_ENGINE DEFAULT STATIC_ONLY
......@@ -217,7 +217,7 @@ FOREACH(se aria partition perfschema sql_sequence wsrep)
ENDFOREACH()
IF(WIN32)
SET(MYSQLD_SOURCE winmain.cc message.rc)
SET(MYSQLD_SOURCE main.cc message.rc)
ELSE()
SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
ENDIF()
......@@ -259,7 +259,9 @@ IF(MSVC OR CMAKE_SYSTEM_NAME MATCHES AIX)
sql_builtins
)
IF(MSVC)
SET_TARGET_PROPERTIES(server PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
IF(NOT WITHOUT_DYNAMIC_PLUGINS)
SET_TARGET_PROPERTIES(server PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
ENDIF()
ELSE()
SET_TARGET_PROPERTIES(server PROPERTIES AIX_EXPORT_ALL_SYMBOLS TRUE)
ENDIF()
......
......@@ -17,10 +17,20 @@
/*
main() for mysqld.
Calls mysqld_main() entry point exported by sql library.
On Windows, might do some service handling.
*/
#ifdef _WIN32
/* Windows main function, service handling, calls mysqld_main */
extern int mysqld_win_main(int argc, char **argv);
#else
extern int mysqld_main(int argc, char **argv);
#endif
int main(int argc, char **argv)
{
#ifdef _WIN32
return mysqld_win_main(argc, argv);
#else
return mysqld_main(argc, argv);
#endif
}
......@@ -60,8 +60,8 @@ static SERVICE_STATUS svc_status{SERVICE_WIN32_OWN_PROCESS};
static SERVICE_STATUS_HANDLE svc_status_handle;
static char *svc_name;
static char **orig_argv;
static int orig_argc;
static char **save_argv;
static int save_argc;
static int install_service(int argc, char **argv, const char *name);
static int remove_service(const char *name);
......@@ -165,8 +165,8 @@ static void WINAPI svc_main(DWORD svc_argc, char **svc_argv)
Do not pass the service name parameter (last on the command line)
to mysqld_main(), it is unaware of it.
*/
orig_argv[orig_argc - 1]= 0;
mysqld_main(orig_argc - 1, orig_argv);
save_argv[save_argc - 1]= 0;
mysqld_main(save_argc - 1, save_argv);
}
/*
......@@ -224,10 +224,10 @@ static const char *get_svc_name(const char *arg)
Plus, the obsolete functionality to register/remove services.
*/
int main(int argc, char **argv)
__declspec(dllexport) int mysqld_win_main(int argc, char **argv)
{
orig_argv= argv;
orig_argc= argc;
save_argv= argv;
save_argc= argc;
/*
If no special arguments are given, service name is nor present
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment