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

CMake: mv code to PythonAPI.cmake

parent bd098ec1
No related branches found
No related tags found
No related merge requests found
......@@ -95,6 +95,7 @@ if(BORNAGAIN_GUI)
string(APPEND CMAKE_CXX_FLAGS " -DHAVE_QT=ON")
endif()
include(BornAgain/Config)
include(BornAgain/PythonAPI)
include(BornAgain/PythonDocs)
# debug optimization
......
......@@ -17,7 +17,6 @@ if(${Cerf_IS_CPP})
string(APPEND CMAKE_CXX_FLAGS " -DCERF_AS_CPP=ON")
endif()
if(BORNAGAIN_PYTHON)
if(CONFIGURE_BINDINGS)
......@@ -99,34 +98,9 @@ set(${lib}_LIBRARY ${lib} PARENT_SCOPE)
if(BORNAGAIN_PYTHON)
if(CONFIGURE_BINDINGS)
add_custom_command(
OUTPUT ${AUTO_DIR}/swig_runtime.h
COMMAND ${SWIG_EXECUTABLE} -c++;-python;-external-runtime;${AUTO_DIR}/swig_runtime.h
DEPENDS ${swig_dependencies} ${include_files}
)
endif()
add_custom_target(${lib}_runtime DEPENDS ${AUTO_DIR}/swig_runtime.h)
add_dependencies(${lib} ${lib}_runtime)
configure_file(${WRAP_DIR}/python/plot_utils.py
${CMAKE_BINARY_DIR}/lib/bornagain/plot_utils.py COPYONLY)
if(WIN32)
set(BA_MODULES_IMPORT_PATH "../../bin")
else()
set(BA_MODULES_IMPORT_PATH "..")
endif()
if(BORNAGAIN_APPLE_BUNDLE)
set(BA_MODULES_IMPORT_PATH
lib/BornAgain-${BornAgain_VERSION_MAJOR}.${BornAgain_VERSION_MINOR})
endif()
configure_file("${WRAP_DIR}/python/__init__.py.in"
"${CMAKE_BINARY_DIR}/lib/bornagain/__init__.py" @ONLY)
add_dependencies(${lib} swig_runtime)
endif()
# --- external dependencies ---
target_link_libraries(${lib} ${BornAgainFit_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
......@@ -180,19 +154,6 @@ foreach(file ${include_files})
install(FILES ${file} DESTINATION ${destination_include}/${name}/${dir})
endforeach()
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "*.py" )
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "README")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "*.gz")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "*.png")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/cpp
DESTINATION ${destination_examples} COMPONENT Examples)
install(FILES "${AUTO_DIR}/swig_runtime.h"
DESTINATION ${destination_include}/Wrap COMPONENT Headers)
if(WIN32)
# python in windows required .pyd extension for the library name
if(BORNAGAIN_PYTHON)
......
# Configure and install the Swig runtime, the BornAgain Python module, and more
configure_file(${WRAP_DIR}/python/plot_utils.py
${CMAKE_BINARY_DIR}/lib/bornagain/plot_utils.py COPYONLY)
if(WIN32)
set(BA_MODULES_IMPORT_PATH "../../bin")
else()
set(BA_MODULES_IMPORT_PATH "..")
endif()
if(BORNAGAIN_APPLE_BUNDLE)
set(BA_MODULES_IMPORT_PATH
lib/BornAgain-${BornAgain_VERSION_MAJOR}.${BornAgain_VERSION_MINOR})
endif()
configure_file("${WRAP_DIR}/python/__init__.py.in"
"${CMAKE_BINARY_DIR}/lib/bornagain/__init__.py" @ONLY)
if(CONFIGURE_BINDINGS)
add_custom_command(
OUTPUT ${AUTO_DIR}/swig_runtime.h
COMMAND ${SWIG_EXECUTABLE} -c++;-python;-external-runtime;${AUTO_DIR}/swig_runtime.h
DEPENDS ${swig_dependencies} ${include_files}
)
endif()
add_custom_target(swig_runtime DEPENDS ${AUTO_DIR}/swig_runtime.h)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "*.py" )
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "README")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "*.gz")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/
DESTINATION ${destination_examples} COMPONENT Examples FILES_MATCHING PATTERN "*.png")
install(DIRECTORY ${CMAKE_SOURCE_DIR}/Examples/cpp
DESTINATION ${destination_examples} COMPONENT Examples)
install(FILES "${AUTO_DIR}/swig_runtime.h"
DESTINATION ${destination_include}/Wrap COMPONENT Headers)
# Install bornagain/__init__.py and utilites
install(DIRECTORY "${CMAKE_BINARY_DIR}/lib/bornagain/"
......
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