Browse Source

Put PCH behind a cmake flag

Allows developers to turn it off if they don't like/don't want it
pull/18/head
Seth Hillbrand 4 months ago
parent
commit
5b3d4fc91d
  1. 4
      CMakeLists.txt
  2. 76
      common/CMakeLists.txt
  3. 7
      common/build_version.cpp
  4. 24
      eeschema/CMakeLists.txt
  5. 2
      pcbnew/CMakeLists.txt

4
CMakeLists.txt

@ -233,6 +233,10 @@ cmake_dependent_option( KICAD_WIN32_LTCG
OFF "WIN32"
OFF )
option( KICAD_USE_PCH
"Enable precompiled header support"
ON )
# Advanced option to make link maps (only available on linux)
cmake_dependent_option( KICAD_MAKE_LINK_MAPS
"Create link maps for artifacts"

76
common/CMakeLists.txt

@ -239,18 +239,20 @@ add_library( kicommon SHARED
${KICOMMON_SRCS}
)
target_precompile_headers( kicommon
PRIVATE
<kicommon.h>
<algorithm>
<map>
<memory>
<optional>
<set>
<string>
<vector>
<wx/wx.h>
)
if( KICAD_USE_PCH )
target_precompile_headers( kicommon
PRIVATE
<kicommon.h>
<algorithm>
<map>
<memory>
<optional>
<set>
<string>
<vector>
<wx/wx.h>
)
endif()
set_target_properties(kicommon PROPERTIES CXX_VISIBILITY_PRESET hidden)
@ -750,18 +752,20 @@ add_library( common STATIC
${COMMON_SRCS}
)
target_precompile_headers( kicommon
PRIVATE
<kicommon.h>
<algorithm>
<map>
<memory>
<optional>
<set>
<string>
<vector>
<wx/wx.h>
)
if( KICAD_USE_PCH )
target_precompile_headers( kicommon
PRIVATE
<kicommon.h>
<algorithm>
<map>
<memory>
<optional>
<set>
<string>
<vector>
<wx/wx.h>
)
endif()
add_dependencies( common version_header )
add_dependencies( common compoundfilereader ) # used by altium_parser.cpp
@ -929,17 +933,19 @@ set( PCB_COMMON_SRCS
add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} )
target_precompile_headers( pcbcommon
PRIVATE
<vector>
<map>
<memory>
<unordered_map>
<board.h>
<footprint.h>
<zone.h>
<connectivity/connectivity_data.h>
<drc/drc_engine.h> )
if( KICAD_USE_PCH )
target_precompile_headers( pcbcommon
PRIVATE
<vector>
<map>
<memory>
<unordered_map>
<board.h>
<footprint.h>
<zone.h>
<connectivity/connectivity_data.h>
<drc/drc_engine.h> )
endif()
target_compile_definitions(pcbcommon PRIVATE PCBNEW)

7
common/build_version.cpp

@ -317,6 +317,13 @@ wxString GetVersionInfoData( const wxString& aTitle, bool aHtml, bool aBrief )
aMsg << indent4 << "KICAD_IPC_API=" << OFF;
#endif
aMsg << indent4 << "KICAD_USE_PCH=";
#ifdef KICAD_USE_PCH
aMsg << ON;
#else
aMsg << OFF;
#endif
#ifndef NDEBUG
aMsg << indent4 << "KICAD_STDLIB_DEBUG=";
#ifdef KICAD_STDLIB_DEBUG

24
eeschema/CMakeLists.txt

@ -576,17 +576,19 @@ add_library( eeschema_kiface_objects OBJECT
${EESCHEMA_COMMON_SRCS}
)
target_precompile_headers( eeschema_kiface_objects
PRIVATE
<vector>
<map>
<memory>
<unordered_map>
<sch_edit_frame.h>
<string_utils.h>
<schematic.h>
<pgm_base.h>
<wx/wx.h> )
if( KICAD_USE_PCH )
target_precompile_headers( eeschema_kiface_objects
PRIVATE
<vector>
<map>
<memory>
<unordered_map>
<sch_edit_frame.h>
<string_utils.h>
<schematic.h>
<pgm_base.h>
<wx/wx.h> )
endif()
target_include_directories( eeschema_kiface_objects
PUBLIC

2
pcbnew/CMakeLists.txt

@ -720,7 +720,7 @@ add_library( pcbnew_kiface_objects OBJECT
${PCBNEW_SCRIPTING_SRCS}
)
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
if( KICAD_USE_PCH AND CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
target_precompile_headers( pcbnew_kiface_objects
PRIVATE
<vector>

Loading…
Cancel
Save