mirror of
https://github.com/MariaDB/server.git
synced 2025-09-11 05:52:26 +03:00
WL#5161 : Cross-platform build with CMake
This commit is contained in:
@@ -29,6 +29,15 @@ sub get_basedir {
|
||||
return $basedir;
|
||||
}
|
||||
|
||||
# Retrive build directory (which is different from basedir in out-of-source build)
|
||||
sub get_bindir {
|
||||
if (defined $ENV{MTR_BINDIR})
|
||||
{
|
||||
return $ENV{MTR_BINDIR};
|
||||
}
|
||||
my ($self, $group)= @_;
|
||||
return $self->get_basedir($group);
|
||||
}
|
||||
|
||||
sub fix_charset_dir {
|
||||
my ($self, $config, $group_name, $group)= @_;
|
||||
@@ -38,7 +47,7 @@ sub fix_charset_dir {
|
||||
|
||||
sub fix_language {
|
||||
my ($self, $config, $group_name, $group)= @_;
|
||||
return my_find_dir($self->get_basedir($group),
|
||||
return my_find_dir($self->get_bindir($group),
|
||||
\@share_locations);
|
||||
}
|
||||
|
||||
|
@@ -167,16 +167,16 @@ sub my_find_paths {
|
||||
}
|
||||
|
||||
# -------------------------------------------------------
|
||||
# Windows specific
|
||||
# CMake generator specific (Visual Studio and Xcode have multimode builds)
|
||||
# -------------------------------------------------------
|
||||
if (IS_WINDOWS) {
|
||||
# Add the default extra build dirs unless a specific one has
|
||||
# already been selected
|
||||
push(@extra_dirs,
|
||||
("release",
|
||||
"relwithdebinfo",
|
||||
"debug")) if @extra_dirs == 0;
|
||||
}
|
||||
|
||||
# Add the default extra build dirs unless a specific one has
|
||||
# already been selected
|
||||
push(@extra_dirs,
|
||||
("Release",
|
||||
"Relwithdebinfo",
|
||||
"Debug")) if @extra_dirs == 0;
|
||||
|
||||
|
||||
#print "extra_build_dir: @extra_dirs\n";
|
||||
|
||||
|
@@ -84,19 +84,31 @@ sub is_child {
|
||||
# Find the safe process binary or script
|
||||
my @safe_process_cmd;
|
||||
my $safe_kill;
|
||||
my $bindir;
|
||||
if(defined $ENV{MTR_BINDIR})
|
||||
{
|
||||
# This is an out-of-source build. Build directory
|
||||
# is given in MTR_BINDIR env.variable
|
||||
$bindir = $ENV{MTR_BINDIR}."/mysql-test";
|
||||
}
|
||||
else
|
||||
{
|
||||
$bindir = ".";
|
||||
}
|
||||
|
||||
if (IS_WIN32PERL or IS_CYGWIN){
|
||||
# Use my_safe_process.exe
|
||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
"my_safe_process");
|
||||
push(@safe_process_cmd, $exe);
|
||||
|
||||
# Use my_safe_kill.exe
|
||||
$safe_kill= my_find_bin(".", "lib/My/SafeProcess", "my_safe_kill");
|
||||
$safe_kill= my_find_bin($bindir, "lib/My/SafeProcess", "my_safe_kill");
|
||||
}
|
||||
else
|
||||
{
|
||||
# Use my_safe_process
|
||||
my $exe= my_find_bin(".", ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
my $exe= my_find_bin($bindir, ["lib/My/SafeProcess", "My/SafeProcess"],
|
||||
"my_safe_process");
|
||||
push(@safe_process_cmd, $exe);
|
||||
}
|
||||
|
@@ -13,5 +13,15 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
|
||||
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
|
||||
IF (WIN32)
|
||||
ADD_EXECUTABLE(my_safe_process safe_process_win.cc)
|
||||
ADD_EXECUTABLE(my_safe_kill safe_kill_win.cc)
|
||||
ELSE()
|
||||
ADD_EXECUTABLE(my_safe_process safe_process.cc)
|
||||
ENDIF()
|
||||
|
||||
INSTALL(TARGETS my_safe_process DESTINATION "mysql-test/lib/My/SafeProcess")
|
||||
IF(WIN32)
|
||||
INSTALL(TARGETS my_safe_kill DESTINATION "mysql-test/lib/My/SafeProcess")
|
||||
ENDIF()
|
||||
INSTALL(FILES safe_process.pl Base.pm DESTINATION "mysql-test/lib/My/SafeProcess")
|
||||
|
@@ -24,6 +24,7 @@
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(int argc, const char** argv )
|
||||
{
|
||||
|
@@ -57,6 +57,7 @@
|
||||
#include <stdio.h>
|
||||
#include <tlhelp32.h>
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static int verbose= 0;
|
||||
static char safe_process_name[32]= {0};
|
||||
@@ -248,6 +249,10 @@ int main(int argc, const char** argv )
|
||||
Make all processes associated with the job terminate when the
|
||||
last handle to the job is closed.
|
||||
*/
|
||||
#ifndef JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE
|
||||
#define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x00002000
|
||||
#endif
|
||||
|
||||
jeli.BasicLimitInformation.LimitFlags = JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE;
|
||||
if (SetInformationJobObject(job_handle, JobObjectExtendedLimitInformation,
|
||||
&jeli, sizeof(jeli)) == 0)
|
||||
|
Reference in New Issue
Block a user