diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 5777366c13..37d6cbba1c 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -744,7 +744,7 @@ if( KICAD_SCRIPTING ) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py COMMENT "Copying pcbnew.py into ${PYTHON_DEST}" ) - add_dependencies( ScriptingPcbnewPyCopy ScriptingWxpythonCopy ) + add_dependencies( ScriptingPcbnewPyCopy ScriptingPythonDirectoryCreation ) endif() # python plugins @@ -791,7 +791,7 @@ if( KICAD_SCRIPTING_MODULES ) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.so COMMENT "Copying _pcbnew.so into ${PYTHON_DEST}" ) - add_dependencies( ScriptingModulesPcbnewSoCopy ScriptingWxpythonCopy ) + add_dependencies( ScriptingModulesPcbnewSoCopy ScriptingPythonDirectoryCreation ) set( PYMOD_EXT "so" ) else() # only linux remains among supported platforms install( FILES ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.kiface DESTINATION ${PYTHON_DEST} COMPONENT binary RENAME "_pcbnew.so" ) @@ -826,6 +826,14 @@ endif() if( APPLE ) if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) + # If we don't have wxPython, then we must create the site-packages directory + add_custom_target( ScriptingPythonDirectoryCreation ALL + COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_DEST}" + COMMENT "Creating Python library directory ${PYTHON_DEST}" + ) + endif() + + if( KICAD_SCRIPTING_WXPYTHON ) # find wx-X.Y-osx_cocoa path below PYTHON_SITE_PACKAGE_PATH file( GLOB WXPYTHON_DIR RELATIVE ${PYTHON_SITE_PACKAGE_PATH} ${PYTHON_SITE_PACKAGE_PATH}/wx-?.?-osx_cocoa ) if( NOT WXPYTHON_DIR ) @@ -837,5 +845,6 @@ if( APPLE ) COMMAND ${CMAKE_COMMAND} -E copy "${PYTHON_SITE_PACKAGE_PATH}/wxversion.py" "${PYTHON_DEST}" COMMENT "Copying wxPython into ${PYTHON_DEST}" ) + add_dependencies( ScriptingWxpythonCopy ScriptingPythonDirectoryCreation ) endif() endif()