diff --git a/3d-viewer/3d_canvas.cpp b/3d-viewer/3d_canvas.cpp index aea2dedf1d..f59e631224 100644 --- a/3d-viewer/3d_canvas.cpp +++ b/3d-viewer/3d_canvas.cpp @@ -52,35 +52,6 @@ #include #include -// ----------------- -// helper function (from wxWidgets, opengl/cube.cpp sample -// ----------------- -void CheckGLError(const char *aFileName, int aLineNumber) -{ - GLenum errLast = GL_NO_ERROR; - - for ( ; ; ) - { - GLenum err = glGetError(); - if ( err == GL_NO_ERROR ) - return; - - // normally the error is reset by the call to glGetError() but if - // glGetError() itself returns an error, we risk looping forever here - // so check that we get a different error than the last time - if ( err == errLast ) - { - wxLogError(wxT("OpenGL error state couldn't be reset.")); - return; - } - - errLast = err; - - wxLogError( wxT( "OpenGL error %d At: %s, line: %d" ), err, - GetChars( FROM_UTF8( aFileName ) ), aLineNumber ); - } -} - /* * EDA_3D_CANVAS implementation diff --git a/3d-viewer/3d_draw_helper_functions.cpp b/3d-viewer/3d_draw_helper_functions.cpp index d6050910f8..b3c08aa86f 100644 --- a/3d-viewer/3d_draw_helper_functions.cpp +++ b/3d-viewer/3d_draw_helper_functions.cpp @@ -42,6 +42,35 @@ #define TEXTURE_PCB_SCALE 5.0 +// ----------------- +// helper function (from wxWidgets, opengl/cube.cpp sample +// ----------------- +void CheckGLError(const char *aFileName, int aLineNumber) +{ + GLenum errLast = GL_NO_ERROR; + + for ( ; ; ) + { + GLenum err = glGetError(); + if ( err == GL_NO_ERROR ) + return; + + // normally the error is reset by the call to glGetError() but if + // glGetError() itself returns an error, we risk looping forever here + // so check that we get a different error than the last time + if ( err == errLast ) + { + wxLogError(wxT("OpenGL error state couldn't be reset.")); + return; + } + + errLast = err; + + wxLogError( wxT( "OpenGL error %d At: %s, line: %d" ), err, + GetChars( FROM_UTF8( aFileName ) ), aLineNumber ); + } +} + INFO3D_VISU& EDA_3D_CANVAS::GetPrm3DVisu() const { diff --git a/3d-viewer/CMakeLists.txt b/3d-viewer/CMakeLists.txt index dd37cf913a..f226aff2c1 100644 --- a/3d-viewer/CMakeLists.txt +++ b/3d-viewer/CMakeLists.txt @@ -33,3 +33,4 @@ set(3D-VIEWER_SRCS ) add_library(3d-viewer STATIC ${3D-VIEWER_SRCS}) +add_dependencies( 3d-viewer pcbcommon ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ea5c8a6e8..dc2f65330c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,7 +312,7 @@ set( KICAD_BIN bin set( KICAD_FP_LIB_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}" CACHE PATH "Default path where footprint libraries are installed." ) -if( UNIX ) +if( UNIX AND NOT APPLE ) # Everything without leading / is relative to CMAKE_INSTALL_PREFIX. set( KICAD_PLUGINS lib/kicad/plugins CACHE PATH "Location of KiCad plugins." ) @@ -339,6 +339,46 @@ set( KICAD_DEMOS ${KICAD_DATA}/demos set( KICAD_TEMPLATE ${KICAD_DATA}/template CACHE PATH "Location of KiCad template files." ) +if( APPLE ) + # everything without leading / is relative to CMAKE_INSTALL_PREFIX. + # CMAKE_INSTALL_PREFIX is root of .dmg image + set( KICAD_BIN ${CMAKE_INSTALL_PREFIX} + CACHE PATH "Location of KiCad binaries." FORCE ) + + # some paths to single app bundle + set( OSX_BUNDLE_MAIN "kicad.app" ) + set( OSX_BUNDLE_BIN_DIR "Contents/MacOS" ) + set( OSX_BUNDLE_LIB_DIR "Contents/Frameworks" ) + set( OSX_BUNDLE_KIFACE_DIR "Contents/Plugins" ) + set( OSX_BUNDLE_SUP_DIR "Contents/SharedSupport" ) + set( OSX_BUNDLE_BUILD_DIR "${CMAKE_BINARY_DIR}/kicad/${OSX_BUNDLE_MAIN}" ) + set( OSX_BUNDLE_BUILD_BIN_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_BIN_DIR}" ) + set( OSX_BUNDLE_BUILD_LIB_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_LIB_DIR}" ) + set( OSX_BUNDLE_BUILD_KIFACE_DIR "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_KIFACE_DIR}" ) + set( OSX_BUNDLE_INSTALL_DIR "${KICAD_BIN}/${OSX_BUNDLE_MAIN}" ) + set( OSX_BUNDLE_INSTALL_BIN_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_BIN_DIR}" ) + set( OSX_BUNDLE_INSTALL_LIB_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_LIB_DIR}" ) + set( OSX_BUNDLE_INSTALL_KIFACE_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_KIFACE_DIR}" ) + + # everything provided with the application bundle goes into + # kicad.app/Contents/SharedSupport => accessible via GetDataDir() + # everything else to the .dmg image + set( KICAD_DATA ${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_SUP_DIR} + CACHE PATH "Location of KiCad data files." FORCE ) + set( KICAD_TEMPLATE ${KICAD_DATA}/template + CACHE PATH "Location of KiCad template files." FORCE ) + set( KICAD_PLUGINS ${KICAD_DATA}/plugins + CACHE PATH "Location of KiCad plugins." FORCE ) + set( KICAD_DOCS doc + CACHE PATH "Location of KiCad documentation files." FORCE ) + set( KICAD_DEMOS demos + CACHE PATH "Location of KiCad demo files." FORCE ) + + # used to set DEFAULT_FP_LIB_PATH in config.h.cmake, but then never used + # set it to correct value just in case (see common.cpp) + set( KICAD_FP_LIB_INSTALL_PATH "~/Library/Preferences/kicad" ) +endif() + mark_as_advanced( KICAD_BIN KICAD_PLUGINS KICAD_DATA @@ -368,13 +408,7 @@ add_definitions( -DWX_COMPATIBILITY ) # See line 41 of CMakeModules/FindwxWidgets.cmake set( wxWidgets_CONFIG_OPTIONS --static=no ) -# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base -# Seems no longer needed on wx-3 -if( APPLE AND ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES OR KICAD_SCRIPTING_WXPYTHON) ) - find_package( wxWidgets 3.0.0 COMPONENTS gl adv html core net base xml REQUIRED ) -else() - find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml REQUIRED ) -endif() +find_package( wxWidgets 3.0.0 COMPONENTS gl aui adv html core net base xml REQUIRED ) # Include wxWidgets macros. include( ${wxWidgets_USE_FILE} ) @@ -397,10 +431,10 @@ add_custom_target( lib-dependencies ) # Only download and build all dependencies from source on OSX if the user specifically requests # it. Otherwise, respect the developers wishes to use the dependencies already installed on -# their systme. +# their system if( APPLE AND USE_OSX_DEPS_BUILDER ) - # This should be built in all cases, if swig exec is not avaiable + # This should be built in all cases, if swig exec is not available # will be impossible also enable SCRIPTING being for PCBNEW required immediately include( download_pcre ) @@ -570,11 +604,22 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) ) if( NOT PYTHON_SITE_PACKAGE_PATH ) - message( FATAL_ERROR "Error occurred while attemping to find the Python site library path." ) + message( FATAL_ERROR "Error occurred while attempting to find the Python site library path." ) endif() endif() - set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" CACHE PATH "Python module install path." ) + if( NOT APPLE ) + set( PYTHON_DEST "${PYTHON_SITE_PACKAGE_PATH}" + CACHE PATH "Python module install path." + ) + else() + # relative path for python in bundle + set( PYTHON_LIB_DIR "python" ) + # install into bundle Frameworks folder + set( PYTHON_DEST "${OSX_BUNDLE_BUILD_LIB_DIR}/${PYTHON_LIB_DIR}" + CACHE PATH "Python module install path." + ) + endif() mark_as_advanced( PYTHON_DEST ) message( STATUS "Python module install path: ${PYTHON_DEST}" ) @@ -650,7 +695,7 @@ add_dependencies( pl_editor boost ) add_dependencies( pnsrouter boost ) -if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) +if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) add_dependencies( pcbnew lib-dependencies ) add_dependencies( eeschema lib-dependencies ) add_dependencies( cvpcb lib-dependencies ) @@ -663,7 +708,7 @@ if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) add_dependencies( pnsrouter lib-dependencies ) endif() -if ( KICAD_BUILD_DYNAMIC ) +if( KICAD_BUILD_DYNAMIC ) endif() ############# @@ -733,7 +778,7 @@ endif() ### # FreeDesktop .desktop and MIME resources ### -if( UNIX ) +if( UNIX AND NOT APPLE ) # Set paths set( UNIX_MIME_DIR resources/linux/mime ) diff --git a/CMakeModules/FindwxWidgets.cmake b/CMakeModules/FindwxWidgets.cmake index 4bcc9caebe..99a0236c09 100644 --- a/CMakeModules/FindwxWidgets.cmake +++ b/CMakeModules/FindwxWidgets.cmake @@ -857,7 +857,7 @@ endif(wxWidgets_FIND_STYLE STREQUAL "win32") # Check if a specfic version was requested by find_package(). if(wxWidgets_FOUND AND wxWidgets_FIND_VERSION) - find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS}) + find_file(_filename wx/version.h PATHS ${wxWidgets_INCLUDE_DIRS} NO_DEFAULT_PATH) dbg_msg("_filename: ${_filename}") if(NOT _filename) diff --git a/Documentation/compiling/mac-osx.txt b/Documentation/compiling/mac-osx.txt index 5e1e0a1934..5570e87efc 100644 --- a/Documentation/compiling/mac-osx.txt +++ b/Documentation/compiling/mac-osx.txt @@ -1,63 +1,198 @@ Compiling KiCad on Apple Mac OS X ================================= - First written: 2010-01-31 - by: Jerry Jacobs - Modified at: 2014-02-07 - by: Marco Serantoni +Building on OSX is very similar to building on Linux. This document will provide +a complete walk-through on what to do but it will focus on OSX specific things. +See general documentation on non-OSX specific KiCad build switches, etc. -Snow Leopard ------------- -Requirements - * XCode Tools (http://developer.apple.com/tools/xcode) - * bzr (bazaar) - * CMake (http://www.cmake.org) +Prerequisites +------------- - The build of Kicad for OSX is now easier than before. - The building system will download and compile the needed libraries for you - patching them accordly to the needs. +Tools needed for building KiCad: +* XCode Tools +* bzr - Bazaar version control system +* CMake - Cross-platform make -Building Kicad with no support for Scripting -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Optional tools: +* Doxygen - Documentation system for several programming languages - The building needs to know if you want a static binary or a dynamic one - Just set ONE of those two options KICAD_BUILD_STATIC or KICAD_BUILD_DYNAMIC - - If you set KICAD_BUILD_DYNAMIC the building system will build all and include - the needed libraries for each executable in its bundle +Mandatory library dependencies needed to compile KiCad: +* GLEW - The OpenGL Extension Wrangler Library +* cairo - 2D graphics library +* wxWidgets - Cross-Platform GUI Library + OR + wxPython - A blending of the wxWidgets C++ class library with the Python + programming language - cmake -DKICAD_BUILD_DYNAMIC=ON . - make +Optional library dependencies, depends on used KiCad features +* OpenSSL - The Open Source toolkit for SSL/TLS + => Needed for github plugin -Building Kicad with support for Scripting -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Due some problems with some dependencies the build of this kind of binary is a bit - more complex, you should initially set KICAD_BUILD_DYNAMIC - then issue for example +All tools (except XCode, of course) and all dependencies except wxWidgets/wxPython +can be compiled manually, but it is advised to install them using your favorite +package manager for OSX like MacPorts or Homebrew. +Depending on the package manager the development packages of the library +dependencies may have to be installed (usually something like -dev or +-devel). +Further, depending on the configuration of your package manager packages might +have to be compiled with special flags/variants to support the correct +architecture. E.g., some packages of MacPorts need to have the "+universal" +variant set to also include the x86_64 variant that might be chosen +automatically by KiCad build process. - cmake -DKICAD_BUILD_DYNAMIC=ON . - make swig +IMPORTANT: +At the moment you *must not* use a wxWidgets/wxPython version installed by any +package manager. +KiCad on OSX needs overlay support and some other fixes, which are not yet +contained in mainline wxWidgets/wxPython sources and builds. +If you don't use a patched wxWidgets you will get graphical artifacts (something +like a magnifying glass effect in the upper left corner of KiCad windows) or +KiCad will just crash on start (due to duplicate libraries). - After successfully building you can set your KICAD_SCRIPTING* options (for example): +Install now the tools and library dependencies as mentioned above. - cmake -DKICAD_SCRIPTING=ON -DKICAD_SCRIPTING_WXPYTHON=ON -DKICAD_SCRIPTING_MODULES=ON . - make - The system will build all accordling your choices and package all in the bundle - I know bundles will be huge, but those will be autosufficient. +Folder Structure +---------------- -Building Kicad for other processors or Universal binaries -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +This documentation will use the following folder structure as an example, but it +is not mandatory to do it like that: +KiCad/ + +-- kicad/ KiCad source folder + +-- build/ KiCad build folder + +-- bin/ KiCad binaries folder + +-- wx-src/ wxWidgets/wxPython source folder + +-- wx-build/ wxWidgets/wxPython build folder + +-- wx-bin/ wxWidgets/wxPython binaries folder - I wish remember you should set the processor like - cmake -DCMAKE_OSX_ARCHITECTURES="x86_64" +Get KiCad sources +----------------- - for other platforms +Create your work root "KiCad" wherever you like and sync KiCad sources to it: + # mkdir KiCad + # cd KiCad + # bzr branch lp:kicad - cmake -DCMAKE_OSX_ARCHITECTURES="x86_64 -arch i386" - cmake -DCMAKE_OSX_ARCHITECTURES="x86_64 -arch i386 -arch ppc" - I know some you should prefer use ; as separator, this will be accomplished soon - keeping support for both the syntaxes +Compiling wxWidgets / wxPython +------------------------------ + +If you don't intend to build KiCad with scripting support then you only need +wxWidgets, otherwise you need wxPython (which also contains wxWidgets). + +Get wxWidgets sources from + http://www.wxwidgets.org/downloads/ +or wxPython sources from + http://www.wxpython.org/download.php#source +and unpack it to the wx-src folder. +It is recommended to use the latest stable version. As of this writing this is +3.0.2 for wxWidgets or 3.0.1.1 for wxPython. + +There is a little helper script osx_build_wx.sh in kicad/scripts that does all +the patching/configuring/compiling of wxWidgets or wxPython for you. +Go to your working root "KiCad" and run: + # kicad/scripts/osx_build_wx.sh wx-src wx-bin kicad "-j4" + +First parameter is the source folder of wxWidgets/wxPython, second parameter the +target folder for compiled binaries, third parameter is the kicad folder, and +the last optional parameter are make options used during the build (in this +case for building with 4 jobs in parallel). +The script will automatically detect if you are compiling wxWidgets or wxPython. +CAUTION: The script will erase existing wx-build and target folders (wx-bin) +without any confirmation! + +If everything went fine during compilation you will now have a working +wxWidgets/wxPython installation in the wx-bin folder. +For building KiCad it is sufficient to keep the wx-bin folder. + +The script doesn't have to be used, the usual "configure/make/make install" will +also work. If you do so, be sure to apply the patches needed for KiCad: + # patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx.patch + # patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_bug_15908.patch + # patch -p0 < ../kicad/patches/wxwidgets-3.0.0_macosx_soname.patch +The same patches apply both for wxWidgets and for wxPython. + +The script uses the following configure command/options for wxWidgets known to +work: + # ../wx-src/configure \ + --prefix=`pwd`/../wx-bin \ + --with-opengl \ + --enable-aui \ + --enable-utf8 \ + --enable-html \ + --enable-stl \ + --with-libjpeg=builtin \ + --with-libpng=builtin \ + --with-regex=builtin \ + --with-libtiff=builtin \ + --with-zlib=builtin \ + --with-expat=builtin \ + --without-liblzma \ + --with-macosx-version-min=10.5 \ + --enable-universal-binary=i386,x86_64 \ + CPPFLAGS="-stdlib=libstdc++" \ + LDFLAGS="-stdlib=libstdc++" \ + CC=clang \ + CXX=clang++ +If you know what you are doing, you can of course use different settings. + + +Compiling KiCad +--------------- + +Change to your working root "KiCad" and create the build folder there: + # mkdir build + # cd build + +Now, configure KiCad without scripting support: + # cmake ../kicad \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \ + -DKICAD_SCRIPTING=OFF \ + -DKICAD_SCRIPTING_MODULES=OFF \ + -DKICAD_SCRIPTING_WXPYTHON=OFF \ + -DCMAKE_INSTALL_PREFIX=../bin \ + -DCMAKE_BUILD_TYPE=Release + +or, configure KiCad with scripting support: + # cmake ../kicad \ + -DCMAKE_C_COMPILER=clang \ + -DCMAKE_CXX_COMPILER=clang++ \ + -DwxWidgets_CONFIG_EXECUTABLE=../wx-bin/bin/wx-config \ + -DPYTHON_EXECUTABLE=`which python` \ + -DPYTHON_SITE_PACKAGE_PATH=`pwd`/../wx-bin/lib/python2.7/site-packages \ + -DKICAD_SCRIPTING=ON \ + -DKICAD_SCRIPTING_MODULES=ON \ + -DKICAD_SCRIPTING_WXPYTHON=ON \ + -DCMAKE_INSTALL_PREFIX=../bin \ + -DCMAKE_BUILD_TYPE=Release +Note, that depending on your python version the "python2.7" part of the +"-DPYTHON_SITE_PACKAGE_PATH" variable might have to be adjusted to what has +been generated when compiling/installing wxPython. If you want to use a specific +python, you can also specify it via "-DPYTHON_EXECUTABLE" instead of using +`which python` (this one will just detect/use you default python). + +Now KiCad is configured using default features/build-switches. +See Documentation/compiling/build-config.txt for a list of all CMake options +available when compiling KiCad. + +Build & Install: + # make + ... will take some time ... + # make install + +Again, if everything went fine you will now have KiCad binaries in the "bin" +folder. KiCad application can be directly run from there to test. +If everything is OK, you can create a .dmg image of your "bin" folder or just +copy/install the KiCad binaries and/or support files (like demos or +documentation) wherever you want. + +If you resync to newer versions of KiCad you don't have to rebuild wxWidgets or +other dependencies. +CMake should pick up the changes automatically and build correctly. However, it +is advised that you make a clean build to be sure (just delete the build folder +and go again through the configure/build steps). + diff --git a/Documentation/development/road-map.md b/Documentation/development/road-map.md index 9c3cbd6d64..32ae96dc42 100644 --- a/Documentation/development/road-map.md +++ b/Documentation/development/road-map.md @@ -615,6 +615,33 @@ Create additional DRC tests for improved error checking. **Progress:** - Planning +## Segment End Point Snapping. ## {#segment_snapping} +**Goal:** + +It is not uncommon for board edge segment end points to inadvertently not +be closed causing issues for the 3D viewer and exporting to different file +formats due the board outline not being a fully enclosed polygon. This +feature would add segment end snapping support to allow the board outline +to be fully enclosed. This feature would only need to be supported by the +GAL rendering. + +**Tasks** +- Mark board edge segment ends with a drag indicator to make it visible to the + user that the segment end does not have an endpoint with any other board edge + segment. +- Allow the user to smap the unconnected segment end to the nearest segment end + point. +- Automatically connect unconnected segments with and additional segment when + opening the 3D viewer or exporting the board to another format. Warn the + user that an addition segment has be added and should be verified. + +**Dependencies:** +- None + +**Progress:** +- Initial discussion. + + ## Gerber File Attributes ## {#gerber_attributes} **Goal:** diff --git a/Doxyfile b/Doxyfile index 2ebbf2d951..162c74c097 100644 --- a/Doxyfile +++ b/Doxyfile @@ -324,22 +324,6 @@ INLINE_SIMPLE_STRUCTS = NO TYPEDEF_HIDES_STRUCT = NO -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -SYMBOL_CACHE_SIZE = 4 - # Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be # set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given # their name and scope. Since this can be an expensive process and often the @@ -1423,18 +1407,6 @@ GENERATE_XML = NO XML_OUTPUT = xml -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - # If the XML_PROGRAMLISTING tag is set to YES Doxygen will # dump the program listings (including syntax highlighting # and cross-referencing information) to the XML output. Note that diff --git a/bitmap2component/CMakeLists.txt b/bitmap2component/CMakeLists.txt index 489ff8f3f1..d513c4379d 100644 --- a/bitmap2component/CMakeLists.txt +++ b/bitmap2component/CMakeLists.txt @@ -20,7 +20,7 @@ set_source_files_properties( bitmap2cmp_gui.cpp PROPERTIES COMPILE_DEFINITIONS "COMPILING_DLL" ) -add_executable( bitmap2component WIN32 MACOSX_BUNDLE +add_executable( bitmap2component WIN32 ${BITMAP2COMPONENT_SRCS} ${BITMAP2COMPONENT_RESOURCES} ) @@ -33,10 +33,17 @@ target_link_libraries( bitmap2component potrace ) -install( TARGETS bitmap2component - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) +if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( bitmap2component PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) +else() + install( TARGETS bitmap2component + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) +endif() if( false ) # linker map with cross reference @@ -52,17 +59,3 @@ if( MINGW ) else() set( BITMAP2COMPONENT_RESOURCES bitmap2component.rc ) endif() - - -if( APPLE ) - set( BITMAP2COMPONENT_RESOURCES bitmap2component.icns ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set( MACOSX_BUNDLE_ICON_FILE bitmap2component.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.bitmap2component ) - - set_target_properties( bitmap2component PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist - ) -endif() diff --git a/bitmaps_png/sources/cvpcb.svg b/bitmaps_png/sources/cvpcb.svg index 9ecdf35b70..4a3136d509 100644 --- a/bitmaps_png/sources/cvpcb.svg +++ b/bitmaps_png/sources/cvpcb.svg @@ -12,8 +12,8 @@ width="26" version="1.1" id="svg2985" - inkscape:version="0.48.3.1 r9886" - sodipodi:docname="2-icon_cvpcb.svg"> + inkscape:version="0.48.4 r9939" + sodipodi:docname="cvpcb.svg"> @@ -35,15 +35,15 @@ guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" - inkscape:window-width="1600" - inkscape:window-height="849" + inkscape:window-width="1920" + inkscape:window-height="1033" id="namedview3055" showgrid="true" - inkscape:zoom="18.178537" - inkscape:cx="5.5742284" - inkscape:cy="8.1742878" - inkscape:window-x="0" - inkscape:window-y="29" + inkscape:zoom="31.120863" + inkscape:cx="13.368694" + inkscape:cy="12.38952" + inkscape:window-x="-4" + inkscape:window-y="-4" inkscape:window-maximized="1" inkscape:current-layer="svg2985" inkscape:snap-to-guides="false" @@ -327,95 +327,6 @@ cy="7.2679" r="38.159" /> - - - - - - - - - - - - - - - - - - - - - @@ -564,161 +429,6 @@ inkscape:connector-curvature="0" sodipodi:nodetypes="cc" /> - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bitmaps_png/sources/find_replace.svg b/bitmaps_png/sources/find_replace.svg index e1ec4e7bf0..4060f07f72 100644 --- a/bitmaps_png/sources/find_replace.svg +++ b/bitmaps_png/sources/find_replace.svg @@ -14,7 +14,7 @@ inkscape:export-xdpi="90.000000" inkscape:export-filename="/home/steven/edit-find-48.png" sodipodi:docname="find_replace.svg" - inkscape:version="0.48.2 r9819" + inkscape:version="0.48.4 r9939" sodipodi:version="0.32" id="svg249" height="26" @@ -433,17 +433,17 @@ image/svg+xml - + edit @@ -704,82 +704,6 @@ inkscape:label="Magnifying Glass" style="display:inline" transform="translate(0,-22)"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp index 524fe39300..bda427fb88 100644 --- a/common/draw_frame.cpp +++ b/common/draw_frame.cpp @@ -24,7 +24,7 @@ */ /** - * @file drawframe.cpp + * @file draw_frame.cpp */ #include diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp index 15aef15117..919fdb1dc7 100644 --- a/common/draw_panel.cpp +++ b/common/draw_panel.cpp @@ -24,7 +24,7 @@ */ /** - * @file drawpanel.cpp + * @file draw_panel.cpp */ #include diff --git a/common/kiface_i.cpp b/common/kiface_i.cpp index 92d71edda7..fdafa4eeb2 100644 --- a/common/kiface_i.cpp +++ b/common/kiface_i.cpp @@ -80,7 +80,9 @@ static void setSearchPaths( SEARCH_STACK* aDst, KIWAY::FACE_T aId ) aDst->AddPaths( fn.GetPath() ); } +#ifndef __WXMAC__ aDst->AddPaths( wxT( "/usr/local/share" ) ); +#endif #if 1 && defined(DEBUG) aDst->Show( "kiface" ); diff --git a/common/kiway.cpp b/common/kiway.cpp index 9562945030..770e074c20 100644 --- a/common/kiway.cpp +++ b/common/kiway.cpp @@ -114,6 +114,11 @@ const wxString KIWAY::dso_full_path( FACE_T aFaceId ) } wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); +#ifdef __WXMAC__ + // we have the dso's in @executable_path/../Plugins in OSX bundle + fn.RemoveLastDir(); + fn.AppendDir( wxT( "Plugins" ) ); +#endif fn.SetName( name ); diff --git a/common/systemdirsappend.cpp b/common/systemdirsappend.cpp index 0aefd88502..fe254df670 100644 --- a/common/systemdirsappend.cpp +++ b/common/systemdirsappend.cpp @@ -26,10 +26,12 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) // Otherwise don't set it. maybe.AddPaths( wxGetenv( wxT( "KICAD" ) ) ); +#ifndef __WXMAC__ // This is from CMAKE_INSTALL_PREFIX. // Useful when KiCad is installed by `make install`. // Use as second ranked place. maybe.AddPaths( wxT( DEFAULT_INSTALL_PATH ) ); +#endif // Add the directory for the user-dependent, program specific, data files: // Unix: ~/.appname @@ -37,6 +39,17 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) // Mac: ~/Library/Application Support/appname maybe.AddPaths( wxStandardPaths::Get().GetUserDataDir() ); +#ifdef __WXMAC__ + // global machine specific application data + maybe.AddPaths( wxT( "/Library/Application Support/kicad" ) ); + + // Dir of the global (not user-specific), application specific, data files. + // From wx docs: + // Unix: prefix/share/appname + // Windows: the directory where the executable file is located + // Mac: appname.app/Contents/SharedSupport bundle subdirectory + maybe.AddPaths( wxStandardPaths::Get().GetDataDir() ); +#else { // Should be full path to this program executable. wxString bin_dir = Pgm().GetExecutablePath(); @@ -77,12 +90,10 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) */ #if defined(__MINGW32__) maybe.AddPaths( wxGetenv( wxT( "PROGRAMFILES" ) ) ); -#elif __WXMAC__ - maybe.AddPaths( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) ); - maybe.AddPaths( wxT( "/Library/Application Support" ) ); #else maybe.AddPaths( wxGetenv( wxT( "PATH" ) ) ); #endif +#endif #if defined(DEBUG) && 0 maybe.Show( "maybe wish list" ); @@ -96,6 +107,7 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) { wxFileName fn( maybe[i], wxEmptyString ); +#ifndef __WXMAC__ if( fn.GetPath().AfterLast( fn.GetPathSeparator() ) == wxT( "bin" ) ) { fn.RemoveLastDir(); @@ -103,9 +115,11 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) if( !fn.GetDirCount() ) continue; // at least on linux } +#endif aSearchStack->AddPaths( fn.GetPath() ); +#ifndef __WXMAC__ fn.AppendDir( wxT( "kicad" ) ); aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/kicad @@ -120,6 +134,7 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) fn.AppendDir( wxT( "kicad" ) ); aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/share/kicad +#endif } #if defined(DEBUG) && 0 @@ -127,4 +142,3 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) aSearchStack->Show( __func__ ); #endif } - diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index 521e21a5c8..64cca8fc36 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -53,24 +53,8 @@ if( MINGW ) endif() -if( APPLE ) - set( CVPCB_RESOURCES cvpcb.icns cvpcb_doc.icns ) - - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/cvpcb_doc.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - - set( MACOSX_BUNDLE_ICON_FILE cvpcb.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.cvpcb ) -endif() - - if( USE_KIWAY_DLLS ) - add_executable( cvpcb WIN32 MACOSX_BUNDLE + add_executable( cvpcb WIN32 ../common/single_top.cpp ../common/pgm_base.cpp ${CVPCB_RESOURCES} @@ -156,16 +140,19 @@ if( USE_KIWAY_DLLS ) add_dependencies( cvpcb cvpcb_kiface ) # these 2 binaries are a matched set, keep them together: - install( TARGETS cvpcb - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) if( APPLE ) - # puts the *.kiface into the *.app bundle while linking + # puts binaries into the *.app bundle while linking + set_target_properties( cvpcb PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) set_target_properties( cvpcb_kiface PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/cvpcb.app/Contents/MacOS/ + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) else() + install( TARGETS cvpcb + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS cvpcb_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -174,7 +161,7 @@ if( USE_KIWAY_DLLS ) else() - add_executable( cvpcb WIN32 MACOSX_BUNDLE + add_executable( cvpcb WIN32 ${CVPCB_SRCS} ${CVPCB_DIALOGS} ${CVPCB_RESOURCES} @@ -214,15 +201,15 @@ else() # Must follow github_plugin target_link_libraries( cvpcb ${Boost_LIBRARIES} ) - install( TARGETS cvpcb - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) -endif() - - -if( APPLE ) - set_target_properties( cvpcb PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist - ) + if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( cvpcb PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) + else() + install( TARGETS cvpcb + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + endif() endif() diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 5ff221eba7..4bf4035b09 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -187,22 +187,6 @@ if( MINGW ) endif() -if( APPLE ) - set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns ) - - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema_doc.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - - set( MACOSX_BUNDLE_ICON_FILE eeschema.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.eeschema ) - set( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) -endif() - - # auto-generate cmp_library_lexer.h and cmp_library_keywords.cpp for the component # library format. make_lexer( @@ -251,7 +235,7 @@ set_source_files_properties( dialogs/dialog_bom.cpp if( USE_KIWAY_DLLS ) - add_executable( eeschema WIN32 MACOSX_BUNDLE + add_executable( eeschema WIN32 ../common/single_top.cpp ../common/pgm_base.cpp ${EESCHEMA_RESOURCES} @@ -296,12 +280,6 @@ if( USE_KIWAY_DLLS ) # if building eeschema, then also build eeschema_kiface if out of date. add_dependencies( eeschema eeschema_kiface ) - if( APPLE ) - set_target_properties( eeschema PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist - ) - endif() - if( MAKE_LINK_MAPS ) # generate link map with cross reference set_target_properties( eeschema_kiface PROPERTIES @@ -313,16 +291,19 @@ if( USE_KIWAY_DLLS ) endif() # these 2 binaries are a matched set, keep them together: - install( TARGETS eeschema - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) if( APPLE ) - # puts the *.kiface into the *.app bundle while linking + # puts binaries into the *.app bundle while linking + set_target_properties( eeschema PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) set_target_properties( eeschema_kiface PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/eeschema.app/Contents/MacOS/ + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) else() + install( TARGETS eeschema + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS eeschema_kiface # actual filename subject to change at milestone C) # modular-kicad blueprint. @@ -332,7 +313,7 @@ if( USE_KIWAY_DLLS ) endif() else() - add_executable( eeschema WIN32 MACOSX_BUNDLE + add_executable( eeschema WIN32 ../common/single_top.cpp ${EESCHEMA_SRCS} ${EESCHEMA_COMMON_SRCS} @@ -353,16 +334,17 @@ else() ) if( APPLE ) + # puts binaries into the *.app bundle while linking set_target_properties( eeschema PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) + else() + install( TARGETS eeschema + DESTINATION ${KICAD_BIN} + COMPONENT binary ) endif() - install( TARGETS eeschema - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) - endif() diff --git a/eeschema/getpart.cpp b/eeschema/getpart.cpp index 15b321f283..7beaf1baef 100644 --- a/eeschema/getpart.cpp +++ b/eeschema/getpart.cpp @@ -208,6 +208,9 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC, // alias exists because its root component was found component->SetPartName( name ); + // Be sure the link to the corresponding LIB_PART is OK: + component->Resolve( Prj().SchLibs() ); + // Set the component value that can differ from component name in lib, for aliases component->GetField( VALUE )->SetText( name ); diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index a4c5c28ae5..24ddb5273e 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -79,22 +79,9 @@ if( MINGW ) mingw_resource_compiler( gerbview ) endif() - -if( APPLE ) - set( GERBVIEW_RESOURCES gerbview.icns gerbview_doc.icns ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview_doc.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set( MACOSX_BUNDLE_ICON_FILE gerbview.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.gerbview ) -endif() - if( USE_KIWAY_DLLS ) - add_executable( gerbview WIN32 MACOSX_BUNDLE + add_executable( gerbview WIN32 ../common/single_top.cpp ../common/pgm_base.cpp ${GERBVIEW_RESOURCES} @@ -147,16 +134,19 @@ if( USE_KIWAY_DLLS ) add_dependencies( gerbview gerbview_kiface ) # these 2 binaries are a matched set, keep them together - install( TARGETS gerbview - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) if( APPLE ) - # puts the *.kiface into the *.app bundle while linking + # puts binaries into the *.app bundle while linking + set_target_properties( gerbview PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) set_target_properties( gerbview_kiface PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/gerbview.app/Contents/MacOS/ + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) else() + install( TARGETS gerbview + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS gerbview_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -165,7 +155,7 @@ if( USE_KIWAY_DLLS ) else() - add_executable( gerbview WIN32 MACOSX_BUNDLE + add_executable( gerbview WIN32 gerbview.cpp ${GERBVIEW_SRCS} ${DIALOGS_SRCS} @@ -180,14 +170,16 @@ else() ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES} ) - install( TARGETS gerbview - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) + if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( gerbview PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) + else() + install( TARGETS gerbview + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + endif() endif() - -if( APPLE ) - set_target_properties( gerbview PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist) -endif() diff --git a/gerbview/printout_control.cpp b/gerbview/printout_control.cpp index 1ae5d969da..05cd9de4c4 100644 --- a/gerbview/printout_control.cpp +++ b/gerbview/printout_control.cpp @@ -23,7 +23,7 @@ */ /** - * @file printout_controller.cpp + * @file printout_control.cpp * @brief Board print handler implementation file. */ diff --git a/include/common.h b/include/common.h index 1a4e8df6fa..ad9c970d74 100644 --- a/include/common.h +++ b/include/common.h @@ -97,13 +97,14 @@ enum pseudokeys { #define PCB_CALCULATOR_EXE wxT( "pcb_calculator" ) #define PL_EDITOR_EXE wxT( "pl_editor" ) #else -#define CVPCB_EXE wxT( "cvpcb.app/Contents/MacOS/cvpcb" ) -#define PCBNEW_EXE wxT( "pcbnew.app/Contents/MacOS/pcbnew" ) -#define EESCHEMA_EXE wxT( "eeschema.app/Contents/MacOS/eeschema" ) -#define GERBVIEW_EXE wxT( "gerbview.app/Contents/MacOS/gerbview" ) -#define BITMAPCONVERTER_EXE wxT( "bitmap2component.app/Contents/MacOS/bitmap2component" ) -#define PCB_CALCULATOR_EXE wxT( "pcb_calculator.app/Contents/MacOS/pcb_calculator" ) -#define PL_EDITOR_EXE wxT( "pl_editor.app/Contents/MacOS/pl_editor" ) +// All binaries are now in kicad.app bundle +#define CVPCB_EXE wxT( "kicad.app/Contents/MacOS/cvpcb" ) +#define PCBNEW_EXE wxT( "kicad.app/Contents/MacOS/pcbnew" ) +#define EESCHEMA_EXE wxT( "kicad.app/Contents/MacOS/eeschema" ) +#define GERBVIEW_EXE wxT( "kicad.app/Contents/MacOS/gerbview" ) +#define BITMAPCONVERTER_EXE wxT( "kicad.app/Contents/MacOS/bitmap2component" ) +#define PCB_CALCULATOR_EXE wxT( "kicad.app/Contents/MacOS/pcb_calculator" ) +#define PL_EDITOR_EXE wxT( "kicad.app/Contents/MacOS/pl_editor" ) # endif #endif diff --git a/include/wxEeschemaStruct.h b/include/wxEeschemaStruct.h index ec835a1c28..2319c79f43 100644 --- a/include/wxEeschemaStruct.h +++ b/include/wxEeschemaStruct.h @@ -268,8 +268,6 @@ public: * Function LoadProjectFile * loads the KiCad project file (*.pro) settings specific to Eeschema. * - * @param aFileName The project file name to load. - * @param aForceReread Force the project file to be reread if true. * @return True if the project file was loaded correctly. */ bool LoadProjectFile(); @@ -643,18 +641,6 @@ public: */ void OnSaveProject( wxCommandEvent& aEvent ); - /** - * Function OpenProjectFiles - * loads an entire project into the schematic editor. - * - * This function loads schematic root file and it's subhierarchies, the project - * configuration, and the component libraries which are not already loaded. - * - * @param aFileSet is a list of one file, the top level schematic. - * - * @return bool - true if the project loaded properly, else false. - */ - //bool LoadOneEEProject( const wxString& aFileName, bool aIsNew ); bool OpenProjectFiles( const std::vector& aFileSet, int aCtl = 0 ); // virtual from KIWAY_PLAYER /** @@ -674,7 +660,7 @@ public: * @param aFullFileName A reference to a wxString object containing the absolute path * and file name to load. * @param append True if loaded file is being appended to the currently open file instead - * of replacing it. + * of replacing it. * @return True if \a aFullFileName has been loaded (at least partially.) */ bool LoadOneEEFile( SCH_SCREEN* aScreen, const wxString& aFullFileName, bool append = false ); @@ -705,8 +691,8 @@ public: * @param aForceVisibilityState = Set to true to change the footprint field visibility * state to \a aVisibilityState. False retains the * current footprint field visibility state. - * @param aVisiblityState True to show the footprint field or false to hide the footprint - * field if \a aForceVisibilityState is true. + * @param aVisibilityState True to show the footprint field or false to hide the footprint + * field if \a aForceVisibilityState is true. * @return bool = true if success. */ bool ProcessCmpToFootprintLinkFile( const wxString& aFullFilename, @@ -1004,16 +990,20 @@ private: * if libname != "", search in lib "libname" * else search in all loaded libs * + * @param aDC is the device context to draw upon. + * @param aLibName is the library name to load the component from. * @param aHistoryList list remembering recently used component names. * @param aHistoryLastUnit remembering last unit in last component. + * @param aUseLibBrowser is the flag to determine if the library browser should be launched. + * @return a pointer the SCH_COMPONENT object selected or NULL if no component was selected. * (TODO(hzeller): This really should be a class doing history, but didn't * want to change too much while other refactoring is going on) */ - SCH_COMPONENT* Load_Component( wxDC* DC, - const wxString& libname, + SCH_COMPONENT* Load_Component( wxDC* aDC, + const wxString& aLibName, wxArrayString& aHistoryList, int& aHistoryLastUnit, - bool UseLibBrowser ); + bool aUseLibBrowser ); /** * Function EditComponent diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index 121c5af247..31b4875b7f 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -56,23 +56,6 @@ if( UNIX ) ) endif() - -if( APPLE ) - # In this CMakeLists.txt's build directory, create kiface symlinks should get - # "installed()" as part of the kicad.app bundle. These are pointers on the - # target which point up and over to the stand alone kicad app's *.kiface files. - foreach( symlink pcbnew eeschema cvpcb ) - add_custom_command( TARGET kicad - COMMAND ${CMAKE_COMMAND} -E remove - "${CMAKE_CURRENT_BINARY_DIR}/kicad.app/Contents/MacOS/_${symlink}.kiface" - COMMAND ${CMAKE_COMMAND} -E create_symlink - "../../../${symlink}.app/Contents/MacOS/_${symlink}.kiface" - "${CMAKE_CURRENT_BINARY_DIR}/kicad.app/Contents/MacOS/_${symlink}.kiface" - COMMENT "kicad.app ${symlink} symlink" - ) - endforeach() -endif() - if( APPLE ) set_target_properties( kicad PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist @@ -97,4 +80,47 @@ install( TARGETS kicad DESTINATION ${KICAD_BIN} COMPONENT binary ) +if( APPLE ) + # "install( CODE ... )" will launch its own CMake, so no variables from + # this CMake instance are accessible... use helper to transfer + if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) + set( SCRIPTING_HELPER "1" ) + else() + set( SCRIPTING_HELPER "0" ) + endif() + # make bundle relocatable + install( CODE " + # find all libs and modules + file( GLOB BUNDLE_FIX_LIBS ${OSX_BUNDLE_INSTALL_KIFACE_DIR}/*.kiface ) + if( ${SCRIPTING_HELPER} ) + file( GLOB PYTHON_SCRIPTING_SO ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/*.so ) + set( BUNDLE_FIX_LIBS \${BUNDLE_FIX_LIBS} \${PYTHON_SCRIPTING_SO} ) + file( GLOB PYTHON_SCRIPTING_SO ${OSX_BUNDLE_INSTALL_LIB_DIR}/${PYTHON_LIB_DIR}/wx/*.so ) + set( BUNDLE_FIX_LIBS \${BUNDLE_FIX_LIBS} \${PYTHON_SCRIPTING_SO} ) + endif() + + # override default embedded path settings + function( gp_item_default_embedded_path_override item default_embedded_path_var ) + # by default, embed things right next to the main bundle executable: + set( path \"@executable_path/../../Contents/MacOS\" ) + set( overridden 0 ) + + # embed .dylibs right next to the main bundle executable: + if( item MATCHES \"\\\\.dylib$\" ) + set( path \"@executable_path/../Frameworks\" ) + set( overridden 1 ) + endif() + + set( \${default_embedded_path_var} \"\${path}\" PARENT_SCOPE ) + endfunction(gp_item_default_embedded_path_override) + + # do all the work + include( BundleUtilities ) + fixup_bundle( ${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad + \"\${BUNDLE_FIX_LIBS}\" + \"\" + ) + " COMPONENT Runtime + ) +endif() diff --git a/kicad/Info.plist b/kicad/Info.plist index d55a08c51a..f83f69d37d 100644 --- a/kicad/Info.plist +++ b/kicad/Info.plist @@ -7,31 +7,32 @@ CFBundleTypeRole Editor CFBundleTypeIconFile kicad_doc.icns - CFBundleTypeExtensions pro - CFBundleTypeName kicad project files LSHandlerRank Owner - CFBundleDevelopmentRegion English CFBundleExecutable kicad CFBundleGetInfoString CFBundleIconFile kicad.icns CFBundleIdentifier org.kicad-eda.kicad CFBundleInfoDictionaryVersion 6.0 - CFBundleLongVersionString + CFBundleLongVersionString CFBundleName KiCad CFBundlePackageType APPL CFBundleShortVersionString CFBundleSignature ???? CFBundleVersion - CSResourcesFileMapped + CSResourcesFileMapped LSRequiresCarbon NSHumanReadableCopyright NSHighResolutionCapable True + LSEnvironment + + KIGITHUB https://github.com/kicad + diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt index 2f6a544db8..28141199c2 100644 --- a/pagelayout_editor/CMakeLists.txt +++ b/pagelayout_editor/CMakeLists.txt @@ -53,23 +53,10 @@ if( MINGW ) endif() -if( APPLE ) - set( PL_EDITOR_RESOURCES pl_editor.icns pl_editor_doc.icns ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pl_editor_doc.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set( MACOSX_BUNDLE_ICON_FILE pl_editor.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pl_editor ) -endif() - - if( USE_KIWAY_DLLS ) # a very small program launcher for pl_editor_kiface - add_executable( pl_editor WIN32 MACOSX_BUNDLE + add_executable( pl_editor WIN32 ../common/single_top.cpp ../common/pgm_base.cpp ${PL_EDITOR_RESOURCES} @@ -122,16 +109,19 @@ if( USE_KIWAY_DLLS ) add_dependencies( pl_editor pl_editor_kiface ) # these 2 binaries are a matched set, keep them together: - install( TARGETS pl_editor - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) if( APPLE ) - # puts the *.kiface into the *.app bundle while linking + # puts binaries into the *.app bundle while linking + set_target_properties( pl_editor PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) set_target_properties( pl_editor_kiface PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pl_editor.app/Contents/MacOS/ + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) else() + install( TARGETS pl_editor + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS pl_editor_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -140,7 +130,7 @@ if( USE_KIWAY_DLLS ) else() - add_executable( pl_editor WIN32 MACOSX_BUNDLE + add_executable( pl_editor WIN32 pl_editor.cpp ${PL_EDITOR_SRCS} ${DIALOGS_SRCS} @@ -155,15 +145,15 @@ else() ${wxWidgets_LIBRARIES} ${GDI_PLUS_LIBRARIES} ) - install( TARGETS pl_editor - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) -endif() - - -if( APPLE ) - set_target_properties( pl_editor PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist - ) + if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( pl_editor PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) + else() + install( TARGETS pl_editor + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + endif() endif() diff --git a/patches/wxwidgets-3.0.0_macosx_soname.patch b/patches/wxwidgets-3.0.0_macosx_soname.patch new file mode 100644 index 0000000000..854348722b --- /dev/null +++ b/patches/wxwidgets-3.0.0_macosx_soname.patch @@ -0,0 +1,44 @@ +Index: configure +=================================================================== +--- configure (revision 77757) ++++ configure (working copy) +@@ -29176,7 +29176,7 @@ + *-*-darwin* ) + install_name_tool=`which ${HOST_PREFIX}install_name_tool` + if test "$install_name_tool" -a -x "$install_name_tool"; then +- DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@" ++ DYLIB_RPATH_POSTLINK="" + cat <change-install-names + #!/bin/sh + libnames=\`cd \${1} ; ls -1 | grep '\.[0-9][0-9]*\.dylib\$'\` +@@ -29189,7 +29189,7 @@ + done + EOF + chmod +x change-install-names +- DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \${DESTDIR}\${bindir} \${libdir} \$(wx_top_builddir)/lib" ++ DYLIB_RPATH_INSTALL="" + fi + + HEADER_PAD_OPTION="-headerpad_max_install_names" +Index: configure.in +=================================================================== +--- configure.in (revision 77757) ++++ configure.in (working copy) +@@ -3772,7 +3772,7 @@ + *-*-darwin* ) + install_name_tool=`which ${HOST_PREFIX}install_name_tool` + if test "$install_name_tool" -a -x "$install_name_tool"; then +- DYLIB_RPATH_POSTLINK="${HOST_PREFIX}install_name_tool -id \$@ \$@" ++ DYLIB_RPATH_POSTLINK="" + cat <change-install-names + #!/bin/sh + libnames=\`cd \${1} ; ls -1 | grep '\.[[0-9]][[0-9]]*\.dylib\$'\` +@@ -3785,7 +3785,7 @@ + done + EOF + chmod +x change-install-names +- DYLIB_RPATH_INSTALL="\$(wx_top_builddir)/change-install-names \${DESTDIR}\${libdir} \${DESTDIR}\${bindir} \${libdir} \$(wx_top_builddir)/lib" ++ DYLIB_RPATH_INSTALL="" + fi + + dnl the HEADER_PAD_OPTION is required by some wx samples to avoid the error: diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index b602c361cf..642eb573b8 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -42,17 +42,6 @@ if( MINGW ) mingw_resource_compiler(pcb_calculator) endif() - -if( APPLE ) - set( PCB_CALCULATOR_RESOURCES pcb_calculator.icns ) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set( MACOSX_BUNDLE_ICON_FILE pcb_calculator.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcb_calculator ) - set( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) -endif() - # auto-generate pcb_calculator_datafile.h and pcb_calculator_datafile_keywords.cpp # for the storage data file format. make_lexer( @@ -69,7 +58,7 @@ make_lexer( if( USE_KIWAY_DLLS ) #if( false ) - add_executable( pcb_calculator WIN32 MACOSX_BUNDLE + add_executable( pcb_calculator WIN32 ../common/single_top.cpp ../common/pgm_base.cpp ${PCB_CALCULATOR_RESOURCES} @@ -118,16 +107,19 @@ if( USE_KIWAY_DLLS ) add_dependencies( pcb_calculator pcb_calculator_kiface ) # these 2 binaries are a matched set, keep them together - install( TARGETS pcb_calculator - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) if( APPLE ) - # puts the *.kiface into the *.app bundle while linking + # puts binaries into the *.app bundle while linking + set_target_properties( pcb_calculator PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) set_target_properties( pcb_calculator_kiface PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pcb_calculator.app/Contents/MacOS/ + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) else() + install( TARGETS pcb_calculator + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS pcb_calculator_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -136,7 +128,7 @@ if( USE_KIWAY_DLLS ) else() - add_executable( pcb_calculator WIN32 MACOSX_BUNDLE + add_executable( pcb_calculator WIN32 ../common/single_top.cpp pcb_calculator.cpp ${PCB_CALCULATOR_SRCS} @@ -154,16 +146,16 @@ else() polygon ${wxWidgets_LIBRARIES} ) - install( TARGETS pcb_calculator - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) + if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( pcb_calculator PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) + else() + install( TARGETS pcb_calculator + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + endif() endif() - - -if( APPLE ) - set_target_properties( pcb_calculator PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist - ) -endif() diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 0d633d0fe4..1a6180ae55 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -417,8 +417,9 @@ if( KICAD_SCRIPTING_MODULES ) if( ${OPENMP_FOUND} ) set_property( TARGET _pcbnew APPEND_STRING - PROPERTY LINK_FLAGS " ${OpenMP_CXX_FLAGS}" ) - endif() + PROPERTY LINK_FLAGS " ${OpenMP_CXX_FLAGS}" + ) + endif() endif() @@ -472,19 +473,6 @@ if( MINGW ) mingw_resource_compiler( pcbnew ) endif() -if( APPLE ) - set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew_doc.icns" PROPERTIES - MACOSX_PACKAGE_LOCATION Resources - ) - set( MACOSX_BUNDLE_ICON_FILE pcbnew.icns ) - set( MACOSX_BUNDLE_GUI_IDENTIFIER org.kicad-eda.pcbnew ) - set( MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist ) -endif() - # Create a C++ compilable string initializer containing html text into a *.h file: add_custom_command( OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_freeroute_exchange_help_html.h @@ -525,7 +513,7 @@ if( USE_KIWAY_DLLS ) #if( false ) # a very small program launcher for pcbnew_kiface - add_executable( pcbnew WIN32 MACOSX_BUNDLE + add_executable( pcbnew WIN32 ../common/single_top.cpp ${PCBNEW_RESOURCES} ) @@ -604,16 +592,19 @@ if( USE_KIWAY_DLLS ) add_dependencies( pcbnew pcbnew_kiface ) # these 2 binaries are a matched set, keep them together: - install( TARGETS pcbnew - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) if( APPLE ) - # puts the *.kiface into the *.app bundle while linking + # puts binaries into the *.app bundle while linking + set_target_properties( pcbnew PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) set_target_properties( pcbnew_kiface PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.app/Contents/MacOS/ + LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) else() + install( TARGETS pcbnew + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS pcbnew_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -622,7 +613,7 @@ if( USE_KIWAY_DLLS ) else() # milestone A) kills this off: - add_executable( pcbnew WIN32 MACOSX_BUNDLE + add_executable( pcbnew WIN32 ../common/single_top.cpp pcbnew.cpp ${PCBNEW_SRCS} @@ -675,59 +666,38 @@ else() # milestone A) kills this off: ) endif() - install( TARGETS pcbnew - DESTINATION ${KICAD_BIN} - COMPONENT binary - ) + if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( pcbnew PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) + else() + install( TARGETS pcbnew + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) + endif() endif() add_dependencies( pcbnew lib-dependencies ) -if( APPLE ) - set_target_properties( pcbnew PROPERTIES - MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/Info.plist - ) -endif() if( KICAD_SCRIPTING ) - add_custom_target( FixSwigImportsScripting ALL - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripting/build_tools/fix_swig_imports.py ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py - DEPENDS pcbnew - COMMENT "Fixing swig_import_helper in Kicad scripting" - ) - - install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} ) - - if( APPLE ) - # copies all into PYTHON_DEST then all into the bundle ! - add_custom_target( _pcbnew_py_copy ALL - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py "${PYTHON_DEST}/wx-3.0-osx_cocoa/" - DEPENDS FixSwigImportsScripting - COMMENT "Copying pcbnew.py into PYTHON_DEST/wx-3.0-osx_cocoa/" + if( NOT APPLE ) + install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} ) + else() + # put into bundle at build time, it is relocated at install + add_custom_target( ScriptingPcbnewPyCopy ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py" "${PYTHON_DEST}" + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/pcbnew.py + COMMENT "Copying pcbnew.py into ${PYTHON_DEST}" ) - - add_custom_target( pcbnew_copy_wxpython_scripting ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${CMAKE_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/ - DEPENDS FixSwigImportsScripting _pcbnew_py_copy - COMMENT "Copying wxPython into pcbnew.app Framework" + # scripting plugins + install( DIRECTORY ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins/ + DESTINATION ${KICAD_DATA}/scripting/plugins + COMPONENT binary ) - - add_custom_target( pcbnew_copy_plugins ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/pcbnew/scripting/plugins ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/PlugIns/scripting/plugins - DEPENDS pcbnew_copy_wxpython_scripting - COMMENT "Copying plugins into bundle" - ) - - # fix bundle after copying wxpython, fixing and copying - add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_scripting ) - - if ( KICAD_SCRIPTING_MODULES ) - #they do more or less the same job, avoid race between them - #Cmake copy goes in error otherwise - add_dependencies( pcbnew_copy_wxpython_scripting pcbnew_copy_wxpython_module ) - endif() - endif() endif() @@ -738,33 +708,43 @@ if( KICAD_SCRIPTING_MODULES ) COMMENT "Fixing swig_import_helper in Kicad scripting modules" ) - install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} ) + if( NOT APPLE ) + install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} ) + else() + # put everything into bundle at build time, it is relocated at install + add_custom_target( ScriptingModulesPcbnewPyCopy ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py" "${PYTHON_DEST}" + DEPENDS FixSwigImportsModuleScripting + COMMENT "Copying pcbnew.py into ${PYTHON_DEST}" + ) + endif() if( MINGW ) install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} ) + elseif( APPLE ) + # put everything into bundle at build time, it is relocated at install + add_custom_target( ScriptingModulesPcbnewSoCopy ALL + COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so" "${PYTHON_DEST}" + DEPENDS _pcbnew + COMMENT "Copying _pcbnew.so into ${PYTHON_DEST}" + ) else() install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so DESTINATION ${PYTHON_DEST} ) endif() +endif() - if( APPLE ) - # copies needed files into PYTHON_DEST then copy all into the bundle ! - add_custom_target( _pcbnew_so_copy ALL - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.so "${PYTHON_DEST}" - DEPENDS _pcbnew FixSwigImportsModuleScripting - COMMENT "Copying _pcbnew.so into PYTHON_DEST" - ) - - add_custom_target( pcbnew_copy_wxpython_module ALL - COMMAND ${CMAKE_COMMAND} -E copy_directory ${LIBWXPYTHON_ROOT}/wxPython/ ${PROJECT_SOURCE_DIR}/pcbnew/pcbnew.app/Contents/Frameworks/wxPython/ - DEPENDS FixSwigImportsModuleScripting _pcbnew_so_copy - COMMENT "Copying wxPython into pcbnew.app Frameworks" - ) - - if( KICAD_BUILD_DYNAMIC ) - # Tell that we have to run osx_fix_bundles fix after building _pcbnew and migrating wxPython - add_dependencies( osx_fix_bundles pcbnew_copy_wxpython_module ) - add_dependencies( osx_fix_bundles _pcbnew ) +if( APPLE ) + if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES ) + # find wx-X.Y-osx_cocoa path below PYTHON_SITE_PACKAGE_PATH + file( GLOB WXPYTHON_PATH ${PYTHON_SITE_PACKAGE_PATH}/wx-?.?-osx_cocoa ) + if( NOT WXPYTHON_PATH ) + message( FATAL_ERROR "Could not find 'wx-?.?-osx_cocoa' in '${PYTHON_SITE_PACKAGE_PATH}'" ) endif() + # copy contents + add_custom_target( ScriptingWxpythonCopy ALL + COMMAND ${CMAKE_COMMAND} -E copy_directory "${WXPYTHON_PATH}" "${PYTHON_DEST}" + COMMENT "Copying wxPython into ${PYTHON_DEST}" + ) endif() endif() @@ -781,4 +761,3 @@ if( false ) # haven't been used in years. ) target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} ) endif() - diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp index 0b76c64d7e..2d20b688eb 100644 --- a/pcbnew/autorouter/auto_place_footprints.cpp +++ b/pcbnew/autorouter/auto_place_footprints.cpp @@ -1,5 +1,5 @@ /** - * @file autoplac.cpp + * @file auto_place_footprints.cpp * @brief Functions to automatically place Footprints on a board. */ diff --git a/pcbnew/autorouter/move_and_route_event_functions.cpp b/pcbnew/autorouter/move_and_route_event_functions.cpp index 8fb6ffcf56..f2396035ea 100644 --- a/pcbnew/autorouter/move_and_route_event_functions.cpp +++ b/pcbnew/autorouter/move_and_route_event_functions.cpp @@ -26,7 +26,7 @@ */ /** - * @file automove.cpp + * @file move_and_route_event_functions.cpp * @brief Routines for automatic displacement and rotation of modules. */ diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index 201de6ff6d..b8db13989a 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.cpp @@ -663,6 +663,7 @@ void BOARD::Add( BOARD_ITEM* aBoardItem, int aControl ) TRACK* insertAid; insertAid = ( (TRACK*) aBoardItem )->GetBestInsertPoint( this ); m_Track.Insert( (TRACK*) aBoardItem, insertAid ); + aBoardItem->SetParent( this ); break; case PCB_ZONE_T: diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h index 9345b7ce4c..27b87ab889 100644 --- a/pcbnew/class_module.h +++ b/pcbnew/class_module.h @@ -382,7 +382,7 @@ public: * Function GetValue * @return const wxString& - the value text. */ - const wxString& GetValue() + const wxString& GetValue() const { return m_Value->GetText(); } diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 957b25f321..8eb13c4843 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -492,3 +492,64 @@ void TEXTE_MODULE::ViewGetLayers( int aLayers[], int& aCount ) const aCount = 1; } +/** + * Macro-expansion for text in library modules + */ +wxString TEXTE_MODULE::GetShownText() const +{ + /* First order optimization: no % means that no processing is + * needed; just hope that RVO and copy constructor implementation + * avoid to copy the whole block; anyway it should be better than + * rebuild the string one character at a time... + * Also it seems wise to only expand macros in user text (but there + * is no technical reason, probably) */ + + if( (m_Type != TEXT_is_DIVERS) || (wxString::npos == m_Text.find('%')) ) + return m_Text; + wxString newbuf; + + + const MODULE *module = static_cast( GetParent() ); + + for( wxString::const_iterator it = m_Text.begin(); + it != m_Text.end(); ++it ) + { + // Process '%' and copy everything else + if( *it != '%' ) + newbuf.append(*it); + else + { + /* Look at the next character (if is it there) and append + * its expansion */ + ++it; + if( it != m_Text.end() ) + { + switch( char(*it) ) + { + case '%': + newbuf.append( '%' ); + break; + + case 'R': + if( module ) + newbuf.append( module->GetReference() ); + break; + + case 'V': + if( module ) + newbuf.append( module->GetValue() ); + break; + + default: + newbuf.append( '?' ); + break; + } + } + else + break; // The string is over and we can't ++ anymore + } + } + return newbuf; +} + + diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 6fb6e10af0..4ade64b213 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -173,6 +173,8 @@ public: EDA_ITEM* Clone() const; + virtual wxString GetShownText() const; + /// @copydoc VIEW_ITEM::ViewBBox() virtual const BOX2I ViewBBox() const; diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp index 104dd19e72..8401e99282 100644 --- a/pcbnew/class_zone.cpp +++ b/pcbnew/class_zone.cpp @@ -804,7 +804,8 @@ void ZONE_CONTAINER::Copy( ZONE_CONTAINER* src ) SetTimeStamp( src->m_TimeStamp ); m_Poly->RemoveAllContours(); m_Poly->Copy( src->m_Poly ); // copy outlines - m_CornerSelection = -1; // For corner moving, corner index to drag, or -1 if no selection + m_CornerSelection = -1; // For corner moving, corner index to drag, + // or -1 if no selection m_ZoneClearance = src->m_ZoneClearance; // clearance value m_ZoneMinThickness = src->m_ZoneMinThickness; m_FillMode = src->m_FillMode; // Filling mode (segments/polygons) diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp index ed8c8412b0..35516e1cb6 100644 --- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp +++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp @@ -1,5 +1,5 @@ /** - * @file zones_non_copper_type_functions.cpp + * @file dialog_non_copper_zones_properties.cpp */ /* * This program source code file is part of KiCad, a free EDA CAD application. diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 7d4676f4da..bf33ae1142 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -1233,8 +1233,8 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule ) textm = &aModule->Value(); break; - case TEXTE_MODULE::TEXT_is_DIVERS: - // text is a drawing + // All other fields greater than 1. + default: textm = new TEXTE_MODULE( aModule ); aModule->GraphicalItems().PushBack( textm ); } diff --git a/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt b/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt index 84d7a27b2d..11e60de223 100644 --- a/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt +++ b/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt @@ -29,5 +29,4 @@ set( PCAD2PCBNEW_SRCS ) add_library( pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS} ) -add_dependencies( pcad2kicadpcb lib-dependencies ) - +add_dependencies( pcad2kicadpcb pcbcommon ) diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 9c68633ef8..8eda1ac809 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -217,7 +217,7 @@ static bool scriptingSetup() { wxString path_frag; - #ifdef __MINGW32__ +#ifdef __MINGW32__ // force python environment under Windows: const wxString python_us( "python27_us" ); @@ -261,32 +261,36 @@ static bool scriptingSetup() // [KICAD_PATH]/scripting/plugins // Add this default search path: path_frag = Pgm().GetExecutablePath() + wxT( "scripting/plugins" ); - #else +#elif defined __WXMAC__ + // User plugin folder is ~/Library/Application Support/kicad/scripting/plugins + path_frag = wxStandardPaths::Get().GetUserDataDir() + wxT( "/scripting/plugins" ); + + // Add default paths to PYTHONPATH + wxString pypath; + // User scripting folder (~/Library/Application Support/kicad/scripting/plugins) + pypath = wxStandardPaths::Get().GetUserDataDir() + wxT( "/scripting/plugins" ); + // Machine scripting folder (/Library/Application Support/kicad/scripting/plugins) + pypath += wxT( ":/Library/Application Support/kicad/scripting/plugins" ); + // Bundle scripting folder (/Contents/SharedSupport/scripting/plugins) + pypath += wxT( ":" ) + wxStandardPaths::Get().GetDataDir() + wxT( "/scripting/plugins" ); + // Bundle wxPython folder (/Contents/Frameworks/python) + wxFileName fn = wxFileName( wxStandardPaths::Get().GetExecutablePath() ); + fn.RemoveLastDir(); + fn.AppendDir( wxT( "Frameworks" ) ); + fn.AppendDir( wxT( "python" ) ); + pypath += wxT( ":" ) + fn.GetPath(); + // Original content of PYTHONPATH + if( wxGetenv("PYTHONPATH") != NULL ) + { + pypath += wxT( ":" ) + wxString( wxGetenv("PYTHONPATH") ); + } + + // set $PYTHONPATH + wxSetEnv( "PYTHONPATH", pypath ); +#else // Add this default search path: path_frag = wxT( "/usr/local/kicad/bin/scripting/plugins" ); - - #ifdef __WXMAC__ - // OSX - // System Library first - // User Library then - // (TODO) Bundle package ? where to place ? Shared Support ? - path_frag = wxT( "/Library/Application Support/kicad/scripting" ); - path_frag = wxString( wxGetenv("HOME") ) + wxT( "/Library/Application Support/kicad/scripting" ); - - // Get pcbnew.app/Contents directory - wxFileName bundledir( wxStandardPaths::Get().GetExecutablePath() ) ; - bundledir.RemoveLastDir(); - - // Prepend in PYTHONPATH the content of the bundle libraries ! - wxSetEnv( "PYTHONPATH", ((wxGetenv("PYTHONPATH") != NULL ) ? (wxString(wxGetenv("PYTHONPATH")) + ":") : wxString("")) + - bundledir.GetPath() + - "/Frameworks/wxPython/lib/python2.6/site-packages/wx-3.0-osx_cocoa" + ":" + - "/Library/Application Support/kicad/" + ":" + - bundledir.GetPath() + "/PlugIns" + ":" + - wxString( wxGetenv("HOME") ) + "/Library/Application Support/kicad/" - ); - #endif - #endif +#endif // On linux and osx, 2 others paths are // [HOME]/.kicad_plugins/ diff --git a/pcbnew/scripting/board.i b/pcbnew/scripting/board.i index 095a285bc0..65d0cb1990 100644 --- a/pcbnew/scripting/board.i +++ b/pcbnew/scripting/board.i @@ -36,7 +36,6 @@ def GetDrawings(self): return self.m_Drawings def GetTracks(self): return self.m_Track def GetFullRatsnest(self): return self.m_FullRatsnest - def GetZones(self): return self.m_ZoneDescriptorList def Save(self,filename): return SaveBoard(filename,self,IO_MGR.KICAD) @@ -47,8 +46,8 @@ # def Add(self,item): - item.thisown=0 - self.AddNative(item) + item.thisown=0 + self.AddNative(item) } } @@ -75,44 +74,44 @@ %extend BOARD { - %pythoncode - { - def GetNetClasses(self): - return self.GetDesignSettings().m_NetClasses + %pythoncode + { + def GetNetClasses(self): + return self.GetDesignSettings().m_NetClasses - def GetCurrentNetClassName(self): - return self.GetDesignSettings().m_CurrentNetClassName + def GetCurrentNetClassName(self): + return self.GetDesignSettings().m_CurrentNetClassName - def GetViasDimensionsList(self): - return self.GetDesignSettings().m_ViasDimensionsList + def GetViasDimensionsList(self): + return self.GetDesignSettings().m_ViasDimensionsList - def GetTrackWidthList(self): - return self.GetDesignSettings().m_TrackWidthList - } + def GetTrackWidthList(self): + return self.GetDesignSettings().m_TrackWidthList + } } %extend DRAWSEGMENT { - %pythoncode - { - def GetShapeStr(self): - return self.ShowShape(self.GetShape()) - } + %pythoncode + { + def GetShapeStr(self): + return self.ShowShape(self.GetShape()) + } } %extend BOARD_ITEM { - %pythoncode - { - def SetPos(self,p): - self.SetPosition(p) - self.SetPos0(p) + %pythoncode + { + def SetPos(self,p): + self.SetPosition(p) + self.SetPos0(p) - def SetStartEnd(self,start,end): - self.SetStart(start) - self.SetStart0(start) - self.SetEnd(end) - self.SetEnd0(end) - } + def SetStartEnd(self,start,end): + self.SetStart(start) + self.SetStart0(start) + self.SetEnd(end) + self.SetEnd0(end) + } } diff --git a/pcbnew/scripting/board_item.i b/pcbnew/scripting/board_item.i index 07384e2e6e..42a421de04 100644 --- a/pcbnew/scripting/board_item.i +++ b/pcbnew/scripting/board_item.i @@ -32,54 +32,64 @@ %inline { - BOARD_ITEM* Cast_to_BOARD_ITEM(EDA_ITEM* base) { return dynamic_cast(base); } + BOARD_ITEM* Cast_to_BOARD_ITEM(EDA_ITEM* base) { return dynamic_cast(base); } } %extend BOARD_ITEM { - TEXTE_PCB* Cast_to_TEXTE_PCB() { return dynamic_cast(self); } - DIMENSION* Cast_to_DIMENSION() { return dynamic_cast(self); } - MODULE* Cast_to_MODULE() { return dynamic_cast(self); } - TEXTE_MODULE* Cast_to_TEXTE_MODULE() { return dynamic_cast(self); } - DRAWSEGMENT* Cast_to_DRAWSEGMENT() { return dynamic_cast(self); } - MARKER_PCB* Cast_to_MARKER_PCB() { return dynamic_cast(self); } - BOARD* Cast_to_BOARD() { return dynamic_cast(self); } - EDGE_MODULE* Cast_to_EDGE_MODULE() { return dynamic_cast(self); } - D_PAD* Cast_to_D_PAD() { return dynamic_cast(self); } - TRACK* Cast_to_TRACK() { return dynamic_cast(self); } - ZONE_CONTAINER* Cast_to_ZONE_CONTAINER() { return dynamic_cast(self);} - VIA* Cast_to_VIA() { return dynamic_cast(self); } + TEXTE_PCB* Cast_to_TEXTE_PCB() { return dynamic_cast(self); } + DIMENSION* Cast_to_DIMENSION() { return dynamic_cast(self); } + MODULE* Cast_to_MODULE() { return dynamic_cast(self); } + TEXTE_MODULE* Cast_to_TEXTE_MODULE() { return dynamic_cast(self); } + DRAWSEGMENT* Cast_to_DRAWSEGMENT() { return dynamic_cast(self); } + MARKER_PCB* Cast_to_MARKER_PCB() { return dynamic_cast(self); } + BOARD* Cast_to_BOARD() { return dynamic_cast(self); } + EDGE_MODULE* Cast_to_EDGE_MODULE() { return dynamic_cast(self); } + D_PAD* Cast_to_D_PAD() { return dynamic_cast(self); } + TRACK* Cast_to_TRACK() { return dynamic_cast(self); } + ZONE_CONTAINER* Cast_to_ZONE_CONTAINER() { return dynamic_cast(self);} + VIA* Cast_to_VIA() { return dynamic_cast(self); } - %pythoncode - { + %pythoncode + { def Cast(self): - ct = self.GetClass() + ct = self.GetClass() - if ct=="PTEXT": - return self.Cast_to_TEXTE_PCB() - elif ct=="BOARD": - return self.Cast_to_BOARD() - elif ct=="DIMENSION": - return self.Cast_to_DIMENSION() - elif ct=="DRAWSEGMENT": - return self.Cast_to_DRAWSEGMENT() - elif ct=="MGRAPHIC": - return self.Cast_to_EDGE_MODULE() - elif ct=="MODULE": - return self.Cast_to_MODULE() - elif ct=="PAD": - return self.Cast_to_D_PAD() - elif ct=="MTEXT": - return self.Cast_to_TEXTE_MODULE() - elif ct=="VIA": - return self.Cast_to_VIA() - elif ct=="TRACK": - return self.Cast_to_TRACK() - elif ct=="ZONE_CONTAINER": - return self.Cast_to_ZONE_CONTAINER() - else: - return None - } + if ct=="PTEXT": + return self.Cast_to_TEXTE_PCB() + elif ct=="BOARD": + return self.Cast_to_BOARD() + elif ct=="DIMENSION": + return self.Cast_to_DIMENSION() + elif ct=="DRAWSEGMENT": + return self.Cast_to_DRAWSEGMENT() + elif ct=="MGRAPHIC": + return self.Cast_to_EDGE_MODULE() + elif ct=="MODULE": + return self.Cast_to_MODULE() + elif ct=="PAD": + return self.Cast_to_D_PAD() + elif ct=="MTEXT": + return self.Cast_to_TEXTE_MODULE() + elif ct=="VIA": + return self.Cast_to_VIA() + elif ct=="TRACK": + return self.Cast_to_TRACK() + elif ct=="ZONE_CONTAINER": + return self.Cast_to_ZONE_CONTAINER() + else: + return None + + + def Duplicate(self): + + ct = self.GetClass() + + if ct=="BOARD": + return None + else: + return Cast_to_BOARD_ITEM(self.Clone()).Cast() + } } diff --git a/pcbnew/scripting/examples/listPcb.py b/pcbnew/scripting/examples/listPcb.py index c1904ad7a6..60ed093741 100755 --- a/pcbnew/scripting/examples/listPcb.py +++ b/pcbnew/scripting/examples/listPcb.py @@ -14,40 +14,40 @@ FromUnits = FromMM print "LISTING VIAS:" for item in pcb.GetTracks(): - if type(item) is VIA: + if type(item) is VIA: - pos = item.GetPosition() - drill = item.GetDrillValue() - width = item.GetWidth() - print " * Via: %s - %f/%f "%(ToUnits(pos),ToUnits(drill),ToUnits(width)) + pos = item.GetPosition() + drill = item.GetDrillValue() + width = item.GetWidth() + print " * Via: %s - %f/%f "%(ToUnits(pos),ToUnits(drill),ToUnits(width)) - elif type(item) is TRACK: + elif type(item) is TRACK: - start = item.GetStart() - end = item.GetEnd() - width = item.GetWidth() + start = item.GetStart() + end = item.GetEnd() + width = item.GetWidth() - print " * Track: %s to %s, width %f" % (ToUnits(start),ToUnits(end),ToUnits(width)) + print " * Track: %s to %s, width %f" % (ToUnits(start),ToUnits(end),ToUnits(width)) - else: - print "Unknown type %s" % type(item) + else: + print "Unknown type %s" % type(item) print "" print "LIST DRAWINGS:" for item in pcb.GetDrawings(): - if type(item) is TEXTE_PCB: - print "* Text: '%s' at %s"%(item.GetText(), item.GetPosition()) - elif type(item) is DRAWSEGMENT: - print "* Drawing: %s"%item.GetShapeStr() # dir(item) - else: - print type(item) + if type(item) is TEXTE_PCB: + print "* Text: '%s' at %s"%(item.GetText(), item.GetPosition()) + elif type(item) is DRAWSEGMENT: + print "* Drawing: %s"%item.GetShapeStr() # dir(item) + else: + print type(item) print "" print "LIST MODULES:" for module in pcb.GetModules(): - print "* Module: %s at %s"%(module.GetReference(),ToUnits(module.GetPosition())) + print "* Module: %s at %s"%(module.GetReference(),ToUnits(module.GetPosition())) print "" print "Ratsnest cnt:",len(pcb.GetFullRatsnest()) @@ -55,12 +55,12 @@ print "track w cnt:",len(pcb.GetTrackWidthList()) print "via s cnt:",len(pcb.GetViasDimensionsList()) print "" -print "LIST ZONES:" +print "LIST ZONES:", pcb.GetAreaCount() for idx in range(0, pcb.GetAreaCount()): zone=pcb.GetArea(idx) print "zone:", idx, "priority:", zone.GetPriority(), "netname", zone.GetNetname() print "" -print "NetClasses:", pcb.GetNetClasses().GetCount() +print "NetClasses:", pcb.GetNetClasses().GetCount(), diff --git a/pcbnew/scripting/examples/listPcbLibrary.py b/pcbnew/scripting/examples/listPcbLibrary.py index 928b3e0191..8262c17497 100755 --- a/pcbnew/scripting/examples/listPcbLibrary.py +++ b/pcbnew/scripting/examples/listPcbLibrary.py @@ -1,9 +1,12 @@ #!/usr/bin/env python from pcbnew import * + lst = FootprintEnumerate("/usr/share/kicad/modules/sockets.mod") + for name in lst: - m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name) - print name,"->",m.GetLibRef(), m.GetReference() - for p in m.Pads(): - print "\t",p.GetPadName(),p.GetPosition(),p.GetPos0(), p.GetOffset() - + m = FootprintLoad("/usr/share/kicad/modules/sockets.mod",name) + print name,"->",m.GetLibRef(), m.GetReference() + + for p in m.Pads(): + print "\t",p.GetPadName(),p.GetPosition(),p.GetPos0(), p.GetOffset() + diff --git a/pcbnew/scripting/module.i b/pcbnew/scripting/module.i index 54369486aa..95a42ccfca 100644 --- a/pcbnew/scripting/module.i +++ b/pcbnew/scripting/module.i @@ -29,81 +29,79 @@ %extend MODULE -{ +{ %pythoncode { - + #def SaveToLibrary(self,filename): # return SaveModuleToLibrary(filename,self) - + # # add function, clears the thisown to avoid python from deleting # the object in the garbage collector # - - def Add(self,item): - - itemC = item.Cast() - - if type(itemC) is D_PAD: - item.thisown=0 - self.Pads().PushBack(itemC) - elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]: - item.thisown = 0 - self.GraphicalItems().PushBack(item) + + def Add(self,item): + + itemC = item.Cast() + + if type(itemC) is D_PAD: + item.thisown=0 + self.Pads().PushBack(itemC) + elif type(itemC) in [ TEXTE_PCB, DIMENSION, TEXTE_MODULE, DRAWSEGMENT,EDGE_MODULE]: + item.thisown = 0 + self.GraphicalItems().PushBack(item) } - + } -%pythoncode +%pythoncode { - -def GetPluginForPath(lpath): + + def GetPluginForPath(lpath): return IO_MGR.PluginFind(IO_MGR.LEGACY) - -def FootprintEnumerate(lpath): + + def FootprintEnumerate(lpath): plug = GetPluginForPath(lpath) return plug.FootprintEnumerate(lpath) - -def FootprintLoad(lpath,name): + + def FootprintLoad(lpath,name): plug = GetPluginForPath(lpath) return plug.FootprintLoad(lpath,name) - -def FootprintSave(lpath,module): - plug = GetPluginForPath(lpath) + + def FootprintSave(lpath,module): + plug = GetPluginForPath(lpath) return plug.FootprintSave(lpath,module) - -def FootprintDelete(lpath,name): + + def FootprintDelete(lpath,name): plug = GetPluginForPath(lpath) plug.FootprintDelete(lpath,name) - -def FootprintLibCreate(lpath): + + def FootprintLibCreate(lpath): plug = GetPluginForPath(lpath) plug.FootprintLibCreate(lpath) - -def FootprintLibDelete(lpath): + + def FootprintLibDelete(lpath): plug = GetPluginForPath(lpath) plug.FootprintLibDelete(lpath) - -def FootprintIsWritable(lpath): + + def FootprintIsWritable(lpath): plug = GetPluginForPath(lpath) plug.FootprintLibIsWritable(lpath) - - } %{ - MODULE *PyModule_to_MODULE(PyObject *obj0) + MODULE *PyModule_to_MODULE(PyObject *obj0) { void *argp; int res1 = SWIG_ConvertPtr(obj0, &argp,SWIGTYPE_p_MODULE, 0 | 0 ); - if (!SWIG_IsOK(res1)) + if (!SWIG_IsOK(res1)) { - SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*"); + SWIG_exception_fail(SWIG_ArgError(res1), "Converting object to MODULE*"); } - + return (MODULE*)argp; - + fail: return NULL; diff --git a/pcbnew/scripting/pcbnew.i b/pcbnew/scripting/pcbnew.i index 376028711b..6c50e1b3f1 100644 --- a/pcbnew/scripting/pcbnew.i +++ b/pcbnew/scripting/pcbnew.i @@ -155,7 +155,6 @@ %include %include - %include "board.i" %include "module.i" %include "plugins.i" diff --git a/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py b/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py index 2c2cb4fdc5..c93eb8f9ef 100644 --- a/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py +++ b/pcbnew/scripting/plugins/FPC_(SMD_type)_footprintwizard.py @@ -131,15 +131,13 @@ class FPCFootprintWizard(FootprintWizardPlugin): module.Add(outline) # lower line - outline1 = EDGE_MODULE(module) - outline1.Copy(outline) #copy all settings from outline + outline1 = outline.Duplicate() #copy all settings from outline posy = pad_height/2 + linewidth/2 + margin outline1.SetStartEnd(wxPoint(xstart, posy), wxPoint( xend, posy)) module.Add(outline1) # around left mechanical pad (the outline around right pad is mirrored/y axix) - outline2 = EDGE_MODULE(module) # vertical segment - outline2.Copy(outline) + outline2 = outline.Duplicate() # vertical segment yend = pad_s0_pos.y + shl_height/2 + margin outline2.SetStartEnd(wxPoint(xstart, posy), wxPoint( xstart, yend)) module.Add(outline2) @@ -148,8 +146,7 @@ class FPCFootprintWizard(FootprintWizardPlugin): outline2_d.SetStartEnd(wxPoint(-xstart, posy), wxPoint( -xstart, yend)) module.Add(outline2_d) - outline3 = EDGE_MODULE(module) # horizontal segment below the pad - outline3.Copy(outline) + outline3 = outline.Duplicate() # horizontal segment below the pad posy = yend xend = pad_s0_pos.x - (shl_width/2 + linewidth + margin*2) outline3.SetStartEnd(wxPoint(xstart, posy), wxPoint( xend, posy)) @@ -159,37 +156,31 @@ class FPCFootprintWizard(FootprintWizardPlugin): outline3_d.SetStartEnd(wxPoint(-xstart, posy), wxPoint( -xend, yend)) module.Add(outline3_d) - outline4 = EDGE_MODULE(module) # vertical segment at left of the pad - outline4.Copy(outline) + outline4 = outline.Duplicate() # vertical segment at left of the pad xstart = xend yend = posy - (shl_height + linewidth + margin*2) outline4.SetStartEnd(wxPoint(xstart, posy), wxPoint( xend, yend)) module.Add(outline4) - outline4_d = EDGE_MODULE(module) # right pad side - outline4_d.Copy(outline4) + outline4_d = outline.Duplicate() # right pad side outline4_d.SetStartEnd(wxPoint(-xstart, posy), wxPoint( -xend, yend)) module.Add(outline4_d) - outline5 = EDGE_MODULE(module) # horizontal segment above the pad - outline5.Copy(outline) + outline5 = outline.Duplicate() # horizontal segment above the pad xstart = xend xend = - pad_pitch*0.5-offsetX posy = yend outline5.SetStartEnd(wxPoint(xstart, posy), wxPoint( xend, yend)) module.Add(outline5) - outline5_d = EDGE_MODULE(module) # right pad side - outline5_d.Copy(outline5) + outline5_d = outline.Duplicate() # right pad side outline5_d.SetStartEnd(wxPoint(-xstart, posy), wxPoint( -xend, yend)) module.Add(outline5_d) - outline6 = EDGE_MODULE(module) # vertical segment above the pad - outline6.Copy(outline) + outline6 = outline.Duplicate() # vertical segment above the pad xstart = xend yend = -pad_height/2 - linewidth/2 - margin outline6.SetStartEnd(wxPoint(xstart, posy), wxPoint( xend, yend)) module.Add(outline6) - outline6_d = EDGE_MODULE(module) # right pad side - outline6_d.Copy(outline6) + outline6_d = outline.Duplicate() # right pad side outline6_d.SetStartEnd(wxPoint(-xstart, posy), wxPoint( -xend, yend)) module.Add(outline6_d) diff --git a/pcbnew/scripting/tests/test1.py b/pcbnew/scripting/tests/test1.py index b507e33090..b1f7cffbf9 100644 --- a/pcbnew/scripting/tests/test1.py +++ b/pcbnew/scripting/tests/test1.py @@ -3,9 +3,9 @@ import pcbnew pcb = pcbnew.GetBoard() for m in pcb.GetModules(): - print m.GetPosition() - for p in m.GetPads() - print "p=>",p.GetPosition(),p.GetPadName() - print p.GetPosition() + print m.GetPosition() + for p in m.Pads(): + print "p=>",p.GetPosition(),p.GetPadName() + print p.GetPosition() diff --git a/pcbnew/scripting/tests/test2.py b/pcbnew/scripting/tests/test2.py index e14028c3dd..e925f88256 100644 --- a/pcbnew/scripting/tests/test2.py +++ b/pcbnew/scripting/tests/test2.py @@ -3,8 +3,6 @@ import pcbnew pcb = pcbnew.GetBoard() for m in pcb.GetModules(): - print m.GetReference(),"(",m.GetValue(),") at ", m.GetPosition() - for p in m.GetPads() - print " pad",p.GetPadName(), "at",p.GetPosition() - - + print m.GetReference(),"(",m.GetValue(),") at ", m.GetPosition() + for p in m.Pads(): + print " pad",p.GetPadName(), "at",p.GetPosition() diff --git a/scripting/kicad.i b/scripting/kicad.i index 59a1afcbab..c522b040e3 100644 --- a/scripting/kicad.i +++ b/scripting/kicad.i @@ -29,6 +29,7 @@ %include %include +%include /* ignore some constructors of EDA_ITEM that will make the build fail */ @@ -56,19 +57,19 @@ %{ #include - #include - #include - #include - #include - #include - #include + #include + #include + #include + #include + #include + #include - #include - #include - #include + #include + #include + #include #include - #include - #include + #include + #include %} diff --git a/scripts/osx_build_wx.sh b/scripts/osx_build_wx.sh new file mode 100644 index 0000000000..0d2a48605a --- /dev/null +++ b/scripts/osx_build_wx.sh @@ -0,0 +1,162 @@ +#!/bin/bash +# +# Small helper script for patching/compiling wxWidgets/wxPython on OSX +# +# Params +# $1 wxWidgets/wxPython source folder (relative to current dir) +# $2 Target bin folder +# $3 KiCad source folder (relative to current dir) +# $4 Make options (e.g., "-j4") + +createPaths() { + echo "*** Creating/wiping build and bin folder..." + + rm -rf wx-build + rm -rf $1 + mkdir wx-build + mkdir $1 +} + +doPatch() { + cwd=$(pwd) + cd $1 + + patchcmd="patch -p0 -RN --dry-run < $cwd/$2" + eval $patchcmd &> /dev/null + if [ $? -eq 0 ]; + then + echo "*** Patch '$2' already applied, skipping..." + else + echo "*** Applying patch '$2'..." + + patch -p0 < $cwd/$2 + if [ $? -ne 0 ]; + then + cd $cwd + exit 1 + fi + fi + + cd $cwd +} + +wxWidgets_configure() { + echo "*** Configuring wxWidgets..." + cwd=$(pwd) + cd wx-build + + ../$1/configure \ + --prefix=$cwd/$2 \ + --with-opengl \ + --enable-aui \ + --enable-utf8 \ + --enable-html \ + --enable-stl \ + --with-libjpeg=builtin \ + --with-libpng=builtin \ + --with-regex=builtin \ + --with-libtiff=builtin \ + --with-zlib=builtin \ + --with-expat=builtin \ + --without-liblzma \ + --with-macosx-version-min=10.5 \ + --enable-universal-binary=i386,x86_64 \ + CPPFLAGS="-stdlib=libstdc++" \ + LDFLAGS="-stdlib=libstdc++" \ + CC=clang \ + CXX=clang++ + if [ $? -ne 0 ]; + then + cd .. + exit 1 + fi + + cd .. +} + +wxWidgets_buildInst() { + echo "*** Building wxWidgets..." + cd wx-build + + make $1 install + if [ $? -ne 0 ]; + then + cd .. + exit 1 + fi + + cd .. +} + +wxPython_buildInst() { + cwd=$(pwd) + cd $1/wxPython + + # build params + WXPYTHON_BUILD_OPTS="WX_CONFIG=$cwd/$2/bin/wx-config \ + BUILD_BASE=$cwd/wx-build \ + UNICODE=1 \ + WXPORT=osx_cocoa" + + # build + python setup.py build_ext $WXPYTHON_BUILD_OPTS + if [ $? -ne 0 ]; + then + cd $cwd + exit 1 + fi + + # install + python setup.py install --prefix=$cwd/$2 $WXPYTHON_BUILD_OPTS + if [ $? -ne 0 ]; + then + cd $cwd + exit 1 + fi + + cd $cwd +} + + +# check parameters +if [ "$#" -lt 3 ]; +then + echo "OSX wxWidgets/wxPython build script" + echo + echo "Usage:" + echo " osx_build_wx.sh " + echo " wxWidgets/wxPython source folder" + echo " Destination folder" + echo " KiCad folder" + echo " Optional: make options for building wxWidgets (e.g., -j4)" + exit 1 +fi + +# create build paths +createPaths "$2" + +# patch wxWidgets sources +echo "*** Patching wxWidgets..." +doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx.patch" +doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_bug_15908.patch" +doPatch "$1" "$3/patches/wxwidgets-3.0.0_macosx_soname.patch" + +# configure and build wxWidgets +wxWidgets_configure "$1" "$2" +wxWidgets_buildInst "$4" + +# check if source is wxPython +if [ -d $1/wxPython ]; +then + echo "*** Source is wxPython, now building wxPython stuff..." + wxPython_buildInst "$1" "$2" +fi + +# remove build dir +echo "*** Removing build folder" +rm -rf wx-build + +# done +echo "*** Finished building!" + + diff --git a/utils/idftools/CMakeLists.txt b/utils/idftools/CMakeLists.txt index 997534ec31..5997b88629 100644 --- a/utils/idftools/CMakeLists.txt +++ b/utils/idftools/CMakeLists.txt @@ -20,6 +20,13 @@ target_link_libraries( dxf2idf lib_dxf idf3 ${wxWidgets_LIBRARIES} ) target_link_libraries( idf2vrml idf3 ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ) -install( TARGETS idfcyl idfrect dxf2idf idf2vrml - DESTINATION ${KICAD_BIN} - COMPONENT binary ) +if( APPLE ) + # puts binaries into the *.app bundle while linking + set_target_properties( idfcyl idfrect dxf2idf idf2vrml PROPERTIES + RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} + ) +else() + install( TARGETS idfcyl idfrect dxf2idf idf2vrml + DESTINATION ${KICAD_BIN} + COMPONENT binary ) +endif()