kicad/scripting/CMakeLists.txt

105 lines
3.0 KiB
CMake
Raw Normal View History

2021-03-08 14:54:22 +00:00
set( KIPYTHON_SRCS
kipython_settings.cpp
python_manager.cpp
2021-03-08 14:54:22 +00:00
)
add_library( scripting STATIC
${KIPYTHON_SRCS}
)
target_link_libraries( scripting
${wxWidgets_LIBRARIES} # wxLogDebug, wxASSERT
2021-04-27 00:32:09 +00:00
${PYTHON_LIBRARIES}
Boost::headers
2021-03-08 14:54:22 +00:00
common
2024-03-20 01:53:21 +00:00
kicommon
2021-03-08 14:54:22 +00:00
)
target_include_directories( scripting PUBLIC
${PYTHON_INCLUDE_DIRS}
${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
)
target_include_directories( scripting PRIVATE
$<TARGET_PROPERTY:nlohmann_json,INTERFACE_INCLUDE_DIRECTORIES>
2022-07-21 23:32:44 +00:00
${PROJECT_SOURCE_DIR}/resources/bitmaps_png/include
2021-03-08 14:54:22 +00:00
${PROJECT_SOURCE_DIR}/include
${wxWidgets_LIBRARIES}
)
# Setup the KIFACE
add_library( scripting_kiface MODULE
kicad_scripting_main.cpp
2021-03-15 21:56:13 +00:00
kipython_frame.cpp
2021-03-08 14:54:22 +00:00
${KIPYTHON_SRCS}
)
set_source_files_properties( kicad_scripting_main.cpp PROPERTIES
# The KIFACE is in kicad_scripting_main.cpp, export it:
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
)
2021-03-15 21:56:13 +00:00
2021-03-08 14:54:22 +00:00
target_include_directories( scripting_kiface PRIVATE
2022-07-21 23:32:44 +00:00
${PROJECT_SOURCE_DIR}/resources/bitmaps_png/include
2021-03-08 14:54:22 +00:00
${PROJECT_SOURCE_DIR}/include
${wxWidgets_LIBRARIES}
)
2021-04-27 00:32:09 +00:00
if( MSVC )
target_sources( scripting_kiface PRIVATE ${CMAKE_SOURCE_DIR}/resources/msw/kipython-dll.rc )
endif()
2021-03-08 14:54:22 +00:00
target_link_libraries( scripting_kiface
scripting
)
set_target_properties( scripting_kiface PROPERTIES
OUTPUT_NAME kipython
PREFIX ${KIFACE_PREFIX}
SUFFIX ${KIFACE_SUFFIX}
)
2021-04-27 00:32:09 +00:00
target_link_options( scripting_kiface PRIVATE
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,--cref,-Map=_scripting.kiface.map>
)
2021-03-08 14:54:22 +00:00
if( APPLE )
2021-03-08 14:54:22 +00:00
set_target_properties( scripting_kiface PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR}
)
set_target_properties( scripting_kiface PROPERTIES INSTALL_RPATH
"@executable_path/../Frameworks;@executable_path/../Frameworks/Python.framework" )
set_target_properties( scripting_kiface PROPERTIES BUILD_WITH_INSTALL_RPATH 1 )
install( CODE "
set( KICAD_CMAKE_MODULE_PATH \"${KICAD_CMAKE_MODULE_PATH}\" )
set( OSX_BUNDLE_BUILD_KIFACE_DIR \"${OSX_BUNDLE_BUILD_KIFACE_DIR}\" )
set( OSX_BUNDLE_INSTALL_LIB_DIR \"${OSX_BUNDLE_INSTALL_LIB_DIR}\" )
include( ${KICAD_CMAKE_MODULE_PATH}/InstallSteps/InstallMacOS.cmake )
# Install any dependencies
install_runtime_deps( \"\"
\"${OSX_BUNDLE_BUILD_KIFACE_DIR}/_kipython.kiface\"
\"\"
)
" )
2021-03-08 14:54:22 +00:00
else()
install( TARGETS scripting_kiface
DESTINATION ${KICAD_KIFACE}
2021-03-08 14:54:22 +00:00
COMPONENT binary
)
endif()
2021-07-16 01:30:59 +00:00
if( KICAD_WIN32_INSTALL_PDBS )
# Get the PDBs to copy over for MSVC
install(FILES $<TARGET_PDB_FILE:scripting_kiface> DESTINATION ${KICAD_KIFACE})
2021-07-16 01:30:59 +00:00
endif()
2021-03-08 14:54:22 +00:00
# python shell installation
install( DIRECTORY ${PROJECT_SOURCE_DIR}/scripting/kicad_pyshell/
DESTINATION ${KICAD_DATA}/scripting/kicad_pyshell
FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ
)