Skip to content

Commit ec373e4

Browse files
authored
Merge branch 'main' into Fix-issue-with-sysroot_path-and-XEUS_CPP_RESOURCE_DIR-with-@-in-absolute-path
2 parents c452f6b + e0946f7 commit ec373e4

File tree

6 files changed

+43
-31
lines changed

6 files changed

+43
-31
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,14 @@ To build Jupyter Lite with this kernel without creating a website you can execut
149149
```bash
150150
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyter_server jupyterlite-xeus -c conda-forge
151151
micromamba activate xeus-lite-host
152-
jupyter lite build --XeusAddon.prefix=$PREFIX
152+
jupyter lite build --XeusAddon.prefix=$PREFIX \
153+
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
154+
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \
155+
--contents README.md \
156+
--contents notebooks/xeus-cpp-lite-demo.ipynb \
157+
--contents notebooks/smallpt.ipynb \
158+
--contents notebooks/images/marie.png \
159+
--contents notebooks/audio/audio.wav
153160
```
154161

155162
Once the Jupyter Lite site has built you can test the website locally by executing

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,14 @@ To build Jupyter Lite with this kernel without creating a website you can execut
151151
```bash
152152
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyter_server jupyterlite-xeus -c conda-forge
153153
micromamba activate xeus-lite-host
154-
jupyter lite build --XeusAddon.prefix=$PREFIX
154+
jupyter lite build --XeusAddon.prefix=$PREFIX \
155+
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
156+
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \
157+
--contents README.md \
158+
--contents notebooks/xeus-cpp-lite-demo.ipynb \
159+
--contents notebooks/smallpt.ipynb \
160+
--contents notebooks/images/marie.png \
161+
--contents notebooks/audio/audio.wav
155162
```
156163

157164
Once the Jupyter Lite site has built you can test the website locally by executing

docs/source/InstallationAndUsage.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ To build Jupyter Lite with this kernel without creating a website you can execut
133133
micromamba create -n xeus-lite-host jupyterlite-core=0.6 jupyter_server jupyterlite-xeus -c conda-forge
134134
micromamba activate xeus-lite-host
135135
jupyter lite build --XeusAddon.prefix=$PREFIX
136+
--XeusAddon.mounts="$PREFIX/share/xeus-cpp/tagfiles:/share/xeus-cpp/tagfiles" \
137+
--XeusAddon.mounts="$PREFIX/etc/xeus-cpp/tags.d:/etc/xeus-cpp/tags.d" \
138+
--contents README.md \
139+
--contents notebooks/xeus-cpp-lite-demo.ipynb \
140+
--contents notebooks/smallpt.ipynb \
141+
--contents notebooks/images/marie.png \
142+
--contents notebooks/audio/audio.wav
136143
137144
Once the Jupyter Lite site has built you can test the website locally by executing
138145

include/xeus-cpp/xeus_cpp_config.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212
// Project version
1313
#define XEUS_CPP_VERSION_MAJOR 0
14-
#define XEUS_CPP_VERSION_MINOR 8
15-
#define XEUS_CPP_VERSION_PATCH 0
16-
#define XEUS_CPP_VERSION_LABEL dev
14+
#define XEUS_CPP_VERSION_MINOR 7
15+
#define XEUS_CPP_VERSION_PATCH 1
1716

1817
// Composing the version string from major, minor and patch
1918
#define XEUS_CPP_CONCATENATE(A, B) XEUS_CPP_CONCATENATE_IMPL(A, B)

src/xinterpreter.cpp

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,20 @@ namespace xcpp
7373
xeus::register_interpreter(this);
7474
}
7575

76-
static std::string get_stdopt()
76+
static std::string get_stdopt(int argc, const char* const* argv)
7777
{
78-
// We need to find what's the C++ version the interpreter runs with.
79-
const char* code = R"(
80-
int __get_cxx_version () {
81-
#if __cplusplus > 202302L
82-
return 26;
83-
#elif __cplusplus > 202002L
84-
return 23;
85-
#elif __cplusplus > 201703L
86-
return 20;
87-
#elif __cplusplus > 201402L
88-
return 17;
89-
#elif __cplusplus > 201103L || (defined(_WIN32) && _MSC_VER >= 1900)
90-
return 14;
91-
#elif __cplusplus >= 201103L
92-
return 11;
93-
#else
94-
return 0;
95-
#endif
96-
}
97-
__get_cxx_version ()
98-
)";
99-
auto cxx_version = Cpp::Evaluate(code);
100-
return std::to_string(cxx_version);
78+
std::string res = "14";
79+
for (int i = 0; i < argc; ++i)
80+
{
81+
std::string arg(argv[i]);
82+
auto pos = arg.find("-std=c++");
83+
if (pos != std::string::npos)
84+
{
85+
res = arg.substr(pos + 8);
86+
break;
87+
}
88+
}
89+
return res;
10190
}
10291

10392
interpreter::interpreter(int argc, const char* const* argv) :
@@ -109,7 +98,7 @@ __get_cxx_version ()
10998
{
11099
//NOLINTNEXTLINE (cppcoreguidelines-pro-bounds-pointer-arithmetic)
111100
createInterpreter(Args(argv ? argv + 1 : argv, argv + argc));
112-
m_version = get_stdopt();
101+
m_version = get_stdopt(argc, argv);
113102
redirect_output();
114103
init_preamble();
115104
init_magic();

test/test_interpreter.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,9 @@ TEST_SUITE("kernel_info_request")
254254
{
255255
TEST_CASE("good_status")
256256
{
257-
std::vector<const char*> Args = {/*"-v", "resource-dir", "....."*/};
257+
std::vector<const char*> Args = {
258+
"-v", "-std=c++23" // test input for get_stdopt
259+
};
258260
xcpp::interpreter interpreter((int)Args.size(), Args.data());
259261

260262
nl::json result = interpreter.kernel_info_request();
@@ -264,6 +266,7 @@ TEST_SUITE("kernel_info_request")
264266
REQUIRE(result["language_info"]["mimetype"] == "text/x-c++src");
265267
REQUIRE(result["language_info"]["codemirror_mode"] == "text/x-c++src");
266268
REQUIRE(result["language_info"]["file_extension"] == ".cpp");
269+
REQUIRE(result["language_info"]["version"] == "23");
267270
REQUIRE(result["status"] == "ok");
268271
}
269272

0 commit comments

Comments
 (0)