File size: 3,023 Bytes
68ce2fc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #
# (C) Copyright 2004-2026 Johns Hopkins University (JHU), All Rights Reserved.
#
# --- begin cisst license - do not edit ---
#
# This software is provided "as is" under an open source license, with
# no warranty. The complete license can be found in license.txt and
# http://www.cisst.org/cisst/license.txt.
#
# --- end cisst license ---
project (pythonEmbedded)
set (REQUIRED_CISST_LIBRARIES cisstCommon cisstVector)
find_package (cisst COMPONENTS ${REQUIRED_CISST_LIBRARIES} QUIET)
if (cisst_FOUND AND CISST_HAS_SWIG_PYTHON)
# Create myDerivedClass as a shared library
add_library (myDerivedClass SHARED myDerivedClass.cpp myDerivedClass.h)
set_property (TARGET myDerivedClass PROPERTY FOLDER "cisstInteractive/examples")
target_link_libraries (myDerivedClass ${REQUIRED_CISST_LIBRARIES})
# Create myReDerivedClass as a shared library
add_library (myReDerivedClass SHARED myReDerivedClass.cpp myReDerivedClass.h)
set_property (TARGET myReDerivedClass PROPERTY FOLDER "cisstInteractive/examples")
target_link_libraries (myReDerivedClass
${REQUIRED_CISST_LIBRARIES}
myDerivedClass)
# Allow generated c++ code to find header files
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
# To link with build libraries
link_directories (${CMAKE_CURRENT_BINARY_DIR})
# Run SWIG on the interface file
cisst_add_swig_module (MODULE myDerivedClass
INTERFACE_FILENAME myDerivedClassPython.i
FOLDER "cisstInteractive/examples"
MODULE_LINK_LIBRARIES myDerivedClass)
cisst_add_swig_module (MODULE myReDerivedClass
INTERFACE_FILENAME myReDerivedClassPython.i
FOLDER "cisstInteractive/examples"
MODULE_LINK_LIBRARIES myReDerivedClass myDerivedClass)
# Built executable with embedding
add_executable (pythonEmbedded pythonEmbedded.cpp)
set_property (TARGET pythonEmbedded PROPERTY FOLDER "cisstInteractive/examples")
target_include_directories (pythonEmbedded PRIVATE ${PYTHON_ALL_INCLUDE_DIRS})
target_link_libraries (pythonEmbedded
${REQUIRED_CISST_LIBRARIES}
myDerivedClass
myReDerivedClass
${CMAKE_THREAD_LIBS_INIT}
${PYTHON_ALL_LIBRARIES}
util)
if (UNIX)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
endif (UNIX)
# Copy the Python example to the binary tree
add_custom_command (TARGET pythonEmbedded
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy
${CMAKE_CURRENT_SOURCE_DIR}/pythonEmbedded.py
${EXECUTABLE_OUTPUT_PATH}/pythonEmbedded.py
COMMENT "pythonEmbedded: copy pythonEmbedded.py to the executable directory")
else ()
message ("Information: code in ${CMAKE_CURRENT_SOURCE_DIR} will not be compiled, it requires ${REQUIRED_CISST_LIBRARIES} and cisst Python/SWIG support")
endif ()
|