From 011a071ca7985a9662eae514ae055dc565c6be18 Mon Sep 17 00:00:00 2001
From: Christoph Alt <christoph.alt@fau.de>
Date: Tue, 7 Jan 2025 18:49:42 +0100
Subject: [PATCH 1/2] the pystencils include directory is now added to the
 include path of a generated target for #5

---
 src/pystencilssfg/cmake/modules/PystencilsSfg.cmake | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake b/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake
index 2765978..e672944 100644
--- a/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake
+++ b/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake
@@ -20,6 +20,10 @@ function(_pssfg_add_gen_source target script)
                     OUTPUT_VARIABLE generatedSources RESULT_VARIABLE _pssfg_result
                     ERROR_VARIABLE _pssfg_stderr)
 
+    execute_process(COMMAND ${Python_EXECUTABLE} -c "from pystencils.include import get_pystencils_include_path; print(get_pystencils_include_path())"
+                    OUTPUT_VARIABLE _Pystencils_INCLUDE_DIR)
+    string(REGEX REPLACE "\n$" "" Pystencils_INCLUDE_DIR "${_Pystencils_INCLUDE_DIR}")
+
     if(NOT (${_pssfg_result} EQUAL 0))
         message( FATAL_ERROR ${_pssfg_stderr} )
     endif()
@@ -37,7 +41,7 @@ function(_pssfg_add_gen_source target script)
                        WORKING_DIRECTORY "${generatedSourcesDir}")
 
     target_sources(${target} PRIVATE ${generatedSourcesAbsolute})
-    target_include_directories(${target} PRIVATE ${PystencilsSfg_GENERATED_SOURCES_DIR})
+    target_include_directories(${target} PRIVATE ${PystencilsSfg_GENERATED_SOURCES_DIR} ${Pystencils_INCLUDE_DIR})
 endfunction()
 
 
-- 
GitLab


From ca7e42b318978ef4c5d60b6f06bb2d633cedd98c Mon Sep 17 00:00:00 2001
From: Christoph Alt <christoph.alt@fau.de>
Date: Wed, 8 Jan 2025 14:46:54 +0100
Subject: [PATCH 2/2] using python's print functionality to remove the newline

---
 src/pystencilssfg/cmake/modules/PystencilsSfg.cmake | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake b/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake
index e672944..cd1f1ba 100644
--- a/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake
+++ b/src/pystencilssfg/cmake/modules/PystencilsSfg.cmake
@@ -20,9 +20,8 @@ function(_pssfg_add_gen_source target script)
                     OUTPUT_VARIABLE generatedSources RESULT_VARIABLE _pssfg_result
                     ERROR_VARIABLE _pssfg_stderr)
 
-    execute_process(COMMAND ${Python_EXECUTABLE} -c "from pystencils.include import get_pystencils_include_path; print(get_pystencils_include_path())"
+    execute_process(COMMAND ${Python_EXECUTABLE} -c "from pystencils.include import get_pystencils_include_path; print(get_pystencils_include_path(), end='')"
                     OUTPUT_VARIABLE _Pystencils_INCLUDE_DIR)
-    string(REGEX REPLACE "\n$" "" Pystencils_INCLUDE_DIR "${_Pystencils_INCLUDE_DIR}")
 
     if(NOT (${_pssfg_result} EQUAL 0))
         message( FATAL_ERROR ${_pssfg_stderr} )
@@ -41,7 +40,7 @@ function(_pssfg_add_gen_source target script)
                        WORKING_DIRECTORY "${generatedSourcesDir}")
 
     target_sources(${target} PRIVATE ${generatedSourcesAbsolute})
-    target_include_directories(${target} PRIVATE ${PystencilsSfg_GENERATED_SOURCES_DIR} ${Pystencils_INCLUDE_DIR})
+    target_include_directories(${target} PRIVATE ${PystencilsSfg_GENERATED_SOURCES_DIR} ${_Pystencils_INCLUDE_DIR})
 endfunction()
 
 
-- 
GitLab