diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index dc253b310..3dc5fbe61 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,80 +1,80 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Fri Dec 12 2014 # @date last modification: Mon Jan 18 2016 # # @brief CMake file for the python wrapping of akantu # # @section LICENSE # # Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory # (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== set(PYAKANTU_SRCS py_aka_common.cc py_aka_error.cc py_akantu.cc py_boundary_conditions.cc py_fe_engine.cc py_group_manager.cc py_mesh.cc py_model.cc py_parser.cc ) package_is_activated(iohelper _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_dumpable.cc ) endif() package_is_activated(solid_mechanics _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_solid_mechanics_model.cc py_material.cc ) endif() package_is_activated(cohesive_element _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_solid_mechanics_model_cohesive.cc ) endif() package_is_activated(heat_transfer _is_activated) if (_is_activated) list(APPEND PYAKANTU_SRCS py_heat_transfer_model.cc ) endif() add_library(pyakantu OBJECT ${PYAKANTU_SRCS}) -target_link_libraries(pyakantu PUBLIC akantu pybind11) +target_link_libraries(pyakantu PUBLIC akantu pybind11::pybind11) target_include_directories(pyakantu INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(pyakantu PROPERTIES POSITION_INDEPENDENT_CODE TRUE) pybind11_add_module(py11_akantu $) target_link_libraries(py11_akantu PRIVATE pyakantu) set_target_properties(py11_akantu PROPERTIES DEBUG_POSTFIX "") diff --git a/test/test_python_interface/CMakeLists.txt b/test/test_python_interface/CMakeLists.txt index c9810f52e..4b9356781 100644 --- a/test/test_python_interface/CMakeLists.txt +++ b/test/test_python_interface/CMakeLists.txt @@ -1,42 +1,45 @@ #=============================================================================== # @file CMakeLists.txt # # @author Fabian Barras # @author Lucas Frerot # # @date creation: Fri Sep 03 2010 # @date last modification: Mon Feb 05 2018 # # @brief Python Interface tests # # @section LICENSE # # Copyright (©) 2010-2018 EPFL (Ecole Polytechnique Fédérale de Lausanne) # Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) # # Akantu is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 3 of the License, or (at your option) any # later version. # # Akantu is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License # along with Akantu. If not, see . # #=============================================================================== -akantu_pybind11_add_module(py11_akantu_test_common MODULE test_common.cc) -target_link_libraries(py11_akantu_test_common PRIVATE pyakantu) +package_is_activated(python_interface _is_activated) +if(_is_activated) + akantu_pybind11_add_module(py11_akantu_test_common MODULE test_common.cc) + target_link_libraries(py11_akantu_test_common PRIVATE pyakantu) +endif() add_mesh(mesh_dcb_2d mesh_dcb_2d.geo 2 2) register_test(test_python_interface SCRIPT test_pybind.py PYTHON FILES_TO_COPY elastic.dat DEPENDS mesh_dcb_2d py11_akantu_test_common PACKAGE python_interface )