diff --git a/CMakeLists.txt b/CMakeLists.txt index 2ea5c8a6e8..19444f5fa9 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,38 @@ 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 ) + + # everything provided with the application bundle goes into + # kicad.app/Contents/SharedSupport => accessible via GetDataDir() + # everything else to the .dmg image + set( KICAD_DATA ${CMAKE_INSTALL_PREFIX}/kicad.app/Contents/SharedSupport + CACHE PATH "Location of KiCad data 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_TEMPLATE ${KICAD_DATA}/template + CACHE PATH "Location of KiCad template 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" ) + + # path to binaries in single app bundle + set( OSX_BUNDLE_BUILD_BIN_DIR "${CMAKE_BINARY_DIR}/kicad/kicad.app/Contents/MacOS" ) + set( OSX_BUNDLE_INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/kicad.app/Contents/MacOS" ) + + # plugins/libs to additionally relocate during fixup_bundle (e.g., *.kiface added in subfolders) + set( OSX_BUNDLE_PLUGINS "" ) +endif() + mark_as_advanced( KICAD_BIN KICAD_PLUGINS KICAD_DATA @@ -397,10 +429,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,7 +602,7 @@ 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() @@ -733,7 +765,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/Documentation/compiling/mac-osx.txt b/Documentation/compiling/mac-osx.txt index 5e1e0a1934..292ce4f3ef 100644 --- a/Documentation/compiling/mac-osx.txt +++ b/Documentation/compiling/mac-osx.txt @@ -1,63 +1,150 @@ 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 - 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 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 version installed by any package manager. +KiCad on OSX needs overlay support and some other fixes, which are not yet contained in +mainline wxWidgets sources and builds. - 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 source folder + +-- wx-build/ wxWidgets build folder + +-- wx-bin/ wxWidgets 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 +------------------- + +Get wxWidgets sources from + http://www.wxwidgets.org/downloads/ +and unpack them to the wx-src folder. +It's recommended to use the latest stable (at the time of this writing 3.0.1) version. + +Apply the patches needed for KiCad: + # cd wx-src + # 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 + +Configure: + # cd .. + # mkdir wx-build + # cd wx-build + # ../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 \ + CPPFLAGS="-stdlib=libstdc++” \ + LDFLAGS="-stdlib=libstdc++” \ + CC=clang \ + CXX=clang++ + +Build & Install: + # make + ... will take some time ... + # make install + +If everything went fine you will now have a working wxWidgets installation in the wx-bin +folder. +For building KiCad it is sufficient to keep the wx-bin folder. +The above configuration of wxWidgets is known to work, if you know what you are doing +you of course can use different settings. + + +Compiling KiCad (without scripting support) +------------------------------------------- + +Change to your working root "KiCad" and create the build folder there: + # mkdir build + +Configure KiCad: + # cd build + # 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 + +Now KiCad is configured using default features/build-switches without scripting support. +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. 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/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/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..3777db416e 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,22 @@ 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_BIN_DIR} + ) + set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_cvpcb.kiface" + PARENT_SCOPE ) else() + install( TARGETS cvpcb + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS cvpcb_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -174,7 +164,7 @@ if( USE_KIWAY_DLLS ) else() - add_executable( cvpcb WIN32 MACOSX_BUNDLE + add_executable( cvpcb WIN32 ${CVPCB_SRCS} ${CVPCB_DIALOGS} ${CVPCB_RESOURCES} @@ -214,15 +204,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..f2c201d44b 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,22 @@ 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_BIN_DIR} + ) + set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_eeschema.kiface" + PARENT_SCOPE ) 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 +316,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 +337,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/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index a4c5c28ae5..bbf2a9c566 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,22 @@ 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_BIN_DIR} + ) + set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_gerbview.kiface" + PARENT_SCOPE ) else() + install( TARGETS gerbview + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS gerbview_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -165,7 +158,7 @@ if( USE_KIWAY_DLLS ) else() - add_executable( gerbview WIN32 MACOSX_BUNDLE + add_executable( gerbview WIN32 gerbview.cpp ${GERBVIEW_SRCS} ${DIALOGS_SRCS} @@ -180,14 +173,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/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/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index 121c5af247..6924417a59 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,13 @@ install( TARGETS kicad DESTINATION ${KICAD_BIN} COMPONENT binary ) - +if( APPLE ) + install( CODE " + include(BundleUtilities) + fixup_bundle(\"${OSX_BUNDLE_INSTALL_BIN_DIR}/kicad\" + \"${OSX_BUNDLE_PLUGINS}\" + \"\" + ) + " 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..691398995e 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,22 @@ 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_BIN_DIR} + ) + set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_pl_editor.kiface" + PARENT_SCOPE ) else() + install( TARGETS pl_editor + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS pl_editor_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -140,7 +133,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 +148,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..1fca832700 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,22 @@ 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_BIN_DIR} + ) + set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_pcb_calculator.kiface" + PARENT_SCOPE ) else() + install( TARGETS pcb_calculator + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS pcb_calculator_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -136,7 +131,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 +149,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..e3919b5bac 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -472,19 +472,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 +512,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 +591,22 @@ 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_BIN_DIR} + ) + set( OSX_BUNDLE_PLUGINS ${OSX_BUNDLE_PLUGINS} "${OSX_BUNDLE_INSTALL_BIN_DIR}/_pcbnew.kiface" + PARENT_SCOPE ) else() + install( TARGETS pcbnew + DESTINATION ${KICAD_BIN} + COMPONENT binary + ) install( TARGETS pcbnew_kiface DESTINATION ${KICAD_BIN} COMPONENT binary @@ -622,7 +615,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,19 +668,21 @@ 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 ) @@ -781,4 +776,3 @@ if( false ) # haven't been used in years. ) target_link_libraries( layer_widget_test common ${wxWidgets_LIBRARIES} ) endif() - 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()