Complete Phase 1: Build KiCad with optional dependencies disabled

Add CMake override modules, stub implementations, and patches to build
KiCad without CURL, libgit2, OpenCASCADE, and ngspice dependencies.

- cmake/: Find modules that provide stub targets when deps disabled
- stubs/include/: Header stubs for curl, git2, ngspice, OCC
- stubs/src/: Implementation stubs for disabled features
- patches/: Consolidated patch for KiCad source modifications
- scripts/: Build helper scripts

Verified full native build on macOS with all optional deps disabled.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-11-26 16:33:48 +01:00
commit f1526d8c24
23 changed files with 3688 additions and 13 deletions

View file

@ -0,0 +1,205 @@
/*
* KiCad Wasm Port - Stub implementations for disabled features
*
* Provides empty/stub implementations for functions from optional
* dependencies (curl, git, ngspice, OCC) when they are disabled.
*/
#include <string>
#include <shared_mutex>
#include <wx/string.h>
#include <kicommon.h>
#include <local_history.h>
#include <kicad_curl/kicad_curl.h>
#include <git/project_git_utils.h>
// =============================================================================
// CURL stubs (when KICAD_USE_CURL=OFF)
// =============================================================================
std::string GetKicadCurlVersion()
{
return "disabled";
}
std::string GetCurlLibVersion()
{
return "disabled";
}
static std::shared_mutex s_curlMutex;
static bool s_shuttingDown = false;
void KICAD_CURL::Init()
{
// No-op when curl is disabled
}
void KICAD_CURL::Cleanup()
{
// No-op when curl is disabled
}
std::shared_mutex& KICAD_CURL::Mutex()
{
return s_curlMutex;
}
bool KICAD_CURL::IsShuttingDown()
{
return s_shuttingDown;
}
// =============================================================================
// Local History stubs (when KICAD_USE_GIT=OFF)
// =============================================================================
LOCAL_HISTORY::LOCAL_HISTORY() {}
LOCAL_HISTORY::~LOCAL_HISTORY() {}
bool LOCAL_HISTORY::Init( const wxString& aProjectPath ) { return false; }
bool LOCAL_HISTORY::CommitSnapshot( const std::vector<wxString>& aFiles, const wxString& aTitle ) { return false; }
bool LOCAL_HISTORY::CommitFullProjectSnapshot( const wxString& aProjectPath, const wxString& aTitle ) { return false; }
void LOCAL_HISTORY::RegisterSaver( const void* aSaverObject, const std::function<void(const wxString&, std::vector<wxString>&)>& aSaver ) {}
void LOCAL_HISTORY::UnregisterSaver( const void* aSaverObject ) {}
void LOCAL_HISTORY::ClearAllSavers() {}
bool LOCAL_HISTORY::RunRegisteredSaversAndCommit( const wxString& aProjectPath, const wxString& aTitle ) { return false; }
void LOCAL_HISTORY::NoteFileChange( const wxString& aFile ) {}
bool LOCAL_HISTORY::CommitPending() { return false; }
bool LOCAL_HISTORY::HistoryExists( const wxString& aProjectPath ) { return false; }
bool LOCAL_HISTORY::TagSave( const wxString& aProjectPath, const wxString& aFileType ) { return false; }
bool LOCAL_HISTORY::CommitDuplicateOfLastSave( const wxString& aProjectPath, const wxString& aFileType, const wxString& aMessage ) { return false; }
bool LOCAL_HISTORY::EnforceSizeLimit( const wxString& aProjectPath, size_t aMaxBytes ) { return false; }
bool LOCAL_HISTORY::HeadNewerThanLastSave( const wxString& aProjectPath ) { return false; }
wxString LOCAL_HISTORY::GetHeadHash( const wxString& aProjectPath ) { return wxEmptyString; }
bool LOCAL_HISTORY::RestoreCommit( const wxString& aProjectPath, const wxString& aHash, wxWindow* aParent ) { return false; }
void LOCAL_HISTORY::ShowRestoreDialog( const wxString& aProjectPath, wxWindow* aParent ) {}
// =============================================================================
// Git utils stubs (when KICAD_USE_GIT=OFF)
// =============================================================================
namespace KIGIT
{
git_repository* PROJECT_GIT_UTILS::GetRepositoryForFile( const char* aFilename )
{
return nullptr;
}
int PROJECT_GIT_UTILS::CreateBranch( git_repository* aRepo, const wxString& aBranchName )
{
return -1; // Error: git disabled
}
wxString PROJECT_GIT_UTILS::GetCurrentHash( const wxString& aProjectFile, bool aShort )
{
return wxEmptyString;
}
bool PROJECT_GIT_UTILS::RemoveVCS( git_repository*& aRepo, const wxString& aProjectPath,
bool aRemoveGitDir, wxString* aErrors )
{
return false;
}
} // namespace KIGIT
// =============================================================================
// KICAD_CURL_EASY stubs (when KICAD_USE_CURL=OFF)
// =============================================================================
// Need to define CURL_PROGRESS before including the header
struct CURL_PROGRESS
{
size_t dltotal;
size_t dlnow;
size_t ultotal;
size_t ulnow;
};
#include <kicad_curl/kicad_curl_easy.h>
KICAD_CURL_EASY::KICAD_CURL_EASY()
: m_CURL( nullptr )
, m_headers( nullptr )
, progress( std::make_unique<CURL_PROGRESS>() )
{
}
KICAD_CURL_EASY::~KICAD_CURL_EASY() {}
int KICAD_CURL_EASY::Perform() { return -1; }
bool KICAD_CURL_EASY::SetURL( const std::string& aURL )
{
(void)aURL;
return false;
}
bool KICAD_CURL_EASY::SetFollowRedirects( bool aFollow )
{
(void)aFollow;
return false;
}
void KICAD_CURL_EASY::SetHeader( const std::string& aName, const std::string& aValue )
{
(void)aName; (void)aValue;
}
bool KICAD_CURL_EASY::SetUserAgent( const std::string& aAgent )
{
(void)aAgent;
return false;
}
bool KICAD_CURL_EASY::SetPostFields( const std::vector<std::pair<std::string, std::string>>& aFields )
{
(void)aFields;
return false;
}
bool KICAD_CURL_EASY::SetPostFields( const std::string& aField )
{
(void)aField;
return false;
}
bool KICAD_CURL_EASY::SetOutputStream( const std::ostream* aOutput )
{
(void)aOutput;
return false;
}
bool KICAD_CURL_EASY::SetTransferCallback( const TRANSFER_CALLBACK& aCallback, size_t aInterval )
{
(void)aCallback; (void)aInterval;
return false;
}
int KICAD_CURL_EASY::GetTransferTotal( uint64_t& aDownloadedBytes ) const
{
aDownloadedBytes = 0;
return -1;
}
const std::string KICAD_CURL_EASY::GetErrorText( int aCode )
{
(void)aCode;
return "CURL disabled";
}
std::string KICAD_CURL_EASY::Escape( const std::string& aUrl )
{
return aUrl; // Return unescaped
}
int KICAD_CURL_EASY::GetResponseStatusCode()
{
return 0;
}
// =============================================================================
// PANEL_GIT_REPOS stub is in panel_git_repos_stub.cpp (common library)
// =============================================================================

View file

@ -0,0 +1,787 @@
/*
* KiCad Wasm Port - Comprehensive stub implementations for git-disabled builds
*
* Provides stub implementations for all git-related classes when KICAD_USE_GIT=OFF.
* These stubs allow the kicad app to link without libgit2.
*/
#include <wx/string.h>
#include <wx/window.h>
#include <wx/panel.h>
#include <wx/aui/aui.h>
#include <vector>
#include <map>
#include <set>
#include <functional>
// Include git2 stub header for types
#include <git2.h>
// Include KiCad headers for proper class declarations
#include <git/kicad_git_common.h>
#include <git/git_backend.h>
#include <git/libgit_backend.h>
#include <git/git_repo_mixin.h>
#include <git/git_status_handler.h>
#include <git/git_resolve_conflict_handler.h>
#include <git/git_remove_from_index_handler.h>
#include <git/git_add_to_index_handler.h>
#include <git/git_commit_handler.h>
#include <git/git_pull_handler.h>
#include <git/git_push_handler.h>
#include <git/git_branch_handler.h>
#include <git/git_revert_handler.h>
#include <git/git_init_handler.h>
#include <git/git_clone_handler.h>
#include <git/git_config_handler.h>
#include <git/git_sync_handler.h>
// Forward declare classes we'll stub
class KICAD_MANAGER_FRAME;
// =============================================================================
// KIGIT_COMMON stub implementations
// =============================================================================
KIGIT_COMMON::KIGIT_COMMON( git_repository* aRepo ) :
m_repo( aRepo ),
m_connType( GIT_CONN_TYPE::GIT_CONN_LOCAL ),
m_testedTypes( 0 ),
m_nextPublicKey( 0 ),
m_secretFetched( false ),
m_cancel( false )
{}
KIGIT_COMMON::KIGIT_COMMON( const KIGIT_COMMON& aOther ) :
m_repo( aOther.m_repo ),
m_connType( aOther.m_connType ),
m_remote( aOther.m_remote ),
m_hostname( aOther.m_hostname ),
m_username( aOther.m_username ),
m_password( aOther.m_password ),
m_testedTypes( aOther.m_testedTypes ),
m_publicKeys( aOther.m_publicKeys ),
m_nextPublicKey( aOther.m_nextPublicKey ),
m_secretFetched( aOther.m_secretFetched ),
m_cancel( aOther.m_cancel.load() )
{}
KIGIT_COMMON::~KIGIT_COMMON() {}
git_repository* KIGIT_COMMON::GetRepo() const { return m_repo; }
wxString KIGIT_COMMON::GetGitRootDirectory() const { return wxEmptyString; }
std::vector<wxString> KIGIT_COMMON::GetBranchNames() const { return {}; }
std::vector<wxString> KIGIT_COMMON::GetProjectDirs() { return {}; }
bool KIGIT_COMMON::HasLocalCommits() const { return false; }
bool KIGIT_COMMON::HasPushAndPullRemote() const { return false; }
std::pair<std::set<wxString>, std::set<wxString>> KIGIT_COMMON::GetDifferentFiles() const
{
return std::make_pair( std::set<wxString>(), std::set<wxString>() );
}
wxString KIGIT_COMMON::GetCurrentBranchName() const { return wxEmptyString; }
wxString KIGIT_COMMON::GetRemotename() const { return wxEmptyString; }
wxString KIGIT_COMMON::GetPassword() { return wxEmptyString; }
KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType() const { return m_connType; }
void KIGIT_COMMON::SetSSHKey( const wxString& aSSHKey ) { (void)aSSHKey; }
void KIGIT_COMMON::UpdateCurrentBranchInfo() {}
int KIGIT_COMMON::HandleSSHKeyAuthentication( git_cred** aOut, const wxString& aUsername )
{
(void)aOut; (void)aUsername;
return -1;
}
int KIGIT_COMMON::HandlePlaintextAuthentication( git_cred** aOut, const wxString& aUsername )
{
(void)aOut; (void)aUsername;
return -1;
}
int KIGIT_COMMON::HandleSSHAgentAuthentication( git_cred** aOut, const wxString& aUsername )
{
(void)aOut; (void)aUsername;
return -1;
}
void KIGIT_COMMON::updatePublicKeys() {}
void KIGIT_COMMON::updateConnectionType() {}
// =============================================================================
// GIT_STATUS_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_STATUS_HANDLER::GIT_STATUS_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_STATUS_HANDLER::~GIT_STATUS_HANDLER() {}
bool GIT_STATUS_HANDLER::HasChangedFiles() { return false; }
std::map<wxString, FileStatus> GIT_STATUS_HANDLER::GetFileStatus( const wxString& aPathspec )
{
(void)aPathspec;
return {};
}
wxString GIT_STATUS_HANDLER::GetCurrentBranchName() { return wxEmptyString; }
void GIT_STATUS_HANDLER::UpdateRemoteStatus( const std::set<wxString>& aLocalChanges,
const std::set<wxString>& aRemoteChanges,
std::map<wxString, FileStatus>& aFileStatus )
{
(void)aLocalChanges; (void)aRemoteChanges; (void)aFileStatus;
}
wxString GIT_STATUS_HANDLER::GetWorkingDirectory() { return wxEmptyString; }
KIGIT_COMMON::GIT_STATUS GIT_STATUS_HANDLER::ConvertStatus( unsigned int aGitStatus )
{
(void)aGitStatus;
return KIGIT_COMMON::GIT_STATUS::GIT_STATUS_CURRENT;
}
void GIT_STATUS_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_RESOLVE_CONFLICT_HANDLER stub implementations (no base class)
// =============================================================================
GIT_RESOLVE_CONFLICT_HANDLER::GIT_RESOLVE_CONFLICT_HANDLER( git_repository* aRepo )
: m_repository( aRepo )
{
}
GIT_RESOLVE_CONFLICT_HANDLER::~GIT_RESOLVE_CONFLICT_HANDLER() {}
bool GIT_RESOLVE_CONFLICT_HANDLER::PerformResolveConflict() { return false; }
// =============================================================================
// GIT_REMOVE_FROM_INDEX_HANDLER stub implementations (inherits from KIGIT_COMMON)
// =============================================================================
GIT_REMOVE_FROM_INDEX_HANDLER::GIT_REMOVE_FROM_INDEX_HANDLER( git_repository* aRepo )
: KIGIT_COMMON( aRepo )
{
}
GIT_REMOVE_FROM_INDEX_HANDLER::~GIT_REMOVE_FROM_INDEX_HANDLER() {}
bool GIT_REMOVE_FROM_INDEX_HANDLER::RemoveFromIndex( const wxString& aFilePath )
{
(void)aFilePath;
return false;
}
void GIT_REMOVE_FROM_INDEX_HANDLER::PerformRemoveFromIndex() {}
// =============================================================================
// GIT_ADD_TO_INDEX_HANDLER stub implementations (inherits from KIGIT_COMMON)
// =============================================================================
GIT_ADD_TO_INDEX_HANDLER::GIT_ADD_TO_INDEX_HANDLER( git_repository* aRepo )
: KIGIT_COMMON( aRepo )
{
}
GIT_ADD_TO_INDEX_HANDLER::~GIT_ADD_TO_INDEX_HANDLER() {}
bool GIT_ADD_TO_INDEX_HANDLER::AddToIndex( const wxString& aFilePath )
{
(void)aFilePath;
return false;
}
bool GIT_ADD_TO_INDEX_HANDLER::PerformAddToIndex() { return false; }
// =============================================================================
// GIT_COMMIT_HANDLER stub implementations (inherits from KIGIT_COMMON)
// =============================================================================
GIT_COMMIT_HANDLER::GIT_COMMIT_HANDLER( git_repository* aRepo )
: KIGIT_COMMON( aRepo )
{
}
GIT_COMMIT_HANDLER::~GIT_COMMIT_HANDLER() {}
CommitResult GIT_COMMIT_HANDLER::PerformCommit( const std::vector<wxString>& aFiles,
const wxString& aMessage,
const wxString& aAuthorName,
const wxString& aAuthorEmail )
{
(void)aFiles; (void)aMessage; (void)aAuthorName; (void)aAuthorEmail;
return CommitResult::Error;
}
wxString GIT_COMMIT_HANDLER::GetErrorString() const { return wxT("Git support is disabled"); }
void GIT_COMMIT_HANDLER::AddErrorString( const wxString& aErrorString )
{
(void)aErrorString;
}
// =============================================================================
// GIT_PULL_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_PULL_HANDLER::GIT_PULL_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_PULL_HANDLER::~GIT_PULL_HANDLER() {}
bool GIT_PULL_HANDLER::PerformFetch( bool aSkipLock )
{
(void)aSkipLock;
return false;
}
PullResult GIT_PULL_HANDLER::PerformPull() { return PullResult::Error; }
const std::vector<std::pair<std::string, std::vector<CommitDetails>>>& GIT_PULL_HANDLER::GetFetchResults() const
{
return m_fetchResults;
}
void GIT_PULL_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_PUSH_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_PUSH_HANDLER::GIT_PUSH_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_PUSH_HANDLER::~GIT_PUSH_HANDLER() {}
PushResult GIT_PUSH_HANDLER::PerformPush() { return PushResult::Error; }
void GIT_PUSH_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_BRANCH_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_BRANCH_HANDLER::GIT_BRANCH_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_BRANCH_HANDLER::~GIT_BRANCH_HANDLER() {}
BranchResult GIT_BRANCH_HANDLER::SwitchToBranch( const wxString& aBranchName )
{
(void)aBranchName;
return BranchResult::Error;
}
bool GIT_BRANCH_HANDLER::BranchExists( const wxString& aBranchName )
{
(void)aBranchName;
return false;
}
void GIT_BRANCH_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_REVERT_HANDLER stub implementations (no base class)
// =============================================================================
GIT_REVERT_HANDLER::GIT_REVERT_HANDLER( git_repository* aRepo )
: m_repository( aRepo )
{
}
GIT_REVERT_HANDLER::~GIT_REVERT_HANDLER() {}
bool GIT_REVERT_HANDLER::Revert( const wxString& aFilePath )
{
(void)aFilePath;
return false;
}
void GIT_REVERT_HANDLER::PerformRevert() {}
// =============================================================================
// GIT_INIT_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_INIT_HANDLER::GIT_INIT_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_INIT_HANDLER::~GIT_INIT_HANDLER() {}
bool GIT_INIT_HANDLER::IsRepository( const wxString& aPath )
{
(void)aPath;
return false;
}
InitResult GIT_INIT_HANDLER::InitializeRepository( const wxString& aPath )
{
(void)aPath;
return InitResult::Error;
}
bool GIT_INIT_HANDLER::SetupRemote( const RemoteConfig& aConfig )
{
(void)aConfig;
return false;
}
void GIT_INIT_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_CLONE_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_CLONE_HANDLER::GIT_CLONE_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_CLONE_HANDLER::~GIT_CLONE_HANDLER() {}
bool GIT_CLONE_HANDLER::PerformClone() { return false; }
void GIT_CLONE_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_CONFIG_HANDLER stub implementations (inherits from KIGIT_REPO_MIXIN)
// =============================================================================
GIT_CONFIG_HANDLER::GIT_CONFIG_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_CONFIG_HANDLER::~GIT_CONFIG_HANDLER() {}
GitUserConfig GIT_CONFIG_HANDLER::GetUserConfig()
{
return GitUserConfig();
}
wxString GIT_CONFIG_HANDLER::GetWorkingDirectory() { return wxEmptyString; }
bool GIT_CONFIG_HANDLER::GetConfigString( const wxString& aKey, wxString& aValue )
{
(void)aKey; (void)aValue;
return false;
}
void GIT_CONFIG_HANDLER::UpdateProgress( int aCurrent, int aTotal, const wxString& aMessage )
{
(void)aCurrent; (void)aTotal; (void)aMessage;
}
// =============================================================================
// GIT_SYNC_HANDLER stub implementations (no base class)
// =============================================================================
GIT_SYNC_HANDLER::GIT_SYNC_HANDLER( git_repository* aRepository )
: m_repository( aRepository )
{
}
GIT_SYNC_HANDLER::~GIT_SYNC_HANDLER() {}
bool GIT_SYNC_HANDLER::PerformSync() { return false; }
// =============================================================================
// LIBGIT_BACKEND stub implementations
// =============================================================================
void LIBGIT_BACKEND::Init() {}
void LIBGIT_BACKEND::Shutdown() {}
bool LIBGIT_BACKEND::IsLibraryAvailable() { return false; }
bool LIBGIT_BACKEND::Clone( GIT_CLONE_HANDLER* aHandler )
{
(void)aHandler;
return false;
}
CommitResult LIBGIT_BACKEND::Commit( GIT_COMMIT_HANDLER* aHandler,
const std::vector<wxString>& aFiles,
const wxString& aMessage,
const wxString& aAuthorName,
const wxString& aAuthorEmail )
{
(void)aHandler; (void)aFiles; (void)aMessage; (void)aAuthorName; (void)aAuthorEmail;
return CommitResult::Error;
}
PushResult LIBGIT_BACKEND::Push( GIT_PUSH_HANDLER* aHandler )
{
(void)aHandler;
return PushResult::Error;
}
bool LIBGIT_BACKEND::HasChangedFiles( GIT_STATUS_HANDLER* aHandler )
{
(void)aHandler;
return false;
}
std::map<wxString, FileStatus> LIBGIT_BACKEND::GetFileStatus( GIT_STATUS_HANDLER* aHandler,
const wxString& aPathspec )
{
(void)aHandler; (void)aPathspec;
return {};
}
wxString LIBGIT_BACKEND::GetCurrentBranchName( GIT_STATUS_HANDLER* aHandler )
{
(void)aHandler;
return wxEmptyString;
}
void LIBGIT_BACKEND::UpdateRemoteStatus( GIT_STATUS_HANDLER* aHandler,
const std::set<wxString>& aLocalChanges,
const std::set<wxString>& aRemoteChanges,
std::map<wxString, FileStatus>& aFileStatus )
{
(void)aHandler; (void)aLocalChanges; (void)aRemoteChanges; (void)aFileStatus;
}
wxString LIBGIT_BACKEND::GetWorkingDirectory( GIT_STATUS_HANDLER* aHandler )
{
(void)aHandler;
return wxEmptyString;
}
wxString LIBGIT_BACKEND::GetWorkingDirectory( GIT_CONFIG_HANDLER* aHandler )
{
(void)aHandler;
return wxEmptyString;
}
bool LIBGIT_BACKEND::GetConfigString( GIT_CONFIG_HANDLER* aHandler, const wxString& aKey,
wxString& aValue )
{
(void)aHandler; (void)aKey; (void)aValue;
return false;
}
bool LIBGIT_BACKEND::IsRepository( GIT_INIT_HANDLER* aHandler, const wxString& aPath )
{
(void)aHandler; (void)aPath;
return false;
}
InitResult LIBGIT_BACKEND::InitializeRepository( GIT_INIT_HANDLER* aHandler, const wxString& aPath )
{
(void)aHandler; (void)aPath;
return InitResult::Error;
}
bool LIBGIT_BACKEND::SetupRemote( GIT_INIT_HANDLER* aHandler, const RemoteConfig& aConfig )
{
(void)aHandler; (void)aConfig;
return false;
}
BranchResult LIBGIT_BACKEND::SwitchToBranch( GIT_BRANCH_HANDLER* aHandler, const wxString& aBranchName )
{
(void)aHandler; (void)aBranchName;
return BranchResult::Error;
}
bool LIBGIT_BACKEND::BranchExists( GIT_BRANCH_HANDLER* aHandler, const wxString& aBranchName )
{
(void)aHandler; (void)aBranchName;
return false;
}
bool LIBGIT_BACKEND::PerformFetch( GIT_PULL_HANDLER* aHandler, bool aSkipLock )
{
(void)aHandler; (void)aSkipLock;
return false;
}
PullResult LIBGIT_BACKEND::PerformPull( GIT_PULL_HANDLER* aHandler )
{
(void)aHandler;
return PullResult::Error;
}
void LIBGIT_BACKEND::PerformRevert( GIT_REVERT_HANDLER* aHandler )
{
(void)aHandler;
}
git_repository* LIBGIT_BACKEND::GetRepositoryForFile( const char* aFilename )
{
(void)aFilename;
return nullptr;
}
int LIBGIT_BACKEND::CreateBranch( git_repository* aRepo, const wxString& aBranchName )
{
(void)aRepo; (void)aBranchName;
return -1;
}
bool LIBGIT_BACKEND::RemoveVCS( git_repository*& aRepo, const wxString& aProjectPath,
bool aRemoveGitDir, wxString* aErrors )
{
(void)aRepo; (void)aProjectPath; (void)aRemoveGitDir; (void)aErrors;
return false;
}
bool LIBGIT_BACKEND::AddToIndex( GIT_ADD_TO_INDEX_HANDLER* aHandler, const wxString& aFilePath )
{
(void)aHandler; (void)aFilePath;
return false;
}
bool LIBGIT_BACKEND::PerformAddToIndex( GIT_ADD_TO_INDEX_HANDLER* aHandler )
{
(void)aHandler;
return false;
}
bool LIBGIT_BACKEND::RemoveFromIndex( GIT_REMOVE_FROM_INDEX_HANDLER* aHandler, const wxString& aFilePath )
{
(void)aHandler; (void)aFilePath;
return false;
}
void LIBGIT_BACKEND::PerformRemoveFromIndex( GIT_REMOVE_FROM_INDEX_HANDLER* aHandler )
{
(void)aHandler;
}
// Private methods
PullResult LIBGIT_BACKEND::handleFastForward( GIT_PULL_HANDLER* aHandler )
{
(void)aHandler;
return PullResult::Error;
}
PullResult LIBGIT_BACKEND::handleMerge( GIT_PULL_HANDLER* aHandler,
const git_annotated_commit** aMergeHeads,
size_t aMergeHeadsCount )
{
(void)aHandler; (void)aMergeHeads; (void)aMergeHeadsCount;
return PullResult::Error;
}
PullResult LIBGIT_BACKEND::handleRebase( GIT_PULL_HANDLER* aHandler,
const git_annotated_commit** aMergeHeads,
size_t aMergeHeadsCount )
{
(void)aHandler; (void)aMergeHeads; (void)aMergeHeadsCount;
return PullResult::Error;
}
// Global backend pointer
static GIT_BACKEND* s_gitBackend = nullptr;
GIT_BACKEND* GetGitBackend()
{
return s_gitBackend;
}
void SetGitBackend( GIT_BACKEND* aBackend )
{
s_gitBackend = aBackend;
}
// =============================================================================
// LOCAL_HISTORY_PANE stub - for kicad main app
// =============================================================================
class LOCAL_HISTORY_PANE : public wxPanel
{
public:
LOCAL_HISTORY_PANE( KICAD_MANAGER_FRAME* aParent );
~LOCAL_HISTORY_PANE();
void RefreshHistory( const wxString& aProjectPath );
};
LOCAL_HISTORY_PANE::LOCAL_HISTORY_PANE( KICAD_MANAGER_FRAME* aParent )
: wxPanel( reinterpret_cast<wxWindow*>(aParent), wxID_ANY )
{
}
LOCAL_HISTORY_PANE::~LOCAL_HISTORY_PANE() {}
void LOCAL_HISTORY_PANE::RefreshHistory( const wxString& aProjectPath )
{
(void)aProjectPath;
}
// =============================================================================
// Git dialog stubs
// =============================================================================
#include <dialogs/git/dialog_git_commit.h>
#include <dialogs/git/dialog_git_switch.h>
#include <dialogs/git/dialog_git_repository.h>
DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo,
const wxString& defaultAuthorName,
const wxString& defaultAuthorEmail,
const std::map<wxString, int>& filesToCommit )
: DIALOG_SHIM( parent, wxID_ANY, wxT("Git Commit (disabled)") ),
m_commitMessageTextCtrl( nullptr ),
m_authorTextCtrl( nullptr ),
m_listCtrl( nullptr ),
m_okButton( nullptr ),
m_repo( repo ),
m_defaultAuthorName( defaultAuthorName ),
m_defaultAuthorEmail( defaultAuthorEmail )
{
(void)filesToCommit;
}
wxString DIALOG_GIT_COMMIT::GetCommitMessage() const { return wxEmptyString; }
wxString DIALOG_GIT_COMMIT::GetAuthorName() const { return wxEmptyString; }
wxString DIALOG_GIT_COMMIT::GetAuthorEmail() const { return wxEmptyString; }
std::vector<wxString> DIALOG_GIT_COMMIT::GetSelectedFiles() const { return {}; }
void DIALOG_GIT_COMMIT::OnTextChanged( wxCommandEvent& event ) { (void)event; }
DIALOG_GIT_SWITCH::DIALOG_GIT_SWITCH( wxWindow* aParent, git_repository* aRepository )
: DIALOG_SHIM( aParent, wxID_ANY, wxT("Git Switch Branch (disabled)") ),
m_branchList( nullptr ),
m_branchNameText( nullptr ),
m_switchButton( nullptr ),
m_repository( aRepository ),
m_existingBranch( false )
{
}
DIALOG_GIT_SWITCH::~DIALOG_GIT_SWITCH() {}
wxString DIALOG_GIT_SWITCH::GetBranchName() const { return wxEmptyString; }
void DIALOG_GIT_SWITCH::PopulateBranchList() {}
void DIALOG_GIT_SWITCH::OnBranchListSelection( wxListEvent& event ) { (void)event; }
void DIALOG_GIT_SWITCH::OnBranchListDClick( wxListEvent& event ) { (void)event; }
void DIALOG_GIT_SWITCH::OnSwitchButton( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_SWITCH::OnCancelButton( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_SWITCH::OnTextChanged( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_SWITCH::OnTimer( wxTimerEvent& event ) { (void)event; }
void DIALOG_GIT_SWITCH::GetBranches() {}
void DIALOG_GIT_SWITCH::StartTimer() {}
void DIALOG_GIT_SWITCH::StopTimer() {}
// DIALOG_GIT_REPOSITORY inherits from DIALOG_GIT_REPOSITORY_BASE
// We need the base class first
#include <dialogs/git/dialog_git_repository_base.h>
// Base class constructor stub
DIALOG_GIT_REPOSITORY_BASE::DIALOG_GIT_REPOSITORY_BASE( wxWindow* parent, wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style )
: DIALOG_SHIM( parent, id, title, pos, size, style )
{
m_ConnType = nullptr;
m_txtName = nullptr;
m_txtURL = nullptr;
m_txtUsername = nullptr;
m_txtPassword = nullptr;
m_fpSSHKey = nullptr;
m_sdbSizerCancel = nullptr;
}
DIALOG_GIT_REPOSITORY_BASE::~DIALOG_GIT_REPOSITORY_BASE() {}
// Now the derived class
DIALOG_GIT_REPOSITORY::DIALOG_GIT_REPOSITORY( wxWindow* aParent, git_repository* aRepository,
wxString aURL )
: DIALOG_GIT_REPOSITORY_BASE( aParent ),
m_repository( aRepository ),
m_fullURL( aURL ),
m_tempRepo( false )
{
}
DIALOG_GIT_REPOSITORY::~DIALOG_GIT_REPOSITORY() {}
void DIALOG_GIT_REPOSITORY::SetEncrypted( bool aEncrypted ) { (void)aEncrypted; }
void DIALOG_GIT_REPOSITORY::OnUpdateUI( wxUpdateUIEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::OnLocationExit( wxFocusEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::OnOKClick( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::OnSelectConnType( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::OnTestClick( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::OnFileUpdated( wxFileDirPickerEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::onCbCustom( wxCommandEvent& event ) { (void)event; }
void DIALOG_GIT_REPOSITORY::setDefaultSSHKey() {}
void DIALOG_GIT_REPOSITORY::updateAuthControls() {}
void DIALOG_GIT_REPOSITORY::updateURLData() {}
bool DIALOG_GIT_REPOSITORY::extractClipboardData() { return false; }
std::tuple<bool,wxString,wxString,wxString> DIALOG_GIT_REPOSITORY::isValidHTTPS( const wxString& url )
{
(void)url;
return std::make_tuple( false, wxEmptyString, wxEmptyString, wxEmptyString );
}
std::tuple<bool,wxString,wxString> DIALOG_GIT_REPOSITORY::isValidSSH( const wxString& url )
{
(void)url;
return std::make_tuple( false, wxEmptyString, wxEmptyString );
}
// =============================================================================
// Extern "C" callbacks (declared in kicad_git_common.h)
// =============================================================================
extern "C" {
int progress_cb( const char* str, int len, void* data )
{
(void)str; (void)len; (void)data;
return 0;
}
void clone_progress_cb( const char* str, size_t len, size_t total, void* data )
{
(void)str; (void)len; (void)total; (void)data;
}
int transfer_progress_cb( const git_transfer_progress* aStats, void* aPayload )
{
(void)aStats; (void)aPayload;
return 0;
}
int update_cb( const char* aRefname, const git_oid* aFirst, const git_oid* aSecond,
void* aPayload )
{
(void)aRefname; (void)aFirst; (void)aSecond; (void)aPayload;
return 0;
}
int push_transfer_progress_cb( unsigned int aCurrent, unsigned int aTotal,
size_t aBytes, void* aPayload )
{
(void)aCurrent; (void)aTotal; (void)aBytes; (void)aPayload;
return 0;
}
int push_update_reference_cb( const char* aRefname, const char* aStatus,
void* aPayload )
{
(void)aRefname; (void)aStatus; (void)aPayload;
return 0;
}
int fetchhead_foreach_cb( const char* aRefname, const char* aRemoteUrl,
const git_oid* aOID, unsigned int aIsMerge, void* aPayload )
{
(void)aRefname; (void)aRemoteUrl; (void)aOID; (void)aIsMerge; (void)aPayload;
return 0;
}
int credentials_cb( git_cred** aOut, const char* aUrl, const char* aUsername,
unsigned int aAllowedTypes, void* aPayload )
{
(void)aOut; (void)aUrl; (void)aUsername; (void)aAllowedTypes; (void)aPayload;
return -1;
}
}

View file

@ -0,0 +1,339 @@
/*
* KiCad Wasm Port - Stub implementations for KiCad git classes
*
* Provides empty/stub implementations for KiCad git-related classes
* when KICAD_USE_GIT=OFF.
*/
#include <wx/string.h>
#include <wx/window.h>
#include <wx/aui/aui.h>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <git2.h>
// Include KiCad headers to get proper class declarations
#include <git/kicad_git_common.h>
#include <git/git_status_handler.h>
#include <git/git_resolve_conflict_handler.h>
#include <git/git_remove_from_index_handler.h>
#include <git/git_add_to_index_handler.h>
#include <git/git_commit_handler.h>
#include <git/git_pull_handler.h>
#include <git/git_push_handler.h>
#include <git/git_sync_handler.h>
#include <git/git_switch_branch_handler.h>
#include <git/git_revert_handler.h>
#include <git/libgit_backend.h>
// Forward declare KICAD_MANAGER_FRAME for LOCAL_HISTORY_PANE
class KICAD_MANAGER_FRAME;
// =============================================================================
// KIGIT_COMMON stub implementations
// =============================================================================
KIGIT_COMMON::KIGIT_COMMON( git_repository* aRepo ) :
m_repo( aRepo ),
m_connType( GIT_CONN_TYPE::GIT_CONN_LOCAL ),
m_testedTypes( 0 ),
m_nextPublicKey( 0 ),
m_secretFetched( false ),
m_cancel( false )
{}
KIGIT_COMMON::KIGIT_COMMON( const KIGIT_COMMON& aOther ) :
m_repo( aOther.m_repo ),
m_connType( aOther.m_connType ),
m_remote( aOther.m_remote ),
m_hostname( aOther.m_hostname ),
m_username( aOther.m_username ),
m_password( aOther.m_password ),
m_testedTypes( aOther.m_testedTypes ),
m_publicKeys( aOther.m_publicKeys ),
m_nextPublicKey( aOther.m_nextPublicKey ),
m_secretFetched( aOther.m_secretFetched ),
m_cancel( aOther.m_cancel.load() )
{}
KIGIT_COMMON::~KIGIT_COMMON() {}
git_repository* KIGIT_COMMON::GetRepo() const { return m_repo; }
wxString KIGIT_COMMON::GetGitRootDirectory() const { return wxEmptyString; }
std::vector<wxString> KIGIT_COMMON::GetBranchNames() const { return {}; }
std::vector<wxString> KIGIT_COMMON::GetProjectDirs() { return {}; }
bool KIGIT_COMMON::HasLocalCommits() const { return false; }
bool KIGIT_COMMON::HasPushAndPullRemote() const { return false; }
std::pair<std::set<wxString>, std::set<wxString>> KIGIT_COMMON::GetDifferentFiles() const
{
return std::make_pair( std::set<wxString>(), std::set<wxString>() );
}
wxString KIGIT_COMMON::GetCurrentBranchName() const { return wxEmptyString; }
wxString KIGIT_COMMON::GetRemotename() const { return wxEmptyString; }
wxString KIGIT_COMMON::GetPassword() { return wxEmptyString; }
KIGIT_COMMON::GIT_CONN_TYPE KIGIT_COMMON::GetConnType() const { return m_connType; }
void KIGIT_COMMON::SetSSHKey( const wxString& aSSHKey ) { (void)aSSHKey; }
void KIGIT_COMMON::UpdateCurrentBranchInfo() {}
int KIGIT_COMMON::HandleSSHKeyAuthentication( git_cred** aOut, const wxString& aUsername )
{
(void)aOut; (void)aUsername;
return -1;
}
int KIGIT_COMMON::HandlePlaintextAuthentication( git_cred** aOut, const wxString& aUsername )
{
(void)aOut; (void)aUsername;
return -1;
}
int KIGIT_COMMON::HandleSSHAgentAuthentication( git_cred** aOut, const wxString& aUsername )
{
(void)aOut; (void)aUsername;
return -1;
}
// Private methods
void KIGIT_COMMON::updatePublicKeys() {}
void KIGIT_COMMON::updateConnectionType() {}
// =============================================================================
// KIGIT_REPO_MIXIN - all methods are inline in the header, no stubs needed
// =============================================================================
// =============================================================================
// GIT_STATUS_HANDLER stub implementations
// =============================================================================
GIT_STATUS_HANDLER::GIT_STATUS_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon ) {}
GIT_STATUS_HANDLER::~GIT_STATUS_HANDLER() {}
bool GIT_STATUS_HANDLER::HasChangedFiles() { return false; }
std::map<wxString, FileStatus> GIT_STATUS_HANDLER::GetFileStatus( const wxString& aPathspec )
{
(void)aPathspec;
return {};
}
wxString GIT_STATUS_HANDLER::GetCurrentBranchName() { return wxEmptyString; }
void GIT_STATUS_HANDLER::UpdateRemoteStatus( const std::set<wxString>& aLocalChanges,
const std::set<wxString>& aRemoteChanges,
std::map<wxString, FileStatus>& aFileStatus )
{
(void)aLocalChanges; (void)aRemoteChanges; (void)aFileStatus;
}
wxString GIT_STATUS_HANDLER::GetWorkingDirectory() { return wxEmptyString; }
KIGIT_COMMON::GIT_STATUS GIT_STATUS_HANDLER::ConvertStatus( unsigned int aGitStatus )
{
(void)aGitStatus;
return KIGIT_COMMON::GIT_STATUS::GIT_STATUS_CURRENT;
}
// =============================================================================
// GIT_RESOLVE_CONFLICT_HANDLER stub implementations
// =============================================================================
GIT_RESOLVE_CONFLICT_HANDLER::GIT_RESOLVE_CONFLICT_HANDLER( git_repository* aRepo )
: KIGIT_REPO_MIXIN( nullptr )
{
(void)aRepo;
}
GIT_RESOLVE_CONFLICT_HANDLER::~GIT_RESOLVE_CONFLICT_HANDLER() {}
bool GIT_RESOLVE_CONFLICT_HANDLER::PerformResolveConflict() { return false; }
// =============================================================================
// GIT_REMOVE_FROM_INDEX_HANDLER stub implementations
// =============================================================================
GIT_REMOVE_FROM_INDEX_HANDLER::GIT_REMOVE_FROM_INDEX_HANDLER( git_repository* aRepo )
: KIGIT_REPO_MIXIN( nullptr )
{
(void)aRepo;
}
GIT_REMOVE_FROM_INDEX_HANDLER::~GIT_REMOVE_FROM_INDEX_HANDLER() {}
bool GIT_REMOVE_FROM_INDEX_HANDLER::PerformRemoveFromIndex() { return false; }
void GIT_REMOVE_FROM_INDEX_HANDLER::SetFilePaths( const std::vector<wxString>& aPaths )
{
(void)aPaths;
}
// =============================================================================
// GIT_ADD_TO_INDEX_HANDLER stub implementations
// =============================================================================
GIT_ADD_TO_INDEX_HANDLER::GIT_ADD_TO_INDEX_HANDLER( git_repository* aRepo )
: KIGIT_REPO_MIXIN( nullptr )
{
(void)aRepo;
}
GIT_ADD_TO_INDEX_HANDLER::~GIT_ADD_TO_INDEX_HANDLER() {}
bool GIT_ADD_TO_INDEX_HANDLER::PerformAddToIndex() { return false; }
void GIT_ADD_TO_INDEX_HANDLER::SetFilePaths( const std::vector<wxString>& aPaths )
{
(void)aPaths;
}
// =============================================================================
// GIT_COMMIT_HANDLER stub implementations
// =============================================================================
GIT_COMMIT_HANDLER::GIT_COMMIT_HANDLER( git_repository* aRepo )
: KIGIT_REPO_MIXIN( nullptr )
{
(void)aRepo;
}
GIT_COMMIT_HANDLER::~GIT_COMMIT_HANDLER() {}
bool GIT_COMMIT_HANDLER::PerformCommit() { return false; }
void GIT_COMMIT_HANDLER::SetAuthorName( const wxString& aName ) { (void)aName; }
void GIT_COMMIT_HANDLER::SetAuthorEmail( const wxString& aEmail ) { (void)aEmail; }
void GIT_COMMIT_HANDLER::SetCommitMessage( const wxString& aMessage ) { (void)aMessage; }
void GIT_COMMIT_HANDLER::SetFilePaths( const std::vector<wxString>& aPaths ) { (void)aPaths; }
// =============================================================================
// GIT_PULL_HANDLER stub implementations
// =============================================================================
GIT_PULL_HANDLER::GIT_PULL_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon ) {}
GIT_PULL_HANDLER::~GIT_PULL_HANDLER() {}
bool GIT_PULL_HANDLER::PerformPull() { return false; }
// =============================================================================
// GIT_PUSH_HANDLER stub implementations
// =============================================================================
GIT_PUSH_HANDLER::GIT_PUSH_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon ) {}
GIT_PUSH_HANDLER::~GIT_PUSH_HANDLER() {}
bool GIT_PUSH_HANDLER::PerformPush() { return false; }
// =============================================================================
// GIT_SYNC_HANDLER stub implementations
// =============================================================================
GIT_SYNC_HANDLER::GIT_SYNC_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon ) {}
GIT_SYNC_HANDLER::~GIT_SYNC_HANDLER() {}
bool GIT_SYNC_HANDLER::PerformSync() { return false; }
// =============================================================================
// GIT_SWITCH_BRANCH_HANDLER stub implementations
// =============================================================================
GIT_SWITCH_BRANCH_HANDLER::GIT_SWITCH_BRANCH_HANDLER( KIGIT_COMMON* aCommon )
: KIGIT_REPO_MIXIN( aCommon )
{
}
GIT_SWITCH_BRANCH_HANDLER::~GIT_SWITCH_BRANCH_HANDLER() {}
bool GIT_SWITCH_BRANCH_HANDLER::PerformSwitchBranch() { return false; }
void GIT_SWITCH_BRANCH_HANDLER::SetBranchName( const wxString& aName ) { (void)aName; }
// =============================================================================
// GIT_REVERT_HANDLER stub implementations
// =============================================================================
GIT_REVERT_HANDLER::GIT_REVERT_HANDLER( KIGIT_COMMON* aCommon ) : KIGIT_REPO_MIXIN( aCommon ) {}
GIT_REVERT_HANDLER::~GIT_REVERT_HANDLER() {}
bool GIT_REVERT_HANDLER::PerformRevert() { return false; }
void GIT_REVERT_HANDLER::SetFilePaths( const std::vector<wxString>& aPaths ) { (void)aPaths; }
// =============================================================================
// LIBGIT_BACKEND stub implementations
// =============================================================================
LIBGIT_BACKEND::LIBGIT_BACKEND() {}
LIBGIT_BACKEND::~LIBGIT_BACKEND() {}
void LIBGIT_BACKEND::Init() {}
void LIBGIT_BACKEND::Cleanup() {}
// =============================================================================
// LOCAL_HISTORY_PANE stub - declared here since we excluded the cpp file
// =============================================================================
class LOCAL_HISTORY_PANE : public wxPanel
{
public:
LOCAL_HISTORY_PANE( KICAD_MANAGER_FRAME* aParent );
~LOCAL_HISTORY_PANE();
void RefreshHistory( const wxString& aProjectPath );
};
LOCAL_HISTORY_PANE::LOCAL_HISTORY_PANE( KICAD_MANAGER_FRAME* aParent )
: wxPanel( reinterpret_cast<wxWindow*>(aParent), wxID_ANY )
{
}
LOCAL_HISTORY_PANE::~LOCAL_HISTORY_PANE() {}
void LOCAL_HISTORY_PANE::RefreshHistory( const wxString& aProjectPath )
{
(void)aProjectPath;
}
// =============================================================================
// Extern "C" callbacks (declared in kicad_git_common.h)
// =============================================================================
extern "C" {
int progress_cb( const char* str, int len, void* data )
{
(void)str; (void)len; (void)data;
return 0;
}
void clone_progress_cb( const char* str, size_t len, size_t total, void* data )
{
(void)str; (void)len; (void)total; (void)data;
}
int transfer_progress_cb( const git_transfer_progress* aStats, void* aPayload )
{
(void)aStats; (void)aPayload;
return 0;
}
int update_cb( const char* aRefname, const git_oid* aFirst, const git_oid* aSecond,
void* aPayload )
{
(void)aRefname; (void)aFirst; (void)aSecond; (void)aPayload;
return 0;
}
int push_transfer_progress_cb( unsigned int aCurrent, unsigned int aTotal,
size_t aBytes, void* aPayload )
{
(void)aCurrent; (void)aTotal; (void)aBytes; (void)aPayload;
return 0;
}
int push_update_reference_cb( const char* aRefname, const char* aStatus,
void* aPayload )
{
(void)aRefname; (void)aStatus; (void)aPayload;
return 0;
}
int fetchhead_foreach_cb( const char* aRefname, const char* aRemoteUrl,
const git_oid* aOID, unsigned int aIsMerge, void* aPayload )
{
(void)aRefname; (void)aRemoteUrl; (void)aOID; (void)aIsMerge; (void)aPayload;
return 0;
}
int credentials_cb( git_cred** aOut, const char* aUrl, const char* aUsername,
unsigned int aAllowedTypes, void* aPayload )
{
(void)aOut; (void)aUrl; (void)aUsername; (void)aAllowedTypes; (void)aPayload;
return -1;
}
}

172
stubs/src/occ_stubs.cpp Normal file
View file

@ -0,0 +1,172 @@
/*
* KiCad Wasm Port - OCC stub implementations
*
* Provides stub implementations for OpenCASCADE-related classes when KICAD_USE_OCC=OFF.
* Uses the clean pcbnew_utils_3d.h header which has no OCC dependencies.
* EXPORTER_STEP is implemented separately without including its header to avoid OCC deps.
*/
#include <wx/string.h>
#include <math/vector3.h>
#include <reporter.h>
#include <jobs/job_export_pcb_3d.h> // For EXPORTER_STEP_PARAMS
// Include the actual header for UTILS classes (no OCC dependency)
#include <python/scripting/pcbnew_utils_3d.h>
// =============================================================================
// UTILS_BOX3D stub implementations
// =============================================================================
VECTOR3D& UTILS_BOX3D::Min()
{
return m_min;
}
VECTOR3D& UTILS_BOX3D::Max()
{
return m_max;
}
VECTOR3D UTILS_BOX3D::GetCenter()
{
return VECTOR3D( 0, 0, 0 );
}
VECTOR3D UTILS_BOX3D::GetSize()
{
return VECTOR3D( 0, 0, 0 );
}
// =============================================================================
// UTILS_STEP_MODEL stub implementations
// =============================================================================
struct UTILS_STEP_MODEL::DATA
{
// Empty stub data
};
UTILS_STEP_MODEL::~UTILS_STEP_MODEL()
{
delete m_data;
}
UTILS_BOX3D UTILS_STEP_MODEL::GetBoundingBox()
{
return UTILS_BOX3D();
}
void UTILS_STEP_MODEL::Translate( double aX, double aY, double aZ )
{
(void)aX; (void)aY; (void)aZ;
}
void UTILS_STEP_MODEL::Scale( double aScale )
{
(void)aScale;
}
bool UTILS_STEP_MODEL::SaveSTEP( const wxString& aFileName )
{
(void)aFileName;
return false;
}
UTILS_STEP_MODEL* UTILS_STEP_MODEL::LoadSTEP( const wxString& aFileName )
{
(void)aFileName;
return nullptr;
}
// =============================================================================
// EXPORTER_STEP stub implementations
// We can't include exporter_step.h because it has OCC-dependent members.
// Instead, we declare the class matching the header's interface and implement stubs.
// =============================================================================
// Forward declarations
class BOARD;
class BOARD_ITEM;
class FOOTPRINT;
class PCB_TRACK;
class SHAPE_POLY_SET;
// EXPORTER_STEP class definition matching the header
// Must match the declaration in exporters/step/exporter_step.h exactly
class EXPORTER_STEP
{
public:
EXPORTER_STEP( BOARD* aBoard, const EXPORTER_STEP_PARAMS& aParams, REPORTER* aReporter );
~EXPORTER_STEP();
bool Export();
wxString m_outputFile;
private:
bool buildBoard3DShapes();
bool buildFootprint3DShapes( FOOTPRINT* aFootprint, const VECTOR2D& aOrigin, SHAPE_POLY_SET* aClipPolygon );
bool buildTrack3DShape( PCB_TRACK* aTrack, const VECTOR2D& aOrigin );
void buildZones3DShape( VECTOR2D aOrigin );
bool buildGraphic3DShape( BOARD_ITEM* aItem, const VECTOR2D& aOrigin );
void initOutputVariant();
// Member variables - simplified stubs without the actual OCC-dependent types
EXPORTER_STEP_PARAMS m_params;
REPORTER* m_reporter;
BOARD* m_board;
};
EXPORTER_STEP::EXPORTER_STEP( BOARD* aBoard, const EXPORTER_STEP_PARAMS& aParams, REPORTER* aReporter )
: m_params( aParams ),
m_reporter( aReporter ),
m_board( aBoard )
{
}
EXPORTER_STEP::~EXPORTER_STEP()
{
}
bool EXPORTER_STEP::Export()
{
if( m_reporter )
{
m_reporter->Report( wxT( "STEP export is not available (OCC support disabled)" ),
RPT_SEVERITY_ERROR );
}
return false;
}
bool EXPORTER_STEP::buildBoard3DShapes()
{
return false;
}
bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, const VECTOR2D& aOrigin, SHAPE_POLY_SET* aClipPolygon )
{
(void)aFootprint; (void)aOrigin; (void)aClipPolygon;
return false;
}
bool EXPORTER_STEP::buildTrack3DShape( PCB_TRACK* aTrack, const VECTOR2D& aOrigin )
{
(void)aTrack; (void)aOrigin;
return false;
}
void EXPORTER_STEP::buildZones3DShape( VECTOR2D aOrigin )
{
(void)aOrigin;
}
bool EXPORTER_STEP::buildGraphic3DShape( BOARD_ITEM* aItem, const VECTOR2D& aOrigin )
{
(void)aItem; (void)aOrigin;
return false;
}
void EXPORTER_STEP::initOutputVariant()
{
}

View file

@ -0,0 +1,36 @@
/*
* KiCad Wasm Port - Stub implementation for PANEL_GIT_REPOS
*
* Provides empty/stub implementation for PANEL_GIT_REPOS when KICAD_USE_GIT=OFF.
* This file is added to the common library sources.
*/
#include <wx/stattext.h>
#include <wx/sizer.h>
#include <dialogs/git/panel_git_repos.h>
PANEL_GIT_REPOS::PANEL_GIT_REPOS( wxWindow* aParent )
: PANEL_GIT_REPOS_BASE( aParent )
{
// Hide all the git-related controls since git is disabled
m_gitSizer->Show( false );
// Add a message saying git is disabled
wxBoxSizer* msgSizer = new wxBoxSizer( wxVERTICAL );
wxStaticText* text = new wxStaticText( this, wxID_ANY,
wxT("Git support is disabled in this build.") );
msgSizer->Add( text, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, 20 );
GetSizer()->Add( msgSizer, 1, wxEXPAND | wxALL, 5 );
}
PANEL_GIT_REPOS::~PANEL_GIT_REPOS() {}
void PANEL_GIT_REPOS::ResetPanel() {}
bool PANEL_GIT_REPOS::TransferDataFromWindow() { return true; }
bool PANEL_GIT_REPOS::TransferDataToWindow() { return true; }
void PANEL_GIT_REPOS::onDefaultClick( wxCommandEvent& event ) { (void)event; }
void PANEL_GIT_REPOS::onEnableGitClick( wxCommandEvent& event ) { (void)event; }