зеркало из https://github.com/microsoft/R-Host.git
OSX build
This commit is contained in:
Родитель
eddad1e635
Коммит
bb2726b41f
|
@ -11,9 +11,15 @@
|
|||
"databaseFilename": "",
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include"
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
]
|
||||
}
|
||||
},
|
||||
"intelliSenseMode": "clang-x64",
|
||||
"macFrameworkPath": [
|
||||
"/System/Library/Frameworks",
|
||||
"/Library/Frameworks"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
|
@ -26,9 +32,11 @@
|
|||
"databaseFilename": "",
|
||||
"path": [
|
||||
"/usr/include",
|
||||
"/usr/local/include"
|
||||
"/usr/local/include",
|
||||
"${workspaceRoot}"
|
||||
]
|
||||
}
|
||||
},
|
||||
"intelliSenseMode": "clang-x64"
|
||||
},
|
||||
{
|
||||
"name": "Win32",
|
||||
|
@ -43,9 +51,12 @@
|
|||
"path": [
|
||||
"C:/msys64/mingw64/include",
|
||||
"C:/msys64/mingw64/x86_64-w64-mingw32/include",
|
||||
"C:/msys64/mingw64/include/c++/6.2.0"
|
||||
"C:/msys64/mingw64/include/c++/6.2.0",
|
||||
"${workspaceRoot}"
|
||||
]
|
||||
}
|
||||
},
|
||||
"intelliSenseMode": "msvc-x64"
|
||||
}
|
||||
]
|
||||
],
|
||||
"version": 3
|
||||
}
|
|
@ -5,8 +5,7 @@
|
|||
"name": "C++ Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/bin/Debug/Microsoft.R.Host.exe",
|
||||
"args": ["--rhost-r-dir", "C:\\Program Files\\R\\R-3.4.0\\bin\\x64"],
|
||||
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"environment": [],
|
||||
|
@ -22,9 +21,13 @@
|
|||
]
|
||||
},
|
||||
"osx": {
|
||||
"program": "${workspaceRoot}/bin/Debug/Microsoft.R.Host",
|
||||
"args": ["--rhost-r-dir", "/Library/Frameworks/R.framework/Resources"],
|
||||
"MIMode": "lldb"
|
||||
},
|
||||
"windows": {
|
||||
"program": "${workspaceRoot}/bin/Debug/Microsoft.R.Host.exe",
|
||||
"args": ["--rhost-r-dir", "C:\\Program Files\\R\\R-3.4.0\\bin\\x64"],
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "C:/msys64/mingw64/bin/gdb.exe",
|
||||
"setupCommands": [
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"files.associations": {
|
||||
"atomic": "cpp"
|
||||
"atomic": "cpp",
|
||||
"*.ipp": "cpp"
|
||||
}
|
||||
}
|
|
@ -19,7 +19,12 @@ set_property(SOURCE "src/detours.cpp" APPEND_STRING PROPERTY COMPILE_FLAGS "-O")
|
|||
|
||||
add_executable(Microsoft.R.Host ${src})
|
||||
|
||||
if(NOT APPLE)
|
||||
set_target_properties(Microsoft.R.Host PROPERTIES LINK_FLAGS "-static-libgcc -static-libstdc++")
|
||||
else()
|
||||
set_target_properties(Microsoft.R.Host PROPERTIES COMPILE_DEFINITIONS _APPLE )
|
||||
endif()
|
||||
|
||||
if("${TARGET_ARCH}" STREQUAL "x86")
|
||||
set_target_properties(Microsoft.R.Host PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
|
||||
endif()
|
||||
|
@ -27,7 +32,7 @@ endif()
|
|||
include_directories("${CMAKE_SOURCE_DIR}/lib/picojson" "${CMAKE_SOURCE_DIR}/lib/picojson")
|
||||
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
find_package(Boost 1.58.0 REQUIRED COMPONENTS date_time filesystem locale program_options regex system)
|
||||
find_package(Boost 1.64.0 REQUIRED COMPONENTS date_time filesystem locale program_options regex system)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
target_link_libraries(Microsoft.R.Host ${Boost_LIBRARIES})
|
||||
|
||||
|
@ -76,6 +81,6 @@ if(WIN32)
|
|||
configure_file("$ENV{MSYSTEM_PREFIX}/bin/${dep}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dep}" COPYONLY)
|
||||
endforeach()
|
||||
else()
|
||||
include_directories("/usr/share/R/include")
|
||||
include_directories("/usr/share/R/include;//Library/Frameworks/R.framework/Resources/include")
|
||||
target_link_libraries(Microsoft.R.Host pthread ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
|
|
@ -663,13 +663,13 @@ namespace rhost {
|
|||
auto device_name(boost::uuids::to_string(_device_id));
|
||||
auto msg = rhost::host::send_request_and_get_response("?Locator", rhost::util::to_utf8_json(device_name.c_str()));
|
||||
auto args = msg.json();
|
||||
if (args.size() != 3 || !args[0].is<bool>() || !args[1].is<double>() || !args[2].is<double>()) {
|
||||
if (args.size() != 3 || !args[0].template is<bool>() || !args[1].template is<double>() || !args[2].template is<double>()) {
|
||||
rhost::log::fatal_error("Locator response is malformed. It must have 3 elements: bool, double, double.");
|
||||
}
|
||||
|
||||
auto& result_clicked = args[0].get<bool>();
|
||||
auto& result_x = args[1].get<double>();
|
||||
auto& result_y = args[2].get<double>();
|
||||
auto& result_clicked = args[0].template get<bool>();
|
||||
auto& result_x = args[1].template get<double>();
|
||||
auto& result_y = args[2].template get<double>();
|
||||
*x = result_x;
|
||||
*y = result_y;
|
||||
clicked = result_clicked ? R_TRUE : R_FALSE;
|
||||
|
|
|
@ -130,7 +130,12 @@ namespace rhost {
|
|||
|
||||
internal_load_rgraphapp_apis();
|
||||
#else // POSIX
|
||||
#ifdef _APPLE
|
||||
fs::path r_path = r_dll_dir / "lib/libR.dylib";
|
||||
|
||||
#else
|
||||
fs::path r_path = r_dll_dir / "libR.so";
|
||||
#endif
|
||||
r_module = dlopen(r_path.make_preferred().string().c_str(), RTLD_LOCAL | RTLD_LAZY);
|
||||
if (!r_module) {
|
||||
log::fatal_error("Error r module failed to load: %s", dlerror());
|
||||
|
|
Загрузка…
Ссылка в новой задаче