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.
Form master branch
This commit is contained in:
jean-pierre charras 2022-07-12 17:34:25 +02:00
parent d53c6f8abe
commit fd65bd8e6e
6 changed files with 1076 additions and 1058 deletions

View File

@ -619,8 +619,8 @@ set( TMP_DIR "${CMAKE_CURRENT_BINARY_DIR}/tmp" )
# generate logs is useful only if you have problems
set( CREATE_LOG_FILES true )
set( BITMAP_INFO_FILE "${CMAKE_SOURCE_DIR}/include/bitmaps/bitmap_info.h" )
set( BITMAP_INFO_TEMPLATE "${CMAKE_SOURCE_DIR}/include/bitmaps/bitmap_info.h.in" )
set( BITMAP_INFO_FILE "${CMAKE_SOURCE_DIR}/common/bitmap_info.cpp" )
set( BITMAP_INFO_TEMPLATE "${CMAKE_SOURCE_DIR}/include/bitmaps/bitmap_info.cpp.in" )
set( BITMAP_INFO_LIST "" )
set( ALL_PNGS "" )
@ -739,7 +739,7 @@ function( bitmap_dir pngWidth pngHeight bmapList )
png2png( ${tmpFile} ${pngPath} )
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}" )

View File

@ -315,6 +315,7 @@ set( COMMON_SRCS
bin_mod.cpp
bitmap.cpp
bitmap_base.cpp
bitmap_info.cpp
bitmap_store.cpp
board_printout.cpp
build_version.cpp

1050
common/bitmap_info.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -101,7 +101,7 @@ BITMAP_STORE::BITMAP_STORE()
{
wxFileName path( PATHS::GetStockDataPath() + wxT( "/resources" ), IMAGE_ARCHIVE );
wxLogTrace( traceBitmaps, wxT( "Loading bitmaps from " ) + path.GetFullPath() );
wxLogTrace( traceBitmaps, "Loading bitmaps from " + path.GetFullPath() );
m_archive = std::make_unique<ASSET_ARCHIVE>( path.GetFullPath() );
@ -148,8 +148,8 @@ wxImage BITMAP_STORE::getImage( BITMAPS aBitmapId, int aHeight )
if( count < 0 )
{
wxLogTrace( traceBitmaps, wxT( "Bitmap for %d, %d, %s has an info tag with file %s," )
wxT( "but that file could not be found in the archive!" ),
wxLogTrace( traceBitmaps, "Bitmap for %d, %d, %s has an info tag with file %s,"
"but that file could not be found in the archive!",
aBitmapId, aHeight, m_theme );
data = s_imageNotFound;
count = sizeof( s_imageNotFound );
@ -204,7 +204,7 @@ wxString BITMAP_STORE::computeBitmapName( BITMAPS aBitmapId, int aHeight )
{
if( !m_bitmapInfoCache.count( aBitmapId ) )
{
wxLogTrace( traceBitmaps, wxT( "No bitmap info available for %d" ), aBitmapId );
wxLogTrace( traceBitmaps, "No bitmap info available for %d", aBitmapId );
return wxEmptyString;
}
@ -224,7 +224,7 @@ wxString BITMAP_STORE::computeBitmapName( BITMAPS aBitmapId, int aHeight )
if( fn.IsEmpty() )
{
wxLogTrace( traceBitmaps, wxT( "No bitmap found matching ID %d, height %d, theme %s" ),
wxLogTrace( traceBitmaps, "No bitmap found matching ID %d, height %d, theme %s",
aBitmapId, aHeight, m_theme );
return m_bitmapInfoCache.at( aBitmapId ).begin()->filename;
}
@ -235,6 +235,5 @@ wxString BITMAP_STORE::computeBitmapName( BITMAPS aBitmapId, int aHeight )
void BITMAP_STORE::buildBitmapInfoCache()
{
for( const BITMAP_INFO& entry : g_BitmapInfo )
m_bitmapInfoCache[entry.id].emplace_back( entry );
BuildBitmapInfo( m_bitmapInfoCache );
}

View File

@ -1,8 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2021 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2022 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
@ -22,25 +21,10 @@
* This file is auto-generated by CMake when MAINTAIN_PNGS is on. Do not edit by hand!
*/
#ifndef KICAD_BITMAP_INFO_H
#define KICAD_BITMAP_INFO_H
#include <vector>
#include <bitmaps/bitmaps_list.h>
#include <bitmaps/bitmap_info.h>
#include <wx/string.h> // wxT
struct BITMAP_INFO
void BuildBitmapInfo( std::unordered_map<BITMAPS, std::vector<BITMAP_INFO>>& aBitmapInfoCache )
{
BITMAPS id;
wxString filename;
int height;
wxString theme;
};
const std::vector<BITMAP_INFO> g_BitmapInfo = {
${BITMAP_INFO_LIST}
};
#endif // KICAD_BITMAP_INFO_H

File diff suppressed because it is too large Load Diff