From ea9f960cc15d9383ac88bd7fa499f28ebda096b3 Mon Sep 17 00:00:00 2001 From: Davide Gerhard Date: Sat, 22 Jan 2022 20:35:32 +0100 Subject: [PATCH] cmake: adding KICAD_MACOSX_APP_BUNDLE option ADDED: with cmake KICAD_MACOSX_APP_BUNDLE option the user can disable the macOS app bundle creation when compiling on macOS. This permit to use/install KiCad like any other *nix platform (/usr/bin, /usr/share, ecc.). By default, cmake build the app bundle. --- 3d-viewer/3d_cache/3d_plugin_manager.cpp | 2 +- 3d-viewer/3d_cache/sg/CMakeLists.txt | 4 ++-- CMakeLists.txt | 15 ++++++++++++--- bitmap2component/CMakeLists.txt | 8 ++++++-- common/gestfich.cpp | 6 +++--- common/kiway.cpp | 4 ++-- common/paths.cpp | 12 ++++++------ common/systemdirsappend.cpp | 6 +++--- cvpcb/CMakeLists.txt | 2 +- eeschema/CMakeLists.txt | 8 ++++++-- eeschema/bom_plugins.cpp | 2 +- eeschema/dialogs/dialog_netlist.cpp | 2 +- eeschema/sim/ngspice.cpp | 2 +- gerbview/CMakeLists.txt | 8 ++++++-- kicad/CMakeLists.txt | 10 +++++++--- kicad/tools/kicad_manager_control.cpp | 2 +- pagelayout_editor/CMakeLists.txt | 10 +++++++--- pcb_calculator/CMakeLists.txt | 8 ++++++-- pcbnew/CMakeLists.txt | 16 ++++++++++------ plugins/3d/idf/CMakeLists.txt | 4 ++-- plugins/3d/oce/CMakeLists.txt | 4 ++-- plugins/3d/vrml/CMakeLists.txt | 4 ++-- scripting/CMakeLists.txt | 4 ++-- scripting/python_scripting.cpp | 2 +- translation/CMakeLists.txt | 2 +- utils/idftools/CMakeLists.txt | 2 +- utils/kicad2step/CMakeLists.txt | 2 +- 27 files changed, 94 insertions(+), 57 deletions(-) diff --git a/3d-viewer/3d_cache/3d_plugin_manager.cpp b/3d-viewer/3d_cache/3d_plugin_manager.cpp index cf9def2a29..b47e438420 100644 --- a/3d-viewer/3d_cache/3d_plugin_manager.cpp +++ b/3d-viewer/3d_cache/3d_plugin_manager.cpp @@ -124,7 +124,7 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void ) std::list< wxString > pluginlist; wxFileName fn; -#ifndef __WXMAC__ +#ifndef __MACOSX_APP__ #ifdef DEBUG // set up to work from the build directory diff --git a/3d-viewer/3d_cache/sg/CMakeLists.txt b/3d-viewer/3d_cache/sg/CMakeLists.txt index 0899a1925b..13d1e6a688 100644 --- a/3d-viewer/3d_cache/sg/CMakeLists.txt +++ b/3d-viewer/3d_cache/sg/CMakeLists.txt @@ -35,7 +35,7 @@ endif( MINGW ) add_library( kicad_3dsg SHARED ${SG_FILES} ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts library into the main kicad.app bundle in build tree set_target_properties( kicad_3dsg PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_LIB_DIR}" @@ -108,4 +108,4 @@ install( TARGETS if( KICAD_WIN32_INSTALL_PDBS ) # Get the PDBs to copy over for MSVC install(FILES $ DESTINATION ${KICAD_BIN}) -endif() \ No newline at end of file +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index ec5d34025e..b577dce71a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,11 @@ if( KICAD_USE_3DCONNEXION ) endif() endif() +cmake_dependent_option( KICAD_MACOSX_APP_BUNDLE + "Create macOS Application bundle" + ON "APPLE" + OFF ) + # Global setting: exports are explicit set( CMAKE_CXX_VISIBILITY_PRESET "hidden" ) set( CMAKE_VISIBILITY_INLINES_HIDDEN ON ) @@ -187,6 +192,10 @@ if( KICAD_GAL_PROFILE ) add_definitions( -DKICAD_GAL_PROFILE ) endif() +if ( KICAD_MACOSX_APP_BUNDLE ) + add_definitions ( -D__MACOSX_APP__ ) +endif() + # Ensure DEBUG is defined for all platforms in Debug builds # change to add_compile_definitions() after minimum required CMake version is 3.12 set_property( DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS $<$:DEBUG> ) @@ -518,7 +527,7 @@ set( KIFACE_PREFIX "_" ) #================================================ # Locations for install targets. #================================================ -if( NOT APPLE ) +if( NOT KICAD_MACOSX_APP_BUNDLE ) # Everything without leading / is relative to CMAKE_INSTALL_PREFIX. set( KICAD_BIN bin CACHE PATH "Location of KiCad binaries." ) @@ -814,7 +823,7 @@ if( NOT PYTHON_SITE_PACKAGE_PATH ) endif() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set( OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR ${OSX_BUNDLE_LIB_DIR}/Python.framework/Versions/${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages) set( OSX_BUNDLE_INSTALL_PYTHON_SITE_PACKAGES_DIR "${OSX_BUNDLE_INSTALL_DIR}/${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}") set( PYTHON_DEST "${OSX_BUNDLE_BUILD_DIR}/${OSX_BUNDLE_PYTHON_SITE_PACKAGES_DIR}" @@ -907,7 +916,7 @@ if( MINGW ) endif() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # Remove app bundles in ${KICAD_BIN} before installing anything new. # Must be defined before all includes so that it is executed first. install( CODE " diff --git a/bitmap2component/CMakeLists.txt b/bitmap2component/CMakeLists.txt index 3b45e9d348..52dee70f27 100644 --- a/bitmap2component/CMakeLists.txt +++ b/bitmap2component/CMakeLists.txt @@ -35,7 +35,7 @@ if( WIN32 ) endif() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # setup bundle set( BITMAP2COMPONENT_RESOURCES bitmap2component.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/bitmap2component.icns" PROPERTIES @@ -57,7 +57,11 @@ target_link_libraries( bitmap2component potrace ) -if( APPLE ) +set_target_properties( bitmap2component PROPERTIES + MACOSX_BUNDLE $ + ) + +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( bitmap2component PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/bitmap2component/Info.plist ) diff --git a/common/gestfich.cpp b/common/gestfich.cpp index 7ad46c0a2f..cd2d727474 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -53,7 +53,7 @@ wxString FindKicadFile( const wxString& shortname ) { // Test the presence of the file in the directory shortname of // the KiCad binary path. -#ifndef __WXMAC__ +#ifndef __MACOSX_APP__ wxString fullFileName = Pgm().GetExecutablePath() + shortname; #else wxString fullFileName = Pgm().GetExecutablePath() + wxT( "Contents/MacOS/" ) + shortname; @@ -79,7 +79,7 @@ wxString FindKicadFile( const wxString& shortname ) // Path list for KiCad binary files const static wxChar* possibilities[] = { -#if defined( __WXMAC__ ) +#if defined( __MACOSX_APP__ ) // all internal paths are relative to main bundle kicad.app wxT( "Contents/Applications/pcbnew.app/Contents/MacOS/" ), wxT( "Contents/Applications/eeschema.app/Contents/MacOS/" ), @@ -97,7 +97,7 @@ wxString FindKicadFile( const wxString& shortname ) // find binary file from possibilities list: for( unsigned i=0; i // lowercase or pretty case depending on platform -#if defined( __WXMAC__ ) || defined( __WXMSW__ ) +#if defined( __MACOSX_APP__ ) || defined( __WXMSW__ ) #define KICAD_PATH_STR "KiCad" #else #define KICAD_PATH_STR "kicad" @@ -154,7 +154,7 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir ) if( aRespectRunFromBuildDir && wxGetEnv( wxT( "KICAD_RUN_FROM_BUILD_DIR" ), nullptr ) ) { // Allow debugging from build dir by placing relevant files/folders in the build root -#if defined( __WXMAC__ ) +#if defined( __MACOSX_APP__ ) wxFileName fn = wxStandardPaths::Get().GetExecutablePath(); fn.RemoveLastDir(); @@ -170,7 +170,7 @@ wxString PATHS::GetStockDataPath( bool aRespectRunFromBuildDir ) } else { -#if defined( __WXMAC__ ) +#if defined( __MACOSX_APP__ ) path = GetOSXKicadDataDir(); #elif defined( __WXMSW__ ) path = getWindowsKiCadRoot() + wxT( "share/kicad" ); @@ -187,7 +187,7 @@ wxString PATHS::GetStockEDALibraryPath() { wxString path; -#if defined( __WXMAC__ ) +#if defined( __MACOSX_APP__ ) path = GetOSXKicadMachineDataDir(); #elif defined( __WXMSW__ ) path = GetStockDataPath( false ); @@ -266,7 +266,7 @@ wxString PATHS::GetStockPlugins3DPath() fn.Assign( tfname, "" ); fn.AppendDir( wxT( "kicad" ) ); fn.AppendDir( wxT( "plugins" ) ); -#elif defined( __WXMAC__ ) +#elif defined( __MACOSX_APP__ ) fn.Assign( wxStandardPaths::Get().GetPluginsDir(), wxEmptyString ); #else fn.AssignDir( Pgm().GetExecutablePath() ); @@ -306,7 +306,7 @@ wxString PATHS::GetDocumentationPath() { wxString path; -#if defined( __WXMAC__ ) +#if defined( __MACOSX_APP__ ) path = GetOSXKicadDataDir(); #elif defined( __WXMSW__ ) path = getWindowsKiCadRoot() + "share/doc/kicad"; diff --git a/common/systemdirsappend.cpp b/common/systemdirsappend.cpp index d322fab161..8997c0268a 100644 --- a/common/systemdirsappend.cpp +++ b/common/systemdirsappend.cpp @@ -52,7 +52,7 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) // Otherwise don't set it. maybe.AddPaths( wxGetenv( wxT( "KICAD" ) ) ); -#ifdef __WXMAC__ +#ifdef __MACOSX_APP__ // Add the directory for the user-dependent, program specific data files. maybe.AddPaths( PATHS::GetOSXKicadUserDataDir() ); @@ -137,7 +137,7 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) { wxFileName fn( maybe[i], wxEmptyString ); -#ifndef __WXMAC__ +#ifndef __MACOSX_APP__ if( fn.GetPath().AfterLast( fn.GetPathSeparator() ) == wxT( "bin" ) ) { fn.RemoveLastDir(); @@ -149,7 +149,7 @@ void SystemDirsAppend( SEARCH_STACK* aSearchStack ) aSearchStack->AddPaths( fn.GetPath() ); -#ifndef __WXMAC__ +#ifndef __MACOSX_APP__ fn.AppendDir( wxT( "kicad" ) ); aSearchStack->AddPaths( fn.GetPath() ); // add maybe[i]/kicad diff --git a/cvpcb/CMakeLists.txt b/cvpcb/CMakeLists.txt index eb68a4f6a4..e81167954f 100644 --- a/cvpcb/CMakeLists.txt +++ b/cvpcb/CMakeLists.txt @@ -99,7 +99,7 @@ if( MAKE_LINK_MAPS ) endif() # these 2 binaries are a matched set, keep them together: -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts binaries into the *.app bundle while linking set_target_properties( cvpcb_kiface PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 9cb66aed5c..704e70ef4b 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -354,7 +354,7 @@ set_source_files_properties( sch_text.cpp OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sch_text_help_md.h ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # setup bundle set( EESCHEMA_RESOURCES eeschema.icns eeschema_doc.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/eeschema.icns" PROPERTIES @@ -385,6 +385,10 @@ target_link_libraries( eeschema ${wxWidgets_LIBRARIES} ) +set_target_properties( eeschema PROPERTIES + MACOSX_BUNDLE $ + ) + # the main Eeschema program, in DSO form. add_library( eeschema_kiface_objects OBJECT ${EESCHEMA_SRCS} @@ -453,7 +457,7 @@ if( MAKE_LINK_MAPS ) endif() # these 2 binaries are a matched set, keep them together: -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( eeschema PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/eeschema/Info.plist ) diff --git a/eeschema/bom_plugins.cpp b/eeschema/bom_plugins.cpp index b18c680123..9f4715f7b9 100644 --- a/eeschema/bom_plugins.cpp +++ b/eeschema/bom_plugins.cpp @@ -75,7 +75,7 @@ BOM_GENERATOR_HANDLER::BOM_GENERATOR_HANDLER( const wxString& aFile ) #else // For macOS, we want to use the Python we bundle along, rather than just PYTHON_EXECUTABLE. // For non-Windows, non-macOS, we can call out to PYTHON_EXECUTABLE. -#ifdef __APPLE__ +#ifdef __MACOSX_APP__ // python is at Contents/Frameworks/Python.framework/Versions/Current/bin/python3 // Of course, for macOS, it's not quite that simple, since the relative path diff --git a/eeschema/dialogs/dialog_netlist.cpp b/eeschema/dialogs/dialog_netlist.cpp index 7ed6153fe0..45dfa0da6a 100644 --- a/eeschema/dialogs/dialog_netlist.cpp +++ b/eeschema/dialogs/dialog_netlist.cpp @@ -673,7 +673,7 @@ void NETLIST_DIALOG_ADD_GENERATOR::OnBrowseGenerators( wxCommandEvent& event ) { wxString FullFileName, Path; -#ifndef __WXMAC__ +#ifndef __MACOSX_APP__ Path = Pgm().GetExecutablePath(); #else Path = PATHS::GetOSXKicadDataDir() + wxT( "/plugins" ); diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index 4d2c0a6f2c..7690f7f937 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -431,7 +431,7 @@ void NGSPICE::init_dll() #else const vector dllPaths = { "", "/mingw64/bin", "/mingw32/bin" }; #endif -#elif defined(__WXMAC__) +#elif defined(__MACOSX_APP__) const vector dllPaths = { PATHS::GetOSXKicadUserDataDir().ToStdString() + "/PlugIns/ngspice", PATHS::GetOSXKicadMachineDataDir().ToStdString() + "/PlugIns/ngspice", diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt index e41408813f..701ebb6e0b 100644 --- a/gerbview/CMakeLists.txt +++ b/gerbview/CMakeLists.txt @@ -89,7 +89,7 @@ if( WIN32 ) endif() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # setup bundle set( GERBVIEW_RESOURCES gerbview.icns gerbview_doc.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/gerbview.icns" PROPERTIES @@ -120,6 +120,10 @@ target_link_libraries( gerbview ${wxWidgets_LIBRARIES} ) +set_target_properties( gerbview PROPERTIES + MACOSX_BUNDLE $ + ) + if( MAKE_LINK_MAPS ) set_target_properties( gerbview PROPERTIES LINK_FLAGS "-Wl,-cref,-Map=gerbview.map" ) @@ -168,7 +172,7 @@ endif() add_dependencies( gerbview gerbview_kiface ) # these 2 binaries are a matched set, keep them together -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( gerbview PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/gerbview/Info.plist ) diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index a90c37d2ab..b24f59f8ee 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -43,7 +43,7 @@ if( WIN32 ) endif() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set( KICAD_RESOURCES kicad.icns kicad_doc.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/kicad.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources @@ -62,6 +62,10 @@ add_executable( kicad WIN32 MACOSX_BUNDLE ${KICAD_RESOURCES} ) +set_target_properties( kicad PROPERTIES + MACOSX_BUNDLE $ + ) + if( UNIX ) # for build directory: create kiface symlinks so kicad (exe) can be run in-situ add_custom_target( kiface_sym_links @@ -72,7 +76,7 @@ if( UNIX ) ) endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( kicad PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/kicad/Info.plist ) @@ -104,7 +108,7 @@ if( KICAD_WIN32_INSTALL_PDBS ) install(FILES $ DESTINATION ${KICAD_BIN}) endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # "install( CODE ... )" will launch its own CMake, so no variables from # this CMake instance are accessible... use helper to transfer set( SCRIPTING_HELPER "1" ) diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp index 0d6bdab3cc..30a1992ec8 100644 --- a/kicad/tools/kicad_manager_control.cpp +++ b/kicad/tools/kicad_manager_control.cpp @@ -799,7 +799,7 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent ) wxString msg = wxString::Format( _( "%s %s opened [pid=%ld]\n" ), execFile, param, pid ); m_frame->PrintMsg( msg ); -#ifdef __WXMAC__ +#ifdef __MACOSX_APP__ // This non-parameterized use of wxExecute is fine because execFile is not derived // from user input. wxExecute( "osascript -e 'activate application \"" + execFile + "\"'" ); diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt index b3c940aabb..1110bdbd67 100644 --- a/pagelayout_editor/CMakeLists.txt +++ b/pagelayout_editor/CMakeLists.txt @@ -62,7 +62,7 @@ if( WIN32 ) endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # setup bundle set( PL_EDITOR_RESOURCES pagelayout_editor.icns pagelayout_editor_doc.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pagelayout_editor.icns" PROPERTIES @@ -93,6 +93,10 @@ target_link_libraries( pl_editor ${wxWidgets_LIBRARIES} ) +set_target_properties( pl_editor PROPERTIES + MACOSX_BUNDLE $ + ) + if( MAKE_LINK_MAPS ) set_target_properties( pl_editor PROPERTIES LINK_FLAGS "-Wl,-cref,-Map=pl_editor.map" ) @@ -130,7 +134,7 @@ endif() add_dependencies( pl_editor pl_editor_kiface ) # these 2 binaries are a matched set, keep them together: -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( pl_editor PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/pagelayout_editor/Info.plist ) @@ -177,4 +181,4 @@ if( KICAD_WIN32_INSTALL_PDBS ) # Get the PDBs to copy over for MSVC install(FILES $ DESTINATION ${KICAD_BIN}) install(FILES $ DESTINATION ${KICAD_BIN}) -endif() \ No newline at end of file +endif() diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index 2069c9e835..2e84c0d32d 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -58,7 +58,7 @@ if( WIN32 ) endif() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # setup bundle set( PCB_CALCULATOR_RESOURCES pcb_calculator.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcb_calculator.icns" PROPERTIES @@ -84,6 +84,10 @@ target_link_libraries( pcb_calculator ${wxWidgets_LIBRARIES} ) +set_target_properties( pcb_calculator PROPERTIES + MACOSX_BUNDLE $ + ) + if( MAKE_LINK_MAPS ) set_target_properties( pcb_calculator PROPERTIES LINK_FLAGS "-Wl,-cref,-Map=pcb_calculator.map" ) @@ -119,7 +123,7 @@ endif() add_dependencies( pcb_calculator pcb_calculator_kiface ) # these 2 binaries are a matched set, keep them together -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( pcb_calculator PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/pcb_calculator/Info.plist ) diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 0e908c4bc7..24c55e0b71 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -586,7 +586,7 @@ set_source_files_properties( dialogs/panel_setup_rules.cpp OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/panel_setup_rules_help_md.h ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # setup bundle set( PCBNEW_RESOURCES pcbnew.icns pcbnew_doc.icns ) set_source_files_properties( "${CMAKE_CURRENT_SOURCE_DIR}/pcbnew.icns" PROPERTIES @@ -626,6 +626,10 @@ target_link_libraries( pcbnew ${wxWidgets_LIBRARIES} ) +set_target_properties( pcbnew PROPERTIES + MACOSX_BUNDLE $ + ) + if( PCBNEW_LINK_MAPS ) set_target_properties( pcbnew PROPERTIES LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map" ) @@ -739,7 +743,7 @@ if( WIN32 ) endif() # these 2 binaries are a matched set, keep them together: -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( pcbnew PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_BINARY_DIR}/pcbnew/Info.plist ) @@ -787,7 +791,7 @@ if( KICAD_WIN32_INSTALL_PDBS ) install(FILES $ DESTINATION ${KICAD_BIN}) endif() -if( NOT APPLE ) +if( NOT KICAD_MACOSX_APP_BUNDLE ) install( FILES ${CMAKE_BINARY_DIR}/pcbnew/pcbnew.py DESTINATION ${PYTHON_DEST} ) else() # put into bundle at build time, it is relocated at install @@ -812,7 +816,7 @@ install( DIRECTORY ${PROJECT_SOURCE_DIR}/pcbnew/python/plugins/ if( MINGW OR VCPKG_TOOLCHAIN ) install( FILES ${CMAKE_BINARY_DIR}/pcbnew/_pcbnew.pyd DESTINATION ${PYTHON_DEST} ) set( PYMOD_EXT "pyd" ) -elseif( APPLE ) +elseif( KICAD_MACOSX_APP_BUNDLE ) # 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}/" @@ -826,7 +830,7 @@ else() # only linux remains among supported platforms set( PYMOD_EXT "so" ) endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/_pcbnew.${PYMOD_EXT} DEPENDS pcbnew_kiface COMMAND ${CMAKE_COMMAND} -E copy ${OSX_BUNDLE_BUILD_KIFACE_DIR}/_pcbnew.kiface _pcbnew.${PYMOD_EXT} @@ -850,7 +854,7 @@ else() endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # If we don't have wxPython, then we must create the site-packages directory add_custom_target( ScriptingPythonDirectoryCreation ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${PYTHON_DEST}" diff --git a/plugins/3d/idf/CMakeLists.txt b/plugins/3d/idf/CMakeLists.txt index 7bcc7656dd..a417d38f88 100644 --- a/plugins/3d/idf/CMakeLists.txt +++ b/plugins/3d/idf/CMakeLists.txt @@ -29,7 +29,7 @@ target_link_libraries( s3d_plugin_idf ${OPENGL_LIBRARIES} ${wxWidgets_LIBRARIES} ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts library into the main kicad.app bundle in build tree set_target_properties( s3d_plugin_idf PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_PLUGIN_DIR}/3d" @@ -45,4 +45,4 @@ install( TARGETS if( KICAD_WIN32_INSTALL_PDBS ) # Get the PDBs to copy over for MSVC install(FILES $ DESTINATION ${KICAD_USER_PLUGIN}/3d) -endif() \ No newline at end of file +endif() diff --git a/plugins/3d/oce/CMakeLists.txt b/plugins/3d/oce/CMakeLists.txt index 074df30a67..5998fb7c15 100644 --- a/plugins/3d/oce/CMakeLists.txt +++ b/plugins/3d/oce/CMakeLists.txt @@ -23,7 +23,7 @@ target_include_directories( s3d_plugin_oce PRIVATE $ ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts library into the main kicad.app bundle in build tree set_target_properties( s3d_plugin_oce PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_PLUGIN_DIR}/3d" @@ -39,4 +39,4 @@ install( TARGETS if( KICAD_WIN32_INSTALL_PDBS ) # Get the PDBs to copy over for MSVC install(FILES $ DESTINATION ${KICAD_USER_PLUGIN}/3d) -endif() \ No newline at end of file +endif() diff --git a/plugins/3d/vrml/CMakeLists.txt b/plugins/3d/vrml/CMakeLists.txt index b651598842..ebe3a7f7c7 100644 --- a/plugins/3d/vrml/CMakeLists.txt +++ b/plugins/3d/vrml/CMakeLists.txt @@ -71,7 +71,7 @@ target_include_directories( s3d_plugin_vrml PRIVATE $ ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts library into the main kicad.app bundle in build tree set_target_properties( s3d_plugin_vrml PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${OSX_BUNDLE_BUILD_PLUGIN_DIR}/3d" @@ -87,4 +87,4 @@ install( TARGETS if( KICAD_WIN32_INSTALL_PDBS ) # Get the PDBs to copy over for MSVC install(FILES $ DESTINATION ${KICAD_USER_PLUGIN}/3d) -endif() \ No newline at end of file +endif() diff --git a/scripting/CMakeLists.txt b/scripting/CMakeLists.txt index 07e7e33d9a..851afbeaf5 100644 --- a/scripting/CMakeLists.txt +++ b/scripting/CMakeLists.txt @@ -62,7 +62,7 @@ if( MAKE_LINK_MAPS ) LINK_FLAGS "-Wl,-cref,-Map=_scripting.kiface.map" ) endif() -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) set_target_properties( scripting_kiface PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_KIFACE_DIR} ) @@ -82,4 +82,4 @@ endif() install( DIRECTORY ${PROJECT_SOURCE_DIR}/scripting/kicad_pyshell/ DESTINATION ${KICAD_DATA}/scripting/kicad_pyshell FILE_PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ -) \ No newline at end of file +) diff --git a/scripting/python_scripting.cpp b/scripting/python_scripting.cpp index e292887ff0..b2531e8891 100644 --- a/scripting/python_scripting.cpp +++ b/scripting/python_scripting.cpp @@ -154,7 +154,7 @@ bool SCRIPTING::scriptingSetup() wxSetEnv( wxT( "PATH" ), kipython ); } #endif -#elif defined( __WXMAC__ ) +#elif defined( __MACOSX_APP__ ) // Add default paths to PYTHONPATH wxString pypath; diff --git a/translation/CMakeLists.txt b/translation/CMakeLists.txt index 6a71974fb0..9dd622f018 100644 --- a/translation/CMakeLists.txt +++ b/translation/CMakeLists.txt @@ -1,7 +1,7 @@ if( UNIX AND KICAD_I18N_UNIX_STRICT_PATH ) set( KICAD_I18N_PATH ${CMAKE_INSTALL_PREFIX}/share/locale CACHE PATH "Location of KiCad i18n files." ) -elseif( APPLE ) +elseif( KICAD_MACOSX_APP_BUNDLE ) set( KICAD_I18N_PATH ${KICAD_DATA}/internat CACHE PATH "Location of KiCad i18n files." ) else() diff --git a/utils/idftools/CMakeLists.txt b/utils/idftools/CMakeLists.txt index c6dbff6dfa..2cfc6bed06 100644 --- a/utils/idftools/CMakeLists.txt +++ b/utils/idftools/CMakeLists.txt @@ -42,7 +42,7 @@ target_link_libraries( idf2vrml ${wxWidgets_LIBRARIES} ) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts binaries into the *.app bundle while linking set_target_properties( idfcyl idfrect dxf2idf idf2vrml PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR} diff --git a/utils/kicad2step/CMakeLists.txt b/utils/kicad2step/CMakeLists.txt index 2bc9c94e29..5eb4bb177b 100644 --- a/utils/kicad2step/CMakeLists.txt +++ b/utils/kicad2step/CMakeLists.txt @@ -59,7 +59,7 @@ target_include_directories( kicad2step_lib PRIVATE set_target_properties( kicad2step_bin PROPERTIES OUTPUT_NAME kicad2step) -if( APPLE ) +if( KICAD_MACOSX_APP_BUNDLE ) # puts binaries into the *.app bundle while linking set_target_properties( kicad2step_bin PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${OSX_BUNDLE_BUILD_BIN_DIR}