Enable cross OS DBI build (#35021)

* Enable cross OS DBI build

* Fix .gitignore

* Fix Cross OS DBI compilation issues

* Review feedback

* Cleanup dummy/twowaypipe.cpp
This commit is contained in:
Steve MacLean 2020-04-17 15:58:26 -04:00 committed by GitHub
parent d7a0cb3ddc
commit 9890a9a6d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 102 additions and 17 deletions

3
.gitignore vendored
View File

@ -348,3 +348,6 @@ linker
# ln -s $(pwd)/src/libraries/Common/src src/coreclr/src/System.Private.CoreLib/common
src/coreclr/src/System.Private.CoreLib/shared
src/coreclr/src/System.Private.CoreLib/common
# The debug directory should not be ignored
!src/coreclr/src/debug

View File

@ -14,10 +14,6 @@ endif()
if(NOT CLR_CMAKE_HOST_LINUX AND NOT FEATURE_CROSSBITNESS)
list (APPEND CLR_CROSS_COMPONENTS_LIST
mscordaccore
mscordbi
)
if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
list (APPEND CLR_CROSS_COMPONENTS_LIST
mscordbi
)
endif (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS)
endif()

View File

@ -8,11 +8,17 @@ if(CLR_CMAKE_HOST_WIN32)
add_definitions(-DWIN32_LEAN_AND_MEAN)
include_directories(../../inc) #needed for warning control
set(TWO_WAY_PIPE_SOURCES
win/diagnosticsipc.cpp
win/twowaypipe.cpp
win/processdescriptor.cpp
)
if(CLR_CMAKE_TARGET_WIN32)
set(TWO_WAY_PIPE_SOURCES
win/diagnosticsipc.cpp
win/twowaypipe.cpp
win/processdescriptor.cpp
)
else(CLR_CMAKE_TARGET_WIN32)
set(TWO_WAY_PIPE_SOURCES
dummy/twowaypipe.cpp
)
endif(CLR_CMAKE_TARGET_WIN32)
endif(CLR_CMAKE_HOST_WIN32)
if(CLR_CMAKE_HOST_UNIX)

View File

@ -0,0 +1,76 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include <windows.h>
#include "twowaypipe.h"
// This file contains a dummy implementation of the simple IPC mechanism - bidirectional named pipe.
// It is used for the cross OS DBI where IPC is not supported.
// Creates a server side of the pipe.
// Id is used to create pipes names and uniquely identify the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::CreateServer(const ProcessDescriptor& pd)
{
return false;
}
// Connects to a previously opened server side of the pipe.
// Id is used to locate the pipe on the machine.
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::Connect(const ProcessDescriptor& pd)
{
return false;
}
// Waits for incoming client connections, assumes GetState() == Created
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::WaitForConnection()
{
return false;
}
// Reads data from pipe. Returns number of bytes read or a negative number in case of an error.
// use GetLastError() for more details
int TwoWayPipe::Read(void *buffer, DWORD bufferSize)
{
return -1;
}
// Writes data to pipe. Returns number of bytes written or a negative number in case of an error.
// use GetLastError() for more details
int TwoWayPipe::Write(const void *data, DWORD dataSize)
{
return -1;
}
// Disconnect server or client side of the pipe.
// true - success, false - failure (use GetLastError() for more details)
bool TwoWayPipe::Disconnect()
{
return false;
}
// Connects to a one sided pipe previously created by CreateOneWayPipe.
// In order to successfully connect id and inbound flag should be the same.
HANDLE TwoWayPipe::OpenOneWayPipe(DWORD id, bool inbound)
{
return NULL;
}
// Creates a one way pipe, id and inboud flag are used for naming.
// Created pipe is supposed to be connected to by OpenOneWayPipe.
HANDLE TwoWayPipe::CreateOneWayPipe(DWORD id, bool inbound)
{
return NULL;
}
// Used by debugger side (RS) to cleanup the target (LS) named pipes
// and semaphores when the debugger detects the debuggee process exited.
void TwoWayPipe::CleanupTargetProcess()
{
}

View File

@ -28,7 +28,7 @@
#endif
//********** Globals. *********************************************************
#ifndef TARGET_UNIX
#ifndef HOST_UNIX
HINSTANCE g_hInst; // Instance handle to this piece of code.
#endif

View File

@ -19,7 +19,7 @@ if(CLR_CMAKE_HOST_LINUX)
list(APPEND MSCORDBI_SOURCES ${PAL_REDEFINES_FILE})
endif(CLR_CMAKE_HOST_LINUX)
if(CLR_CMAKE_TARGET_WIN32)
if(CLR_CMAKE_HOST_WIN32)
add_definitions(-DFX_VER_INTERNALNAME_STR=mscordbi.dll)
list(APPEND MSCORDBI_SOURCES
@ -35,11 +35,11 @@ if(CLR_CMAKE_TARGET_WIN32)
preprocess_file(${DEF_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def)
list(APPEND MSCORDBI_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.def)
else(CLR_CMAKE_TARGET_WIN32)
else(CLR_CMAKE_HOST_WIN32)
set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mscordbi_unixexports.src)
set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/mscordbi.exports)
generate_exports_file(${DEF_SOURCES} ${EXPORTS_FILE})
endif(CLR_CMAKE_TARGET_WIN32)
endif(CLR_CMAKE_HOST_WIN32)
if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD)
# This option is necessary to ensure that the overloaded new/delete operators defined inside
@ -79,9 +79,13 @@ set(COREDBI_LIBRARIES
)
if(CLR_CMAKE_HOST_WIN32)
if(CLR_CMAKE_TARGET_WIN32)
set(COREDBI_TARGET_WIN32_LIBRARIES mdwinmd_dbi)
endif(CLR_CMAKE_TARGET_WIN32)
list(APPEND COREDBI_LIBRARIES
mdhotdata-staticcrt
mdwinmd_dbi
${COREDBI_TARGET_WIN32_LIBRARIES}
kernel32.lib
advapi32.lib
ole32.lib

View File

@ -40,7 +40,7 @@ add_library_clr(mdhotdata_crossgen ${MDHOTDATA_SOURCES})
set_target_properties(mdhotdata_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE)
target_precompile_header(TARGET mdhotdata_crossgen HEADER external.h)
if(CLR_CMAKE_TARGET_WIN32)
if(CLR_CMAKE_HOST_WIN32)
add_library_clr(mdhotdata-staticcrt ${MDHOTDATA_SOURCES})
target_precompile_header(TARGET mdhotdata-staticcrt HEADER external.h)
endif(CLR_CMAKE_TARGET_WIN32)
endif(CLR_CMAKE_HOST_WIN32)