From 932c92af5592211a1090227adeeb86f9c57ab66f Mon Sep 17 00:00:00 2001 From: Marco Serantoni Date: Wed, 19 Feb 2014 22:39:21 +0100 Subject: [PATCH] [MacOSX] New reorg for building system, typos and path refines --- CMakeLists.txt | 35 ++++++++++++---------- CMakeModules/download_pcre.cmake | 6 ---- Documentation/compiling/mac-osx.txt | 4 +-- common/CMakeLists.txt | 9 ++++++ common/edaappl.cpp | 4 +-- pcbnew/CMakeLists.txt | 2 ++ pcbnew/edit.cpp | 2 +- pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt | 2 ++ pcbnew/router/CMakeLists.txt | 1 - polygon/CMakeLists.txt | 3 ++ utils/idftools/CMakeLists.txt | 4 +++ 11 files changed, 44 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87bdd4efee..e127099a1a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -343,16 +343,17 @@ add_definitions(-DWX_COMPATIBILITY) find_package( OpenGL QUIET ) check_find_package_result( OPENGL_FOUND "OpenGL" ) +# Handle target used to specify if a target needs wx-widgets or other libraries +# Always defined, empty if no libraries are to be build +add_custom_target( lib-dependencies ) if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) -add_custom_target( lib-wxpython ) + # This should be build in all cases, if swig exec is not avaiable + # will be impossible also enable SCRIPTING being for PCBNEW required immediatly + include( download_pcre ) include( download_swig ) - include( download_wxpython ) - add_dependencies( lib-wxpython pcre ) - add_dependencies( lib-wxpython swig ) - add_dependencies( lib-wxpython libwxpython ) #set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib;.dll") @@ -372,15 +373,11 @@ add_custom_target( lib-wxpython ) message(STATUS "KICAD_BUILD_DYNAMIC set") endif() - add_custom_target( lib-dependencies - DEPENDS boost cairo glew libpng pixman pkgconfig - ) - - include( download_libpng ) if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES ) message(STATUS "Scripting ENABLED") + include( download_wxpython ) set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig ) set( SWIG_INCLUDE ${SWIG_ROOT}/include ) @@ -388,7 +385,7 @@ add_custom_target( lib-wxpython ) if( NOT EXISTS ${SWIG_EXECUTABLE} ) set(KICAD_SCRIPTING CACHE OFF FORCE "Disabling KICAD_SCRIPTING") - message( STATUS "KICAD_SCRIPTING Enabled but SWIG not found, please disable and before reenabling execute: make lib-wxpython") + message( STATUS "KICAD_SCRIPTING Enabled but SWIG not found, please disable and before reenabling execute: make swig") message( FATAL_ERROR "Missing SWIG!") endif() message(STATUS "SWIG_EXECUTABLE: ${SWIG_EXECUTABLE}") @@ -401,11 +398,15 @@ add_custom_target( lib-wxpython ) set(wxWidgets_LIBRARY_DIRS ${LIBWXPYTHON_ROOT}/lib ) add_dependencies( lib-dependencies libwxpython ) + add_dependencies( lib-dependencies swig ) + else() include( download_wxwidgets ) add_dependencies( lib-dependencies libwx ) endif() + include( download_libpng ) + include( download_pkgconfig ) set( PKG_CONFIG_EXECUTABLE "${PKGCONFIG_ROOT}/bin/pkg-config" ) include( download_glew ) @@ -417,6 +418,12 @@ add_custom_target( lib-wxpython ) set( CAIRO_INCLUDE_DIR "${CAIRO_ROOT}/include/cairo" ) set( CAIRO_LIBRARY "${CAIRO_ROOT}/lib/libcairo.a" ) + add_dependencies( lib-dependencies boost ) + add_dependencies( lib-dependencies cairo ) + add_dependencies( lib-dependencies libpng ) + add_dependencies( lib-dependencies pixman ) + add_dependencies( lib-dependencies pkgconfig ) + if( KICAD_BUILD_DYNAMIC AND APPLE ) add_custom_target( osx_fix_bundles ALL DEPENDS cvpcb eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor) add_custom_command(TARGET osx_fix_bundles POST_BUILD COMMAND scripts/osx_fixbundle.sh COMMENT "Migrating dylibs to bundles") @@ -623,17 +630,13 @@ if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC ) add_dependencies( pcbnew lib-dependencies ) add_dependencies( eeschema lib-dependencies ) add_dependencies( cvpcb lib-dependencies ) -add_dependencies( gal lib-dependencies ) add_dependencies( common lib-dependencies ) +add_dependencies( gal lib-dependencies ) add_dependencies( pcbcommon lib-dependencies ) add_dependencies( 3d-viewer lib-dependencies ) add_dependencies( pcad2kicadpcb lib-dependencies ) -add_dependencies( polygon lib-dependencies ) add_dependencies( pl_editor lib-dependencies ) add_dependencies( pnsrouter lib-dependencies ) - if ( BUILD_GITHUB_PLUGIN ) - add_dependencies( github_plugin lib-dependencies ) - endif() endif() if ( KICAD_BUILD_DYNAMIC ) diff --git a/CMakeModules/download_pcre.cmake b/CMakeModules/download_pcre.cmake index 540887a7a8..09f8900878 100644 --- a/CMakeModules/download_pcre.cmake +++ b/CMakeModules/download_pcre.cmake @@ -27,8 +27,6 @@ set( PCRE_RELEASE 8.34 ) set( PCRE_MD5 eb34b2c9c727fd64940d6fd9a00995eb ) # re-calc this on every RELEASE change -# The boost headers [and static libs if built] go here, at the top of KiCad -# source tree in boost_root. set( PCRE_ROOT "${PROJECT_SOURCE_DIR}/pcre_root" ) #-------------------------------------------------------------------- @@ -45,10 +43,6 @@ if (APPLE) endif( CMAKE_OSX_ARCHITECTURES ) endif(APPLE) -# There is a Bazaar 'boost scratch repo' in /boost and after committing pristine -# download, the patch is applied. This lets you regenerate a new patch at any time -# easily, simply by editing the working tree in and doing "bzr diff" in there. - ExternalProject_Add( pcre PREFIX "${PREFIX}" DOWNLOAD_DIR "${DOWNLOAD_DIR}" diff --git a/Documentation/compiling/mac-osx.txt b/Documentation/compiling/mac-osx.txt index cb24f9632d..5e1e0a1934 100644 --- a/Documentation/compiling/mac-osx.txt +++ b/Documentation/compiling/mac-osx.txt @@ -37,11 +37,11 @@ Building Kicad with support for Scripting then issue for example cmake -DKICAD_BUILD_DYNAMIC=ON . - make lib-wxpython + make swig After successfully building you can set your KICAD_SCRIPTING* options (for example): - cmake -DKICAD_SCRIPTING=ON -DKICAD_SCRIPTING_WXPYTHON=ON . + 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 diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index e69e9ecae7..01455b7df0 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -57,6 +57,10 @@ set( GAL_SRCS add_library( gal STATIC ${GAL_SRCS} ) add_dependencies( gal shader_headers ) +add_dependencies( gal lib-dependencies ) +add_dependencies( shader_headers lib-dependencies ) + + # Only for win32 cross compilation using MXE if( WIN32 AND MSYS ) add_definitions( -DGLEW_STATIC ) @@ -183,6 +187,7 @@ set( COMMON_SRCS add_library( common STATIC ${COMMON_SRCS} ) +add_dependencies( common lib-dependencies ) set( PCB_COMMON_SRCS base_screen.cpp @@ -249,6 +254,7 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES ) add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} ) +add_dependencies( pcbcommon lib-dependencies ) # auto-generate specctra_lexer.h and specctra_keywords.cpp make_lexer( @@ -315,3 +321,6 @@ make_lexer( # to build it, first enable #define STAND_ALONE at top of dsnlexer.cpp add_executable( dsntest EXCLUDE_FROM_ALL dsnlexer.cpp ) target_link_libraries( dsntest common ${wxWidgets_LIBRARIES} rt ) + +add_dependencies( dsntest lib-dependencies ) + diff --git a/common/edaappl.cpp b/common/edaappl.cpp index eb5b54bdd3..6ac3ba3d1e 100644 --- a/common/edaappl.cpp +++ b/common/edaappl.cpp @@ -502,8 +502,8 @@ void EDA_APP::SetDefaultSearchPaths() #ifdef __WXMSW__ tmp.AddEnvList( wxT( "PROGRAMFILES" ) ); #elif __WXMAC__ - tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) ); - tmp.Add( wxT( "/Library/Application Support" ) ); + tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support/kicad/" ) ); + tmp.Add( wxT( "/Library/Application Support/kicad/" ) ); #else tmp.AddEnvList( wxT( "PATH" ) ); #endif diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index a22c4a900c..10b014c162 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -513,6 +513,7 @@ make_lexer( add_subdirectory( pcad2kicadpcb_plugin ) if( BUILD_GITHUB_PLUGIN ) add_subdirectory( github ) + add_dependencies( github_plugin lib-dependencies ) endif() @@ -526,6 +527,7 @@ add_executable( pcbnew WIN32 MACOSX_BUNDLE ${PCBNEW_RESOURCES} ) +add_dependencies( pcbnew lib-dependencies ) ### # Set properties for APPLE on pcbnew target ### diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index ea1c320956..e2ccdd8a8f 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1077,7 +1077,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) #ifndef USE_WX_OVERLAY InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), &dc ); #else - // #1267772 - Draw into dialog converted in refresh request + // #1277772 - Draw into dialog converted in refresh request InstallGraphicItemPropertiesDialog( (DRAWSEGMENT*) GetCurItem(), NULL ); m_canvas->Refresh(); #endif diff --git a/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt b/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt index 90492ed2df..84d7a27b2d 100644 --- a/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt +++ b/pcbnew/pcad2kicadpcb_plugin/CMakeLists.txt @@ -29,3 +29,5 @@ set( PCAD2PCBNEW_SRCS ) add_library( pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS} ) +add_dependencies( pcad2kicadpcb lib-dependencies ) + diff --git a/pcbnew/router/CMakeLists.txt b/pcbnew/router/CMakeLists.txt index 1352dd2ab0..329714658b 100644 --- a/pcbnew/router/CMakeLists.txt +++ b/pcbnew/router/CMakeLists.txt @@ -48,4 +48,3 @@ set( PCBNEW_PNS_SRCS ) add_library( pnsrouter STATIC ${PCBNEW_PNS_SRCS} ) - diff --git a/polygon/CMakeLists.txt b/polygon/CMakeLists.txt index 482c3a1170..26eade92c7 100644 --- a/polygon/CMakeLists.txt +++ b/polygon/CMakeLists.txt @@ -18,3 +18,6 @@ set(POLYGON_SRCS ) add_library(polygon STATIC ${POLYGON_SRCS}) + +add_dependencies( polygon lib-dependencies ) + diff --git a/utils/idftools/CMakeLists.txt b/utils/idftools/CMakeLists.txt index edc98e46bb..a36fa45878 100644 --- a/utils/idftools/CMakeLists.txt +++ b/utils/idftools/CMakeLists.txt @@ -18,6 +18,10 @@ add_executable( dxf2idf dxf2idfmain.cpp dxf2idf.cpp "${CMAKE_SOURCE_DIR}/common/richio.cpp" ) +add_dependencies( idfcyl lib-dependencies ) +add_dependencies( idfrect lib-dependencies ) +add_dependencies( dxf2idf lib-dependencies ) + target_link_libraries( dxf2idf lib_dxf ${wxWidgets_LIBRARIES} ) install( TARGETS idfcyl idfrect dxf2idf