Remove unused legacy build scripts and directories

Clean up obsolete files that are not part of the current build workflows:

Deleted:
- cmake/ - Old native build CMake modules
- core/ - Old core extraction from Nov 2024
- stubs/ - Old stubs for native build
- scripts/build.sh - Old native build script
- scripts/build-core-wasm.sh - Old core library build
- scripts/build-wxbase-wasm.sh - Old CMake-based wxBase
- scripts/build-kicad-wasm.sh - Old standalone kicad build
- scripts/build-wxwidgets-wasm-clean.sh - Patch testing script
- scripts/generate-wxwidgets-patches.sh - Patch generation
- scripts/prepare.sh - Old patch apply script
- scripts/update-kicad.sh - Old kicad update script
- CMakeLists.txt - Old native build root
- wxWidgets-wasm-reference submodule - Unused reference clone

Both workflows verified working after cleanup:
1. KiCad: docker/build.sh → tests/scripts/setup-kicad-wasm.sh → npm test
2. wxWidgets: scripts/build-wxuniversal-wasm.sh → scripts/build-wasm-test.sh → npm test

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Viktor Vaczi 2025-12-27 11:07:54 +01:00
commit a88652279b
41 changed files with 0 additions and 4691 deletions

3
.gitmodules vendored
View file

@ -6,6 +6,3 @@
path = wxwidgets
url = git@github.com:VV-EE/wxWidgets.git
branch = wasm-port
[submodule "wxWidgets-wasm-reference"]
path = wxWidgets-wasm-reference
url = git@github.com:ahilss/wxWidgets-wasm.git

View file

@ -1,51 +0,0 @@
#
# KiCad WebAssembly Port - Root Build Configuration
#
# This is a wrapper CMakeLists.txt that configures optional dependencies
# before building KiCad. Use this for building with features disabled.
#
# Usage:
# mkdir build && cd build
# cmake .. -DKICAD_USE_CURL=OFF -DKICAD_USE_GIT=OFF -DKICAD_USE_OCC=OFF
# make -j$(nproc)
#
cmake_minimum_required(VERSION 3.22)
project(kicad-wasm-wrapper)
# Add our stubs to the include path when dependencies are disabled
set(KICAD_WASM_STUBS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/stubs/include")
# Include our options module
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/KicadWasmOptions.cmake")
# Add stubs to include path when features are disabled
if(NOT KICAD_USE_CURL OR NOT KICAD_USE_GIT)
message(STATUS "Adding stub headers to include path: ${KICAD_WASM_STUBS_DIR}")
include_directories(BEFORE SYSTEM "${KICAD_WASM_STUBS_DIR}")
endif()
# For now, we need to build KiCad from its directory directly
# because it expects to be the root project.
#
# This wrapper is mainly for documentation and can be extended later.
message(STATUS "")
message(STATUS "=== KiCad Wasm Build Configuration ===")
message(STATUS "")
message(STATUS "Note: KiCad must be built from its source directory.")
message(STATUS "")
message(STATUS "To build with features disabled, use:")
message(STATUS "")
message(STATUS " cd kicad")
message(STATUS " mkdir build && cd build")
message(STATUS " cmake .. \\")
message(STATUS " -DCMAKE_MODULE_PATH=${CMAKE_CURRENT_SOURCE_DIR}/cmake \\")
message(STATUS " -DKICAD_USE_CURL=${KICAD_USE_CURL} \\")
message(STATUS " -DKICAD_USE_GIT=${KICAD_USE_GIT} \\")
message(STATUS " -DKICAD_USE_OCC=${KICAD_USE_OCC} \\")
message(STATUS " -DKICAD_USE_NGSPICE=${KICAD_USE_NGSPICE}")
message(STATUS "")
message(STATUS "Or use the helper script:")
message(STATUS " ./scripts/build.sh")
message(STATUS "")
message(FATAL_ERROR "Please build from kicad/ directory as described above")

View file

@ -1,34 +0,0 @@
#
# KiCad Wasm Port - CURL Find Module Override
#
# When KICAD_USE_CURL=OFF, this module provides stub values
# so the build can proceed without libcurl.
#
# Check if curl is disabled
if(DEFINED KICAD_USE_CURL AND NOT KICAD_USE_CURL)
message(STATUS "CURL: DISABLED (KICAD_USE_CURL=OFF)")
# Set variables that KiCad expects
set(CURL_FOUND TRUE)
set(CURL_INCLUDE_DIRS "")
set(CURL_LIBRARIES "")
set(CURL_VERSION_STRING "stub")
# Create an imported target that does nothing
if(NOT TARGET CURL::libcurl)
add_library(CURL::libcurl INTERFACE IMPORTED)
endif()
return()
endif()
# Otherwise, use CMake's built-in FindCURL
# Remove our path to avoid recursion
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
# Use built-in module
include(${CMAKE_ROOT}/Modules/FindCURL.cmake)
# Restore module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

View file

@ -1,41 +0,0 @@
#
# KiCad Wasm Port - OpenCASCADE Find Module Override
#
# When KICAD_USE_OCC=OFF, this module provides stub values
# so the build can proceed without OpenCASCADE.
#
# Check if OCC is disabled
if(DEFINED KICAD_USE_OCC AND NOT KICAD_USE_OCC)
message(STATUS "OpenCASCADE: DISABLED (KICAD_USE_OCC=OFF)")
# Set stubs include directory
set(STUBS_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../stubs/include")
# Set variables that KiCad expects
set(OCC_FOUND TRUE)
set(OCC_INCLUDE_DIR "${STUBS_INCLUDE_DIR}")
set(OCC_INCLUDE_DIRS "${STUBS_INCLUDE_DIR}")
set(OCC_LIBRARIES "")
set(OCC_VERSION_STRING "7.5.0") # Fake version to pass version check
set(OCC_VERSION_MAJOR 7)
set(OCC_VERSION_MINOR 5)
set(OCC_VERSION_PATCH 0)
# Add stub includes globally
include_directories("${STUBS_INCLUDE_DIR}")
return()
endif()
# Otherwise, use the original find module from KiCad
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(_KICAD_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake")
if(EXISTS "${_KICAD_CMAKE_DIR}/FindOCC.cmake")
include("${_KICAD_CMAKE_DIR}/FindOCC.cmake")
else()
message(FATAL_ERROR "Cannot find OpenCASCADE find module")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

View file

@ -1,64 +0,0 @@
#
# KiCad Wasm Port - libgit2 Find Module Override
#
# When KICAD_USE_GIT=OFF, this module provides stub values
# so the build can proceed without libgit2.
#
# Check if git is disabled
if(DEFINED KICAD_USE_GIT AND NOT KICAD_USE_GIT)
message(STATUS "libgit2: DISABLED (KICAD_USE_GIT=OFF)")
# Set variables that KiCad expects
set(LIBGIT2_FOUND TRUE)
set(LIBGIT2_INCLUDE_DIR "")
set(LIBGIT2_INCLUDE_DIRS "")
set(LIBGIT2_LIBRARIES "")
set(LIBGIT2_DEFINITIONS "")
set(LIBGIT2_VERSION_STRING "stub")
# Mark as found
set(libgit2_FOUND TRUE)
return()
endif()
# Otherwise, use the original find module from KiCad
# First, remove our cmake dir from the module path to avoid recursion
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
# Look for the original module in KiCad's cmake dir
set(_KICAD_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake")
if(EXISTS "${_KICAD_CMAKE_DIR}/Findlibgit2.cmake")
include("${_KICAD_CMAKE_DIR}/Findlibgit2.cmake")
else()
# Fallback: Use pkg-config
find_package(PkgConfig)
pkg_search_module(PC_LIBGIT2 libgit2)
set(LIBGIT2_DEFINITIONS ${PC_LIBGIT2_CFLAGS_OTHER})
find_path(LIBGIT2_INCLUDE_DIR NAMES git2.h
HINTS
${PC_LIBGIT2_INCLUDEDIR}
${PC_LIBGIT2_INCLUDE_DIRS}
)
find_library(LIBGIT2_LIBRARY NAMES git2
HINTS
${PC_LIBGIT2_LIBDIR}
${PC_LIBGIT2_LIBRARY_DIRS}
)
set(LIBGIT2_LIBRARIES ${LIBGIT2_LIBRARY})
set(LIBGIT2_INCLUDE_DIRS ${LIBGIT2_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libgit2 DEFAULT_MSG
LIBGIT2_LIBRARY LIBGIT2_INCLUDE_DIR)
mark_as_advanced(LIBGIT2_INCLUDE_DIR LIBGIT2_LIBRARY)
endif()
# Restore module path
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

View file

@ -1,56 +0,0 @@
#
# KiCad Wasm Port - ngspice Find Module Override
#
# When KICAD_USE_NGSPICE=OFF, this module provides stub values
# so the build can proceed without ngspice.
#
# Check if ngspice is disabled
if(DEFINED KICAD_USE_NGSPICE AND NOT KICAD_USE_NGSPICE)
message(STATUS "ngspice: DISABLED (KICAD_USE_NGSPICE=OFF)")
# Set stubs include directory
set(STUBS_INCLUDE_DIR "${CMAKE_CURRENT_LIST_DIR}/../stubs/include")
# Set variables that KiCad expects
# ngspice is dynamically loaded via dlopen, so we don't need to link against it.
# Set library variables to empty to prevent linking.
set(ngspice_FOUND TRUE)
set(NGSPICE_FOUND TRUE)
set(NGSPICE_INCLUDE_DIR "${STUBS_INCLUDE_DIR}")
set(NGSPICE_INCLUDE_DIRS "${STUBS_INCLUDE_DIR}")
# Empty library - ngspice is loaded dynamically, not linked
set(NGSPICE_LIBRARY "" CACHE STRING "ngspice library (disabled)")
set(NGSPICE_LIBRARIES "")
set(NGSPICE_VERSION "disabled")
# NGSPICE_DLL is used by eeschema at runtime, not link time
set(NGSPICE_DLL "")
# Add stub includes globally
include_directories("${STUBS_INCLUDE_DIR}")
return()
endif()
# Otherwise, use the original find module from KiCad
list(REMOVE_ITEM CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
set(_KICAD_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake")
if(EXISTS "${_KICAD_CMAKE_DIR}/Findngspice.cmake")
include("${_KICAD_CMAKE_DIR}/Findngspice.cmake")
else()
# Fallback search
find_path(NGSPICE_INCLUDE_DIR NAMES ngspice/sharedspice.h)
find_library(NGSPICE_LIBRARY NAMES ngspice)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ngspice DEFAULT_MSG
NGSPICE_LIBRARY NGSPICE_INCLUDE_DIR)
set(NGSPICE_LIBRARIES ${NGSPICE_LIBRARY})
set(NGSPICE_INCLUDE_DIRS ${NGSPICE_INCLUDE_DIR})
mark_as_advanced(NGSPICE_INCLUDE_DIR NGSPICE_LIBRARY)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")

View file

@ -1,84 +0,0 @@
#
# KiCad WebAssembly Port - Optional Dependency Configuration
#
# This module defines options to disable optional dependencies for Wasm builds.
# Include this BEFORE processing KiCad's CMakeLists.txt
#
# Optional dependency flags
option( KICAD_USE_CURL "Enable network features (curl)" ON )
option( KICAD_USE_GIT "Enable git integration (libgit2)" ON )
option( KICAD_USE_OCC "Enable STEP/3D via OpenCASCADE" ON )
option( KICAD_USE_NGSPICE "Enable SPICE simulation" ON )
option( KICAD_USE_DATABASE "Enable database libraries (ODBC)" ON )
# When building for Wasm, disable all optional deps by default
option( KICAD_WASM_BUILD "Building for WebAssembly target" OFF )
if( KICAD_WASM_BUILD )
message( STATUS "KiCad Wasm build: Disabling optional dependencies" )
set( KICAD_USE_CURL OFF CACHE BOOL "" FORCE )
set( KICAD_USE_GIT OFF CACHE BOOL "" FORCE )
set( KICAD_USE_OCC OFF CACHE BOOL "" FORCE )
set( KICAD_USE_NGSPICE OFF CACHE BOOL "" FORCE )
set( KICAD_USE_DATABASE OFF CACHE BOOL "" FORCE )
endif()
# Report status
message( STATUS "KICAD_USE_CURL: ${KICAD_USE_CURL}" )
message( STATUS "KICAD_USE_GIT: ${KICAD_USE_GIT}" )
message( STATUS "KICAD_USE_OCC: ${KICAD_USE_OCC}" )
message( STATUS "KICAD_USE_NGSPICE: ${KICAD_USE_NGSPICE}" )
message( STATUS "KICAD_USE_DATABASE: ${KICAD_USE_DATABASE}" )
#
# Create stub/dummy targets for disabled dependencies
#
# CURL stub
if( NOT KICAD_USE_CURL )
if( NOT TARGET CURL::libcurl )
add_library( CURL::libcurl INTERFACE IMPORTED )
endif()
add_compile_definitions( KICAD_USE_CURL=0 )
else()
add_compile_definitions( KICAD_USE_CURL=1 )
endif()
# libgit2 stub
if( NOT KICAD_USE_GIT )
set( LIBGIT2_FOUND TRUE )
set( LIBGIT2_LIBRARIES "" )
set( LIBGIT2_INCLUDE_DIRS "" )
add_compile_definitions( KICAD_USE_GIT=0 )
else()
add_compile_definitions( KICAD_USE_GIT=1 )
endif()
# OpenCASCADE stub
if( NOT KICAD_USE_OCC )
set( OCC_FOUND TRUE )
set( OCC_VERSION_STRING "7.5.0" )
set( OCC_INCLUDE_DIR "" )
set( OCC_LIBRARIES "" )
add_compile_definitions( KICAD_USE_OCC=0 )
else()
add_compile_definitions( KICAD_USE_OCC=1 )
endif()
# ngspice stub
if( NOT KICAD_USE_NGSPICE )
set( ngspice_FOUND TRUE )
set( NGSPICE_LIBRARY "" )
set( NGSPICE_INCLUDE_DIR "" )
add_compile_definitions( KICAD_USE_NGSPICE=0 )
else()
add_compile_definitions( KICAD_USE_NGSPICE=1 )
endif()
# Database (ODBC) - affects boost::locale requirement
if( NOT KICAD_USE_DATABASE )
add_compile_definitions( KICAD_USE_DATABASE=0 )
else()
add_compile_definitions( KICAD_USE_DATABASE=1 )
endif()

3
core/.gitignore vendored
View file

@ -1,3 +0,0 @@
# Build directories
build/
build-wasm/

View file

@ -1,293 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(kicad_core VERSION 1.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Path to KiCad source (submodule)
set(KICAD_SOURCE "${CMAKE_SOURCE_DIR}/../kicad" CACHE PATH "Path to KiCad source")
# Verify KiCad source exists
if(NOT EXISTS "${KICAD_SOURCE}/libs/kimath")
message(FATAL_ERROR "KiCad source not found at ${KICAD_SOURCE}")
endif()
message(STATUS "Using KiCad source at: ${KICAD_SOURCE}")
# =============================================================================
# wxWidgets Base (pre-built for WASM)
# =============================================================================
set(WXWIDGETS_SOURCE "${CMAKE_SOURCE_DIR}/../wxwidgets" CACHE PATH "Path to wxWidgets source")
set(WXWIDGETS_BUILD "${CMAKE_SOURCE_DIR}/../build-wasm/wxwidgets" CACHE PATH "Path to wxWidgets WASM build")
# Verify wxWidgets build exists
if(NOT EXISTS "${WXWIDGETS_BUILD}/lib/libwx_baseu-3.2-Emscripten.a")
message(FATAL_ERROR "wxBase WASM build not found. Run scripts/build-wxbase-wasm.sh first")
endif()
# Create imported wxBase library
add_library(wxbase STATIC IMPORTED)
set_target_properties(wxbase PROPERTIES
IMPORTED_LOCATION "${WXWIDGETS_BUILD}/lib/libwx_baseu-3.2-Emscripten.a"
)
# Create imported wxRegex library (for wxRegEx support)
add_library(wxregex STATIC IMPORTED)
set_target_properties(wxregex PROPERTIES
IMPORTED_LOCATION "${WXWIDGETS_BUILD}/lib/libwxregexu-3.2.a"
)
# wxWidgets include directories
set(WX_INCLUDE_DIRS
"${WXWIDGETS_BUILD}/lib/wx/include/base-unicode-static-3.2" # Platform setup.h
"${WXWIDGETS_SOURCE}/include" # Main wx headers
)
message(STATUS "Using wxWidgets source at: ${WXWIDGETS_SOURCE}")
message(STATUS "Using wxWidgets build at: ${WXWIDGETS_BUILD}")
# =============================================================================
# Options
# =============================================================================
option(KICAD_CORE_VERBOSE "Enable verbose logging in core library" OFF)
# =============================================================================
# Thirdparty include directories
# =============================================================================
set(THIRDPARTY_INCLUDE_DIRS
"${KICAD_SOURCE}/thirdparty/fmt/include"
"${KICAD_SOURCE}/thirdparty/nlohmann_json"
"${KICAD_SOURCE}/thirdparty/magic_enum/magic_enum" # magic_enum.hpp is here
"${KICAD_SOURCE}/thirdparty/dynamic_bitset"
"${KICAD_SOURCE}/thirdparty/pybind11/include"
)
# =============================================================================
# Clipper2 library (for polygon boolean operations)
# =============================================================================
set(CLIPPER2_DIR "${KICAD_SOURCE}/thirdparty/clipper2")
add_library(clipper2 STATIC
${CLIPPER2_DIR}/Clipper2Lib/src/clipper.engine.cpp
${CLIPPER2_DIR}/Clipper2Lib/src/clipper.offset.cpp
${CLIPPER2_DIR}/Clipper2Lib/src/clipper.rectclip.cpp
)
target_include_directories(clipper2 PUBLIC
${CLIPPER2_DIR}/Clipper2Lib/include
)
target_compile_definitions(clipper2 PUBLIC USINGZ)
# =============================================================================
# RTree library (header-only spatial index)
# =============================================================================
add_library(rtree INTERFACE)
target_include_directories(rtree INTERFACE
${KICAD_SOURCE}/thirdparty/rtree
)
# =============================================================================
# Core utilities library (with wxBase support)
# =============================================================================
add_library(kicad_core_utils STATIC
${KICAD_SOURCE}/libs/core/base64.cpp
${KICAD_SOURCE}/libs/core/observable.cpp
${KICAD_SOURCE}/libs/core/profile.cpp
${KICAD_SOURCE}/libs/core/utf8.cpp
${KICAD_SOURCE}/libs/core/wx_stl_compat.cpp
)
target_include_directories(kicad_core_utils PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/wasm-config # config.h for WASM build
${WX_INCLUDE_DIRS}
${KICAD_SOURCE}/libs/core/include
)
target_link_libraries(kicad_core_utils PUBLIC wxbase wxregex)
# =============================================================================
# S-expression library (parser for .kicad_pcb files)
# =============================================================================
add_library(sexpr STATIC
${KICAD_SOURCE}/libs/sexpr/sexpr.cpp
${KICAD_SOURCE}/libs/sexpr/sexpr_parser.cpp
)
target_include_directories(sexpr PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/wasm-config # config.h for WASM build
${WX_INCLUDE_DIRS}
${KICAD_SOURCE}/libs/sexpr/include
${KICAD_SOURCE}/libs/core/include
${KICAD_SOURCE}/include # string_utils.h, etc.
)
target_link_libraries(sexpr PUBLIC kicad_core_utils)
# =============================================================================
# KiMath library (geometry and math)
# =============================================================================
set(KIMATH_SRCS
${KICAD_SOURCE}/libs/kimath/src/bezier_curves.cpp
${KICAD_SOURCE}/libs/kimath/src/convert_basic_shapes_to_polygon.cpp
${KICAD_SOURCE}/libs/kimath/src/md5_hash.cpp
${KICAD_SOURCE}/libs/kimath/src/transform.cpp
${KICAD_SOURCE}/libs/kimath/src/trigo.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/corner_operations.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/distribute.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/eda_angle.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/ellipse.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/circle.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/convex_hull.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/direction_45.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/geometry_utils.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/half_line.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/intersection.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/line.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/nearest.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/oval.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/roundrect.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/seg.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_arc.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_collisions.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_compound.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_file_io.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_line_chain.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_nearest_points.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_poly_set.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_rect.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_segment.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/vector_utils.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/shape_utils.cpp
${KICAD_SOURCE}/libs/kimath/src/geometry/vertex_set.cpp
${KICAD_SOURCE}/libs/kimath/src/math/vector2.cpp
${KICAD_SOURCE}/libs/kimath/src/math/util.cpp
)
add_library(kimath STATIC ${KIMATH_SRCS})
target_include_directories(kimath PUBLIC
${WX_INCLUDE_DIRS}
${KICAD_SOURCE}/libs/kimath/include
${KICAD_SOURCE}/libs/core/include
${KICAD_SOURCE}/include # Main KiCad includes (units, etc.)
)
target_link_libraries(kimath PUBLIC
kicad_core_utils
clipper2
rtree
)
# Define KICAD_CORE_ONLY to enable any conditional compilation
target_compile_definitions(kimath PRIVATE
KICAD_CORE_ONLY=1
)
if(KICAD_CORE_VERBOSE)
target_compile_definitions(kimath PRIVATE KICAD_CORE_VERBOSE=1)
endif()
# =============================================================================
# Board data model library
# =============================================================================
# Common infrastructure sources
set(COMMON_SRCS
${KICAD_SOURCE}/common/eda_item.cpp
${KICAD_SOURCE}/common/eda_shape.cpp
${KICAD_SOURCE}/common/eda_text.cpp
${KICAD_SOURCE}/common/lset.cpp
${KICAD_SOURCE}/common/layer_id.cpp
${KICAD_SOURCE}/common/title_block.cpp
${KICAD_SOURCE}/common/page_info.cpp
${KICAD_SOURCE}/common/common.cpp
${KICAD_SOURCE}/common/eda_units.cpp
${KICAD_SOURCE}/common/kiid.cpp
${KICAD_SOURCE}/common/marker_base.cpp
)
# PCB board model sources
set(BOARD_MODEL_SRCS
${KICAD_SOURCE}/pcbnew/board.cpp
${KICAD_SOURCE}/pcbnew/board_item.cpp
${KICAD_SOURCE}/pcbnew/board_connected_item.cpp
${KICAD_SOURCE}/pcbnew/footprint.cpp
${KICAD_SOURCE}/pcbnew/pad.cpp
${KICAD_SOURCE}/pcbnew/pcb_track.cpp
${KICAD_SOURCE}/pcbnew/zone.cpp
${KICAD_SOURCE}/pcbnew/pcb_shape.cpp
${KICAD_SOURCE}/pcbnew/pcb_text.cpp
${KICAD_SOURCE}/pcbnew/pcb_field.cpp
${KICAD_SOURCE}/pcbnew/pcb_group.cpp
${KICAD_SOURCE}/pcbnew/netinfo_item.cpp
${KICAD_SOURCE}/pcbnew/netinfo_list.cpp
${KICAD_SOURCE}/pcbnew/padstack.cpp
${KICAD_SOURCE}/pcbnew/zone_settings.cpp
${KICAD_SOURCE}/pcbnew/board_design_settings.cpp
)
add_library(board_model STATIC
${COMMON_SRCS}
${BOARD_MODEL_SRCS}
)
target_include_directories(board_model PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/wasm-config
${CMAKE_CURRENT_SOURCE_DIR}/stubs
${WX_INCLUDE_DIRS}
${THIRDPARTY_INCLUDE_DIRS}
${KICAD_SOURCE}/include
${KICAD_SOURCE}/pcbnew
${KICAD_SOURCE}/libs/kimath/include
${KICAD_SOURCE}/libs/core/include
)
target_link_libraries(board_model PUBLIC
kimath
sexpr
kicad_core_utils
)
target_compile_definitions(board_model PRIVATE
KICAD_CORE_ONLY=1
PCBNEW=1
)
# =============================================================================
# Combined kicad_core library
# =============================================================================
add_library(kicad_core INTERFACE)
target_link_libraries(kicad_core INTERFACE
board_model
kimath
sexpr
kicad_core_utils
clipper2
rtree
)
# =============================================================================
# Test executable (optional)
# =============================================================================
option(BUILD_TESTS "Build test executables" ON)
if(BUILD_TESTS)
add_executable(test_kimath
${CMAKE_CURRENT_SOURCE_DIR}/src/test_kimath.cpp
)
target_link_libraries(test_kimath PRIVATE kimath sexpr)
endif()
# =============================================================================
# Summary
# =============================================================================
message(STATUS "")
message(STATUS "kicad_core configuration:")
message(STATUS " KiCad source: ${KICAD_SOURCE}")
message(STATUS " Verbose logging: ${KICAD_CORE_VERBOSE}")
message(STATUS " Build tests: ${BUILD_TESTS}")
message(STATUS "")

View file

@ -1,70 +0,0 @@
/*
* advanced_config.h - Stub for kicad-core standalone build
*
* Provides default configuration values without wx dependencies
*/
#ifndef KICAD_CORE_ADVANCED_CONFIG_H
#define KICAD_CORE_ADVANCED_CONFIG_H
// Stub ADVANCED_CFG class with default values
class ADVANCED_CFG {
public:
// Triangulation settings (defaults from KiCad)
int m_TriangulateSimplificationLevel = 50;
double m_TriangulateMinimumArea = 1000.0;
// Other settings that might be accessed
bool m_EnableLibWithText = false;
bool m_EnableEeschemaPrintCairo = false;
int m_UpdateUIEventInterval = 0;
double m_DrawArcAccuracy = 0.005;
double m_DrawArcCenterMaxAngle = 50.0;
int m_MaxUndoItems = 0;
double m_MinPlotPenWidth = 0.0;
int m_3DRT_BevelExtentFactor = 1;
int m_3DRT_BevelHeight_um = 30;
bool m_ShowRepairSchematic = false;
bool m_ShowPropertiesPanel = true;
bool m_ShowEventCounters = false;
bool m_AllowManualCanvasScale = false;
double m_CanvasScale = 1.0;
bool m_CompactSave = false;
int m_CoroutineStackSize = 0;
int m_DrawBoundingBoxes = 0;
bool m_ShowPcbnewExportNetlist = false;
bool m_Skip3DModelFileCache = false;
bool m_Skip3DModelMemoryCache = false;
bool m_HideVersionFromTitle = false;
bool m_TraceMasks = false;
bool m_ShowRouterDebugGraphics = false;
bool m_ExtraZoneDisplayModes = false;
double m_MinClrDistance = 0.0;
bool m_DebugZoneFiller = false;
bool m_DebugPDFWriter = false;
int m_HotkeysDumper = 0;
bool m_DrawTriangulationOutlines = false;
bool m_StrokeTriangulation = false;
bool m_ExtraClearance = false;
double m_SmallDrillMarkSize = 0.0;
int m_HoleijWallThickness = 0;
int m_MaxTangentAngleDeviation = 1;
int m_MaxClearanceDistanceFactor = 2;
int m_ViaijFillMinRatio = 0;
bool m_RealtimeConnectivity = true;
bool m_EnableCacheFriendlyFracture = true;
double m_FontErrorSize = 0.0;
double m_OcctVerbosity = 0.0;
bool m_Use3DConnexionDriver = false;
bool m_IncrementalConnectivity = true;
static ADVANCED_CFG& GetCfg() {
static ADVANCED_CFG instance;
return instance;
}
private:
ADVANCED_CFG() = default;
};
#endif // KICAD_CORE_ADVANCED_CONFIG_H

View file

@ -1,19 +0,0 @@
/*
* string_utils.h - Minimal stub for kicad-core
*
* The sexpr library only uses From_UTF8() which is defined in wx_shim.h
*/
#ifndef KICAD_CORE_STRING_UTILS_H
#define KICAD_CORE_STRING_UTILS_H
#include "wx_shim.h"
// From_UTF8 is already defined in wx_shim.h
// Additional string utilities that might be needed
inline std::string To_UTF8(const wxString& str) {
return str;
}
#endif // KICAD_CORE_STRING_UTILS_H

View file

@ -1,27 +0,0 @@
// Stub wx/confbase.h - minimal config base for kicad-core
#ifndef _WX_CONFBASE_H_
#define _WX_CONFBASE_H_
#include "wx_shim.h"
// Minimal wxConfigBase stub
class wxConfigBase {
public:
virtual ~wxConfigBase() = default;
// Minimal interface - returns false/empty for everything
virtual bool Read(const wxString& key, wxString* str) const { return false; }
virtual bool Read(const wxString& key, long* val) const { return false; }
virtual bool Read(const wxString& key, double* val) const { return false; }
virtual bool Read(const wxString& key, bool* val) const { return false; }
virtual bool Write(const wxString& key, const wxString& value) { return false; }
virtual bool Write(const wxString& key, long value) { return false; }
virtual bool Write(const wxString& key, double value) { return false; }
virtual bool Write(const wxString& key, bool value) { return false; }
static wxConfigBase* Get(bool createOnDemand = true) { return nullptr; }
static wxConfigBase* Set(wxConfigBase* config) { return nullptr; }
};
#endif // _WX_CONFBASE_H_

View file

@ -1,5 +0,0 @@
// Stub wx/debug.h - redirects to wx_shim.h
#ifndef _WX_DEBUG_H_
#define _WX_DEBUG_H_
#include "wx_shim.h"
#endif

View file

@ -1,5 +0,0 @@
// Stub wx/ffile.h - redirects to wx_shim.h
#ifndef _WX_FFILE_H_
#define _WX_FFILE_H_
#include "wx_shim.h"
#endif

View file

@ -1,5 +0,0 @@
// Stub wx/file.h - redirects to wx_shim.h
#ifndef _WX_FILE_H_
#define _WX_FILE_H_
#include "wx_shim.h"
#endif

View file

@ -1,5 +0,0 @@
// Stub wx/log.h - redirects to wx_shim.h
#ifndef _WX_LOG_H_
#define _WX_LOG_H_
#include "wx_shim.h"
#endif

View file

@ -1,5 +0,0 @@
// Stub wx/string.h - redirects to wx_shim.h
#ifndef _WX_STRING_H_
#define _WX_STRING_H_
#include "wx_shim.h"
#endif

View file

@ -1,264 +0,0 @@
/*
* wx_shim.h - Minimal wxWidgets compatibility layer for kicad-core
*
* Provides drop-in replacements for wx utility macros/functions used in
* KiCad's core computation libraries. This is NOT a port of wxWidgets -
* just ~100 lines of standard C++ that replaces debug/logging utilities.
*
* Used macros in kimath:
* - wxASSERT, wxASSERT_MSG
* - wxCHECK, wxCHECK_MSG, wxCHECK2_MSG, wxCHECK_RET
* - wxFAIL_MSG
* - wxLogTrace, wxLogDebug, wxLogWarning
* - wxString, wxString::Format
* - wxT()
*/
#ifndef KICAD_WX_SHIM_H
#define KICAD_WX_SHIM_H
#include <cassert>
#include <string>
#include <cstdio>
#include <cstdarg>
#include <sstream>
// =============================================================================
// Assertions
// =============================================================================
#define wxASSERT(cond) assert(cond)
#define wxASSERT_MSG(cond, msg) assert(cond) // msg ignored in release
// wxCHECK variants - check condition, return if false
#define wxCHECK(cond, ret) do { if(!(cond)) return ret; } while(0)
#define wxCHECK_MSG(cond, ret, msg) do { if(!(cond)) return ret; } while(0)
#define wxCHECK_RET(cond, msg) do { if(!(cond)) return; } while(0)
#define wxCHECK2(cond, op) do { if(!(cond)) { op; } } while(0)
#define wxCHECK2_MSG(cond, op, msg) do { if(!(cond)) { op; } } while(0)
#define wxFAIL_MSG(msg) assert(false) // msg ignored in standalone build
// =============================================================================
// Logging - mostly no-ops for core library
// =============================================================================
// Trace logging - typically disabled in release builds anyway
#define wxLogTrace(...) ((void)0)
#define wxLogDebug(...) ((void)0)
// Warnings - optionally print to stderr
#ifdef KICAD_CORE_VERBOSE
#define wxLogWarning(fmt, ...) fprintf(stderr, "Warning: " fmt "\n", ##__VA_ARGS__)
#else
#define wxLogWarning(...) ((void)0)
#endif
// Variable argument version
inline void wxVLogWarning(const char* format, va_list args) {
#ifdef KICAD_CORE_VERBOSE
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
#else
(void)format;
(void)args;
#endif
}
// Log level checking - always returns false (logging disabled)
namespace wxLog {
inline bool IsLevelEnabled(int, const std::string&) { return false; }
inline void EnableLogging(bool enable = true) { (void)enable; }
inline bool IsLoggingEnabled() { return false; }
}
// Log level constants
constexpr int wxLOG_Debug = 0;
// Log component macro
#ifndef wxLOG_COMPONENT
#define wxLOG_COMPONENT "kicad-core"
#endif
// =============================================================================
// String utilities
// =============================================================================
// wxChar type
using wxChar = char;
// wxT() macro - pass through (we're always using UTF-8)
#define wxT(x) x
// wxASCII_STR for older wx compatibility
#define wxASCII_STR(s) std::string(s)
// Helper to convert args for snprintf - strings need c_str()
template<typename T>
struct FormatArg {
static auto convert(const T& arg) { return arg; }
};
template<>
struct FormatArg<std::string> {
static const char* convert(const std::string& arg) { return arg.c_str(); }
};
// Forward declaration for wxString specialization
class wxString;
template<>
struct FormatArg<wxString> {
static const char* convert(const wxString& arg);
};
// wxString class with static Format method
class wxString : public std::string {
public:
// Inherit constructors
using std::string::string;
// Additional constructors for compatibility
wxString() : std::string() {}
wxString(const std::string& s) : std::string(s) {}
wxString(const char* s) : std::string(s ? s : "") {}
// Static Format method - converts string args to c_str()
template<typename... Args>
static wxString Format(const char* fmt, Args... args) {
char buf[2048];
snprintf(buf, sizeof(buf), fmt, FormatArg<Args>::convert(args)...);
return wxString(buf);
}
static wxString Format(const wxString& fmt) {
return fmt;
}
// FromAscii static method
static wxString FromAscii(const char* s) {
return wxString(s ? s : "");
}
// c_str() for compatibility (inherited from std::string but explicit)
const char* c_str() const { return std::string::c_str(); }
// RemoveLast - removes last n characters
void RemoveLast(size_t n = 1) {
if (n <= size()) {
resize(size() - n);
} else {
clear();
}
}
// Truncate - truncate to given length
void Truncate(size_t len) {
if (len < size()) {
resize(len);
}
}
};
// Define the wxString FormatArg specialization now that wxString is defined
inline const char* FormatArg<wxString>::convert(const wxString& arg) {
return arg.c_str();
}
// Empty string constant
inline const wxString wxEmptyString = wxString("");
// =============================================================================
// File I/O utilities
// =============================================================================
#include <fstream>
// wxFFile - File wrapper class
class wxFFile {
FILE* m_fp = nullptr;
bool m_close = false;
public:
wxFFile() = default;
wxFFile(const wxString& filename, const char* mode = "r") {
Open(filename, mode);
}
~wxFFile() { Close(); }
bool Open(const wxString& filename, const char* mode = "r") {
Close();
m_fp = fopen(filename.c_str(), mode);
m_close = (m_fp != nullptr);
return m_fp != nullptr;
}
bool IsOpened() const { return m_fp != nullptr; }
void Close() {
if (m_fp && m_close) {
fclose(m_fp);
}
m_fp = nullptr;
m_close = false;
}
size_t Read(void* buffer, size_t count) {
if (!m_fp) return 0;
return fread(buffer, 1, count, m_fp);
}
size_t Write(const void* buffer, size_t count) {
if (!m_fp) return 0;
return fwrite(buffer, 1, count, m_fp);
}
bool ReadAll(wxString* str) {
if (!m_fp || !str) return false;
// Get file size
long pos = ftell(m_fp);
fseek(m_fp, 0, SEEK_END);
long size = ftell(m_fp);
fseek(m_fp, pos, SEEK_SET);
// Read content
str->resize(size);
size_t read = fread(&(*str)[0], 1, size, m_fp);
str->resize(read);
return read > 0;
}
size_t Length() const {
if (!m_fp) return 0;
long pos = ftell(m_fp);
fseek(m_fp, 0, SEEK_END);
long size = ftell(m_fp);
fseek(m_fp, pos, SEEK_SET);
return static_cast<size_t>(size);
}
bool Eof() const {
return m_fp ? feof(m_fp) != 0 : true;
}
bool Seek(long offset, int origin = SEEK_SET) {
return m_fp ? fseek(m_fp, offset, origin) == 0 : false;
}
long Tell() const {
return m_fp ? ftell(m_fp) : -1;
}
};
// From_UTF8 - passthrough for UTF-8 strings
inline wxString From_UTF8(const char* s) {
return wxString(s ? s : "");
}
// =============================================================================
// Replacement for wx headers
// =============================================================================
// Empty stubs for wx includes - these get included but do nothing
// Create empty headers in core/include/wx/
#endif // KICAD_WX_SHIM_H

View file

@ -1,57 +0,0 @@
/*
* test_kimath.cpp - Test kimath and sexpr without wxWidgets
*/
#include <iostream>
#include <math/vector2d.h>
#include <geometry/seg.h>
#include <geometry/shape_poly_set.h>
#include <sexpr/sexpr.h>
#include <sexpr/sexpr_parser.h>
int main() {
std::cout << "Testing kimath standalone build...\n";
// Test VECTOR2I
VECTOR2I p1(0, 0);
VECTOR2I p2(100, 100);
std::cout << "Created VECTOR2I: (" << p1.x << "," << p1.y << ") and ("
<< p2.x << "," << p2.y << ")\n";
// Test SEG
SEG segment(p1, p2);
int length = segment.Length();
std::cout << "SEG length: " << length << "\n";
// Test SHAPE_POLY_SET
SHAPE_POLY_SET poly;
poly.NewOutline();
poly.Append(0, 0);
poly.Append(1000, 0);
poly.Append(1000, 1000);
poly.Append(0, 1000);
std::cout << "Created polygon with " << poly.OutlineCount() << " outline(s)\n";
std::cout << "Polygon area: " << poly.Area() << "\n";
// Test S-expression parser
std::cout << "\nTesting S-expression parser...\n";
std::string test_sexpr = "(kicad_pcb (version 20231014) (generator \"test\") (layer F.Cu front copper))";
SEXPR::PARSER parser;
std::unique_ptr<SEXPR::SEXPR> parsed = parser.Parse(test_sexpr);
if (parsed && parsed->IsList()) {
const SEXPR::SEXPR_VECTOR* list = parsed->GetChildren();
std::cout << "Parsed S-expr with " << list->size() << " elements\n";
if (!list->empty() && (*list)[0]->IsSymbol()) {
std::cout << "Root element: " << (*list)[0]->GetSymbol() << "\n";
}
} else {
std::cout << "Failed to parse S-expression\n";
return 1;
}
std::cout << "\nkimath + sexpr standalone build: SUCCESS!\n";
return 0;
}

View file

@ -1,31 +0,0 @@
/*
* config.h - Minimal config for kicad-core standalone build
*
* This replaces the auto-generated config.h from KiCad's CMake
*/
#ifndef KICAD_CORE_CONFIG_H
#define KICAD_CORE_CONFIG_H
// Platform detection for timing functions
#if defined(_WIN32)
// Windows uses GetSystemTimeAsFileTime
#elif defined(__EMSCRIPTEN__) || defined(__APPLE__) || defined(__linux__) || defined(__unix__)
#define HAVE_CLOCK_GETTIME 1
#else
#define HAVE_GETTIMEOFDAY_FUNC 1
#endif
// Version info
#define KICAD_MAJOR_VERSION 8
#define KICAD_MINOR_VERSION 0
#define KICAD_PATCH_VERSION 0
#define KICAD_VERSION_FULL "8.0.0-wasm"
// Feature flags - all disabled for core-only build
#define KICAD_USE_CURL 0
#define KICAD_USE_GIT 0
#define KICAD_USE_OCC 0
#define KICAD_USE_NGSPICE 0
#endif // KICAD_CORE_CONFIG_H

View file

@ -1,53 +0,0 @@
#!/bin/bash
# Build KiCad core library for WebAssembly
# This builds kimath, sexpr, and core utilities with wxBase
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/core"
CORE_SOURCE="$PROJECT_ROOT/core"
echo "=== Building KiCad Core for WASM ==="
echo "Project root: $PROJECT_ROOT"
echo "Build dir: $BUILD_DIR"
echo "Core source: $CORE_SOURCE"
# Verify core source exists
if [ ! -f "$CORE_SOURCE/CMakeLists.txt" ]; then
echo "ERROR: Core source not found at $CORE_SOURCE"
exit 1
fi
# Verify wxBase was built
if [ ! -f "$PROJECT_ROOT/build-wasm/wxwidgets/lib/libwx_baseu-3.2-Emscripten.a" ]; then
echo "ERROR: wxBase not built. Run scripts/build-wxbase-wasm.sh first"
exit 1
fi
# Clean if requested (must be before mkdir to properly reset CMake cache)
if [ "$1" = "--clean" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with emcmake
echo ""
echo "=== Configuring ==="
emcmake cmake "$CORE_SOURCE" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTS=OFF
# Build
echo ""
echo "=== Building ==="
emmake make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
echo ""
echo "=== Build complete ==="
ls -lh "$BUILD_DIR"/*.a 2>/dev/null || echo "Libraries built in $BUILD_DIR"

View file

@ -1,222 +0,0 @@
#!/bin/bash
# Master build script for KiCad PCBnew WASM
# Usage: ./build-kicad-wasm.sh [OPTIONS]
#
# Options:
# --clean Full clean rebuild
# --deps-only Only build dependencies
# --skip-deps Skip dependency builds
# --with-occ Enable OpenCASCADE (3D/STEP support)
# --with-ngspice Enable ngspice (simulation)
# --with-pthread Enable pthreads (multi-threading)
# --release Release build (optimized, no debug symbols)
# --debug Debug build with symbols (default)
# -j N Parallel jobs (default: nproc)
# --help Show this help
set -e
# Source common environment
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/common/env.sh"
# Default options
DEPS_ONLY=0
SKIP_DEPS=0
WITH_OCC=0
WITH_NGSPICE=0
WITH_PTHREAD=0
# Show help
show_help() {
head -20 "$0" | tail -18 | sed 's/^# //' | sed 's/^#//'
exit 0
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--help|-h)
show_help
;;
--clean)
CLEAN_BUILD=1
shift
;;
--deps-only)
DEPS_ONLY=1
shift
;;
--skip-deps)
SKIP_DEPS=1
shift
;;
--with-occ)
WITH_OCC=1
shift
;;
--with-ngspice)
WITH_NGSPICE=1
shift
;;
--with-pthread)
WITH_PTHREAD=1
shift
;;
--debug)
DEBUG_BUILD=1
shift
;;
--release)
DEBUG_BUILD=0
shift
;;
-j)
PARALLEL_JOBS="$2"
shift 2
;;
-j*)
PARALLEL_JOBS="${1#-j}"
shift
;;
*)
log_error "Unknown option: $1"
show_help
;;
esac
done
# Set defaults if not set
CLEAN_BUILD=${CLEAN_BUILD:-0}
DEBUG_BUILD=${DEBUG_BUILD:-1} # Debug mode by default (use --release for optimized builds)
PARALLEL_JOBS=${PARALLEL_JOBS:-$(get_nproc)}
# Export for sub-scripts
export CLEAN_BUILD DEBUG_BUILD PARALLEL_JOBS WITH_OCC WITH_NGSPICE WITH_PTHREAD
# Print configuration
echo "========================================"
echo "KiCad WASM Build"
echo "========================================"
echo " Clean build: $CLEAN_BUILD"
echo " Debug build: $DEBUG_BUILD"
echo " Deps only: $DEPS_ONLY"
echo " Skip deps: $SKIP_DEPS"
echo " With OCC: $WITH_OCC"
echo " With ngspice: $WITH_NGSPICE"
echo " With pthreads: $WITH_PTHREAD"
echo " Parallel jobs: $PARALLEL_JOBS"
echo "========================================"
# Verify prerequisites
setup_error_trap
verify_emscripten
verify_submodules "$PROJECT_ROOT"
# Clean if requested
if [ "$CLEAN_BUILD" = "1" ]; then
log_step "Cleaning previous builds..."
rm -rf "$STAMPS_DIR"/*
rm -rf "$DEPS_ROOT"/*
rm -rf "$BUILD_ROOT/kicad"
fi
# Build dependencies
if [ "$SKIP_DEPS" != "1" ]; then
log_step "Building dependencies..."
# Tier 1: Header-only (just verify they exist)
log_info "Tier 1: Header-only libraries (no build needed)"
# Tier 2: Simple C/C++ libraries from thirdparty
log_info "Tier 2: Simple libraries"
# These are built as part of KiCad's CMake, no separate build needed
# Tier 3: Emscripten ports
log_info "Tier 3: Emscripten ports (zlib, freetype via -sUSE_*)"
# These are linked via emscripten flags, no separate build
# Build Zstd
if [ -f "$SCRIPT_DIR/build-deps/build-zstd-wasm.sh" ]; then
build_if_needed "zstd" "$SCRIPT_DIR/build-deps/build-zstd-wasm.sh" "$CLEAN_BUILD"
else
log_warn "Zstd build script not found, skipping"
fi
# Build HarfBuzz
if [ -f "$SCRIPT_DIR/build-deps/build-harfbuzz-wasm.sh" ]; then
build_if_needed "harfbuzz" "$SCRIPT_DIR/build-deps/build-harfbuzz-wasm.sh" "$CLEAN_BUILD"
else
log_warn "HarfBuzz build script not found, skipping"
fi
# Build Pixman
if [ -f "$SCRIPT_DIR/build-deps/build-pixman-wasm.sh" ]; then
build_if_needed "pixman" "$SCRIPT_DIR/build-deps/build-pixman-wasm.sh" "$CLEAN_BUILD"
else
log_warn "Pixman build script not found, skipping"
fi
# Build Cairo
if [ -f "$SCRIPT_DIR/build-deps/build-cairo-wasm.sh" ]; then
build_if_needed "cairo" "$SCRIPT_DIR/build-deps/build-cairo-wasm.sh" "$CLEAN_BUILD"
else
log_warn "Cairo build script not found, skipping"
fi
# Tier 4: Complex dependencies
if [ "$WITH_OCC" = "1" ]; then
log_info "Tier 4: Building OpenCASCADE..."
if [ -f "$SCRIPT_DIR/build-deps/build-opencascade-wasm.sh" ]; then
build_if_needed "opencascade" "$SCRIPT_DIR/build-deps/build-opencascade-wasm.sh" "$CLEAN_BUILD"
else
log_warn "OpenCASCADE build script not found"
fi
fi
if [ "$WITH_NGSPICE" = "1" ]; then
log_info "Tier 4: Building ngspice..."
if [ -f "$SCRIPT_DIR/build-deps/build-ngspice-wasm.sh" ]; then
build_if_needed "ngspice" "$SCRIPT_DIR/build-deps/build-ngspice-wasm.sh" "$CLEAN_BUILD"
else
log_warn "ngspice build script not found"
fi
fi
# Verify wxWidgets is built
if [ ! -f "$WX_BUILD/wx-config" ]; then
log_step "Building wxWidgets..."
"$SCRIPT_DIR/build-wxuniversal-wasm.sh"
else
log_info "wxWidgets already built"
fi
log_info "Dependencies complete"
fi
if [ "$DEPS_ONLY" = "1" ]; then
log_info "Dependency build complete (--deps-only specified)"
exit 0
fi
# Build KiCad compatibility layer
log_step "Building WASM compatibility layer..."
if [ -f "$SCRIPT_DIR/build-wasm-compat.sh" ]; then
"$SCRIPT_DIR/build-wasm-compat.sh"
else
log_warn "WASM compatibility layer script not found, skipping"
fi
# Build KiCad PCBnew
log_step "Building KiCad PCBnew..."
if [ -f "$SCRIPT_DIR/build-pcbnew-wasm.sh" ]; then
"$SCRIPT_DIR/build-pcbnew-wasm.sh"
else
log_error "PCBnew build script not found: $SCRIPT_DIR/build-pcbnew-wasm.sh"
exit 1
fi
log_info "========================================"
log_info "Build complete!"
log_info "Output: $BUILD_ROOT/kicad/pcbnew/"
log_info "========================================"

View file

@ -1,67 +0,0 @@
#!/bin/bash
# Build wxBase (non-GUI wxWidgets) for WebAssembly
# This builds only the base utilities needed by KiCad core (wxString, wxFile, etc.)
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
echo "=== Building wxBase for WASM ==="
echo "Project root: $PROJECT_ROOT"
echo "Build dir: $BUILD_DIR"
echo "wxWidgets source: $WX_SOURCE"
# Verify we're in the right place
if [ ! -f "$WX_SOURCE/CMakeLists.txt" ]; then
echo "ERROR: wxWidgets source not found at $WX_SOURCE"
echo "Make sure the wxwidgets submodule is initialized"
exit 1
fi
# Clean if requested (must be before mkdir to properly reset CMake cache)
if [ "$1" = "--clean" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Configure with emcmake
# Disable all GUI and most optional features - we only need wxBase utilities
# Note: zlib/expat "builtin" versions use POSIX file descriptors not available in WASM,
# so we disable them. We'll use Emscripten's ports if compression is needed.
emcmake cmake "$WX_SOURCE" \
-DwxUSE_GUI=OFF \
-DwxBUILD_SHARED=OFF \
-DwxBUILD_SAMPLES=OFF \
-DwxBUILD_TESTS=OFF \
-DwxBUILD_DEMOS=OFF \
-DwxBUILD_BENCHMARKS=OFF \
-DwxUSE_REGEX=builtin \
-DwxUSE_ZLIB=OFF \
-DwxUSE_EXPAT=OFF \
-DwxUSE_LIBJPEG=OFF \
-DwxUSE_LIBPNG=OFF \
-DwxUSE_LIBTIFF=OFF \
-DwxUSE_WEBREQUEST=OFF \
-DwxUSE_SECRETSTORE=OFF \
-DwxUSE_LIBSDL=OFF \
-DwxUSE_LIBMSPACK=OFF \
-DwxUSE_FSWATCHER=OFF \
-DwxUSE_XLOCALE=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
# Build
echo ""
echo "=== Building ==="
emmake make -j$(nproc 2>/dev/null || sysctl -n hw.ncpu)
echo ""
echo "=== Build complete ==="
ls -lh "$BUILD_DIR"/lib/*.a 2>/dev/null || echo "Libraries built in $BUILD_DIR"

View file

@ -1,178 +0,0 @@
#!/bin/bash
# Build wxWidgets for WASM from a clean clone + patches
# This tests that our patches can reproduce the build
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
PATCHES_DIR="$PROJECT_ROOT/patches/wxwidgets-wasm"
CLONE_DIR="$PROJECT_ROOT/wxwidgets-clean"
BUILD_DIR="$PROJECT_ROOT/build-wasm/wxwidgets-clean"
REFERENCE_BUILD="$PROJECT_ROOT/build-wasm/wxwidgets-universal"
# Configuration - fork URL and commit
WX_REPO="git@github.com:VV-EE/wxWidgets.git"
WX_COMMIT="5ff25322553c1870cf20a2e1ba6f20ed50d9fe9a"
# Parse arguments
CLEAN=false
SKIP_BUILD=false
while [[ $# -gt 0 ]]; do
case $1 in
--clean) CLEAN=true; shift ;;
--skip-build) SKIP_BUILD=true; shift ;;
--help)
echo "Usage: $0 [OPTIONS]"
echo " --clean Force fresh clone (remove existing)"
echo " --skip-build Only clone and patch, skip building"
exit 0
;;
*) echo "Unknown option: $1"; exit 1 ;;
esac
done
echo "=== wxWidgets WASM Clean Build ==="
echo "Repository: $WX_REPO"
echo "Commit: $WX_COMMIT"
echo "Clone dir: $CLONE_DIR"
echo "Build dir: $BUILD_DIR"
echo ""
# Verify patch exists
if [ ! -f "$PATCHES_DIR/wxwidgets-wasm.patch" ]; then
echo "ERROR: Patch not found: $PATCHES_DIR/wxwidgets-wasm.patch"
echo "Run ./scripts/generate-wxwidgets-patches.sh first"
exit 1
fi
# Verify checksums
echo "=== Verifying patch checksums ==="
cd "$PATCHES_DIR"
if ! shasum -a 256 -c checksums.sha256; then
echo "ERROR: Patch checksum verification failed"
exit 1
fi
echo "Checksums OK"
echo ""
# Step 1: Clone repository
echo "=== Step 1: Clone repository ==="
if [ "$CLEAN" = true ] || [ ! -d "$CLONE_DIR/.git" ]; then
rm -rf "$CLONE_DIR"
echo "Cloning $WX_REPO..."
git clone "$WX_REPO" "$CLONE_DIR"
cd "$CLONE_DIR"
git checkout "$WX_COMMIT"
else
echo "Using existing clone at $CLONE_DIR"
cd "$CLONE_DIR"
git fetch origin
git checkout "$WX_COMMIT"
git reset --hard "$WX_COMMIT"
fi
echo ""
# Step 2: Initialize submodules
echo "=== Step 2: Initialize submodules ==="
git submodule update --init --recursive
echo ""
# Step 3: Apply the unified patch
echo "=== Step 3: Apply unified patch ==="
echo "Applying wxwidgets-wasm.patch..."
patch -p1 < "$PATCHES_DIR/wxwidgets-wasm.patch"
echo ""
if [ "$SKIP_BUILD" = true ]; then
echo "=== Skipping build (--skip-build) ==="
echo "Clone and patch complete. Source ready at: $CLONE_DIR"
exit 0
fi
# Step 4: Configure and build
echo "=== Step 4: Configure ==="
rm -rf "$BUILD_DIR"
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
export CFLAGS="-DZ_HAVE_UNISTD_H=1"
export CXXFLAGS="-DZ_HAVE_UNISTD_H=1"
emconfigure "$CLONE_DIR/configure" \
--host=emscripten \
--enable-universal \
--disable-shared \
--with-opengl \
--disable-exceptions \
--disable-richtext \
--without-libtiff \
--disable-xlocale \
--with-cxx=17 \
--enable-utf8
echo ""
echo "=== Step 5: Build ==="
emmake make -j$(sysctl -n hw.ncpu 2>/dev/null || nproc 2>/dev/null || echo 4)
echo ""
echo "=== Step 6: Verify and compare ==="
# List built libraries
echo "Built libraries:"
ls -lh "$BUILD_DIR/lib/"*.a 2>/dev/null || echo "No libraries found"
# Compare with reference build if it exists
if [ -d "$REFERENCE_BUILD/lib" ]; then
echo ""
echo "=== Comparison with reference build ==="
printf "%-50s %12s %12s %10s\n" "Library" "Reference" "Clean" "Match"
printf "%-50s %12s %12s %10s\n" "-------" "---------" "-----" "-----"
MISMATCH=0
for lib in "$BUILD_DIR/lib/"*.a; do
basename=$(basename "$lib")
ref_lib="$REFERENCE_BUILD/lib/$basename"
if [ -f "$ref_lib" ]; then
# Get sizes (macOS stat syntax)
new_size=$(stat -f%z "$lib" 2>/dev/null || stat -c%s "$lib")
ref_size=$(stat -f%z "$ref_lib" 2>/dev/null || stat -c%s "$ref_lib")
if [ "$new_size" -eq "$ref_size" ]; then
match="YES"
else
match="NO (diff: $((new_size - ref_size)))"
MISMATCH=1
fi
printf "%-50s %12d %12d %10s\n" "$basename" "$ref_size" "$new_size" "$match"
else
printf "%-50s %12s %12d %10s\n" "$basename" "(missing)" "$new_size" "NEW"
fi
done
# Check for libraries in reference but not in clean build
for lib in "$REFERENCE_BUILD/lib/"*.a; do
basename=$(basename "$lib")
if [ ! -f "$BUILD_DIR/lib/$basename" ]; then
ref_size=$(stat -f%z "$lib" 2>/dev/null || stat -c%s "$lib")
printf "%-50s %12d %12s %10s\n" "$basename" "$ref_size" "(missing)" "MISSING"
MISMATCH=1
fi
done
echo ""
if [ "$MISMATCH" -eq 0 ]; then
echo "SUCCESS: All libraries match!"
else
echo "WARNING: Some libraries differ (this may be expected due to build timestamps)"
fi
else
echo ""
echo "No reference build found at $REFERENCE_BUILD"
echo "Run ./scripts/build-wxuniversal-wasm.sh first to create a reference"
fi
echo ""
echo "=== Build complete ==="
echo "Libraries in: $BUILD_DIR/lib/"

View file

@ -1,162 +0,0 @@
#!/bin/bash
#
# KiCad Wasm Port - Build Script
#
# This script builds KiCad with optional dependencies disabled.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
KICAD_DIR="$PROJECT_ROOT/kicad"
BUILD_DIR="$PROJECT_ROOT/build"
CMAKE_MODULE_PATH="$PROJECT_ROOT/cmake"
STUBS_DIR="$PROJECT_ROOT/stubs/include"
# Default options
USE_CURL="${KICAD_USE_CURL:-OFF}"
USE_GIT="${KICAD_USE_GIT:-OFF}"
USE_OCC="${KICAD_USE_OCC:-OFF}"
USE_NGSPICE="${KICAD_USE_NGSPICE:-OFF}"
BUILD_TYPE="${CMAKE_BUILD_TYPE:-Release}"
PARALLEL_JOBS="${PARALLEL_JOBS:-$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)}"
show_help() {
echo "KiCad Wasm Port - Build Script"
echo ""
echo "Usage: $0 [options]"
echo ""
echo "Options:"
echo " --with-curl Enable CURL (network features)"
echo " --with-git Enable libgit2 (git integration)"
echo " --with-occ Enable OpenCASCADE (STEP/3D)"
echo " --with-ngspice Enable ngspice (SPICE simulation)"
echo " --debug Build in Debug mode"
echo " --clean Clean build directory first"
echo " -j N Number of parallel jobs (default: $PARALLEL_JOBS)"
echo " --configure-only Only run cmake, don't build"
echo " -h, --help Show this help"
echo ""
echo "Environment variables:"
echo " KICAD_USE_CURL=ON|OFF (default: OFF)"
echo " KICAD_USE_GIT=ON|OFF (default: OFF)"
echo " KICAD_USE_OCC=ON|OFF (default: OFF)"
echo " KICAD_USE_NGSPICE=ON|OFF (default: OFF)"
echo " CMAKE_BUILD_TYPE=Release|Debug"
echo ""
}
CLEAN_BUILD=0
CONFIGURE_ONLY=0
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--with-curl)
USE_CURL=ON
shift
;;
--with-git)
USE_GIT=ON
shift
;;
--with-occ)
USE_OCC=ON
shift
;;
--with-ngspice)
USE_NGSPICE=ON
shift
;;
--debug)
BUILD_TYPE=Debug
shift
;;
--clean)
CLEAN_BUILD=1
shift
;;
-j)
PARALLEL_JOBS="$2"
shift 2
;;
--configure-only)
CONFIGURE_ONLY=1
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo "Unknown option: $1"
show_help
exit 1
;;
esac
done
echo "=== KiCad Wasm Port - Build ==="
echo ""
echo "Configuration:"
echo " Build type: $BUILD_TYPE"
echo " CURL: $USE_CURL"
echo " Git: $USE_GIT"
echo " OpenCASCADE: $USE_OCC"
echo " ngspice: $USE_NGSPICE"
echo " Parallel jobs: $PARALLEL_JOBS"
echo ""
# Check if kicad exists
if [ ! -f "$KICAD_DIR/CMakeLists.txt" ]; then
echo "Error: KiCad source not found at $KICAD_DIR"
echo "Run: git submodule update --init --recursive"
exit 1
fi
# Clean if requested
if [ $CLEAN_BUILD -eq 1 ] && [ -d "$BUILD_DIR" ]; then
echo "Cleaning build directory..."
rm -rf "$BUILD_DIR"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
# Additional include paths for stubs
EXTRA_INCLUDES=""
if [ "$USE_CURL" = "OFF" ] || [ "$USE_GIT" = "OFF" ]; then
EXTRA_INCLUDES="-DCMAKE_CXX_FLAGS=-I$STUBS_DIR"
fi
# Configure
echo "Running CMake..."
cmake "$KICAD_DIR" \
-DCMAKE_BUILD_TYPE="$BUILD_TYPE" \
-DCMAKE_MODULE_PATH="$CMAKE_MODULE_PATH" \
-DKICAD_USE_CURL="$USE_CURL" \
-DKICAD_USE_GIT="$USE_GIT" \
-DKICAD_USE_OCC="$USE_OCC" \
-DKICAD_USE_NGSPICE="$USE_NGSPICE" \
-DKICAD_SCRIPTING_WXPYTHON=OFF \
-DKICAD_BUILD_QA_TESTS=OFF \
-DKICAD_BUILD_I18N=OFF \
$EXTRA_INCLUDES
if [ $CONFIGURE_ONLY -eq 1 ]; then
echo ""
echo "Configuration complete. Run 'make -j$PARALLEL_JOBS' in $BUILD_DIR to build."
exit 0
fi
# Build
echo ""
echo "Building..."
cmake --build . --parallel "$PARALLEL_JOBS"
echo ""
echo "=== Build Complete ==="
echo ""
echo "Binaries are in: $BUILD_DIR"

View file

@ -1,163 +0,0 @@
#!/bin/bash
# Generate a single unified patch from current wxwidgets state
# This captures ALL modifications including submodule config.sub changes
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
WX_SOURCE="$PROJECT_ROOT/wxwidgets"
PATCHES_DIR="$PROJECT_ROOT/patches/wxwidgets-wasm"
PATCH_FILE="$PATCHES_DIR/wxwidgets-wasm.patch"
echo "=== Generating wxWidgets WASM Unified Patch ==="
echo "Source: $WX_SOURCE"
echo "Output: $PATCH_FILE"
# Verify wxwidgets exists (check for .git as file or directory - submodules use a file)
if [ ! -e "$WX_SOURCE/.git" ]; then
echo "ERROR: wxwidgets is not a git repository"
exit 1
fi
# Create output directory
mkdir -p "$PATCHES_DIR"
cd "$WX_SOURCE"
# Capture current commit SHA (the base we're patching from)
CURRENT_COMMIT=$(git rev-parse HEAD)
echo ""
echo "Base commit: $CURRENT_COMMIT"
# Start with empty patch file
> "$PATCH_FILE"
echo ""
echo "=== Part 1: Main wxWidgets changes ==="
# Mark all untracked files as "intent to add" (allows git diff to see them)
git add -N .
# Generate main diff (excluding submodule directory pointers, but including everything else)
git diff HEAD -- . \
':!3rdparty/catch' \
':!3rdparty/nanosvg' \
':!3rdparty/pcre' \
':!src/expat' \
':!src/jpeg' \
':!src/png' \
':!src/tiff' \
':!src/zlib' \
>> "$PATCH_FILE"
# Undo the intent-to-add
git reset HEAD --quiet
MAIN_LINES=$(wc -l < "$PATCH_FILE")
echo "Added main changes ($MAIN_LINES lines so far)"
echo ""
echo "=== Part 2: Submodule config.sub changes ==="
# Process each submodule config.sub
add_submodule_config_sub() {
local submodule="$1"
local config_sub_path="$2"
local full_path="$WX_SOURCE/$config_sub_path"
if [ -d "$WX_SOURCE/$submodule" ] && [ -f "$full_path" ]; then
cd "$WX_SOURCE/$submodule"
# Get the relative path within the submodule
local rel_config_sub="${config_sub_path#$submodule/}"
# Check if config.sub is modified in this submodule
if ! git diff --quiet HEAD -- "$rel_config_sub" 2>/dev/null; then
echo " Adding $config_sub_path"
# Generate diff with paths rewritten to be relative to main repo
git diff HEAD -- "$rel_config_sub" | sed "s|a/$rel_config_sub|a/$config_sub_path|g; s|b/$rel_config_sub|b/$config_sub_path|g" >> "$PATCH_FILE"
else
echo " Skipping $config_sub_path (no changes)"
fi
else
echo " Skipping $submodule (not found)"
fi
}
add_submodule_config_sub "3rdparty/pcre" "3rdparty/pcre/config.sub"
add_submodule_config_sub "src/expat" "src/expat/expat/conftools/config.sub"
add_submodule_config_sub "src/jpeg" "src/jpeg/config.sub"
add_submodule_config_sub "src/png" "src/png/config.sub"
add_submodule_config_sub "src/tiff" "src/tiff/config/config.sub"
cd "$WX_SOURCE"
TOTAL_LINES=$(wc -l < "$PATCH_FILE")
echo ""
echo "Total patch: $TOTAL_LINES lines"
echo ""
echo "=== Generating checksums ==="
cd "$PATCHES_DIR"
shasum -a 256 *.patch > checksums.sha256
echo "Created checksums.sha256"
echo ""
echo "=== Generating README ==="
cat > README.md << EOF
# wxWidgets WASM Port Patch
Single unified patch that transforms wxWidgets into a WASM-capable build.
## Base Version
- Repository: git@github.com:VV-EE/wxWidgets.git
- Commit: $CURRENT_COMMIT
- Generated: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
## Patch Contents
This single patch includes:
- Main wxWidgets modifications (config.sub, configure.in, headers, sources)
- New WASM platform: src/wasm/, include/wx/wasm/
- New build files: build/wasm/
- WASM theme renderer: src/univ/themes/wasm.cpp
- Submodule config.sub updates for emscripten/wasm32 support:
- 3rdparty/pcre/config.sub
- src/expat/expat/conftools/config.sub
- src/jpeg/config.sub
- src/png/config.sub
- src/tiff/config/config.sub
## Apply Instructions
\`\`\`bash
# Clone wxWidgets fork at the base commit
git clone git@github.com:VV-EE/wxWidgets.git wxwidgets-clean
cd wxwidgets-clean
git checkout $CURRENT_COMMIT
git submodule update --init --recursive
# Apply the unified patch
patch -p1 < /path/to/patches/wxwidgets-wasm/wxwidgets-wasm.patch
# Build
mkdir build && cd build
emconfigure ../configure --host=emscripten --enable-universal ...
emmake make
\`\`\`
## Verification
\`\`\`bash
shasum -a 256 -c checksums.sha256
\`\`\`
EOF
echo "Created README.md"
echo ""
echo "=== Summary ==="
ls -lh "$PATCHES_DIR"
echo ""
echo "Unified patch generated successfully!"

View file

@ -1,120 +0,0 @@
#!/bin/bash
#
# KiCad Wasm Port - Prepare Script
#
# This script applies patches to the KiCad source code to enable
# building with optional dependencies disabled.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
KICAD_DIR="$PROJECT_ROOT/kicad"
PATCHES_DIR="$PROJECT_ROOT/patches"
echo "=== KiCad Wasm Port - Prepare ==="
echo "Project root: $PROJECT_ROOT"
echo "KiCad source: $KICAD_DIR"
echo ""
# Check if kicad submodule is initialized
if [ ! -f "$KICAD_DIR/CMakeLists.txt" ]; then
echo "Error: KiCad submodule not initialized."
echo "Run: git submodule update --init --recursive"
exit 1
fi
# Check if patches directory exists
if [ ! -d "$PATCHES_DIR" ]; then
echo "Error: Patches directory not found: $PATCHES_DIR"
exit 1
fi
# Function to check if a patch is already applied
patch_already_applied() {
local patch_file="$1"
# Try to reverse-apply the patch (dry run)
# If it succeeds, the patch is already applied
cd "$KICAD_DIR"
if git apply --reverse --check "$patch_file" 2>/dev/null; then
return 0
else
return 1
fi
}
# Function to apply a patch
apply_patch() {
local patch_file="$1"
local patch_name="$(basename "$patch_file")"
echo "Checking patch: $patch_name"
if patch_already_applied "$patch_file"; then
echo " -> Already applied, skipping"
return 0
fi
echo " -> Applying..."
cd "$KICAD_DIR"
# Try to apply the patch
if git apply --check "$patch_file" 2>/dev/null; then
git apply "$patch_file"
echo " -> Success"
else
echo " -> Warning: Patch may not apply cleanly, trying with -3 (three-way merge)"
if git apply -3 "$patch_file" 2>/dev/null; then
echo " -> Success with three-way merge"
else
echo " -> Error: Patch failed to apply"
echo " You may need to manually resolve conflicts or update the patch"
return 1
fi
fi
}
# Apply all patches in order
echo "Applying patches..."
echo ""
patch_count=0
patch_failed=0
for patch_file in "$PATCHES_DIR"/*.patch; do
if [ -f "$patch_file" ]; then
if apply_patch "$patch_file"; then
((patch_count++))
else
((patch_failed++))
fi
echo ""
fi
done
echo "=== Summary ==="
echo "Patches applied: $patch_count"
echo "Patches failed: $patch_failed"
if [ $patch_failed -gt 0 ]; then
echo ""
echo "Some patches failed to apply. Please check the errors above."
exit 1
fi
echo ""
echo "=== Next Steps ==="
echo ""
echo "Build with optional dependencies disabled:"
echo ""
echo " mkdir build && cd build"
echo " cmake ../kicad \\"
echo " -DKICAD_USE_CURL=OFF \\"
echo " -DKICAD_USE_GIT=OFF \\"
echo " -DKICAD_USE_OCC=OFF \\"
echo " -DKICAD_USE_NGSPICE=OFF \\"
echo " -DCMAKE_PREFIX_PATH=\"\$(pwd)/../stubs/include\""
echo " make -j\$(nproc)"
echo ""
echo "Done!"

View file

@ -1,137 +0,0 @@
#!/bin/bash
#
# KiCad Wasm Port - Update KiCad Submodule
#
# This script updates the KiCad submodule to a new version and
# helps regenerate patches if needed.
#
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
KICAD_DIR="$PROJECT_ROOT/kicad"
PATCHES_DIR="$PROJECT_ROOT/patches"
echo "=== KiCad Wasm Port - Update KiCad ==="
echo ""
# Check if kicad submodule exists
if [ ! -d "$KICAD_DIR/.git" ] && [ ! -f "$KICAD_DIR/.git" ]; then
echo "Error: KiCad submodule not initialized."
echo "Run: git submodule update --init --recursive"
exit 1
fi
# Parse arguments
TARGET_REF="${1:-}"
FORCE_UPDATE=0
if [ "$1" = "--force" ] || [ "$2" = "--force" ]; then
FORCE_UPDATE=1
fi
show_usage() {
echo "Usage: $0 [<ref>] [--force]"
echo ""
echo "Arguments:"
echo " <ref> Git reference (branch, tag, or commit) to update to"
echo " Examples: 8.0, master, v8.0.0, abc1234"
echo " --force Force update even if patches need manual intervention"
echo ""
echo "If no ref is provided, shows current KiCad version."
}
# Show current version
show_current_version() {
cd "$KICAD_DIR"
echo "Current KiCad version:"
echo " Branch: $(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo 'detached')"
echo " Commit: $(git rev-parse --short HEAD)"
echo " Date: $(git log -1 --format=%ci)"
# Check if there are local modifications
if ! git diff --quiet; then
echo ""
echo "Warning: There are uncommitted changes in the KiCad directory"
git status --short
fi
}
# Revert patches before update
revert_patches() {
echo "Reverting existing patches..."
cd "$KICAD_DIR"
for patch_file in "$PATCHES_DIR"/*.patch; do
if [ -f "$patch_file" ]; then
patch_name="$(basename "$patch_file")"
# Try to reverse the patch
if git apply --reverse --check "$patch_file" 2>/dev/null; then
echo " Reverting: $patch_name"
git apply --reverse "$patch_file"
else
echo " Skipping (not applied): $patch_name"
fi
fi
done
}
# Update submodule
update_submodule() {
local ref="$1"
echo ""
echo "Updating KiCad to: $ref"
cd "$KICAD_DIR"
# Fetch latest
echo "Fetching from origin..."
git fetch origin
# Checkout the target ref
echo "Checking out $ref..."
git checkout "$ref"
# If it's a branch, pull latest
if git rev-parse --verify "origin/$ref" >/dev/null 2>&1; then
echo "Pulling latest from origin/$ref..."
git pull origin "$ref"
fi
echo ""
show_current_version
}
# Main logic
if [ -z "$TARGET_REF" ] || [ "$TARGET_REF" = "--force" ]; then
show_current_version
echo ""
show_usage
exit 0
fi
echo "Preparing to update KiCad..."
echo ""
# Show current version
show_current_version
echo ""
# Revert patches first
revert_patches
echo ""
# Update submodule
update_submodule "$TARGET_REF"
echo ""
# Re-apply patches
echo "Re-applying patches..."
"$SCRIPT_DIR/prepare.sh"
echo ""
echo "=== Update Complete ==="
echo ""
echo "Don't forget to test the build:"
echo " cd build && cmake --build . --clean-first"

View file

@ -1,23 +0,0 @@
/*
* KiCad Wasm Port - OpenCASCADE Standard_Version stub
*
* Provides stub version macros when OCC is disabled.
*/
#ifndef _Standard_Version_HeaderFile
#define _Standard_Version_HeaderFile
// Stub version when OCC is disabled
#define OCC_VERSION_MAJOR 0
#define OCC_VERSION_MINOR 0
#define OCC_VERSION_MAINTENANCE 0
#define OCC_VERSION_DEVELOPMENT "N/A"
#define OCC_VERSION_STRING "0.0.0"
#define OCC_VERSION_STRING_EXT "0.0.0 (disabled)"
#define OCC_VERSION_COMPLETE "disabled"
#define OCC_VERSION 0
#define OCC_VERSION_HEX 0x000000
#endif // _Standard_Version_HeaderFile

View file

@ -1,149 +0,0 @@
/*
* KiCad Wasm Port - CURL Stub Header
*
* This is a minimal stub header for when KICAD_USE_CURL=0.
* It provides just enough type definitions to let the code compile
* without the actual libcurl library.
*/
#ifndef KICAD_WASM_CURL_STUB_H
#define KICAD_WASM_CURL_STUB_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* CURL handle type */
typedef void CURL;
/* CURL multi handle */
typedef void CURLM;
/* CURL share handle */
typedef void CURLSH;
/* Linked list for headers */
struct curl_slist {
char *data;
struct curl_slist *next;
};
/* Error codes */
typedef enum {
CURLE_OK = 0,
CURLE_UNSUPPORTED_PROTOCOL,
CURLE_FAILED_INIT,
CURLE_URL_MALFORMAT,
CURLE_NOT_BUILT_IN,
CURLE_COULDNT_RESOLVE_PROXY,
CURLE_COULDNT_RESOLVE_HOST,
CURLE_COULDNT_CONNECT,
CURLE_REMOTE_ACCESS_DENIED = 9,
CURLE_HTTP_RETURNED_ERROR = 22,
CURLE_WRITE_ERROR = 23,
CURLE_READ_ERROR = 26,
CURLE_OUT_OF_MEMORY = 27,
CURLE_OPERATION_TIMEDOUT = 28,
CURLE_SSL_CONNECT_ERROR = 35,
CURLE_ABORTED_BY_CALLBACK = 42,
CURLE_GOT_NOTHING = 52,
CURLE_SSL_ENGINE_NOTFOUND = 53,
CURLE_SSL_ENGINE_SETFAILED = 54,
CURLE_SEND_ERROR = 55,
CURLE_RECV_ERROR = 56,
CURLE_SSL_CERTPROBLEM = 58,
CURLE_SSL_CIPHER = 59,
CURLE_PEER_FAILED_VERIFICATION = 60,
CURLE_BAD_CONTENT_ENCODING = 61,
CURLE_FILESIZE_EXCEEDED = 63,
CURLE_SEND_FAIL_REWIND = 65,
CURLE_LOGIN_DENIED = 67,
CURLE_REMOTE_DISK_FULL = 70,
CURLE_REMOTE_FILE_EXISTS = 73,
CURLE_SSH = 79,
CURLE_AGAIN = 81,
CURLE_SSL_CRL_BADFILE = 82,
CURLE_SSL_ISSUER_ERROR = 83,
CURLE_CHUNK_FAILED = 88,
CURLE_NO_CONNECTION_AVAILABLE = 89,
CURLE_SSL_PINNEDPUBKEYNOTMATCH = 90,
CURLE_SSL_INVALIDCERTSTATUS = 91,
CURLE_HTTP2_STREAM = 92,
CURL_LAST
} CURLcode;
/* CURL options (minimal subset) */
typedef enum {
CURLOPT_URL = 10002,
CURLOPT_WRITEFUNCTION = 20011,
CURLOPT_WRITEDATA = 10001,
CURLOPT_USERAGENT = 10018,
CURLOPT_HTTPHEADER = 10023,
CURLOPT_POSTFIELDS = 10015,
CURLOPT_FOLLOWLOCATION = 52,
CURLOPT_SSL_VERIFYPEER = 64,
CURLOPT_SSL_VERIFYHOST = 81,
CURLOPT_TIMEOUT = 13,
CURLOPT_CONNECTTIMEOUT = 78,
CURLOPT_NOPROGRESS = 43,
CURLOPT_PROGRESSFUNCTION = 20056,
CURLOPT_PROGRESSDATA = 10057,
CURLOPT_XFERINFOFUNCTION = 20219,
CURLOPT_XFERINFODATA = 10057
} CURLoption;
/* CURL info types */
typedef enum {
CURLINFO_RESPONSE_CODE = 0x200002,
CURLINFO_CONTENT_LENGTH_DOWNLOAD = 0x300015,
CURLINFO_SIZE_DOWNLOAD = 0x300008
} CURLINFO;
/* Global flags */
#define CURL_GLOBAL_DEFAULT 3
#define CURL_GLOBAL_SSL 1
#define CURL_GLOBAL_WIN32 2
#define CURL_GLOBAL_ALL 3
/* Stub function declarations - all return error or NULL */
static inline CURL* curl_easy_init(void) { return NULL; }
static inline void curl_easy_cleanup(CURL* curl) { (void)curl; }
static inline CURLcode curl_easy_setopt(CURL* curl, CURLoption option, ...) {
(void)curl; (void)option;
return CURLE_NOT_BUILT_IN;
}
static inline CURLcode curl_easy_perform(CURL* curl) {
(void)curl;
return CURLE_NOT_BUILT_IN;
}
static inline CURLcode curl_easy_getinfo(CURL* curl, CURLINFO info, ...) {
(void)curl; (void)info;
return CURLE_NOT_BUILT_IN;
}
static inline const char* curl_easy_strerror(CURLcode error) {
(void)error;
return "CURL support not built in";
}
static inline char* curl_easy_escape(CURL* curl, const char* string, int length) {
(void)curl; (void)string; (void)length;
return NULL;
}
static inline void curl_free(void* p) { (void)p; }
static inline struct curl_slist* curl_slist_append(struct curl_slist* list, const char* string) {
(void)list; (void)string;
return NULL;
}
static inline void curl_slist_free_all(struct curl_slist* list) { (void)list; }
static inline CURLcode curl_global_init(long flags) { (void)flags; return CURLE_OK; }
static inline void curl_global_cleanup(void) { }
static inline const char* curl_version(void) { return "curl-stub/0.0 (KICAD_USE_CURL=0)"; }
#ifdef __cplusplus
}
#endif
#endif /* KICAD_WASM_CURL_STUB_H */

View file

@ -1,12 +0,0 @@
/*
* KiCad Wasm Port - CURL Easy API Stub Header
*
* This stub is empty because curl.h includes all the easy API.
*/
#ifndef KICAD_WASM_CURL_EASY_STUB_H
#define KICAD_WASM_CURL_EASY_STUB_H
#include "curl.h"
#endif /* KICAD_WASM_CURL_EASY_STUB_H */

View file

@ -1,587 +0,0 @@
/*
* KiCad Wasm Port - libgit2 Stub Header
*
* This is a minimal stub header for when KICAD_USE_GIT=0.
* It provides just enough type definitions to let the code compile
* without the actual libgit2 library.
*/
#ifndef KICAD_WASM_GIT2_STUB_H
#define KICAD_WASM_GIT2_STUB_H
#include <stddef.h>
#include <stdint.h>
#include <time.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Basic types
*/
typedef int64_t git_off_t;
typedef int64_t git_time_t;
typedef struct git_repository git_repository;
typedef struct git_reference git_reference;
typedef struct git_commit git_commit;
typedef struct git_tree git_tree;
typedef struct git_tree_entry git_tree_entry;
typedef struct git_index git_index;
typedef struct git_index_entry git_index_entry;
typedef struct git_config git_config;
typedef struct git_remote git_remote;
typedef struct git_signature git_signature;
typedef struct git_revwalk git_revwalk;
typedef struct git_diff git_diff;
typedef struct git_diff_delta git_diff_delta;
typedef struct git_diff_file git_diff_file;
typedef struct git_diff_options git_diff_options;
typedef struct git_status_list git_status_list;
typedef struct git_status_entry git_status_entry;
typedef struct git_branch_iterator git_branch_iterator;
typedef struct git_annotated_commit git_annotated_commit;
typedef struct git_rebase git_rebase;
typedef struct git_rebase_operation git_rebase_operation;
typedef struct git_merge_options git_merge_options;
typedef struct git_checkout_options git_checkout_options;
typedef struct git_fetch_options git_fetch_options;
typedef struct git_push_options git_push_options;
typedef struct git_clone_options git_clone_options;
typedef struct git_credential git_credential;
typedef struct git_credential git_cred; /* Alias for older API */
typedef struct git_blob git_blob;
typedef struct git_object git_object;
typedef struct git_buf git_buf;
typedef struct git_strarray git_strarray;
typedef struct git_odb git_odb;
typedef struct git_odb_backend git_odb_backend;
typedef struct git_refdb git_refdb;
typedef struct git_refdb_backend git_refdb_backend;
typedef struct git_indexer_progress git_indexer_progress;
typedef struct git_blame git_blame;
typedef struct git_blame_options git_blame_options;
typedef struct git_blame_hunk git_blame_hunk;
typedef struct git_config_entry git_config_entry;
typedef struct git_config_iterator git_config_iterator;
typedef struct git_patch git_patch;
typedef struct git_oidarray git_oidarray;
typedef struct git_describe_result git_describe_result;
typedef struct git_diff_stats git_diff_stats;
typedef struct git_filter_list git_filter_list;
typedef struct git_transfer_progress git_transfer_progress;
typedef git_transfer_progress git_indexer_progress_alias; /* Alias in newer libgit2 */
typedef struct git_note git_note;
typedef struct git_note_iterator git_note_iterator;
typedef struct git_status_options git_status_options;
typedef struct git_submodule git_submodule;
typedef struct git_worktree git_worktree;
typedef struct git_tag git_tag;
typedef struct git_indexer git_indexer;
typedef struct git_index_iterator git_index_iterator;
typedef struct git_index_conflict_iterator git_index_conflict_iterator;
/* git_oid - 20 byte SHA1 */
#define GIT_OID_RAWSZ 20
#define GIT_OID_HEXSZ 40
typedef struct git_oid {
unsigned char id[GIT_OID_RAWSZ];
} git_oid;
/* git_time */
typedef struct git_time {
git_time_t time;
int offset;
char sign;
} git_time;
/* git_signature */
struct git_signature {
char *name;
char *email;
git_time when;
};
/* git_strarray */
struct git_strarray {
char **strings;
size_t count;
};
/* git_buf */
struct git_buf {
char *ptr;
size_t reserved;
size_t size;
};
/* Error codes */
/* Error class enum */
typedef enum {
GIT_ERROR_NONE = 0,
GIT_ERROR_NOMEMORY = 1,
GIT_ERROR_OS = 2,
GIT_ERROR_INVALID = 3,
GIT_ERROR_REFERENCE = 4,
GIT_ERROR_ZLIB = 5,
GIT_ERROR_REPOSITORY = 6,
GIT_ERROR_CONFIG = 7,
GIT_ERROR_REGEX = 8,
GIT_ERROR_ODB = 9,
GIT_ERROR_INDEX = 10,
GIT_ERROR_OBJECT = 11,
GIT_ERROR_NET = 12,
GIT_ERROR_TAG = 13,
GIT_ERROR_TREE = 14,
GIT_ERROR_INDEXER = 15,
GIT_ERROR_SSL = 16,
GIT_ERROR_SUBMODULE = 17,
GIT_ERROR_THREAD = 18,
GIT_ERROR_STASH = 19,
GIT_ERROR_CHECKOUT = 20,
GIT_ERROR_FETCHHEAD = 21,
GIT_ERROR_MERGE = 22,
GIT_ERROR_SSH = 23,
GIT_ERROR_FILTER = 24,
GIT_ERROR_REVERT = 25,
GIT_ERROR_CALLBACK = 26,
GIT_ERROR_CHERRYPICK = 27,
GIT_ERROR_DESCRIBE = 28,
GIT_ERROR_REBASE = 29,
GIT_ERROR_FILESYSTEM = 30,
GIT_ERROR_PATCH = 31,
GIT_ERROR_WORKTREE = 32,
GIT_ERROR_SHA1 = 33,
GIT_ERROR_HTTP = 34,
GIT_ERROR_INTERNAL = 35
} git_error_t;
/* Error codes */
typedef enum {
GIT_OK = 0,
GIT_ERROR = -1,
GIT_ENOTFOUND = -3,
GIT_EEXISTS = -4,
GIT_EAMBIGUOUS = -5,
GIT_EBUFS = -6,
GIT_EUSER = -7,
GIT_EBAREREPO = -8,
GIT_EUNBORNBRANCH = -9,
GIT_EUNMERGED = -10,
GIT_ENONFASTFORWARD = -11,
GIT_EINVALIDSPEC = -12,
GIT_ECONFLICT = -13,
GIT_ELOCKED = -14,
GIT_EMODIFIED = -15,
GIT_EAUTH = -16,
GIT_ECERTIFICATE = -17,
GIT_EAPPLIED = -18,
GIT_EPEEL = -19,
GIT_EEOF = -20,
GIT_EINVALID = -21,
GIT_EUNCOMMITTED = -22,
GIT_EDIRECTORY = -23,
GIT_EMERGECONFLICT = -24,
GIT_PASSTHROUGH = -30,
GIT_ITEROVER = -31,
GIT_RETRY = -32,
GIT_EMISMATCH = -33,
GIT_EINDEXDIRTY = -34,
GIT_EAPPLYFAIL = -35
} git_error_code;
/* Object types */
typedef enum {
GIT_OBJECT_ANY = -2,
GIT_OBJECT_INVALID = -1,
GIT_OBJECT_COMMIT = 1,
GIT_OBJECT_TREE = 2,
GIT_OBJECT_BLOB = 3,
GIT_OBJECT_TAG = 4,
GIT_OBJECT_OFS_DELTA = 6,
GIT_OBJECT_REF_DELTA = 7
} git_object_t;
/* Branch types */
typedef enum {
GIT_BRANCH_LOCAL = 1,
GIT_BRANCH_REMOTE = 2,
GIT_BRANCH_ALL = GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE
} git_branch_t;
/* Status flags */
typedef enum {
GIT_STATUS_CURRENT = 0,
GIT_STATUS_INDEX_NEW = (1u << 0),
GIT_STATUS_INDEX_MODIFIED = (1u << 1),
GIT_STATUS_INDEX_DELETED = (1u << 2),
GIT_STATUS_INDEX_RENAMED = (1u << 3),
GIT_STATUS_INDEX_TYPECHANGE = (1u << 4),
GIT_STATUS_WT_NEW = (1u << 7),
GIT_STATUS_WT_MODIFIED = (1u << 8),
GIT_STATUS_WT_DELETED = (1u << 9),
GIT_STATUS_WT_TYPECHANGE = (1u << 10),
GIT_STATUS_WT_RENAMED = (1u << 11),
GIT_STATUS_WT_UNREADABLE = (1u << 12),
GIT_STATUS_IGNORED = (1u << 14),
GIT_STATUS_CONFLICTED = (1u << 15)
} git_status_t;
/* Delta types */
typedef enum {
GIT_DELTA_UNMODIFIED = 0,
GIT_DELTA_ADDED = 1,
GIT_DELTA_DELETED = 2,
GIT_DELTA_MODIFIED = 3,
GIT_DELTA_RENAMED = 4,
GIT_DELTA_COPIED = 5,
GIT_DELTA_IGNORED = 6,
GIT_DELTA_UNTRACKED = 7,
GIT_DELTA_TYPECHANGE = 8,
GIT_DELTA_UNREADABLE = 9,
GIT_DELTA_CONFLICTED = 10
} git_delta_t;
/* Credential types */
typedef enum {
GIT_CREDENTIAL_USERPASS_PLAINTEXT = (1u << 0),
GIT_CREDENTIAL_SSH_KEY = (1u << 1),
GIT_CREDENTIAL_SSH_CUSTOM = (1u << 2),
GIT_CREDENTIAL_DEFAULT = (1u << 3),
GIT_CREDENTIAL_SSH_INTERACTIVE = (1u << 4),
GIT_CREDENTIAL_USERNAME = (1u << 5),
GIT_CREDENTIAL_SSH_MEMORY = (1u << 6)
} git_credential_t;
/* git_error */
typedef struct git_error {
char *message;
int klass;
} git_error;
/*
* Stub functions - all return error
*/
/* Global */
static inline int git_libgit2_init(void) { return 1; }
static inline int git_libgit2_shutdown(void) { return 0; }
static inline const git_error* git_error_last(void) { return NULL; }
static inline void git_error_clear(void) {}
/* Repository */
static inline int git_repository_open(git_repository **out, const char *path) {
(void)out; (void)path;
return GIT_ENOTFOUND;
}
static inline int git_repository_open_ext(git_repository **out, const char *path,
unsigned int flags, const char *ceiling_dirs) {
(void)out; (void)path; (void)flags; (void)ceiling_dirs;
return GIT_ENOTFOUND;
}
static inline int git_repository_init(git_repository **out, const char *path, unsigned is_bare) {
(void)out; (void)path; (void)is_bare;
return GIT_ERROR;
}
static inline void git_repository_free(git_repository *repo) { (void)repo; }
static inline int git_repository_head(git_reference **out, git_repository *repo) {
(void)out; (void)repo;
return GIT_ERROR;
}
static inline int git_repository_index(git_index **out, git_repository *repo) {
(void)out; (void)repo;
return GIT_ERROR;
}
static inline int git_repository_config(git_config **out, git_repository *repo) {
(void)out; (void)repo;
return GIT_ERROR;
}
static inline const char* git_repository_path(const git_repository *repo) {
(void)repo;
return NULL;
}
static inline const char* git_repository_workdir(const git_repository *repo) {
(void)repo;
return NULL;
}
static inline int git_repository_discover(git_buf *out, const char *start_path,
int across_fs, const char *ceiling_dirs) {
(void)out; (void)start_path; (void)across_fs; (void)ceiling_dirs;
return GIT_ENOTFOUND;
}
/* Reference */
static inline int git_reference_resolve(git_reference **out, const git_reference *ref) {
(void)out; (void)ref;
return GIT_ERROR;
}
static inline void git_reference_free(git_reference *ref) { (void)ref; }
static inline const git_oid* git_reference_target(const git_reference *ref) {
(void)ref;
return NULL;
}
static inline const char* git_reference_name(const git_reference *ref) {
(void)ref;
return NULL;
}
static inline int git_reference_name_to_id(git_oid *out, git_repository *repo, const char *name) {
(void)out; (void)repo; (void)name;
return GIT_ERROR;
}
/* Branch */
static inline int git_branch_name(const char **out, const git_reference *ref) {
(void)out; (void)ref;
return GIT_ERROR;
}
static inline int git_branch_is_head(const git_reference *branch) {
(void)branch;
return 0;
}
static inline int git_branch_iterator_new(git_branch_iterator **out, git_repository *repo,
git_branch_t list_flags) {
(void)out; (void)repo; (void)list_flags;
return GIT_ERROR;
}
static inline int git_branch_next(git_reference **out, git_branch_t *out_type,
git_branch_iterator *iter) {
(void)out; (void)out_type; (void)iter;
return GIT_ITEROVER;
}
static inline void git_branch_iterator_free(git_branch_iterator *iter) { (void)iter; }
static inline int git_branch_create(git_reference **out, git_repository *repo,
const char *branch_name, const git_commit *target, int force) {
(void)out; (void)repo; (void)branch_name; (void)target; (void)force;
return GIT_ERROR;
}
/* Commit */
static inline int git_commit_lookup(git_commit **commit, git_repository *repo, const git_oid *id) {
(void)commit; (void)repo; (void)id;
return GIT_ERROR;
}
static inline void git_commit_free(git_commit *commit) { (void)commit; }
static inline git_time_t git_commit_time(const git_commit *commit) {
(void)commit;
return 0;
}
static inline int git_commit_tree(git_tree **tree_out, const git_commit *commit) {
(void)tree_out; (void)commit;
return GIT_ERROR;
}
static inline const git_signature* git_commit_author(const git_commit *commit) {
(void)commit;
return NULL;
}
static inline const char* git_commit_message(const git_commit *commit) {
(void)commit;
return NULL;
}
static inline const char* git_commit_summary(const git_commit *commit) {
(void)commit;
return "";
}
static inline unsigned int git_commit_parentcount(const git_commit *commit) {
(void)commit;
return 0;
}
static inline int git_commit_parent(git_commit **out, const git_commit *commit, unsigned int n) {
(void)out; (void)commit; (void)n;
return GIT_ERROR;
}
/* Tree */
static inline void git_tree_free(git_tree *tree) { (void)tree; }
static inline int git_tree_walk(const git_tree *tree, int mode,
int (*callback)(const char*, const git_tree_entry*, void*), void *payload) {
(void)tree; (void)mode; (void)callback; (void)payload;
return GIT_ERROR;
}
static inline const char* git_tree_entry_name(const git_tree_entry *entry) {
(void)entry;
return NULL;
}
static inline git_object_t git_tree_entry_type(const git_tree_entry *entry) {
(void)entry;
return GIT_OBJECT_INVALID;
}
/* Index */
static inline void git_index_free(git_index *index) { (void)index; }
static inline int git_index_add_bypath(git_index *index, const char *path) {
(void)index; (void)path;
return GIT_ERROR;
}
static inline int git_index_remove_bypath(git_index *index, const char *path) {
(void)index; (void)path;
return GIT_ERROR;
}
static inline int git_index_write(git_index *index) {
(void)index;
return GIT_ERROR;
}
/* Revwalk */
static inline int git_revwalk_new(git_revwalk **out, git_repository *repo) {
(void)out; (void)repo;
return GIT_ERROR;
}
static inline void git_revwalk_free(git_revwalk *walk) { (void)walk; }
static inline int git_revwalk_push(git_revwalk *walk, const git_oid *id) {
(void)walk; (void)id;
return GIT_ERROR;
}
static inline int git_revwalk_hide(git_revwalk *walk, const git_oid *id) {
(void)walk; (void)id;
return GIT_ERROR;
}
static inline int git_revwalk_next(git_oid *out, git_revwalk *walk) {
(void)out; (void)walk;
return GIT_ITEROVER;
}
static inline int git_revwalk_push_head(git_revwalk *walk) {
(void)walk;
return GIT_ERROR;
}
static inline void git_revwalk_sorting(git_revwalk *walk, unsigned int sort_mode) {
(void)walk; (void)sort_mode;
}
/* Status */
static inline int git_status_list_new(git_status_list **out, git_repository *repo,
const void *opts) {
(void)out; (void)repo; (void)opts;
return GIT_ERROR;
}
static inline void git_status_list_free(git_status_list *list) { (void)list; }
/* Clone */
static inline int git_clone(git_repository **out, const char *url, const char *local_path,
const git_clone_options *options) {
(void)out; (void)url; (void)local_path; (void)options;
return GIT_ERROR;
}
/* Remote */
static inline int git_remote_lookup(git_remote **out, git_repository *repo, const char *name) {
(void)out; (void)repo; (void)name;
return GIT_ERROR;
}
static inline void git_remote_free(git_remote *remote) { (void)remote; }
/* Diff */
static inline void git_diff_free(git_diff *diff) { (void)diff; }
/* Signature */
static inline void git_signature_free(git_signature *sig) { (void)sig; }
/* Buffer */
static inline void git_buf_dispose(git_buf *buffer) {
if (buffer) buffer->ptr = NULL;
}
static inline void git_buf_free(git_buf *buffer) {
if (buffer) buffer->ptr = NULL;
}
/* Blob */
static inline void git_blob_free(git_blob *blob) { (void)blob; }
static inline const void* git_blob_rawcontent(const git_blob *blob) { (void)blob; return NULL; }
static inline git_off_t git_blob_rawsize(const git_blob *blob) { (void)blob; return 0; }
/* Blame */
static inline void git_blame_free(git_blame *blame) { (void)blame; }
/* Config entry/iterator */
static inline void git_config_entry_free(git_config_entry *entry) { (void)entry; }
static inline void git_config_iterator_free(git_config_iterator *iter) { (void)iter; }
/* Patch */
static inline void git_patch_free(git_patch *patch) { (void)patch; }
/* Config */
static inline void git_config_free(git_config *cfg) { (void)cfg; }
static inline int git_config_get_entry(git_config_entry **out, const git_config *cfg, const char *name) {
(void)out; (void)cfg; (void)name;
return GIT_ENOTFOUND;
}
/* Annotated commit */
static inline void git_annotated_commit_free(git_annotated_commit *commit) { (void)commit; }
/* Credential */
static inline void git_credential_free(git_credential *cred) { (void)cred; }
/* OID array */
static inline void git_oidarray_free(git_oidarray *array) { (void)array; }
/* Str array */
static inline void git_strarray_free(git_strarray *array) { (void)array; }
/* Describe result */
static inline void git_describe_result_free(git_describe_result *result) { (void)result; }
/* Diff stats */
static inline void git_diff_stats_free(git_diff_stats *stats) { (void)stats; }
/* Filter list */
static inline void git_filter_list_free(git_filter_list *list) { (void)list; }
/* Object */
static inline void git_object_free(git_object *object) { (void)object; }
static inline int git_object_lookup(git_object **object, git_repository *repo,
const git_oid *id, git_object_t type) {
(void)object; (void)repo; (void)id; (void)type;
return GIT_ERROR;
}
static inline git_object_t git_object_type(const git_object *obj) {
(void)obj;
return GIT_OBJECT_INVALID;
}
/* Note */
static inline void git_note_free(git_note *note) { (void)note; }
static inline void git_note_iterator_free(git_note_iterator *it) { (void)it; }
/* Submodule */
static inline void git_submodule_free(git_submodule *submodule) { (void)submodule; }
/* Worktree */
static inline void git_worktree_free(git_worktree *wt) { (void)wt; }
/* Tag */
static inline void git_tag_free(git_tag *tag) { (void)tag; }
/* Rebase */
static inline void git_rebase_free(git_rebase *rebase) { (void)rebase; }
/* Indexer */
static inline void git_indexer_free(git_indexer *idx) { (void)idx; }
/* Index iterator */
static inline void git_index_iterator_free(git_index_iterator *iterator) { (void)iterator; }
/* Index conflict iterator */
static inline void git_index_conflict_iterator_free(git_index_conflict_iterator *iterator) { (void)iterator; }
/* OID */
static inline int git_oid_cmp(const git_oid *a, const git_oid *b) {
(void)a; (void)b;
return 0;
}
static inline char* git_oid_tostr_s(const git_oid *id) {
(void)id;
return (char*)"";
}
static inline char* git_oid_tostr(char *out, size_t n, const git_oid *id) {
(void)out; (void)n; (void)id;
if (out && n > 0) out[0] = '\0';
return out;
}
#ifdef __cplusplus
}
#endif
#endif /* KICAD_WASM_GIT2_STUB_H */

View file

@ -1,27 +0,0 @@
/*
* KiCad Wasm Port - libgit2 sys/errors.h Stub Header
*/
#ifndef KICAD_WASM_GIT2_SYS_ERRORS_STUB_H
#define KICAD_WASM_GIT2_SYS_ERRORS_STUB_H
#include "../git2.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Error setting functions - stubs */
static inline void git_error_set_str(int error_class, const char *string) {
(void)error_class; (void)string;
}
static inline void git_error_set(int error_class, const char *fmt, ...) {
(void)error_class; (void)fmt;
}
#ifdef __cplusplus
}
#endif
#endif /* KICAD_WASM_GIT2_SYS_ERRORS_STUB_H */

View file

@ -1,39 +0,0 @@
/*
* KiCad Wasm Port - libgit2 sys/merge.h Stub Header
*/
#ifndef KICAD_WASM_GIT2_SYS_MERGE_STUB_H
#define KICAD_WASM_GIT2_SYS_MERGE_STUB_H
#include "../git2.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Merge driver structures - minimal stubs */
typedef struct git_merge_driver git_merge_driver;
typedef struct git_merge_driver_source git_merge_driver_source;
typedef enum {
GIT_MERGE_DRIVER_BINARY = 0,
GIT_MERGE_DRIVER_TEXT = 1,
GIT_MERGE_DRIVER_UNION = 2
} git_merge_driver_t;
/* Registration functions - stubs */
static inline int git_merge_driver_register(const char *name, git_merge_driver *driver) {
(void)name; (void)driver;
return GIT_ERROR;
}
static inline int git_merge_driver_unregister(const char *name) {
(void)name;
return GIT_ERROR;
}
#ifdef __cplusplus
}
#endif
#endif /* KICAD_WASM_GIT2_SYS_MERGE_STUB_H */

View file

@ -1,90 +0,0 @@
/*
* KiCad Wasm Port - ngspice sharedspice.h stub
*
* Provides stub declarations when ngspice is disabled.
*/
#ifndef NGSPICE_SHAREDSPICE_H
#define NGSPICE_SHAREDSPICE_H
// Version information (stub)
#define NGSPICE_PACKAGE_VERSION "disabled"
// ngspice types
typedef int NG_BOOL;
// Callback function types (as used by ngspice)
// These are function types, not function pointer types.
// So SendChar* is a function pointer type.
typedef int SendChar(char*, int, void*);
typedef int SendStat(char*, int, void*);
typedef int ControlledExit(int, NG_BOOL, NG_BOOL, int, void*);
typedef int SendData(void*, int, int, void*);
typedef int SendInitData(void*, int, void*);
typedef int BGThreadRunning(NG_BOOL, int, void*);
typedef int GetVSRCData(double*, double, char*, int, void*);
typedef int GetISRCData(double*, double, char*, int, void*);
typedef int GetSyncData(double, double*, double, int, int, int, void*);
// ngspice is loaded dynamically via dlopen/GetSymbol, so we don't need to
// provide stub implementations for the functions. KiCad will get nullptr
// from GetSymbol when ngspice is not available, and handle it appropriately.
// However, we do need to provide the vector_info struct since it's used
// when processing data from ngspice.
struct vector_info;
typedef struct vector_info* pvector_info;
// Basic type definitions that might be used
typedef struct {
char* name;
char* type;
void* data;
} vecvalues;
typedef struct {
char* name;
int veccount;
vecvalues* vecarray;
} vecvaluesall;
typedef struct {
char* name;
char* type;
int length;
} vecinfo;
typedef struct {
char* name;
char* title;
char* date;
char* type;
int veccount;
vecinfo** vecs;
} vecinfosall;
typedef struct {
double progress;
double value;
} plotmsg;
// ngcomplex_t is a complex number with cx_real and cx_imag
typedef struct ngcomplex {
double cx_real;
double cx_imag;
} ngcomplex_t;
// vector_info struct - matches the real ngspice definition
// Note: pvector_info is forward-declared above as struct vector_info*
struct vector_info {
char* v_name; // name of the vector
int v_type; // type of vector
short v_flags; // various flags
double* v_realdata; // real data (if real vector)
ngcomplex_t* v_compdata; // complex data (if complex vector)
int v_length; // length of the vector
int v_numdims; // number of dimensions (1 for scalar/vector)
int v_dims[8]; // dimension sizes
};
#endif // NGSPICE_SHAREDSPICE_H

View file

@ -1,205 +0,0 @@
/*
* 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

@ -1,787 +0,0 @@
/*
* 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

@ -1,339 +0,0 @@
/*
* 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;
}
}

View file

@ -1,172 +0,0 @@
/*
* 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

@ -1,36 +0,0 @@
/*
* 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; }

@ -1 +0,0 @@
Subproject commit 293bd9febaea31375447a83f0aec79f022135ac1