From f209bf6f19b0e291de964274df18bccd9143e2b7 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Wed, 2 Aug 2023 18:27:16 -0700 Subject: [PATCH 1/4] Don't pass extra includes; configure this with flags --- src/main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2ee19be1..58f1814e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -84,7 +84,7 @@ using interpreter_ptr = std::unique_ptr; interpreter_ptr build_interpreter(int argc, char** argv) { - int interpreter_argc = argc + 1; + int interpreter_argc = argc; const char** interpreter_argv = new const char*[interpreter_argc]; interpreter_argv[0] = "xeus-cling"; // Copy all arguments in the new array excepting the process name. @@ -92,8 +92,6 @@ interpreter_ptr build_interpreter(int argc, char** argv) { interpreter_argv[i] = argv[i]; } - std::string include_dir = std::string(LLVM_DIR) + std::string("/include"); - interpreter_argv[interpreter_argc - 1] = include_dir.c_str(); interpreter_ptr interp_ptr = interpreter_ptr(new xcpp::interpreter(interpreter_argc, interpreter_argv)); delete[] interpreter_argv; From 7b5123dc70f0dc42a201e7a7a5afd14122aa2725 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Wed, 9 Aug 2023 01:56:30 -0700 Subject: [PATCH 2/4] Add "-I LLVM_DIR/include" flag in kernel.json.in files --- share/jupyter/kernels/xcpp11/kernel.json.in | 1 + share/jupyter/kernels/xcpp14/kernel.json.in | 1 + share/jupyter/kernels/xcpp17/kernel.json.in | 1 + 3 files changed, 3 insertions(+) diff --git a/share/jupyter/kernels/xcpp11/kernel.json.in b/share/jupyter/kernels/xcpp11/kernel.json.in index 5d365c1a..388a3c2b 100644 --- a/share/jupyter/kernels/xcpp11/kernel.json.in +++ b/share/jupyter/kernels/xcpp11/kernel.json.in @@ -4,6 +4,7 @@ "@XEUS_CLING_KERNELSPEC_PATH@/xcpp", "-f", "{connection_file}", + "-I", "@LLVM_DIR@/include", "-std=c++11" ], "language": "C++11" diff --git a/share/jupyter/kernels/xcpp14/kernel.json.in b/share/jupyter/kernels/xcpp14/kernel.json.in index f0c915b4..2b78479d 100644 --- a/share/jupyter/kernels/xcpp14/kernel.json.in +++ b/share/jupyter/kernels/xcpp14/kernel.json.in @@ -4,6 +4,7 @@ "@XEUS_CLING_KERNELSPEC_PATH@/xcpp", "-f", "{connection_file}", + "-I", "@LLVM_DIR@/include", "-std=c++14" ], "language": "C++14" diff --git a/share/jupyter/kernels/xcpp17/kernel.json.in b/share/jupyter/kernels/xcpp17/kernel.json.in index d13aa42e..8d7dac23 100644 --- a/share/jupyter/kernels/xcpp17/kernel.json.in +++ b/share/jupyter/kernels/xcpp17/kernel.json.in @@ -4,6 +4,7 @@ "@XEUS_CLING_KERNELSPEC_PATH@/xcpp", "-f", "{connection_file}", + "-I", "@LLVM_DIR@/include", "-std=c++17" ], "language": "C++17" From 2fd9730b57d64527cb99ba137db9a86a3842d179 Mon Sep 17 00:00:00 2001 From: thomasjm Date: Wed, 9 Aug 2023 04:16:36 -0700 Subject: [PATCH 3/4] Switch to LLVM_MAIN_INCLUDE_DIR --- share/jupyter/kernels/xcpp11/kernel.json.in | 2 +- share/jupyter/kernels/xcpp14/kernel.json.in | 2 +- share/jupyter/kernels/xcpp17/kernel.json.in | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/share/jupyter/kernels/xcpp11/kernel.json.in b/share/jupyter/kernels/xcpp11/kernel.json.in index 388a3c2b..71adeb09 100644 --- a/share/jupyter/kernels/xcpp11/kernel.json.in +++ b/share/jupyter/kernels/xcpp11/kernel.json.in @@ -4,7 +4,7 @@ "@XEUS_CLING_KERNELSPEC_PATH@/xcpp", "-f", "{connection_file}", - "-I", "@LLVM_DIR@/include", + "-I", "@LLVM_MAIN_INCLUDE_DIR@", "-std=c++11" ], "language": "C++11" diff --git a/share/jupyter/kernels/xcpp14/kernel.json.in b/share/jupyter/kernels/xcpp14/kernel.json.in index 2b78479d..5ffe9e3d 100644 --- a/share/jupyter/kernels/xcpp14/kernel.json.in +++ b/share/jupyter/kernels/xcpp14/kernel.json.in @@ -4,7 +4,7 @@ "@XEUS_CLING_KERNELSPEC_PATH@/xcpp", "-f", "{connection_file}", - "-I", "@LLVM_DIR@/include", + "-I", "@LLVM_MAIN_INCLUDE_DIR@", "-std=c++14" ], "language": "C++14" diff --git a/share/jupyter/kernels/xcpp17/kernel.json.in b/share/jupyter/kernels/xcpp17/kernel.json.in index 8d7dac23..46b847a8 100644 --- a/share/jupyter/kernels/xcpp17/kernel.json.in +++ b/share/jupyter/kernels/xcpp17/kernel.json.in @@ -4,7 +4,7 @@ "@XEUS_CLING_KERNELSPEC_PATH@/xcpp", "-f", "{connection_file}", - "-I", "@LLVM_DIR@/include", + "-I", "@LLVM_MAIN_INCLUDE_DIR@", "-std=c++17" ], "language": "C++17" From bd364d7b9538a1e5b836977b03d3cda3fbdef817 Mon Sep 17 00:00:00 2001 From: Tom McLaughlin Date: Fri, 11 Aug 2023 15:35:06 -0700 Subject: [PATCH 4/4] Set LLVM_MAIN_INCLUDE_DIR for kernelspecs in CMakeLists.txt --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 43718f5a..38113c2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -362,9 +362,10 @@ install(TARGETS xcpp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) # Configuration and data directories for jupyter and xeus-cling -set(XJUPYTER_DATA_DIR "share/jupyter" CACHE STRING "Jupyter data directory") -set(XEUS_CLING_DATA_DIR "share/xeus-cling" CACHE STRING "xeus-cling data directory") -set(XEUS_CLING_CONF_DIR "etc/xeus-cling" CACHE STRING "xeus-cling configuration directory") +set(XJUPYTER_DATA_DIR "share/jupyter" CACHE STRING "Jupyter data directory") +set(XEUS_CLING_DATA_DIR "share/xeus-cling" CACHE STRING "xeus-cling data directory") +set(XEUS_CLING_CONF_DIR "etc/xeus-cling" CACHE STRING "xeus-cling configuration directory") +set(LLVM_MAIN_INCLUDE_DIR ${INCLUDE_DIR} CACHE STRING "Path to llvm/include") # Install xcpp headers install(FILES ${XCPP_HEADERS}