Skip to content

Commit de94995

Browse files
committed
Add non wasm build of xeus-cpp to ci
1 parent 5194327 commit de94995

File tree

8 files changed

+484
-24
lines changed

8 files changed

+484
-24
lines changed

.github/workflows/ci.yml

Lines changed: 438 additions & 9 deletions
Large diffs are not rendered by default.

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,15 @@ if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
303303
endif ()
304304

305305
# Fixes "C++ exception handler used, but unwind semantics are not enabled" warning Windows
306-
if (WIN32)
306+
if (MSVC)
307307
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
308308
endif ()
309309

310+
# Attempt to fix emulated tls missing symbols
311+
if (WIN32)
312+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -femulated-tls")
313+
endif ()
314+
310315
if (APPLE)
311316
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
312317
endif ()
@@ -393,7 +398,7 @@ else()
393398
option(CPPINTEROP_ENABLE_TESTING "Enables the testing infrastructure." ON)
394399
endif()
395400

396-
if(MSVC)
401+
if(WIN32)
397402

398403
set(MSVC_EXPORTLIST
399404
??_7type_info@@6B@
@@ -421,8 +426,8 @@ if(MSVC)
421426
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@D@Z
422427
??$?6U?$char_traits@D@std@@@std@@YAAEAV?$basic_ostream@DU?$char_traits@D@std@@@0@AEAV10@PEBD@Z
423428
?_Facet_Register@std@@YAXPEAV_Facet_base@1@@Z
424-
)
425-
429+
)
430+
426431
if(MSVC_VERSION LESS 1914)
427432
set(MSVC_EXPORTLIST ${MSVC_EXPORTLIST} ??3@YAXPAX0@Z ??_V@YAXPAX0@Z)
428433
endif()

cmake/CppInterOp/CppInterOpConfig.cmake.in

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}"
99
# Determine CMAKE_SHARED_LIBRARY_SUFFIX based on operating system
1010
include(CMakeSystemSpecificInformation)
1111

12-
if(MSVC)
13-
set(shared_lib_dir bin)
14-
else()
15-
set(shared_lib_dir lib)
16-
endif()
12+
set(shared_lib_dir lib)
1713

1814
### build/install workaround
1915
if (@BUILD_SHARED_LIBS@)
@@ -56,7 +52,7 @@ set_target_properties(clangCppInterOp PROPERTIES
5652
INTERFACE_INCLUDE_DIRECTORIES ${_include}
5753
IMPORTED_LOCATION ${_lib}
5854
)
59-
if (MSVC)
55+
if (WIN32)
6056
if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/include")
6157
set(_static_lib "${CPPINTEROP_INSTALL_PREFIX}/lib/${_lib_prefix}clangCppInterOp.lib")
6258
else()
@@ -66,7 +62,7 @@ if (MSVC)
6662
set_target_properties(clangCppInterOp PROPERTIES
6763
IMPORTED_IMPLIB ${_static_lib}
6864
)
69-
endif(MSVC)
65+
endif(WIN32)
7066

7167
unset(_lib_prefix)
7268
unset(_lib_suffix)

cmake/modules/GoogleTest.cmake

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(_gtest_byproduct_binary_dir
2-
${CMAKE_BINARY_DIR}/downloads/googletest-prefix/src/googletest-build)
2+
${CMAKE_CURRENT_BINARY_DIR}/googletest-prefix/src/googletest-stamp)
3+
34
set(_gtest_byproducts
45
${_gtest_byproduct_binary_dir}/lib/libgtest.a
56
${_gtest_byproduct_binary_dir}/lib/libgtest_main.a
@@ -20,6 +21,10 @@ elseif(APPLE)
2021
endif()
2122

2223
include(ExternalProject)
24+
IF(WIN32)
25+
string(REPLACE "-Wsuggest-override" "" CMAKE_CXX_FLAGS_GTEST ${CMAKE_CXX_FLAGS})
26+
set(CMAKE_CXX_FLAGS_GTEST "${CMAKE_CXX_FLAGS_GTEST} -Wno-language-extension-token")
27+
endif()
2328
ExternalProject_Add(
2429
googletest
2530
GIT_REPOSITORY https://github.com/google/googletest.git
@@ -36,7 +41,7 @@ ExternalProject_Add(
3641
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
3742
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
3843
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
39-
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
44+
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS_GTEST}
4045
-DCMAKE_AR=${CMAKE_AR}
4146
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
4247
${EXTRA_GTEST_OPTS}

environment-dev.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: xeus-cpp
2+
channels:
3+
- conda-forge
4+
dependencies:
5+
# Build dependencies
6+
- make
7+
- cmake
8+
# Host dependencies
9+
- xeus>=5.0.0
10+
- xeus-zmq>=3.0,<4.0
11+
- nlohmann_json=3.11.3
12+
- pugixml
13+
- cpp-argparse <3.1
14+
- zlib
15+
# Test dependencies
16+
- pytest
17+
- jupyter_kernel_test>=0.5,<0.6
18+
- papermill
19+
- nbformat
20+
- nbval
21+
- pytest-rerunfailures
22+
- doctest

lib/Interpreter/CppInterOp.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include <sstream>
3838
#include <string>
39+
#include <cstdlib>
3940

4041
// Stream redirect.
4142
#ifdef _WIN32

lib/Interpreter/DynamicLibraryManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ namespace Cpp {
5252
// Behaviour is to not add paths that don't exist...In an interpreted env
5353
// does this make sense? Path could pop into existance at any time.
5454
for (const char* Var : kSysLibraryEnv) {
55-
if (const char* Env = ::getenv(Var)) {
55+
char* Env = nullptr;
56+
size_t sz = 0;
57+
if (_dupenv_s(&Env, &sz, Var) == 0 && Env != nullptr) {
5658
SmallVector<StringRef, 10> CurPaths;
5759
SplitPaths(Env, CurPaths, utils::kPruneNonExistant, Cpp::utils::platform::kEnvDelim);
5860
for (const auto& Path : CurPaths)

lib/Interpreter/Paths.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ bool ExpandEnvVars(std::string& Str, bool Path) {
168168

169169
std::string EnvVar = Str.substr(DPos + 1, Length -1); //"HOME"
170170
std::string FullPath;
171-
if (const char* Tok = ::getenv(EnvVar.c_str()))
171+
if (const char* Tok = getenv(EnvVar.c_str()))
172172
FullPath = Tok;
173173

174174
Str.replace(DPos, Length, FullPath);

0 commit comments

Comments
 (0)