7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-20 20:21:42 +00:00

merge tip in, resolve.

This commit is contained in:
Dick Hollenbeck 2014-03-20 01:24:33 -05:00
commit 6bfff89fe5
953 changed files with 68990 additions and 50310 deletions
.bzrignore
3d-viewer
CMakeLists.txt
CMakeModules
Documentation
INSTALL.txt
bitmap2component
bitmaps_png
CMakeLists.txt
cpp_16
cpp_26
add_arc.cppadd_bus.cppadd_bus2bus.cppadd_circle.cppadd_component.cppadd_corner.cppadd_dashed_line.cppadd_dimension.cppadd_entry.cppadd_glabel.cppadd_hierar_pin.cppadd_hierarchical_label.cppadd_junction.cppadd_keepout_area.cppadd_line.cppadd_line2bus.cppadd_line_label.cppadd_polygon.cppadd_power.cppadd_rectangle.cppadd_text.cppadd_tracks.cppadd_zone.cppadd_zone_cutout.cppannotate.cppapply.cppauto_associe.cppauto_track_width.cppbom.cppcopycomponent.cppcreate_cmp_file.cppcursor.cppcursor_shape.cppcvpcb.cppdatasheet.cppdelete_association.cppdelete_field.cppdelete_glabel.cppdelete_pin.cppdirectory.cppedit_comp_footprint.cppedit_module.cpperc_green.cppercerr.cppercwarn.cppexport.cppexport_footprint_names.cppexport_module.cppfind.cppfonts.cppgbr_select_mode0.cppgbr_select_mode1.cppgbr_select_mode2.cppgeneral_ratsnest.cppgerber_file.cppgerber_open_dcode_file.cppgerbview_clear_layers.cppgerbview_drill_file.cppgerbview_show_negative_objects.cppgrid.cppgrid_select.cppgrid_select_axis.cpphidden_pin.cpphierarchy_cursor.cpphierarchy_nav.cppicon_cvpcb_small.cppimage.cppimport.cppimport3d.cppimport_cmp_from_lib.cppimport_footprint_names.cppimport_hierarchical_label.cppimport_module.cppinsert_module_board.cpplang_def.cpplang_en.cpplang_fr.cpplayers_manager.cpplib_next.cpplib_previous.cpplibedit.cpplibrary_browse.cpplibrary_table.cpplibrary_update.cpplibview.cpplines90.cppload_module_board.cppload_module_lib.cpplocal_ratsnest.cppmode_module.cppmode_track.cppmodule.cppmodule_check.cppmodule_editor.cppmodule_filtered_list.cppmodule_full_list.cppmodule_library_list.cppmodule_options.cppmodule_pin_filtered_list.cppmodule_wizard.cppmodview_icon.cppmorgan1.cppmorgan2.cppmw_add_gap.cppmw_add_line.cppmw_add_shape.cppmw_add_stub.cppmw_add_stub_arc.cppnet_highlight.cppnet_locked.cppnet_unlocked.cppnetlist.cppnew.cppnew_component.cppnew_cvpcb.cppnew_footprint.cppnew_library.cppnew_pcb.cppnew_project.cppnew_project_with_template.cppnew_sch.cppnew_txt.cppnoconn.cppopen_project.cppopt_show_polygon.cppoptions_module.cppoptions_new_pad.cppoptions_pad.cpportho.cpppad.cpppad_sketch.cpppagelayout_load.cpppagelayout_load_default.cpppagelayout_new.cpppagelayout_normal_view_mode.cpppagelayout_special_view_mode.cpppart_properties.cpppcb_offset.cpppin.cpppin2pin.cppplot.cppplot_dxf.cppplot_hpg.cppplot_pdf.cppplot_ps.cppplot_svg.cpppolar_coord.cpppost_compo.cpppost_module.cppps_router.cpppy_script.cpprotate_neg_x.cpprotate_neg_y.cpprotate_neg_z.cpprotate_pin.cpprotate_pos_x.cpprotate_pos_y.cpprotate_pos_z.cppsave.cppsave_as.cppsave_library.cppsave_netlist.cppsave_part_in_mem.cppsave_project.cppshow_dcodenumber.cppshow_footprint.cppshow_mod_edge.cppshow_zone.cppshow_zone_disable.cppshow_zone_outline_only.cppshowtrack.cppsvg_file.cpptext_sketch.cppthree_d.cpptool_ratsnest.cpptrack_sketch.cppunit_inch.cppunit_mm.cppupdate_module_board.cppvia_sketch.cppzoom_area.cppzoom_center_on_screen.cpp
cpp_48
icons
sources
CREDITSadd_arc.svgadd_bus.svgadd_bus2bus.svgadd_circle.svgadd_component.svgadd_corner.svgadd_dashed_line.svgadd_dimension.svgadd_entry.svgadd_glabel.svgadd_hierar_pin.svgadd_hierarchical_label.svgadd_junction.svgadd_keepout_area.svgadd_line.svgadd_line2bus.svgadd_line_label.svgadd_pin.svgadd_polygon.svgadd_power.svgadd_rectangle.svgadd_text.svgadd_tracks.svgadd_tracks_and_vias.svgadd_zone.svgadd_zone_cutout.svgannotate.svgapply.svgauto_associe.svgauto_track_width.svgbom.svgcopycomponent.svgcreate_cmp_file.svgcursor.svgcursor_shape.svgcvpcb.svgdatasheet.svgdelete_association.svgdelete_field.svgdelete_glabel.svgdelete_pin.svgdelete_pinsheet.svgdirectory.svgedit_comp_footprint.svgedit_module.svgerc_green.svgercerr.svgercwarn.svgexit.svgexport.svgexport_footprint_names.svgexport_module.svgfind.svgfonts.svgfootprint_text.svggbr_select_mode0.svggbr_select_mode1.svggbr_select_mode2.svggeneral_ratsnest.svggerber_file.svggerber_open_dcode_file.svggerber_recent_files.svggerbview_clear_layers.svggerbview_drill_file.svggerbview_open_recent_drill_files.svggerbview_show_negative_objects.svggrid.svggrid_select.svggrid_select_axis.svghidden_pin.svghierarchy_cursor.svghierarchy_nav.svgicon_3d.svgicon_bitmap2component.svgicon_cvpcb.svgicon_cvpcb_small.svgicon_eeschema.svgicon_gerbview.svgicon_kicad.svgicon_modedit.svgicon_pagelayout_editor.svgicon_pcbcalculator.svgicon_pcbnew.svgimage.svgimport.svgimport3d.svgimport_cmp_from_lib.svgimport_footprint_names.svgimport_hierarchical_label.svgimport_module.svginfo.svginsert_module_board.svglang_def.svglang_en.svglang_fr.svglayers_manager.svglib_next.svglib_previous.svglibedit.svglibedit_icon.svglibrary_browse.svglibrary_table.svglibrary_update.svglibview.svglines90.svgload_module_board.svgload_module_lib.svglocal_ratsnest.svgmode_module.svgmode_track.svgmodule.svgmodule_check.svgmodule_editor.svgmodule_filtered_list.svgmodule_full_list.svgmodule_library_list.svgmodule_options.svgmodule_pin_filtered_list.svgmodule_wizard.svgmodview_icon.svgmorgan1.svgmorgan2.svgmw_add_gap.svgmw_add_line.svgmw_add_shape.svgmw_add_stub.svgmw_add_stub_arc.svgnet_highlight.svgnet_locked.svgnet_unlocked.svgnetlist.svgnew.svgnew_component.svgnew_cvpcb.svgnew_footprint.svgnew_library.svgnew_pcb.svgnew_project.svgnew_project_with_template.svgnew_sch.svgnew_txt.svgnoconn.svgnormal.svgopen_project.svgopt_show_polygon.svgoptions_module.svgoptions_new_pad.svgoptions_pad.svgortho.svgpad.svgpad_sketch.svgpads_mask_layers.svgpagelayout_load.svgpagelayout_load_default.svgpagelayout_new.svgpagelayout_normal_view_mode.svgpagelayout_special_view_mode.svgpart_properties.svgpcb_offset.svgpin.svgpin2pin.svgplot.svgplot_dxf.svgplot_hpg.svgplot_pdf.svgplot_ps.svgplot_svg.svgpolar_coord.svgpost_compo.svgpost_module.svgps_router.svgpy_script.svgrotate_neg_x.svgrotate_neg_y.svgrotate_neg_z.svgrotate_pin.svgrotate_pos_x.svgrotate_pos_y.svgrotate_pos_z.svgsave.svgsave_as.svgsave_library.svgsave_netlist.svgsave_part_in_mem.svgsave_project.svgshow_dcodenumber.svgshow_footprint.svgshow_mod_edge.svgshow_zone.svgshow_zone_disable.svgshow_zone_outline_only.svgshowtrack.svgsvg_file.svgtext_sketch.svgthree_d.svgtool_ratsnest.svgtrack_sketch.svgtree_nosel.svgtree_sel.svgunit_inch.svgunit_mm.svgupdate_module_board.svgvia_sketch.svgzoom_area.svgzoom_auto.svgzoom_center_on_screen.svg
common
cvpcb
eeschema
gerbview
include
base_struct.hbitmaps.hclass_board_design_settings.hclass_board_item.hclass_layer_box_selector.hclass_undoredo_container.h
gal
color4d.h
opengl/glm
core
ext.hppglm.hpp
gtc
gtx
associated_min_max.hppassociated_min_max.inlbit.hppbit.inlclosest_point.hppclosest_point.inlcolor_cast.hppcolor_cast.inlcolor_space.hppcolor_space.inlcolor_space_YCoCg.hppcolor_space_YCoCg.inlcompatibility.hppcompatibility.inlcomponent_wise.hppcomponent_wise.inlconstants.hppepsilon.hppeuler_angles.hppeuler_angles.inlextend.hppextend.inlextented_min_max.hppextented_min_max.inlfast_exponential.hppfast_exponential.inlfast_square_root.hppfast_square_root.inlfast_trigonometry.hppfast_trigonometry.inlgradient_paint.hppgradient_paint.inlhanded_coordinate_space.hpphanded_coordinate_space.inlinertia.hppinertia.inlint_10_10_10_2.hppint_10_10_10_2.inlinteger.hppinteger.inlintersect.hppintersect.inllog_base.hpplog_base.inlmatrix_cross_product.hppmatrix_cross_product.inlmatrix_interpolation.hppmatrix_interpolation.inlmatrix_major_storage.hppmatrix_major_storage.inlmatrix_operation.hppmatrix_operation.inlmatrix_query.hppmatrix_query.inlmixed_product.hppmixed_product.inlmultiple.hppmultiple.inlnoise.hppnorm.hppnorm.inlnormal.hppnormal.inlnormalize_dot.hppnormalize_dot.inlnumber_precision.hppnumber_precision.inlocl_type.hppocl_type.inloptimum_pow.hppoptimum_pow.inlorthonormalize.hpporthonormalize.inlperpendicular.hppperpendicular.inlpolar_coordinates.hpppolar_coordinates.inlprojection.hppprojection.inlquaternion.hppquaternion.inlrandom.hppraw_data.hppraw_data.inlreciprocal.hpprotate_vector.hpprotate_vector.inlsimd_mat4.hppsimd_mat4.inlsimd_vec4.hppsimd_vec4.inlspline.hppspline.inlstd_based_type.hppstd_based_type.inlstring_cast.hpptransform.hpptransform.inltransform2.hpptransform2.inlulp.hppunsigned_int.hppunsigned_int.inlvec1.hppvec1.inlvector_access.hppvector_access.inlvector_angle.hppvector_angle.inlvector_query.hppvector_query.inlverbose_operator.hppverbose_operator.inlwrap.hppwrap.inl
virtrev
hashtables.hhotkeys_basic.hlayers_id_colors_and_visibility.h
math
menus_helpers.hpgm_base.hrichio.hsch_base_frame.h
tool
ttl
view
worksheet_viewitem.hwxBasePcbFrame.hwxEeschemaStruct.hwxPcbStruct.h
kicad
packaging/windows/nsis
patches
pcb_calculator
pcbnew
CMakeLists.txtattribut.cpp
autorouter
basepcbframe.cppblock.cppboard_items_to_polygon_shape_transform.cppboard_undo_redo.cppclass_board.cppclass_board.hclass_board_connected_item.cppclass_board_connected_item.hclass_board_design_settings.cppclass_drawsegment.cppclass_drawsegment.hclass_edge_mod.cppclass_module.cppclass_module.hclass_netclass.cppclass_netinfo.hclass_netinfo_item.cppclass_netinfolist.cppclass_pad.cppclass_pad.hclass_pad_draw_functions.cppclass_text_mod.cppclass_text_mod.hclass_track.cppclass_zone.cppclass_zone.hclass_zone_settings.cppclean.cppconnect.cppcross-probing.cppdeltrack.cpp
dialogs
dimension.cppdragsegm.cppdrc.cppdrc_clearance_test_functions.cppeagle_plugin.cppedit.cppedit_track_width.cppeditrack-part2.cppeditrack.cpp
exporters
footprint_wizard_frame.hhelp_common_strings.hhighlight.cpphotkeys.hkicad_plugin.cppkicad_plugin.hlegacy_plugin.cpplegacy_plugin.hmagnetic_tracks_functions.cppmenubar_modedit.cppmenubar_pcbframe.cppminimun_spanning_tree.cppmodedit_onclick.cppmodedit_undo_redo.cppmodule_editor_frame.hmodview_frame.hmove_or_drag_track.cpponrightclick.cpppad_edition_functions.cpp
pcad2kicadpcb_plugin
pcb_netlist.hpcb_painter.cpppcb_painter.hpcb_parser.cpppcb_parser.hpcbframe.cpppcbnew.cpppcbnew_config.cpppcbnew_id.hprintout_controler.cppratsnest.cppratsnest_data.cppratsnest_data.hratsnest_viewitem.cpp
router
scripting
specctra_export.cppspecctra_import.cpptool_pcb.cpptoolbars_update_user_interface.cpp
tools
tr_modif.cpptracepcb.cppxchgmod.cppzones_by_polygon.cppzones_by_polygon_fill_functions.cppzones_convert_brd_items_to_polygons_with_Boost.cppzones_convert_to_polygons_aux_functions.cppzones_functions_for_undo_redo.cppzones_polygons_insulated_copper_islands.cppzones_polygons_test_connections.cppzones_test_and_combine_areas.cpp
polygon
qa
resources/linux/mime/applications
scripting
scripts
tools
utils

View File

@ -1,5 +1,6 @@
boost_root
.downloads-by-cmake
Build
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h

View File

@ -45,16 +45,11 @@
#include <info3d_visu.h>
#include <trackball.h>
// Exported function:
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
{
unsigned ii;
/* adjust object scale, rotation and offset position */
for( ii = 0; ii < aVertices.size(); ii++ )
for( unsigned ii = 0; ii < aVertices.size(); ii++ )
{
aVertices[ii].x *= m_MatScale.x;
aVertices[ii].y *= m_MatScale.y;
@ -79,7 +74,7 @@ void S3D_MASTER::Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices )
}
void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits )
{
unsigned ii;
GLfloat ax, ay, az, bx, by, bz, nx, ny, nz, r;
@ -138,44 +133,6 @@ void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits
glEnd();
}
GLuint EDA_3D_CANVAS::DisplayCubeforTest()
{
GLuint gllist = glGenLists( 1 );
glNewList( gllist, GL_COMPILE_AND_EXECUTE );
/* draw six faces of a cube */
glBegin( GL_QUADS );
glNormal3f( 0.0F, 0.0F, 1.0F );
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F );
glVertex3f( -0.5F, -0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F );
glNormal3f( 0.0F, 0.0F, -1.0F );
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F );
glVertex3f( 0.5F, 0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F );
glNormal3f( 0.0F, 1.0F, 0.0F );
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F );
glVertex3f( -0.5F, 0.5F, -0.5F ); glVertex3f( -0.5F, 0.5F, 0.5F );
glNormal3f( 0.0F, -1.0F, 0.0F );
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, -0.5F, -0.5F );
glVertex3f( 0.5F, -0.5F, 0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F );
glNormal3f( 1.0F, 0.0F, 0.0F );
glVertex3f( 0.5F, 0.5F, 0.5F ); glVertex3f( 0.5F, -0.5F, 0.5F );
glVertex3f( 0.5F, -0.5F, -0.5F ); glVertex3f( 0.5F, 0.5F, -0.5F );
glNormal3f( -1.0F, 0.0F, 0.0F );
glVertex3f( -0.5F, -0.5F, -0.5F ); glVertex3f( -0.5F, -0.5F, 0.5F );
glVertex3f( -0.5F, 0.5F, 0.5F ); glVertex3f( -0.5F, 0.5F, -0.5F );
glEnd();
glEndList();
return gllist;
}
VERTEX_VALUE_CTRL::VERTEX_VALUE_CTRL( wxWindow* aParent, wxBoxSizer* aBoxSizer )
{
wxString text;

View File

@ -78,7 +78,11 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
wxFULL_REPAINT_ON_RESIZE )
{
m_init = false;
m_gllist = 0;
// Clear all gl list identifiers:
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
m_glLists[ii] = 0;
// Explicitly create a new rendering context instance for this canvas.
m_glRC = new wxGLContext( this );
@ -94,12 +98,25 @@ EDA_3D_CANVAS::~EDA_3D_CANVAS()
}
void EDA_3D_CANVAS::ClearLists()
void EDA_3D_CANVAS::ClearLists( GLuint aGlList )
{
if( m_gllist > 0 )
glDeleteLists( m_gllist, 1 );
if( aGlList )
{
if( m_glLists[aGlList] > 0 )
glDeleteLists( m_glLists[aGlList], 1 );
m_gllist = 0;
m_glLists[aGlList] = 0;
return;
}
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )
{
if( m_glLists[ii] > 0 )
glDeleteLists( m_glLists[ii], 1 );
m_glLists[ii] = 0;
}
}

View File

@ -50,14 +50,29 @@ class S3D_VERTEX;
class SEGVIA;
class D_PAD;
// We are using GL lists to store layers and other items
// to draw or not
// GL_LIST_ID are the GL lists indexes in m_glLists
enum GL_LIST_ID
{
GL_ID_BEGIN = 0,
GL_ID_AXIS = GL_ID_BEGIN, // list id for 3D axis
GL_ID_GRID, // list id for 3D grid
GL_ID_BOARD, // List id for copper layers
GL_ID_TECH_LAYERS, // List id for non copper layers (masks...)
GL_ID_AUX_LAYERS, // List id for user layers (draw, eco, comment)
GL_ID_3DSHAPES_SOLID, // List id for 3D shapes, non transparent entities
GL_ID_3DSHAPES_TRANSP, // List id for 3D shapes, transparent entities
GL_ID_END
};
class EDA_3D_CANVAS : public wxGLCanvas
{
private:
bool m_init;
GLuint m_gllist;
GLuint m_glLists[GL_ID_END]; // GL lists
wxGLContext* m_glRC;
wxRealPoint m_draw3dOffset; // offset to draw the 3 mesh.
wxRealPoint m_draw3dOffset; // offset to draw the 3D mesh.
double m_ZBottom; // position of the back layer
double m_ZTop; // position of the front layer
@ -67,7 +82,15 @@ public:
EDA_3D_FRAME* Parent() { return (EDA_3D_FRAME*)GetParent(); }
void ClearLists();
BOARD* GetBoard() { return Parent()->GetBoard(); }
/**
* Function ClearLists
* Clear the display list.
* @param aGlList = the list to clear.
* if 0 (default) all lists are cleared
*/
void ClearLists( GLuint aGlList = 0 );
// Event functions:
void OnPaint( wxPaintEvent& event );
@ -81,10 +104,9 @@ public:
void OnEnterWindow( wxMouseEvent& event );
// Display functions
GLuint DisplayCubeforTest(); // Just a test function
void SetView3D( int keycode );
void DisplayStatus();
void Redraw( bool finish = false );
void Redraw();
void Render();
/**
@ -92,7 +114,7 @@ public:
* Prepares the parameters of the OpenGL draw list
* creates the OpenGL draw list items (board, grid ...
*/
GLuint CreateDrawGL_List();
void CreateDrawGL_List();
void InitGL();
void SetLights();
void SetOffset(double aPosX, double aPosY)
@ -104,11 +126,40 @@ public:
/**
* Function BuildBoard3DView
* Called by CreateDrawGL_List()
* Fills the OpenGL draw list with board items draw list.
* Populates the OpenGL GL_ID_BOARD draw list with board items only on copper layers.
* 3D footprint shapes, tech layers and aux layers are not on this list
*/
void BuildBoard3DView();
void DrawGrid( double aGriSizeMM );
/**
* Function BuildTechLayers3DView
* Called by CreateDrawGL_List()
* Populates the OpenGL GL_ID_BOARD draw list with items on tech layers
*/
void BuildTechLayers3DView();
/**
* Function BuildFootprintShape3DList
* Called by CreateDrawGL_List()
* Fills the OpenGL GL_ID_3DSHAPES_SOLID and GL_ID_3DSHAPES_TRANSP
* draw lists with 3D footprint shapes
* @param aOpaqueList is the gl list for non transparent items
* @param aTransparentList is the gl list for non transparent items,
* which need to be drawn after all other items
*/
void BuildFootprintShape3DList( GLuint aOpaqueList,
GLuint aTransparentList);
/**
* Function BuildBoard3DAuxLayers
* Called by CreateDrawGL_List()
* Fills the OpenGL GL_ID_AUX_LAYERS draw list
* with items on aux layers only
*/
void BuildBoard3DAuxLayers();
void Draw3DGrid( double aGriSizeMM );
void Draw3DAxis();
void Draw3DViaHole( SEGVIA * aVia );
void Draw3DPadHole( D_PAD * aPad );

View File

@ -41,9 +41,14 @@ S3D_MATERIAL::S3D_MATERIAL( S3D_MASTER* father, const wxString& name ) :
m_Name = name;
}
void S3D_MATERIAL::SetMaterial()
{
S3D_MASTER * s3dParent = (S3D_MASTER *) GetParent();
s3dParent->SetLastTransparency( m_Transparency );
if( ! s3dParent->IsOpenGlAllowed() )
return;
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
m_DiffuseColor.y * m_AmbientIntensity,
@ -52,8 +57,29 @@ void S3D_MATERIAL::SetMaterial()
#if 0
glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
#endif
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
#endif
}
bool S3D_MASTER::IsOpenGlAllowed()
{
if( m_loadNonTransparentObjects ) // return true for non transparent objects only
{
if( m_lastTransparency == 0.0 )
return true;
}
if( m_loadTransparentObjects ) // return true for transparent objects only
if( m_lastTransparency != 0.0 )
return true;
return false;
}
void S3D_MASTER::Insert( S3D_MATERIAL* aMaterial )
{
aMaterial->SetNext( m_Materials );
m_Materials = aMaterial;
}
@ -72,6 +98,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
EDA_ITEM( aParent, NOT_USED )
{
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_lastTransparency = 0.0;
m_3D_Drawings = NULL;
m_Materials = NULL;
m_ShapeType = FILE3D_NONE;

View File

@ -50,10 +50,10 @@
#include <3d_draw_basic_functions.h>
// Imported function:
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void CheckGLError();
/* returns true if aLayer should be displayed, false otherwise
/* Helper function
* returns true if aLayer should be displayed, false otherwise
*/
static bool Is3DLayerEnabled( LAYER_NUM aLayer );
@ -99,7 +99,7 @@ static void BuildPadShapeThickOutlineAsPolygon( D_PAD* aPad,
}
void EDA_3D_CANVAS::Redraw( bool finish )
void EDA_3D_CANVAS::Redraw()
{
// SwapBuffer requires the window to be shown before calling
if( !IsShown() )
@ -134,15 +134,47 @@ void EDA_3D_CANVAS::Redraw( bool finish )
glRotatef( g_Parm_3D_Visu.m_Rot[1], 0.0, 1.0, 0.0 );
glRotatef( g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0 );
if( m_gllist )
glCallList( m_gllist );
else
if( ! m_glLists[GL_ID_BOARD] || ! m_glLists[GL_ID_TECH_LAYERS] )
CreateDrawGL_List();
glFlush();
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) && m_glLists[GL_ID_AXIS] )
glCallList( m_glLists[GL_ID_AXIS] );
if( finish )
glFinish();
// move the board in order to draw it with its center at 0,0 3D coordinates
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
0.0F );
// draw all objects in lists
// transparent objects should be drawn after opaque objects
glCallList( m_glLists[GL_ID_BOARD] );
glCallList( m_glLists[GL_ID_TECH_LAYERS] );
if( g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) || g_Parm_3D_Visu.GetFlag( FL_COMMENTS ) )
{
if( ! m_glLists[GL_ID_AUX_LAYERS] )
CreateDrawGL_List();
glCallList( m_glLists[GL_ID_AUX_LAYERS] );
}
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
{
if( ! m_glLists[GL_ID_3DSHAPES_SOLID] )
CreateDrawGL_List();
glCallList( m_glLists[GL_ID_3DSHAPES_SOLID] );
}
// Grid uses transparency: draw it after all objects
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) && m_glLists[GL_ID_GRID] )
glCallList( m_glLists[GL_ID_GRID] );
// This list must be drawn last, because it contains the
// transparent gl objects, which should be drawn after all
// non transparent objects
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) && m_glLists[GL_ID_3DSHAPES_TRANSP] )
glCallList( m_glLists[GL_ID_3DSHAPES_TRANSP] );
SwapBuffers();
}
@ -204,8 +236,7 @@ static inline void SetGLTechLayersColor( LAYER_NUM aLayer )
void EDA_3D_CANVAS::BuildBoard3DView()
{
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
BOARD* pcb = pcbframe->GetBoard();
BOARD* pcb = GetBoard();
bool realistic_mode = g_Parm_3D_Visu.IsRealisticMode();
// Number of segments to draw a circle using segments
@ -329,7 +360,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
}
}
// draw graphic items
// draw graphic items on copper layers (texts)
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
{
if( !item->IsOnLayer( layer ) )
@ -337,11 +368,9 @@ void EDA_3D_CANVAS::BuildBoard3DView()
switch( item->Type() )
{
case PCB_LINE_T:
case PCB_LINE_T: // should not exist on copper layers
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
bufferPolys, 0,
segcountforcircle,
correctionFactor );
bufferPolys, 0, segcountforcircle, correctionFactor );
break;
case PCB_TEXT_T:
@ -462,14 +491,78 @@ void EDA_3D_CANVAS::BuildBoard3DView()
Draw3D_SolidHorizontalPolyPolygons( bufferPcbOutlines, zpos + board_thickness/2,
board_thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
}
}
void EDA_3D_CANVAS::BuildTechLayers3DView()
{
BOARD* pcb = GetBoard();
// Number of segments to draw a circle using segments
const int segcountforcircle = 16;
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
const int segcountLowQuality = 12; // segments to draw a circle with low quality
// to reduce time calculations
// for holes and items which do not need
// a fine representation
CPOLYGONS_LIST bufferPolys;
bufferPolys.reserve( 100000 ); // Reserve for large board
CPOLYGONS_LIST allLayerHoles; // Contains through holes, calculated only once
allLayerHoles.reserve( 20000 );
CPOLYGONS_LIST bufferPcbOutlines; // stores the board main outlines
// Build a polygon from edge cut items
wxString msg;
if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,
allLayerHoles, &msg ) )
{
msg << wxT("\n\n") <<
_("Unable to calculate the board outlines.\n"
"Therefore use the board boundary box.");
wxMessageBox( msg );
}
int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
{
// Add via hole
if( track->Type() == PCB_VIA_T )
{
int shape = track->GetShape();
int holediameter = track->GetDrillValue();
int hole_outer_radius = (holediameter + thickness) / 2;
if( shape == VIA_THROUGH )
TransformCircleToPolygon( allLayerHoles,
track->GetStart(), hole_outer_radius,
segcountLowQuality );
}
}
// draw pads holes
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
{
// Add pad hole, if any
D_PAD* pad = module->Pads();
for( ; pad != NULL; pad = pad->Next() )
pad->BuildPadDrillShapePolygon( allLayerHoles, 0,
segcountLowQuality );
}
// draw graphic items, on technical layers
// draw graphic items, not on copper layers
KI_POLYGON_SET brdpolysetHoles;
allLayerHoles.ExportTo( brdpolysetHoles );
for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
layer++ )
{
// Skip user layers, which are not drawn here
if( IsUserLayer( layer) )
continue;
if( !Is3DLayerEnabled( layer ) )
continue;
@ -487,9 +580,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
{
case PCB_LINE_T:
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
bufferPolys, 0,
segcountforcircle,
correctionFactor );
bufferPolys, 0, segcountforcircle, correctionFactor );
break;
case PCB_TEXT_T:
@ -562,10 +653,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()
currLayerPolyset += polyset;
}
SetGLTechLayersColor( layer );
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
if( layer == EDGE_N )
{
@ -588,35 +677,222 @@ void EDA_3D_CANVAS::BuildBoard3DView()
bufferPolys.RemoveAllContours();
bufferPolys.ImportFrom( currLayerPolyset );
SetGLTechLayersColor( layer );
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
}
// draw modules 3D shapes
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
module->ReadAndInsert3DComponentShape( this );
}
GLuint EDA_3D_CANVAS::CreateDrawGL_List()
/**
* Function BuildBoard3DAuxLayers
* Called by CreateDrawGL_List()
* Fills the OpenGL GL_ID_BOARD draw list with items
* on aux layers only
*/
void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
{
PCB_BASE_FRAME* pcbframe = Parent()->Parent();
BOARD* pcb = pcbframe->GetBoard();
const int segcountforcircle = 16;
double correctionFactor = 1.0 / cos( M_PI / (segcountforcircle * 2) );
BOARD* pcb = GetBoard();
CPOLYGONS_LIST bufferPolys;
bufferPolys.reserve( 5000 ); // Reserve for items not on board
for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
layer++ )
{
if( !Is3DLayerEnabled( layer ) )
continue;
bufferPolys.RemoveAllContours();
for( BOARD_ITEM* item = pcb->m_Drawings; item; item = item->Next() )
{
if( !item->IsOnLayer( layer ) )
continue;
switch( item->Type() )
{
case PCB_LINE_T:
( (DRAWSEGMENT*) item )->TransformShapeWithClearanceToPolygon(
bufferPolys, 0, segcountforcircle, correctionFactor );
break;
case PCB_TEXT_T:
( (TEXTE_PCB*) item )->TransformShapeWithClearanceToPolygonSet(
bufferPolys, 0, segcountforcircle, correctionFactor );
break;
default:
break;
}
}
for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
{
module->TransformPadsShapesWithClearanceToPolygon( layer,
bufferPolys,
0,
segcountforcircle,
correctionFactor );
module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
bufferPolys,
0,
segcountforcircle,
correctionFactor );
}
// bufferPolys contains polygons to merge. Many overlaps .
// Calculate merged polygons and remove pads and vias holes
if( bufferPolys.GetCornersCount() == 0 )
continue;
KI_POLYGON_SET currLayerPolyset;
KI_POLYGON_SET polyset;
bufferPolys.ExportTo( polyset );
currLayerPolyset += polyset;
int thickness = g_Parm_3D_Visu.GetLayerObjectThicknessBIU( layer );
int zpos = g_Parm_3D_Visu.GetLayerZcoordBIU( layer );
// for Draw3D_SolidHorizontalPolyPolygons,
// zpos it the middle between bottom and top sides.
// However for top layers, zpos should be the bottom layer pos,
// and for bottom layers, zpos should be the top layer pos.
if( Get3DLayer_Z_Orientation( layer ) > 0 )
zpos += thickness/2;
else
zpos -= thickness/2 ;
bufferPolys.RemoveAllContours();
bufferPolys.ImportFrom( currLayerPolyset );
SetGLTechLayersColor( layer );
glNormal3f( 0.0, 0.0, Get3DLayer_Z_Orientation( layer ) );
Draw3D_SolidHorizontalPolyPolygons( bufferPolys, zpos,
thickness, g_Parm_3D_Visu.m_BiuTo3Dunits );
}
}
void EDA_3D_CANVAS::CreateDrawGL_List()
{
BOARD* pcb = GetBoard();
wxBusyCursor dummy;
m_gllist = glGenLists( 1 );
// Build 3D board parameters:
g_Parm_3D_Visu.InitSettings( pcb );
glNewList( m_gllist, GL_COMPILE_AND_EXECUTE );
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
// draw axis
if( g_Parm_3D_Visu.GetFlag( FL_AXIS ) )
// Create axis gl list (if it is not shown, the list will be not called
Draw3DAxis();
// Create grid gl list
if( ! m_glLists[GL_ID_GRID] )
{
m_glLists[GL_ID_GRID] = glGenLists( 1 );
glNewList( m_glLists[GL_ID_GRID], GL_COMPILE );
Draw3DGrid( g_Parm_3D_Visu.m_3D_Grid );
glEndList();
}
// Create Board full gl lists:
// For testing purpose only, display calculation time to generate 3D data
// #define PRINT_CALCULATION_TIME
#ifdef PRINT_CALCULATION_TIME
unsigned strtime = GetRunningMicroSecs();
#endif
if( ! m_glLists[GL_ID_BOARD] )
{
m_glLists[GL_ID_BOARD] = glGenLists( 1 );
glNewList( m_glLists[GL_ID_BOARD], GL_COMPILE );
BuildBoard3DView();
glEndList();
}
if( ! m_glLists[GL_ID_TECH_LAYERS] )
{
m_glLists[GL_ID_TECH_LAYERS] = glGenLists( 1 );
glNewList( m_glLists[GL_ID_TECH_LAYERS], GL_COMPILE );
BuildTechLayers3DView();
glEndList();
}
if( ! m_glLists[GL_ID_AUX_LAYERS] )
{
m_glLists[GL_ID_AUX_LAYERS] = glGenLists( 1 );
glNewList( m_glLists[GL_ID_AUX_LAYERS], GL_COMPILE );
BuildBoard3DAuxLayers();
glEndList();
}
// draw modules 3D shapes
if( ! m_glLists[GL_ID_3DSHAPES_SOLID] && g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
{
m_glLists[GL_ID_3DSHAPES_SOLID] = glGenLists( 1 );
// GL_ID_3DSHAPES_TRANSP is an auxiliary list for 3D shapes;
// Ensure it is cleared before rebuilding it
if( m_glLists[GL_ID_3DSHAPES_TRANSP] )
glDeleteLists( m_glLists[GL_ID_3DSHAPES_TRANSP], 1 );
m_glLists[GL_ID_3DSHAPES_TRANSP] = glGenLists( 1 );
BuildFootprintShape3DList( m_glLists[GL_ID_3DSHAPES_SOLID],
m_glLists[GL_ID_3DSHAPES_TRANSP] );
}
// Test for errors
CheckGLError();
#ifdef PRINT_CALCULATION_TIME
unsigned endtime = GetRunningMicroSecs();
wxString msg;
msg.Printf( "Built data %.1f ms", (double) (endtime - strtime) / 1000 );
Parent()->SetStatusText( msg, 0 );
#endif
}
void EDA_3D_CANVAS::BuildFootprintShape3DList( GLuint aOpaqueList,
GLuint aTransparentList)
{
// aOpaqueList is the gl list for non transparent items
// aTransparentList is the gl list for non transparent items,
// which need to be drawn after all other items
BOARD* pcb = GetBoard();
glNewList( aOpaqueList, GL_COMPILE );
bool loadTransparentObjects = false;
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects,
loadTransparentObjects );
glEndList();
glNewList( aTransparentList, GL_COMPILE );
loadTransparentObjects = true;
for( MODULE* module = pcb->m_Modules; module; module = module->Next() )
module->ReadAndInsert3DComponentShape( this, !loadTransparentObjects,
loadTransparentObjects );
glEndList();
}
void EDA_3D_CANVAS::Draw3DAxis()
{
if( ! m_glLists[GL_ID_AXIS] )
{
m_glLists[GL_ID_AXIS] = glGenLists( 1 );
glNewList( m_glLists[GL_ID_AXIS], GL_COMPILE );
glEnable( GL_COLOR_MATERIAL );
SetGLColor( WHITE );
glBegin( GL_LINES );
@ -629,52 +905,20 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
glVertex3f( 0.0f, 0.0f, 0.0f );
glVertex3f( 0.0f, 0.0f, 0.3f ); // Z axis
glEnd();
glEndList();
}
// move the board in order to draw it with its center at 0,0 3D coordinates
glTranslatef( -g_Parm_3D_Visu.m_BoardPos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
0.0F );
// Draw Board:
// For testing purpose only, display calculation time to generate 3D data
// #define PRINT_CALCULATION_TIME
#ifdef PRINT_CALCULATION_TIME
unsigned strtime = GetRunningMicroSecs();
#endif
BuildBoard3DView();
// Draw grid
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
DrawGrid( g_Parm_3D_Visu.m_3D_Grid );
glEndList();
// Test for errors
CheckGLError();
#ifdef PRINT_CALCULATION_TIME
unsigned endtime = GetRunningMicroSecs();
wxString msg;
msg.Printf( "Built data %.1f ms", (double) (endtime - strtime) / 1000 );
Parent()->SetStatusText( msg, 0 );
#endif
return m_gllist;
}
// draw a 3D grid: an horizontal grid (XY plane and Z = 0,
// and a vertical grid (XZ plane and Y = 0)
void EDA_3D_CANVAS::DrawGrid( double aGriSizeMM )
void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )
{
double zpos = 0.0;
EDA_COLOR_T gridcolor = DARKGRAY; // Color of grid lines
EDA_COLOR_T gridcolor_marker = LIGHTGRAY; // Color of grid lines every 5 lines
double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
double transparency = 0.4;
const double scale = g_Parm_3D_Visu.m_BiuTo3Dunits;
const double transparency = 0.3;
glNormal3f( 0.0, 0.0, 1.0 );
@ -829,43 +1073,40 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
}
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,
bool aAllowNonTransparentObjects,
bool aAllowTransparentObjects )
{
// Draw module shape: 3D shape if exists (or module outlines if not exists)
S3D_MASTER* struct3D = m_3D_Drawings;
if( g_Parm_3D_Visu.GetFlag( FL_MODULE ) )
// Read from disk and draws the footprint 3D shapes if exists
S3D_MASTER* shape3D = m_3D_Drawings;
double zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( IsFlipped() );
glPushMatrix();
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-m_Pos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
zpos );
if( m_Orient )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
if( IsFlipped() )
{
double zpos;
if( IsFlipped() )
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( true );
else
zpos = g_Parm_3D_Visu.GetModulesZcoord3DIU( false );
glPushMatrix();
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BiuTo3Dunits,
-m_Pos.y * g_Parm_3D_Visu.m_BiuTo3Dunits,
zpos );
if( m_Orient )
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
if( IsFlipped() )
{
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
for( ; struct3D != NULL; struct3D = struct3D->Next() )
{
if( struct3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
struct3D->ReadData();
}
glPopMatrix();
glRotatef( 180.0, 0.0, 1.0, 0.0 );
glRotatef( 180.0, 0.0, 0.0, 1.0 );
}
for( ; shape3D != NULL; shape3D = shape3D->Next() )
{
shape3D->SetLoadNonTransparentObjects( aAllowNonTransparentObjects );
shape3D->SetLoadTransparentObjects( aAllowTransparentObjects );
if( shape3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
shape3D->ReadData();
}
glPopMatrix();
}

View File

@ -35,7 +35,7 @@
#include <3d_draw_basic_functions.h>
// Imported function:
extern void Set_Object_Data( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void TransfertToGLlist( std::vector<S3D_VERTEX>& aVertices, double aBiuTo3DUnits );
extern void CheckGLError();
// Number of segments to approximate a circle by segments
@ -116,7 +116,7 @@ static void Draw3D_VerticalPolygonalCylinder( const CPOLYGONS_LIST& aPolysList,
coords[3].y = coords[2].y; // only z change
// Creates the GL_QUAD
Set_Object_Data( coords, aBiuTo3DUnits );
TransfertToGLlist( coords, aBiuTo3DUnits );
}
}

View File

@ -39,12 +39,15 @@
#include <wxBasePcbFrame.h>
INFO3D_VISU g_Parm_3D_Visu;
// Key to store 3D Viewer config:
static const wxChar keyBgColor_Red[] = wxT( "BgColor_Red" );
static const wxChar keyBgColor_Green[] = wxT( "BgColor_Green" );
static const wxChar keyBgColor_Blue[] = wxT( "BgColor_Blue" );
static const wxChar keyShowRealisticMode[] = wxT( "ShowRealisticMode" );
static const wxChar keyShowAxis[] = wxT( "ShowAxis" );
static const wxChar keyShowGrid[] = wxT( "ShowGrid3D" );
static const wxChar keyShowGridSize[] = wxT( "Grid3DSize" );
static const wxChar keyShowZones[] = wxT( "ShowZones" );
static const wxChar keyShowFootprints[] = wxT( "ShowFootprints" );
static const wxChar keyShowCopperThickness[] = wxT( "ShowCopperThickness" );
@ -159,6 +162,12 @@ void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( keyShowAxis, &tmp, true );
prms.SetFlag( FL_AXIS, tmp );
aCfg->Read( keyShowGrid, &tmp, true );
prms.SetFlag( FL_GRID, tmp );
aCfg->Read( keyShowGridSize, &prms.m_3D_Grid, 10.0 );
prms.SetFlag( FL_MODULE, tmp );
aCfg->Read( keyShowFootprints, &tmp, true );
prms.SetFlag( FL_MODULE, tmp );
@ -202,6 +211,8 @@ void EDA_3D_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( keyBgColor_Blue, g_Parm_3D_Visu.m_BgColor.m_Blue );
aCfg->Write( keyShowRealisticMode, prms.GetFlag( FL_USE_REALISTIC_MODE ) );
aCfg->Write( keyShowAxis, prms.GetFlag( FL_AXIS ) );
aCfg->Write( keyShowGrid, prms.GetFlag( FL_GRID ) );
aCfg->Write( keyShowGridSize, prms.m_3D_Grid );
aCfg->Write( keyShowFootprints, prms.GetFlag( FL_MODULE ) );
aCfg->Write( keyShowCopperThickness, prms.GetFlag( FL_USE_COPPER_THICKNESS ) );
aCfg->Write( keyShowZones, prms.GetFlag( FL_ZONE ) );
@ -359,52 +370,52 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MENU3D_AXIS_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_AXIS, isChecked );
NewDisplay();
m_canvas->Refresh();
return;
case ID_MENU3D_MODULE_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_MODULE, isChecked );
NewDisplay();
m_canvas->Refresh();
return;
case ID_MENU3D_USE_COPPER_THICKNESS:
g_Parm_3D_Visu.SetFlag( FL_USE_COPPER_THICKNESS, isChecked );
NewDisplay();
NewDisplay(GL_ID_BOARD);
return;
case ID_MENU3D_ZONE_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_ZONE, isChecked );
NewDisplay();
NewDisplay(GL_ID_BOARD);
return;
case ID_MENU3D_ADHESIVE_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_ADHESIVE, isChecked );
NewDisplay();
NewDisplay(GL_ID_TECH_LAYERS);
return;
case ID_MENU3D_SILKSCREEN_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_SILKSCREEN, isChecked );
NewDisplay();
NewDisplay(GL_ID_TECH_LAYERS);
return;
case ID_MENU3D_SOLDER_MASK_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_SOLDERMASK, isChecked );
NewDisplay();
NewDisplay(GL_ID_TECH_LAYERS);
return;
case ID_MENU3D_SOLDER_PASTE_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_SOLDERPASTE, isChecked );
NewDisplay();
NewDisplay(GL_ID_TECH_LAYERS);
return;
case ID_MENU3D_COMMENTS_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_COMMENTS, isChecked );
NewDisplay();
NewDisplay(GL_ID_AUX_LAYERS);
return;
case ID_MENU3D_ECO_ONOFF:
g_Parm_3D_Visu.SetFlag( FL_ECO, isChecked );
NewDisplay();
NewDisplay(GL_ID_AUX_LAYERS);
return;
default:
@ -429,7 +440,6 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
GetMenuBar()->Check( ii, false );
}
switch( id )
{
case ID_MENU3D_GRID_NOGRID:
@ -461,18 +471,17 @@ void EDA_3D_FRAME::On3DGridSelection( wxCommandEvent& event )
return;
}
NewDisplay();
NewDisplay( GL_ID_GRID );
}
void EDA_3D_FRAME::NewDisplay()
void EDA_3D_FRAME::NewDisplay( GLuint aGlList )
{
m_reloadRequest = false;
m_canvas->ClearLists();
m_canvas->ClearLists( aGlList );
m_canvas->CreateDrawGL_List();
// m_canvas->InitGL();
m_canvas->Refresh( true );
m_canvas->DisplayStatus();
}
@ -502,6 +511,9 @@ void EDA_3D_FRAME::Set3DBgColor()
newcolor = wxGetColourFromUser( this, oldcolor );
if( !newcolor.IsOk() ) // Happens on cancel dialog
return;
if( newcolor != oldcolor )
{
g_Parm_3D_Visu.m_BgColor.m_Red = (double) newcolor.Red() / 255.0;
@ -510,3 +522,8 @@ void EDA_3D_FRAME::Set3DBgColor()
NewDisplay();
}
}
BOARD* EDA_3D_FRAME::GetBoard()
{
return Parent()->GetBoard();
}

View File

@ -38,9 +38,6 @@
#include "3d_struct.h"
#include "modelparsers.h"
// Imported function:
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
const wxString aExtension )
@ -59,16 +56,46 @@ S3D_MODEL_PARSER* S3D_MODEL_PARSER::Create( S3D_MASTER* aMaster,
}
}
const wxString S3D_MASTER::GetShape3DFullFilename()
{
wxString shapeName;
// Expand any environment variables embedded in footprint's m_Shape3DName field.
// To ensure compatibility with most of footprint's m_Shape3DName field,
// if the m_Shape3DName is not an absolute path the default path
// given by the environment variable KISYS3DMOD will be used
if( m_Shape3DName.StartsWith( wxT("${") ) )
shapeName = wxExpandEnvVars( m_Shape3DName );
else
shapeName = m_Shape3DName;
wxFileName fn( shapeName );
if( fn.IsAbsolute() || shapeName.StartsWith( wxT(".") ) )
return shapeName;
wxString default_path;
wxGetEnv( wxT( KISYS3DMOD ), &default_path );
if( default_path.IsEmpty() )
return shapeName;
if( !default_path.EndsWith( wxT("/") ) && !default_path.EndsWith( wxT("\\") ) )
default_path += wxT("/");
default_path += shapeName;
return default_path;
}
int S3D_MASTER::ReadData()
{
if( m_Shape3DName.IsEmpty() )
{
return 1;
}
// Expand any environment variables embedded in footprint's m_Shape3DName field.
wxString filename = wxExpandEnvVars( m_Shape3DName );
wxString filename = GetShape3DFullFilename();
#ifdef __WINDOWS__
filename.Replace( wxT( "/" ), wxT( "\\" ) );
@ -103,15 +130,3 @@ int S3D_MASTER::ReadData()
return -1;
}
int STRUCT_3D_SHAPE::ReadData( FILE* file, int* LineNum )
{
char line[512];
while( GetLine( file, line, LineNum, 512 ) )
{
}
return -1;
}

View File

@ -109,6 +109,10 @@ public:
private:
wxString m_Shape3DName; /* 3D shape name in 3D library */
FILE3D_TYPE m_ShapeType;
double m_lastTransparency; // last transparency value from
// last material in use
bool m_loadTransparentObjects;
bool m_loadNonTransparentObjects;
public:
S3D_MASTER( EDA_ITEM* aParent );
@ -117,16 +121,41 @@ public:
S3D_MASTER* Next() const { return (S3D_MASTER*) Pnext; }
S3D_MASTER* Back() const { return (S3D_MASTER*) Pback; }
void Insert( S3D_MATERIAL* aMaterial )
{
aMaterial->SetNext( m_Materials );
m_Materials = aMaterial;
}
// Accessors
void SetLastTransparency( double aValue ) { m_lastTransparency = aValue; }
void SetLoadTransparentObjects( bool aLoad )
{ m_loadTransparentObjects = aLoad; }
void SetLoadNonTransparentObjects( bool aLoad )
{ m_loadNonTransparentObjects = aLoad; }
void Insert( S3D_MATERIAL* aMaterial );
/**
* Function IsOpenGlAllowed
* @return true if opengl current list accepts a gl data
* used to filter transparent objects, which are drawn after
* non transparent objects
*/
bool IsOpenGlAllowed();
void Copy( S3D_MASTER* pattern );
/**
* Function ReadData
* Select the parser to read the 3D data file (vrml, x3d ...)
* and build the description objects list
*/
int ReadData();
void Set_Object_Coords( std::vector< S3D_VERTEX >& aVertices );
/**
* Function ObjectCoordsTo3DUnits
* @param aVertices = a list of 3D coordinates in shape units
* to convert to 3D canvas units, according to the
* footprint 3Dshape rotation, offset and scale parameters
*/
void ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
@ -144,6 +173,21 @@ public:
return m_Shape3DName;
}
/**
* Function GetShape3DFullFilename
* @return the full filename of the 3D shape,
* expanding environment variable (if any ) and/or adding default 3D path
* given by environment variable KISYS3DMOD
*/
const wxString GetShape3DFullFilename();
/**
* Function SetShape3DName
* @param aShapeName = file name of the data file relative to the 3D shape
*
* Set the filename of the 3D shape, and depending on the file extention
* (vrl, x3d, idf ) the type of file.
*/
void SetShape3DName( const wxString& aShapeName );
};
@ -163,8 +207,6 @@ public:
STRUCT_3D_SHAPE* Next() const { return (STRUCT_3D_SHAPE*) Pnext; }
STRUCT_3D_SHAPE* Back() const { return (STRUCT_3D_SHAPE*) Pback; }
int ReadData( FILE* file, int* LineNum );
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif

View File

@ -166,13 +166,22 @@ void EDA_3D_FRAME::CreateMenuBar()
wxMenu * gridlistMenu = new wxMenu;
AddMenuItem( prefsMenu, gridlistMenu, ID_MENU3D_GRID,
_( "3D Grid" ), KiBitmap( grid_xpm ) );
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
gridlistMenu->Append( ID_MENU3D_GRID_NOGRID, _( "No 3D Grid" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_10_MM, _( "3D Grid 10 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_5_MM, _( "3D Grid 5 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_2P5_MM, _( "3D Grid 2.5 mm" ), wxEmptyString, true );
gridlistMenu->Append( ID_MENU3D_GRID_1_MM, _( "3D Grid 1 mm" ), wxEmptyString, true );
// If the grid is on, check the corresponding menuitem showing the grid size
if( g_Parm_3D_Visu.GetFlag( FL_GRID ) )
{
gridlistMenu->Check( ID_MENU3D_GRID_10_MM, g_Parm_3D_Visu.m_3D_Grid == 10.0 );
gridlistMenu->Check( ID_MENU3D_GRID_5_MM, g_Parm_3D_Visu.m_3D_Grid == 5.0 );
gridlistMenu->Check( ID_MENU3D_GRID_2P5_MM, g_Parm_3D_Visu.m_3D_Grid == 2.5 );
gridlistMenu->Check( ID_MENU3D_GRID_1_MM, g_Parm_3D_Visu.m_3D_Grid == 1.0 );
}
else
gridlistMenu->Check( ID_MENU3D_GRID_NOGRID, true );
prefsMenu->AppendSeparator();

View File

@ -48,6 +48,9 @@
# include <GL/glu.h>
#endif
#define KISYS3DMOD "KISYS3DMOD"
#include <3d_struct.h>
#define KISYS3DMOD "KISYS3DMOD"
@ -80,6 +83,8 @@ public:
PCB_BASE_FRAME* Parent() { return (PCB_BASE_FRAME*)GetParent(); }
BOARD* GetBoard();
/**
* Function ReloadRequest
* must be called when reloading data from Pcbnew is needed
@ -95,8 +100,10 @@ public:
* Function NewDisplay
* Rebuild the display list.
* must be called when 3D opengl data is modified
* @param aGlList = the list to rebuild.
* if 0 (default) all lists are rebuilt
*/
void NewDisplay();
void NewDisplay( GLuint aGlList = 0 );
void SetDefaultFileName(const wxString &aFn) { m_defaultFileName = aFn; }
const wxString &GetDefaultFileName() const { return m_defaultFileName; }

View File

@ -88,8 +88,8 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
if( bbbox.GetWidth() == 0 && bbbox.GetHeight() == 0 )
{
bbbox.SetWidth( 100 * IU_PER_MM );
bbbox.SetHeight( 100 * IU_PER_MM );
bbbox.SetWidth( Millimeter2iu( 100 ) );
bbbox.SetHeight( Millimeter2iu( 100 ) );
}
m_BoardSettings = &aBoard->GetDesignSettings();
@ -131,6 +131,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
// Fill remaining unused copper layers and front layer zpos
// with m_EpoxyThickness
// Solder mask and Solder paste have the same Z position
for( ; layer <= LAST_COPPER_LAYER; layer++ )
{
m_LayerZcoord[layer] = m_EpoxyThickness;
@ -144,21 +145,21 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
switch( layer_id )
{
case ADHESIVE_N_BACK:
zpos = zpos_copper_back - 4 * zpos_offset;
break;
case ADHESIVE_N_FRONT:
zpos = zpos_copper_front + 4 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back - 3 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
case ADHESIVE_N_FRONT:
zpos = zpos_copper_front + 3 * zpos_offset;
break;
case SOLDERPASTE_N_BACK:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
case SOLDERPASTE_N_FRONT:
zpos = zpos_copper_front + 1 * zpos_offset;
break;
case SOLDERMASK_N_BACK:
zpos = zpos_copper_back - 1 * zpos_offset;
break;
@ -177,7 +178,7 @@ void INFO3D_VISU::InitSettings( BOARD* aBoard )
default:
zpos = zpos_copper_front +
(layer_id - FIRST_NON_COPPER_LAYER + 5) * zpos_offset;
(layer_id - FIRST_NON_COPPER_LAYER + 4) * zpos_offset;
break;
}

View File

@ -74,7 +74,6 @@ enum DISPLAY3D_FLG {
FL_LAST
};
class INFO3D_VISU
{
public:
@ -148,9 +147,10 @@ public: INFO3D_VISU();
*/
int GetCopperThicknessBIU() const
{
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS )
// || GetFlag( FL_USE_REALISTIC_MODE )
;
return use_thickness ?
KiROUND( m_CopperThickness / m_BiuTo3Dunits )
: 0;
}
@ -173,9 +173,10 @@ public: INFO3D_VISU();
*/
int GetNonCopperLayerThicknessBIU() const
{
bool use_copper_thickness = GetFlag( FL_USE_COPPER_THICKNESS ) ||
GetFlag( FL_USE_REALISTIC_MODE );
return use_copper_thickness ?
bool use_thickness = GetFlag( FL_USE_COPPER_THICKNESS )
// || GetFlag( FL_USE_REALISTIC_MODE )
;
return use_thickness ?
KiROUND( m_NonCopperLayerThickness / m_BiuTo3Dunits )
: 0;
}

View File

@ -37,7 +37,7 @@
class S3D_MASTER;
class S3D_VERTEX;
extern void Set_Object_Data( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
extern void TransfertToGLlist( std::vector< S3D_VERTEX >& aVertices, double aBiuTo3DUnits );
class S3D_MODEL_PARSER;
class X3D_MODEL_PARSER;

View File

@ -68,6 +68,8 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
while( GetLine( file, line, &LineNum, 512 ) )
{
text = strtok( line, sep_chars );
if ( text == NULL )
continue;
if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
{
@ -280,8 +282,6 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
}
#define BUFSIZE 2000
void VRML_MODEL_PARSER::readCoordsList( FILE* file, char* text_buffer,
std::vector< double >& aList, int* LineNum )
{
@ -371,6 +371,9 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
strcpy( buffer, line );
text = strtok( buffer, sep_chars );
if( text == NULL )
continue;
if( *text == '}' )
{
err = 0;
@ -381,7 +384,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
if( text && stricmp( text, "true" ) == 0 )
{
}
else
@ -395,7 +398,7 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
{
text = strtok( NULL, " ,\t\n\r" );
if( stricmp( text, "true" ) == 0 )
if( text && stricmp( text, "true" ) == 0 )
{
}
else
@ -516,8 +519,12 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
vertices.push_back( vertex );
}
GetMaster()->Set_Object_Coords( vertices );
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
if( GetMaster()->IsOpenGlAllowed() )
{
GetMaster()->ObjectCoordsTo3DUnits( vertices );
TransfertToGLlist( vertices, vrmlunits_to_3Dunits );
}
vertices.clear();
coordIndex.clear();
}

View File

@ -479,8 +479,11 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
vertices.push_back( triplets.at( *id ) );
}
GetMaster()->Set_Object_Coords( vertices );
Set_Object_Data( vertices, vrmlunits_to_3Dunits );
if( GetMaster()->IsOpenGlAllowed() )
{
GetMaster()->ObjectCoordsTo3DUnits( vertices );
TransfertToGLlist( vertices, vrmlunits_to_3Dunits );
}
vertices.clear();
coordIndex.clear();

View File

@ -23,8 +23,9 @@ set( CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules )
# reports.
#
option( USE_KIWAY_DLLS
"Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." ON )
#option( USE_KIWAY_DLLS "Build the major modules as KIFACE DLLs or DSOs, will soon be the norm." ON )
set( USE_KIWAY_DLLS true ) # this is now mandatory, the code is the same anyways, the old code is gone.
# The desire is to migrate designs *away from* case independence, and to create designs which use
# literally (case specific) interpreted component names. But for backwards compatibility,
@ -58,9 +59,14 @@ option( KICAD_SCRIPTING_WXPYTHON
)
option( KICAD_BUILD_STATIC
"Builds Kicad and all libraries static (except wx-widgets)"
"Builds Kicad and all libraries static"
)
option( KICAD_BUILD_DYNAMIC
"Builds Kicad and all libraries dynamic (required for wxPython)"
)
# WARNING: KiCad developers strongly advise you to build Boost with supplied patches,
# as it is known to work with KiCad. Other versions may contain bugs that may result
# in KiCad errors.
@ -93,9 +99,9 @@ set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
if( UNIX )
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specifig KiCad config files" )
set( KICAD_USER_CONFIG_DIR $ENV{HOME} CACHE PATH "Location of user specific KiCad config files" )
elseif( MINGW )
set( KICAD_USER_CONFIG_DIR $ENV{%APPDATA%} CACHE PATH "Location of user specifig KiCad config files" )
set( KICAD_USER_CONFIG_DIR $ENV{%APPDATA%} CACHE PATH "Location of user specific KiCad config files" )
endif()
mark_as_advanced( KICAD_USER_CONFIG_DIR )
@ -150,6 +156,13 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" )
endif()
find_package( OpenMP QUIET )
if( OPENMP_FOUND )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}" )
add_definitions( -DUSE_OPENMP )
endif()
if( MINGW )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
@ -183,11 +196,14 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PIC_FLAG}" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${PIC_FLAG}" )
# Thou shalt not link vaporware and tell us it's a valid DSO:
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
if( NOT APPLE )
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
endif()
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
endif()
# quiet GCC while in boost
@ -201,7 +217,7 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__ -mmacosx-version-min=10.5" )
# Allows .dylib relocation in the future
# Allows .dylib relocation in the future - needed by fixbundle
set( CMAKE_LD_FLAGS "${CMAKE_LD_FLAGS} -headerpad_max_install_names")
if( NOT CMAKE_CXX_COMPILER )
@ -335,12 +351,24 @@ find_package( OpenGL QUIET )
check_find_package_result( OPENGL_FOUND "OpenGL" )
# Dick 5-Feb-2014:
# Marco: This is broken. You cannot use both ExternalProject_Add() add and find_package()
# Marco: We cannot use both ExternalProject_Add() add and find_package()
# in the same CMake tree and have them both reference the same package:
# http://stackoverflow.com/questions/6351609/cmake-linking-to-library-downloaded-from-externalproject-add
# https://www.mail-archive.com/cmake@cmake.org/msg47501.html
# Handle target used to specify if a target needs wx-widgets or other libraries
# Always defined, empty if no libraries are to be build
add_custom_target( lib-dependencies )
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
# This should be build in all cases, if swig exec is not avaiable
# will be impossible also enable SCRIPTING being for PCBNEW required immediatly
include( download_pcre )
include( download_swig )
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib;.dll")
if( KICAD_BUILD_STATIC AND KICAD_BUILD_DYNAMIC )
@ -349,33 +377,49 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
if( KICAD_BUILD_STATIC )
message(STATUS "KICAD_BUILD_STATIC set")
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
message(FATAL_ERROR "KICAD_SCRIPTING* is not supported with KICAD_BUILD_STATIC, please select KICAD_BUILD_DYNAMIC" )
endif()
endif()
if( KICAD_BUILD_DYNAMIC )
message(STATUS "KICAD_BUILD_DYNAMIC set")
# TODO - Library packaging/relocation
endif()
if( MINGW )
include( download_bzip2 )
add_custom_target( lib-dependencies
DEPENDS boost cairo glew libpng pixman pkgconfig bzip2
)
else()
add_custom_target( lib-dependencies
DEPENDS boost cairo glew libpng pixman pkgconfig
)
endif()
include( download_libpng )
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
message(STATUS "Scripting ENABLED")
include( download_wxpython )
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
set( SWIG_INCLUDE ${SWIG_ROOT}/include )
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
if( NOT EXISTS ${SWIG_EXECUTABLE} )
set(KICAD_SCRIPTING CACHE OFF FORCE "Disabling KICAD_SCRIPTING")
message( STATUS "KICAD_SCRIPTING Enabled but SWIG not found, please disable and before reenabling execute: make swig")
message( FATAL_ERROR "Missing SWIG!")
endif()
message(STATUS "SWIG_EXECUTABLE: ${SWIG_EXECUTABLE}")
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
set(wxWidgets_BIN_DIR ${LIBWXPYTHON_ROOT}/bin/wxrc )
set(wxWidgets_CONFIG_EXECUTABLE ${LIBWXPYTHON_ROOT}/bin/wx-config )
set(wxWidgets_INCLUDE_DIRS ${LIBWXPYTHON_ROOT}/include/wx-3.0 )
set(wxWidgets_LIBRARY_DIRS ${LIBWXPYTHON_ROOT}/lib )
add_dependencies( lib-dependencies libwxpython )
add_dependencies( lib-dependencies swig )
if( KICAD_SCRIPTING_WXPYTHON )
message( FATAL_ERROR "KICAD_BUILD_* and SCRIPTING Not Implemented Yet!" )
else()
include( download_wxwidgets )
add_dependencies( lib-dependencies libwx )
endif()
include( download_libpng )
include( download_pkgconfig )
set( PKG_CONFIG_EXECUTABLE "${PKGCONFIG_ROOT}/bin/pkg-config" )
include( download_glew )
@ -387,6 +431,12 @@ if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
set( CAIRO_INCLUDE_DIR "${CAIRO_ROOT}/include/cairo" )
set( CAIRO_LIBRARY "${CAIRO_ROOT}/lib/libcairo.a" )
add_dependencies( lib-dependencies boost )
add_dependencies( lib-dependencies cairo )
add_dependencies( lib-dependencies libpng )
add_dependencies( lib-dependencies pixman )
add_dependencies( lib-dependencies pkgconfig )
if( KICAD_BUILD_DYNAMIC AND APPLE )
add_custom_target( osx_fix_bundles ALL DEPENDS cvpcb eeschema gerbview kicad pcbnew bitmap2component pcb_calculator pl_editor)
add_custom_command(TARGET osx_fix_bundles POST_BUILD COMMAND scripts/osx_fixbundle.sh COMMENT "Migrating dylibs to bundles")
@ -437,7 +487,7 @@ endif()
# On Apple only wxwidgets 2.9 or higher doesn't need to find aui part of base
# Seems no more needed on wx-3
if( APPLE AND NOT (KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC) )
if( APPLE AND ( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES OR KICAD_SCRIPTING_WXPYTHON) )
find_package( wxWidgets COMPONENTS gl adv html core net base xml QUIET )
else()
find_package( wxWidgets COMPONENTS gl aui adv html core net base xml QUIET )
@ -486,10 +536,25 @@ set( INC_AFTER
# Find Python and other scripting resources
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
set( PythonInterp_FIND_VERSION )
if( APPLE )
set( PYTHON_LIBRARY /System/Library/Frameworks/Python.framework/Versions/2.6/Python )
set( PYTHON_INCLUDE_DIR /System/Library/Frameworks/Python.framework/Versions//2.6/include/python2.6 )
set( PythonInterp_FIND_VERSION 2.6 )
set( PythonLibs_FIND_VERSION 2.6 )
endif()
# force a python version < 3.0
set( PythonInterp_FIND_VERSION 2.6)
set( PythonLibs_FIND_VERSION 2.6 )
find_package( PythonInterp )
check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
if( NOT PYTHON_VERSION_MAJOR EQUAL 2 )
message( FATAL_ERROR "Python 2.x is required." )
endif()
# Get the correct Python site package install path from the Python interpreter found by
# FindPythonInterp unless the user specifically defined a custom path.
if( NOT PYTHON_SITE_PACKAGE_PATH )
@ -507,7 +572,7 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
mark_as_advanced( PYTHON_DEST )
message( STATUS "Python module install path: ${PYTHON_DEST}" )
find_package( PythonLibs )
find_package( PythonLibs 2.6 )
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
@ -558,6 +623,7 @@ add_subdirectory( potrace )
add_subdirectory( bitmap2component )
add_subdirectory( pcb_calculator )
add_subdirectory( tools )
add_subdirectory( utils )
add_subdirectory( qa )
#add_subdirectory( new )
@ -581,17 +647,13 @@ if ( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
add_dependencies( pcbnew lib-dependencies )
add_dependencies( eeschema lib-dependencies )
add_dependencies( cvpcb lib-dependencies )
add_dependencies( gal lib-dependencies )
add_dependencies( common lib-dependencies )
add_dependencies( gal lib-dependencies )
add_dependencies( pcbcommon lib-dependencies )
add_dependencies( 3d-viewer lib-dependencies )
add_dependencies( pcad2kicadpcb lib-dependencies )
add_dependencies( polygon lib-dependencies )
add_dependencies( pl_editor lib-dependencies )
add_dependencies( pnsrouter lib-dependencies )
if ( BUILD_GITHUB_PLUGIN )
add_dependencies( github_plugin lib-dependencies )
endif()
endif()
if ( KICAD_BUILD_DYNAMIC )

View File

@ -0,0 +1,67 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Downloads and builds PCRE
#-----<configure>----------------------------------------------------------------
set( PCRE_RELEASE 8.34 )
set( PCRE_MD5 eb34b2c9c727fd64940d6fd9a00995eb ) # re-calc this on every RELEASE change
set( PCRE_ROOT "${PROJECT_SOURCE_DIR}/pcre_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/pcre )
if (APPLE)
if( CMAKE_OSX_ARCHITECTURES )
set( PCRE_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( PCRE_CXXFLAGS "CXXFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( PCRE_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
ExternalProject_Add( pcre
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://sourceforge.net/projects/pcre/files/pcre/${PCRE_RELEASE}/pcre-${PCRE_RELEASE}.tar.gz
URL_MD5 ${PCRE_MD5}
STAMP_DIR "${PREFIX}"
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PCRE_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${PCRE_ROOT} ${PCRE_CFLAGS} ${PCRE_CXXFLAGS} ${PCRE_LDFLAGS} --disable-dependency-tracking
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${PCRE_ROOT}"
INSTALL_COMMAND $(MAKE) install
)

View File

@ -0,0 +1,79 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Downloads and builds SWIG
#-----<configure>----------------------------------------------------------------
set( SWIG_RELEASE 2.0.11 )
set( SWIG_MD5 291ba57c0acd218da0b0916c280dcbae ) # re-calc this on every RELEASE change
# The boost headers [and static libs if built] go here, at the top of KiCad
# source tree in boost_root.
set( SWIG_ROOT "${PROJECT_SOURCE_DIR}/swig_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/swig )
if (APPLE)
if( CMAKE_OSX_ARCHITECTURES )
set( SWIG_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( SWIG_CXXFLAGS "CXXFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
set( SWIG_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
endif( CMAKE_OSX_ARCHITECTURES )
set( SWIG_PYTHON "--with-python=/usr/bin/python2.6" )
set( SWIG_OPTS --disable-dependency-tracking )
endif(APPLE)
# <SOURCE_DIR> = ${PREFIX}/src/glew
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
# download, the patch is applied. This lets you regenerate a new patch at any time
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
ExternalProject_Add( swig
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://sourceforge.net/projects/swig/files/swig/swig-${SWIG_RELEASE}/swig-${SWIG_RELEASE}.tar.gz
URL_MD5 ${SWIG_MD5}
STAMP_DIR "${PREFIX}"
DEPENDS pcre
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${SWIG_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${SWIG_ROOT} --with-pcre-prefix=${PCRE_ROOT} ${SWIG_CFLAGS} ${SWIG_LDFLAGS} ${SWIG_CXXFLAGS} ${SWIG_PYTHON} ${SWIG_OPTS}
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${SWIG_ROOT}"
INSTALL_COMMAND $(MAKE) install
)

View File

@ -0,0 +1,121 @@
# This program source code file is part of KICAD, a free EDA CAD application.
#
# Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
# Copyright (C) 2013 Kicad Developers, see AUTHORS.txt for contributors.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, you may find one here:
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# or you may search the http://www.gnu.org website for the version 2 license,
# or you may write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
# Downloads and builds LIBWXPYTHON
#-----<configure>----------------------------------------------------------------
set( LIBWXPYTHON_RELEASE 3.0.0.0 )
set( LIBWXPYTHON_MD5 f5e32c7d85dc261ba777e113c3b7e365 ) # re-calc this on every RELEASE change
set( LIBWXPYTHON_ROOT "${PROJECT_SOURCE_DIR}/libwxpython_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/libwxpython )
set( LIBWXPYTHON_EXEC python )
set( LIBWXPYTHON_OPTS --wxpy_installdir=${LIBWXPYTHON_ROOT}/wxPython )
if (APPLE)
SET( LIBWXPYTHON_EXEC python2.6 )
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --osx_cocoa )
#SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_framework --mac_framework_prefix=${LIBWXPYTHON_ROOT}/wxPython )
if( CMAKE_OSX_ARCHITECTURES )
STRING(REGEX REPLACE " -arch " "," LIBWXPYTHON_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
SET( LIBWXPYTHON_OPTS ${LIBWXPYTHON_OPTS} --mac_arch=${LIBWXPYTHON_ARCHITECTURES})
endif( CMAKE_OSX_ARCHITECTURES )
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
SET( LIBWXPYTHON_PRECMD export CFLAGS=-Qunused-arguments && )
endif()
endif(APPLE)
if ( KICAD_BUILD_STATIC )
#message fail
set( LIBWXPYTHON_BUILDTYPE "--disable-shared" )
endif( KICAD_BUILD_STATIC )
# <SOURCE_DIR> = ${PREFIX}/src/libwx
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
# download, the patch is applied. This lets you regenerate a new patch at any time
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
ExternalProject_Add( libwxpython
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://sourceforge.net/projects/wxpython/files/wxPython/${LIBWXPYTHON_RELEASE}/wxPython-src-${LIBWXPYTHON_RELEASE}.tar.bz2
URL_MD5 ${LIBWXPYTHON_MD5}
STAMP_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
PATCH_COMMAND bzr revert
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxpython-3.0.0_macosx.patch"
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxpython-3.0.0_macosx_multiarch.patch" # http://trac.wxwidgets.org/ticket/15957
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWXPYTHON_ROOT}"
COMMAND ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --clean
CONFIGURE_COMMAND ${LIBWXPYTHON_PRECMD} ${LIBWXPYTHON_EXEC} wxPython/build-wxpython.py --prefix=${LIBWXPYTHON_ROOT} --unicode --install ${LIBWXPYTHON_OPTS}
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND true
INSTALL_DIR "${LIBWXPYTHON_ROOT}"
INSTALL_COMMAND true
)
ExternalProject_Add_Step( libwxpython bzr_commit_libwxpython
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
COMMENT "committing pristine libwxpython files to 'libwxpython scratch repo'"
DEPENDERS patch
)
ExternalProject_Add_Step( libwxpython bzr_add_libwxpython
COMMAND bzr add -q ${PREFIX}/src/libwxpython
COMMENT "adding pristine libwxpython files to 'libwxpython scratch repo'"
DEPENDERS bzr_commit_libwxpython
)
ExternalProject_Add_Step( libwxpython bzr_init_libwxpython
COMMAND bzr init -q <SOURCE_DIR>
COMMENT "creating 'libwxpython scratch repo' specifically for libwx to track libwx patches"
DEPENDERS bzr_add_libwxpython
DEPENDEES download
)
######
# Now is time to search what we have built
######
ExternalProject_Add_Step( libwxpython libwxpython_recursive_message
COMMAND cmake .
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
DEPENDEES install
)

Note: AllSpice cannot diff pdf files. Rendering head (latest) version below.

View File

@ -11,32 +11,40 @@ Contribute to KiCad (under Linux)
2) initialize Bazaar:
bzr whoami "John Doe <john.doe@gmail.com>"
3) get LATEST KiCad source tree and name it, for instance, "kicad_john":
3) get latest KiCad source tree:
cd ~/
bzr branch lp:kicad kicad_john
bzr branch lp:kicad kicad.bzr
4) Read coding_style_policy.pdf, in <kicad_sources>/Documentation,
and other docs.
this should leave you with the folder kicad.bzr
5) Modify/add source code.
cd kicad_john
4) Read coding_style_policy.pdf, in kicad.bzr/Documentation,
and other docs.
5) create a local (branch) copy of the KiCad project
bzr branch ./kicad.bzr ./kicad.my_contrib
6) Modify/add source code in
cd kicad.my_contrib
gedit .......
if you need to create and add the file foo.cpp do so and:
bzr add foo.cpp
if you need to delete files:
bzr rm foo.cpp
6) Compile:
cd kicad_john
7) Compile:
cd kicad.my_contrib
mkdir build; cd build
cmake ../ -DCMAKE_BUILD_TYPE=Debug
to build a debug version
or
to build a debug version
or
cmake ../ -DCMAKE_BUILD_TYPE=Release
to build a release version
make
to build a release version
make -j8
7) Repeat step 5 and 6 until satisfied.
8) Repeat step 6 and 7 until satisfied.
8) Create a patch:
in kicad_john:
if some files are added: bzr add [FILE...]
9) Create a patch file:
cd kicad.my_contrib
bzr diff > my_changes.patch
9) Send the patch file "my_changes.patch" to the KiCad developers mailing list.

View File

@ -31,15 +31,22 @@ KiCad from source.
* bzr - Bazaar version control system
* CMake - Cross-platform make
* GLUT - The OpenGL Utility Library
* GLEW
* wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
* libbz2 (dev)
* libcairo (dev)
* Boost - Collection of portable C++ source libraries
boost will be automagically downloaded and copied in kicad sources tree,
boost will be automagically downloaded, copied in kicad sources tree and patched,
the first time you compile kicad.
Useful, but not required:
* Doxygen - Documentation system for several programming languages
Required to build Kicad with scripting (using python) support:
Python
Swig
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
Be sure you bzr install also includes bzrtools.
@ -60,40 +67,43 @@ Install or Build wxWidgets
WARNING:
see wxWidgets_patch_notes.txt for patches and issues in wxWidgets.
If on Windows, download
http://sourceforge.net/projects/wxwindows/files/wxAll/2.9.3/wxWidgets-2.9.3.zip/download
On Windows, download
http://sourceforge.net/projects/wxwindows/files/3.0.0/wxWidgets-3.0.0.zip/download
or a newer version.
Do NOT use previous versions which all have annoying issues for KiCad.
Start msys so you have a bash shell.
Note also since 2.9 versions no need to build a "debug" version of the wxWidgets library,
the release abd the debug version are same.
the release and the debug version are same.
Unzip the wxWidgets zip file into the build directory. Change directories into
there, and then:
mkdir Release
cd Release
../configure --enable-unicode --enable-monolithic=no --disable-shared --with-opengl
../configure --with-opengl
make
and under Linux, but not under Windows:
sudo make install that install wxWidgets libs and headers in /usr/local/
If on linux, you can use your package manager to install the
development versions of the wxWidgets packages which include the C++ headers. An
alternative is to build static libaries from source. Verify that wx-config is in
your path by running it from a command prompt. Linux users then go to next step.
On linux, yo can also download wxWidgets 3.0 (recommandedd)
or you can use your package manager to install the
development versions of the wxWidgets packages which include the C++ headers.
The recommended way is to build wxWidgets from source, and use wxWidgets 3.0
or more recent (Older versions have a print function which does not work).
Verify that wx-config is in your path by running it from a command prompt.
Linux users then go to next step.
Install CMake
-------------
If windows, download the installation binary for windows from cmake.org.
On windows, download the installation binary for windows from cmake.org.
Install that and choose to add cmake to your path during installation. You
will have to restart and command shells for the new path to take effect.
will have to restart your command shell for the new path to take effect.
Verify that cmake is in your path by trying to run it from a command prompt.
If linux, use your package manager to install cmake. You should get cmake 2.6.4
On linux, use your package manager to install cmake. You should get cmake 2.8.4
or later. If only an older one is available in your package repository, build
cmake from source. Verify that cmake is in your path by trying to run it from a
command prompt.
@ -106,25 +116,50 @@ To download files from Launchpad repository, you should install bazaar (bzr) th
version control system like subversion, mercurial, git...
Launchpad repository handle 2 branches for KiCda sources:
- a testing branch (used by developers)
- a stable branch (a copy of the testing branch, when this testing branch is near a stable state))
- a product branch (used by developers, which is most of time usable in production)
- a stable branch (a copy of the testing branch,
when the product branch is a stable state))
Remarks:
- The product branch is actively maintained
- From the product branch, you can go back to any previous version, using bzr features
- The stable branch is poorly or not maintained (and could be removed)
Testing branch:
bzr branch lp:kicad kicad_testing
In order to have a working Kicad installtion, you need
- sources to build binaries
- libraries (they are not included in sources)
- documentation and translations (they are not included in sources)
product branch:
bzr branch lp:kicad kicad_src
Stable branch:
bzr branch lp:kicad/stable kicad_stable
bzr branch lp:kicad/stable kicad_src
Components and Footprints libraries
bzr branch lp:~kicad-lib-committers/kicad/library kicad_libraries
all (schematic libs, 3D shapes ...) but new footprints libraries (use Download zip tool)
https://github.com/KiCad/kicad-library/
New footprints libraries (use Download zip tool for each lib you want)
https://github.com/KiCad/ for footprint libs (*.pretty folders)
A mirror of github is available, using bzr:
(schematic libs, 3D shapes ... all but new footprints libraries)
bzr checkout lp:~kicad-product-committers/kicad/library
Old legacy libraries:
bzr checkout lp:~dickelbeck/kicad/library-read-only
Note also Kicad is able to read on github.com/KiCad/ the *.pretty folders
without download, using github plugin.
(however the time to read them can be long)
Documentation and translations:
bzr branch lp:~kicad-developers/kicad/doc kicad_doc
Create Makefiles with CMake
---------------------------
If windows, go into your msys shell. Linux and windows users both then make
two "out of source" build directories:
On windows, go into your msys shell.
Linux and windows users both then make two "out of source" build directories:
cd <kicadSource>
mkdir -p build/release
mkdir build/debug (if you want a debug version of KiCad)
@ -133,10 +168,10 @@ two "out of source" build directories:
On either cmake command line shown below, you can optionally include
-DCMAKE_INSTALL_PREFIX=<finallInstallDir>
If windows, run the following command:
On windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
If linux, run instead the following command:
On linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Release ../../
Take a look at CMakeCache.txt, and in particular CMAKE_INSTALL_PREFIX, which
@ -166,18 +201,16 @@ On either cmake command line shown below, you can optionally include
Although normally you do not install the Debug binaries, you can debug them
where they were built.
If windows, run the following command:
On windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
where <wxInstallDir> is <wxWidgets path>/Release
If linux, run instead the following command:
On linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON ../../
Make the Debug binaries:
make
Note: that it is easy to build only a specific binary such as pcbnew alone:
make pcbnew
See ./cmake_config.txt for customizing the KiCad build setting.
See Documentation/compiling/build-config.txt for a list of all CMake options
available when compiling KiCad.

Some files were not shown because too many files have changed in this diff Show More