Rework on bitmap_info.cpp cmake build process.

on gcc 12.1 / msys2 the large initialized list in bitmap_info.cpp breaks
the compiler (perhaps a bug in the compiler).
So, as workaround, the initialization sequence is modified.
This commit is contained in:
jean-pierre charras 2022-07-05 20:30:14 +02:00
parent d24e6c3408
commit 1a5b0d7e39
5 changed files with 1113 additions and 1102 deletions

View File

@ -786,7 +786,7 @@ function( bitmap_dir pngWidth pngHeight bmapList )
png2png( ${tmpFile} ${pngPath} ) png2png( ${tmpFile} ${pngPath} )
set( bitmapInfo set( bitmapInfo
" { BITMAPS::${bmn}, wxT( \"${pngFile}\" ), ${pngHeight}, wxT( \"${theme}\" ) },\n" " aBitmapInfoCache[BITMAPS::${bmn}].emplace_back( BITMAPS::${bmn}, wxT( \"${pngFile}\" ), ${pngHeight}, wxT( \"${theme}\" ) );\n"
) )
set( BITMAP_INFO_LIST "${BITMAP_INFO_LIST}${bitmapInfo}" ) set( BITMAP_INFO_LIST "${BITMAP_INFO_LIST}${bitmapInfo}" )

File diff suppressed because it is too large Load Diff

View File

@ -235,6 +235,5 @@ wxString BITMAP_STORE::computeBitmapName( BITMAPS aBitmapId, int aHeight )
void BITMAP_STORE::buildBitmapInfoCache() void BITMAP_STORE::buildBitmapInfoCache()
{ {
for( const BITMAP_INFO& entry : g_BitmapInfo ) BuildBitmapInfo( m_bitmapInfoCache );
m_bitmapInfoCache[entry.id].emplace_back( entry );
} }

View File

@ -24,6 +24,7 @@
#include <bitmaps/bitmaps_list.h> #include <bitmaps/bitmaps_list.h>
#include <bitmaps/bitmap_info.h> #include <bitmaps/bitmap_info.h>
const std::vector<BITMAP_INFO> g_BitmapInfo = { void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBitmapInfoCache )
{
${BITMAP_INFO_LIST} ${BITMAP_INFO_LIST}
}; };

View File

@ -22,9 +22,10 @@
#define KICAD_BITMAP_INFO_H #define KICAD_BITMAP_INFO_H
#include <vector> #include <vector>
#include <unordered_map>
#include <bitmaps/bitmaps_list.h> #include <bitmaps/bitmaps_list.h>
#include <wx/string.h> // wxT #include <wx/string.h>
struct BITMAP_INFO struct BITMAP_INFO
{ {
@ -32,9 +33,18 @@ struct BITMAP_INFO
wxString filename; wxString filename;
int height; int height;
wxString theme; wxString theme;
BITMAP_INFO( BITMAPS aId, const wxString& aFilename, int aHeight, const wxString& aTheme ) :
id( aId ),
filename( aFilename ),
height( aHeight ),
theme( aTheme )
{};
}; };
extern const std::vector<BITMAP_INFO> g_BitmapInfo; extern void BuildBitmapInfo( std::unordered_map<BITMAPS,
std::vector<BITMAP_INFO>>& aBitmapInfoCache );
#endif // KICAD_BITMAP_INFO_H #endif // KICAD_BITMAP_INFO_H