Skip to content
Snippets Groups Projects
Commit 85b372a0 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

don't include PyCore unless BORNAGAIN_PYTHON is defined

parent 206e0830
No related branches found
No related tags found
1 merge request!1636PyCore: Re-implementation of embedded Python as a separate module (Major change)
Showing with 25 additions and 3 deletions
...@@ -12,14 +12,15 @@ ...@@ -12,14 +12,15 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_PYTHON
#error this header requires Python support
#endif
#ifdef SWIG #ifdef SWIG
#error no need to expose this header to Swig #error no need to expose this header to Swig
#endif #endif
#ifndef BORNAGAIN_PYTOOLS_PYCORE_H #ifndef BORNAGAIN_PYTOOLS_PYCORE_H
#define BORNAGAIN_PYTOOLS_PYCORE_H #define BORNAGAIN_PYTOOLS_PYCORE_H
#ifdef BORNAGAIN_PYTHON
#undef _POSIX_C_SOURCE #undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE #undef _XOPEN_SOURCE
...@@ -52,5 +53,4 @@ ...@@ -52,5 +53,4 @@
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#endif // BORNAGAIN_PYTHON
#endif // BORNAGAIN_PYTOOLS_PYCORE_H #endif // BORNAGAIN_PYTOOLS_PYCORE_H
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_PYTHON
#error this header requires Python support
#endif
#ifndef BORNAGAIN_PYCORE_EMBED_PYINTERPRETER_H #ifndef BORNAGAIN_PYCORE_EMBED_PYINTERPRETER_H
#define BORNAGAIN_PYCORE_EMBED_PYINTERPRETER_H #define BORNAGAIN_PYCORE_EMBED_PYINTERPRETER_H
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_PYTHON
#error this header requires Python support
#endif
#ifndef BORNAGAIN_PYCORE_EMBED_PYOBJECTDECL_H #ifndef BORNAGAIN_PYCORE_EMBED_PYOBJECTDECL_H
#define BORNAGAIN_PYCORE_EMBED_PYOBJECTDECL_H #define BORNAGAIN_PYCORE_EMBED_PYOBJECTDECL_H
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_PYTHON
#error this header requires Python support
#endif
#ifndef BORNAGAIN_PYCORE_EMBED_PYOBJECTPTR_H #ifndef BORNAGAIN_PYCORE_EMBED_PYOBJECTPTR_H
#define BORNAGAIN_PYCORE_EMBED_PYOBJECTPTR_H #define BORNAGAIN_PYCORE_EMBED_PYOBJECTPTR_H
......
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
// //
// ************************************************************************************************ // ************************************************************************************************
#ifndef BORNAGAIN_PYTHON
#error this header requires Python support
#endif
#ifdef SWIG #ifdef SWIG
#error no need to expose this header to Swig #error no need to expose this header to Swig
#endif #endif
......
...@@ -5,6 +5,7 @@ set(test TestCoreConsistence) ...@@ -5,6 +5,7 @@ set(test TestCoreConsistence)
file(GLOB source_files *.cpp) file(GLOB source_files *.cpp)
add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_include_directories(${test} PUBLIC target_include_directories(${test} PUBLIC
${BornAgainSim_INCLUDE_DIRS} ${BornAgainSim_INCLUDE_DIRS}
......
...@@ -8,6 +8,7 @@ set(source_files ...@@ -8,6 +8,7 @@ set(source_files
) )
add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_include_directories(${test} target_include_directories(${test}
PUBLIC PUBLIC
${CMAKE_SOURCE_DIR}/Tests/Unit/utilities ${CMAKE_SOURCE_DIR}/Tests/Unit/utilities
......
...@@ -24,6 +24,7 @@ set(test TestCoreFitting) ...@@ -24,6 +24,7 @@ set(test TestCoreFitting)
file(GLOB source_files *.cpp) file(GLOB source_files *.cpp)
add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) add_executable(${test} ${source_files} ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_include_directories(${test} target_include_directories(${test}
PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/common/gtest/gtest-1.8.0/include) PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/common/gtest/gtest-1.8.0/include)
target_link_libraries(${test} BornAgainTestSimFactory gtest) target_link_libraries(${test} BornAgainTestSimFactory gtest)
......
...@@ -28,6 +28,7 @@ set(test TestGuiSuite) ...@@ -28,6 +28,7 @@ set(test TestGuiSuite)
set(source_files Check.cpp ../Common/RunTest.cpp ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) set(source_files Check.cpp ../Common/RunTest.cpp ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_compile_options(${test} PUBLIC -DGUI_STD_TEST -DTESTNAME=GUI) target_compile_options(${test} PUBLIC -DGUI_STD_TEST -DTESTNAME=GUI)
target_compile_definitions(${test} PUBLIC DISABLE_DISTRIBUTION_TESTS) target_compile_definitions(${test} PUBLIC DISABLE_DISTRIBUTION_TESTS)
......
...@@ -28,6 +28,7 @@ set(test TestSuitePersist) ...@@ -28,6 +28,7 @@ set(test TestSuitePersist)
set(source_files Check.cpp ../Common/RunTest.cpp ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) set(source_files Check.cpp ../Common/RunTest.cpp ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_compile_definitions(${test} PUBLIC DISABLE_DISTRIBUTION_TESTS -DTESTNAME=Persist) target_compile_definitions(${test} PUBLIC DISABLE_DISTRIBUTION_TESTS -DTESTNAME=Persist)
target_include_directories(${test} PUBLIC target_include_directories(${test} PUBLIC
${BornAgainSim_INCLUDE_DIRS} ${BornAgainSim_INCLUDE_DIRS}
......
...@@ -31,6 +31,7 @@ set(source_files Check.cpp ...@@ -31,6 +31,7 @@ set(source_files Check.cpp
${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_compile_options(${test} PUBLIC -DPYTHON_STD_TEST -DTESTNAME=Py) target_compile_options(${test} PUBLIC -DPYTHON_STD_TEST -DTESTNAME=Py)
target_compile_definitions(${test} PUBLIC DISABLE_DISTRIBUTION_TESTS) target_compile_definitions(${test} PUBLIC DISABLE_DISTRIBUTION_TESTS)
......
...@@ -5,6 +5,7 @@ set(test UnitTestDevice) ...@@ -5,6 +5,7 @@ set(test UnitTestDevice)
file(GLOB source_files "*.cpp" ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) file(GLOB source_files "*.cpp" ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_link_libraries(${test} BornAgainDevice gtest) target_link_libraries(${test} BornAgainDevice gtest)
gtest_discover_tests(${test} DISCOVERY_TIMEOUT 300 TEST_PREFIX Unit.Device.) gtest_discover_tests(${test} DISCOVERY_TIMEOUT 300 TEST_PREFIX Unit.Device.)
...@@ -11,6 +11,7 @@ include_directories(${CMAKE_SOURCE_DIR}/Tests/Unit/utilities) ...@@ -11,6 +11,7 @@ include_directories(${CMAKE_SOURCE_DIR}/Tests/Unit/utilities)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_link_libraries(${test} BornAgainGUI gtest Qt6::Core Qt6::Test) target_link_libraries(${test} BornAgainGUI gtest Qt6::Core Qt6::Test)
set(test_data_dir ${TEST_OUTPUT_DIR}/Unit/GUI) set(test_data_dir ${TEST_OUTPUT_DIR}/Unit/GUI)
......
...@@ -9,6 +9,7 @@ endif() ...@@ -9,6 +9,7 @@ endif()
file(GLOB source_files "*.cpp" ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) file(GLOB source_files "*.cpp" ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_include_directories(${test} PUBLIC target_include_directories(${test} PUBLIC
${CMAKE_SOURCE_DIR}/3rdparty/common/gtest/gtest-1.8.0/include ${CMAKE_SOURCE_DIR}/3rdparty/common/gtest/gtest-1.8.0/include
${CMAKE_SOURCE_DIR}/Tests/Unit/utilities) ${CMAKE_SOURCE_DIR}/Tests/Unit/utilities)
......
...@@ -5,6 +5,7 @@ set(test UnitTestSim) ...@@ -5,6 +5,7 @@ set(test UnitTestSim)
file(GLOB source_files "*.cpp" ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp) file(GLOB source_files "*.cpp" ${CMAKE_SOURCE_DIR}/Tests/GTestWrapper/TestAll.cpp)
add_executable(${test} ${source_files}) add_executable(${test} ${source_files})
target_compile_definitions(${test} PRIVATE -DBORNAGAIN_PYTHON)
target_link_libraries(${test} BornAgainSim gtest) target_link_libraries(${test} BornAgainSim gtest)
gtest_discover_tests(${test} DISCOVERY_TIMEOUT 300 TEST_PREFIX Unit.Sim.) gtest_discover_tests(${test} DISCOVERY_TIMEOUT 300 TEST_PREFIX Unit.Sim.)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment