forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cross-platform support for Unity
bug fix (microsoft#1604 & microsoft#1579) and SceneSelector bug fix
- Loading branch information
msb336
authored and
Matthew Brown
committed
Dec 4, 2018
1 parent
628299a
commit 107f8ef
Showing
16 changed files
with
1,323 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
cmake_minimum_required(VERSION 3.9.0) | ||
|
||
|
||
find_path(AIRSIM_ROOT NAMES AirSim.sln PATHS ".." "../.." "../../.." "../../../.." "../../../../.." "../../../../../..") | ||
message(AirSim Root directory: ${AIRSIM_ROOT}) | ||
|
||
LIST(APPEND CMAKE_MODULE_PATH "${AIRSIM_ROOT}/cmake/cmake-modules") | ||
LIST(APPEND CMAKE_MODULE_PATH "${RPC_SOURCE_DIR}/cmake") | ||
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
|
||
INCLUDE("${AIRSIM_ROOT}/cmake/cmake-modules/CommonSetup.cmake") | ||
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpc-setup.cmake") | ||
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/mav-setup.cmake") | ||
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/airlib-setup.cmake") | ||
INCLUDE("${CMAKE_CURRENT_SOURCE_DIR}/cmake/airsimwrapper-setup.cmake") | ||
|
||
IncludeEigen() | ||
|
||
project(AirsimWrapper VERSION 0) | ||
|
||
# RPC includes & source files | ||
BuildRpc() | ||
# MavLink source files | ||
BuildMavLink() | ||
#AirLib source files | ||
BuildAirlib() | ||
#AirsimWrapper source files | ||
BuildAirsimWrapper() | ||
|
||
|
||
###################### Link source files to library ######################################33 | ||
add_library( | ||
${PROJECT_NAME} SHARED | ||
${RPC_LIBRARY_SOURCE_FILES} | ||
${MAVLINK_LIBRARY_SOURCE_FILES} | ||
${AIRLIB_LIBRARY_SOURCE_FILES} | ||
${AIRSIMWRAPPER_LIBRARY_SOURCE_FILES} | ||
) | ||
target_link_libraries(${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT} -lstdc++ -lpthread -lboost_filesystem) | ||
|
||
|
||
|
||
##################### Build Options #############################3 | ||
# Rpc | ||
RpcCheckMSVN() | ||
RpcCmakePkg() | ||
RpcMSVNConfig() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Unity/AirLibWrapper/AirsimWrapper/cmake/airlib-setup.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
macro(BuildAirLib) | ||
include_directories( | ||
${AIRSIM_ROOT}/AirLib/ | ||
${AIRSIM_ROOT}/AirLib/include | ||
${AIRSIM_ROOT}/MavLinkCom/include | ||
${RPC_LIB_INCLUDES} | ||
) | ||
|
||
file(GLOB_RECURSE AIRLIB_LIBRARY_SOURCE_FILES | ||
${AIRSIM_ROOT}/AirLib/src/api/*.cpp | ||
${AIRSIM_ROOT}/AirLib/src/common/common_utils/*.cpp | ||
${AIRSIM_ROOT}/AirLib/src/safety/*.cpp | ||
${AIRSIM_ROOT}/AirLib/src/vehicles/car/api/*.cpp | ||
${AIRSIM_ROOT}/AirLib/src/vehicles/multirotor/api/*.cpp | ||
${AIRSIM_ROOT}/AirLib/src/vehicles/multirotor/*.cpp | ||
) | ||
|
||
endmacro(BuildAirLib) |
27 changes: 27 additions & 0 deletions
27
Unity/AirLibWrapper/AirsimWrapper/cmake/airsimwrapper-setup.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
macro(BuildAirsimWrapper) | ||
set(AIRSIMWRAPPER_LIBRARY_SOURCE_FILES | ||
Source/Logger.cpp | ||
Source/NedTransform.cpp | ||
Source/PawnSimApi.cpp | ||
Source/PInvokeWrapper.cpp | ||
Source/SimHUD/SimHUD.cpp | ||
Source/SimMode/SimModeBase.cpp | ||
Source/SimMode/SimModeWorldBase.cpp | ||
Source/UnityImageCapture.cpp | ||
Source/UnitySensors/UnityDistanceSensor.cpp | ||
Source/UnitySensors/UnitySensorFactory.cpp | ||
Source/UnityToAirSimCalls.cpp | ||
Source/Vehicles/Car/CarPawn.cpp | ||
Source/Vehicles/Car/CarPawnApi.cpp | ||
Source/Vehicles/Car/CarPawnSimApi.cpp | ||
Source/Vehicles/Car/SimModeCar.cpp | ||
Source/Vehicles/Multirotor/FlyingPawn.cpp | ||
Source/Vehicles/Multirotor/MultirotorPawnEvents.cpp | ||
Source/Vehicles/Multirotor/MultirotorPawnSimApi.cpp | ||
Source/Vehicles/Multirotor/SimModeWorldMultiRotor.cpp | ||
Source/WorldSimApi.cpp | ||
) | ||
include_directories( | ||
Source/ | ||
) | ||
endmacro(BuildAirsimWrapper) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
macro(BuildMavLink) | ||
|
||
include_directories( | ||
${AIRSIM_ROOT}/MavLinkCom | ||
${AIRSIM_ROOT}/MavLinkCom/common_utils | ||
${AIRSIM_ROOT}/MavLinkCom/include | ||
) | ||
|
||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/common_utils/FileSystem.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/common_utils/ThreadUtils.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/AdHocConnection.cpp") # | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkConnection.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkFtpClient.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkLog.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkMessageBase.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkMessages.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkNode.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkTcpServer.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkVehicle.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/MavLinkVideoStream.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/Semaphore.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/AdHocConnectionImpl.cpp") # | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/MavLinkConnectionImpl.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/MavLinkFtpClientImpl.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/MavLinkNodeImpl.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/MavLinkTcpServerImpl.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/MavLinkVehicleImpl.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/MavLinkVideoStreamImpl.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/serial_com/SerialPort.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/serial_com/TcpClientPort.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/serial_com/UdpClientPort.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/serial_com/SocketInit.cpp") | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/serial_com/wifi.cpp") | ||
|
||
|
||
IF(UNIX) | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/linux/MavLinkFindSerialPorts.cpp") | ||
ELSE() | ||
LIST(APPEND MAVLINK_LIBRARY_SOURCE_FILES "${AIRSIM_ROOT}/MavLinkCom/src/impl/windows/MavLinkFindSerialPorts.cpp") | ||
ENDIF() | ||
|
||
endmacro(BuildMavLink) |
Oops, something went wrong.
107f8ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @msb336
Thanks for looking into the issue microsoft#1579 I posted. I am looking at the use of EditorApplication.Exit(1); above. Isn't that is actually going to close the whole editor down and cause us to loose any changes made in the scene)? And is that necessary? Could we instead just stop play mode like this:
#if UNITY_EDITOR if(EditorApplication.isPlaying) { UnityEditor.EditorApplication.isPlaying = false; } #endif
According to the Unity docs " Setting isPlaying delays the result until after all script code has completed for this frame." https://docs.unity3d.com/ScriptReference/EditorApplication-isPlaying.html