Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded to xeus 5 #13

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions BuildWasmDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,6 @@ RUN mkdir -p /install/lib
# make install dir
RUN mkdir install

##################################################################
# xtl
##################################################################

RUN mkdir -p /deps/xtl/build && \
git clone --branch 0.7.2 https://github.com/xtensor-stack/xtl.git /deps/xtl/src
#RUN cd /deps/xtl/src && git checkout tags/0.7.2

RUN cd /deps/xtl/build && \
emcmake cmake ../src/ -DCMAKE_INSTALL_PREFIX=/install

RUN cd /deps/xtl/build && \
emmake make -j8 install


##################################################################
# nloman json
##################################################################
Expand All @@ -42,15 +27,14 @@ RUN cd /deps/nlohmannjson/build && \
##################################################################

RUN mkdir -p /deps/xeus/build
RUN git clone --branch 4.0.1 https://github.com/jupyter-xeus/xeus.git /deps/xeus/src
RUN git clone --branch 5.0.0 https://github.com/jupyter-xeus/xeus.git /deps/xeus/src

#COPY xeus /deps/xeus/src

RUN cd /deps/xeus/build && \
emcmake cmake ../src \
-DCMAKE_INSTALL_PREFIX=/install \
-Dnlohmann_json_DIR=/install/share/cmake/nlohmann_json \
-Dxtl_DIR=/install/share/cmake/xtl \
-DXEUS_EMSCRIPTEN_WASM_BUILD=ON

RUN cd /deps/xeus/build && \
Expand All @@ -69,7 +53,6 @@ RUN mkdir -p /xeus-build && cd /xeus-build && \
emcmake cmake .. \
-DCMAKE_INSTALL_PREFIX=/install \
-Dnlohmann_json_DIR=/install/share/cmake/nlohmann_json \
-Dxtl_DIR=/install/share/cmake/xtl \
-Dxeus_DIR=/install/lib/cmake/xeus \
-DXEUS_LITE_BUILD_BROWSER_TEST_KERNEL=ON \
-DXEUS_LITE_BUILD_NODE_TESTS=ON
Expand Down
8 changes: 1 addition & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,7 @@ message(STATUS "XEUS_LITE_BUILD_NODE_TESTS: ${XEUS_LITE_BUILD_NOD
# Dependencies
# ============

set(xtl_REQUIRED_VERSION 0.7)
set(xeus_REQUIRED_VERSION 4.0.0)

if (NOT TARGET xtl)
find_package(xtl ${xtl_REQUIRED_VERSION} REQUIRED)
endif ()
set(xeus_REQUIRED_VERSION 5.0.0)

if (NOT TARGET xeus)
find_package(xeus ${xeus_REQUIRED_VERSION} REQUIRED)
Expand Down Expand Up @@ -93,7 +88,6 @@ target_include_directories(
)
target_link_libraries(
xeus-lite
PUBLIC xtl
PUBLIC xeus-static
)

Expand Down
1 change: 1 addition & 0 deletions include/xeus-lite/xembind.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef XEUS_LITE_XEMBIND_HPP
#define XEUS_LITE_XEMBIND_HPP

#include <memory>
#include <string>

#include "xeus/xkernel.hpp"
Expand Down
2 changes: 2 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@

if(XEUS_LITE_BUILD_NODE_TESTS)
add_executable(emscripten_wasm_test main_emscripten_wasm.cpp xmock_interpreter.cpp)
target_compile_features(emscripten_wasm_test PRIVATE cxx_std_17)
target_link_libraries(emscripten_wasm_test PRIVATE xeus-lite)
xeus_wasm_compile_options(emscripten_wasm_test)
xeus_wasm_link_options(emscripten_wasm_test "node")
endif()

if(XEUS_LITE_BUILD_BROWSER_TEST_KERNEL)
add_executable(xlite main_emscripten_wasm.cpp xmock_interpreter.cpp)
target_compile_features(xlite PRIVATE cxx_std_17)
target_link_libraries(xlite PRIVATE xeus-lite)
xeus_wasm_compile_options(xlite)
xeus_wasm_link_options(xlite "web,worker")
Expand Down
9 changes: 4 additions & 5 deletions test/xmock_interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@ namespace xeus
using function_type = std::function<void(xeus::xcomm&&, const xeus::xmessage&)>;
}

void xmock_interpreter::execute_request_impl(xrequest_context request_context,
send_reply_callback cb,
void xmock_interpreter::execute_request_impl(send_reply_callback cb,
int execution_counter,
const std::string& code,
execute_request_config config,
nl::json /* user_expressions */)
{
if (code.compare("hello, world") == 0)
{
publish_stream(request_context, "stdout", code);
publish_stream("stdout", code);
}

if (code.compare("error") == 0)
{
publish_stream(request_context, "stderr", code);
publish_stream("stderr", code);
}

if (code.compare("?") == 0)
Expand All @@ -67,7 +66,7 @@ namespace xeus

nl::json pub_data;
pub_data["text/plain"] = code;
publish_execution_result(request_context, execution_counter, std::move(pub_data), nl::json::object());
publish_execution_result(execution_counter, std::move(pub_data), nl::json::object());

cb(xeus::create_successful_reply());
return;
Expand Down
3 changes: 1 addition & 2 deletions test/xmock_interpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ namespace xeus

void configure_impl() override;

void execute_request_impl(xrequest_context context,
send_reply_callback cb,
void execute_request_impl(send_reply_callback cb,
int execution_counter,
const std::string& code,
execute_request_config config,
Expand Down
1 change: 0 additions & 1 deletion xeus-liteConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR};${CMAKE_MODULE_PATH}")
@XEUS_LITE_CONFIG_CODE@

include(CMakeFindDependencyMacro)
find_dependency(xtl @xtl_REQUIRED_VERSION@)
find_dependency(xeus @xeus_REQUIRED_VERSION@)

if(NOT TARGET xeus-lite)
Expand Down