diff --git a/bitmap2component/CMakeLists.txt b/bitmap2component/CMakeLists.txt index 766c303f07..ebf6a5a954 100644 --- a/bitmap2component/CMakeLists.txt +++ b/bitmap2component/CMakeLists.txt @@ -10,8 +10,8 @@ include_directories( BEFORE ${INC_BEFORE} ) include_directories( ${INC_AFTER} ) set( BITMAP2COMPONENT_SRCS + ${CMAKE_SOURCE_DIR}/common/base_units.cpp ${CMAKE_SOURCE_DIR}/common/single_top.cpp - bitmap2cmp_main.cpp bitmap2cmp_settings.cpp bitmap2component.cpp diff --git a/common/base_units.cpp b/common/base_units.cpp index 3ee7bd2dca..296ff4a70e 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -41,16 +41,12 @@ #include -#if defined( PCBNEW ) || defined( CVPCB ) || defined( EESCHEMA ) || defined( GERBVIEW ) || defined( PL_EDITOR ) #define IU_TO_MM( x ) ( x / IU_PER_MM ) #define IU_TO_IN( x ) ( x / IU_PER_MILS / 1000 ) #define IU_TO_MILS( x ) ( x / IU_PER_MILS ) #define MM_TO_IU( x ) ( x * IU_PER_MM ) #define IN_TO_IU( x ) ( x * IU_PER_MILS * 1000 ) #define MILS_TO_IU( x ) ( x * IU_PER_MILS ) -#else -#error "Cannot resolve internal units due to no definition of EESCHEMA, CVPCB or PCBNEW." -#endif // Helper function to print a float number without using scientific notation diff --git a/common/settings/app_settings.cpp b/common/settings/app_settings.cpp index 320d99827e..5194c2277b 100644 --- a/common/settings/app_settings.cpp +++ b/common/settings/app_settings.cpp @@ -25,6 +25,7 @@ #include #include #include +#include ///! Update the schema version whenever a migration is required const int appSettingsSchemaVersion = 0; @@ -211,7 +212,6 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri ret &= fromLegacy( aCfg, aFrame + "_LastGridSize", aJsonPath + ".grid.last_size" ); -#if defined( PCBNEW ) double x, y; if( aCfg->Read( aFrame + "PcbUserGrid_X", &x ) && aCfg->Read( aFrame + "PcbUserGrid_Y", &y ) ) @@ -221,7 +221,6 @@ bool APP_SETTINGS_BASE::migrateWindowConfig( wxConfigBase* aCfg, const std::stri ( *this )[PointerFromString( ".grid.user_grid_x" )] = StringFromValue( u, x, true, true ); ( *this )[PointerFromString( ".grid.user_grid_y" )] = StringFromValue( u, y, true, true ); } -#endif ret &= fromLegacy( aCfg, aFrame + gd + "GridAxesEnabled", aJsonPath + ".grid.axes_enabled" ); diff --git a/include/convert_to_biu.h b/include/convert_to_biu.h index c54deb5fff..882a5a157d 100644 --- a/include/convert_to_biu.h +++ b/include/convert_to_biu.h @@ -86,12 +86,13 @@ constexpr inline int Iu2Mils( int iu ) return static_cast< int >( mils < 0 ? mils - 0.5 : mils + 0.5 ); } #else -// Here, we do not know the value of internal units: do not define -// conversion functions (They do not have meaning) -#define UNKNOWN_IU +// Here, we do not know the value of internal units: just use something safe to allow +// easier packaging of compilation units +constexpr double IU_PER_MM = 1; +constexpr double IU_PER_MILS = IU_PER_MM * 0.0254; #endif -#ifndef UNKNOWN_IU + // Other definitions used in a few files constexpr double MM_PER_IU = ( 1 / IU_PER_MM ); @@ -121,6 +122,4 @@ constexpr inline double Iu2Millimeter( int iu ) constexpr int ARC_LOW_DEF = Millimeter2iu( 0.02 ); constexpr int ARC_HIGH_DEF = Millimeter2iu( 0.005 ); -#endif - #endif // CONVERT_TO_BIU_H_ diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt index dccd99739f..3c7c43649a 100644 --- a/kicad/CMakeLists.txt +++ b/kicad/CMakeLists.txt @@ -15,6 +15,7 @@ include_directories( set( KICAD_SRCS + ${CMAKE_SOURCE_DIR}/common/base_units.cpp dialogs/dialog_template_selector_base.cpp dialogs/dialog_template_selector.cpp files-io.cpp diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt index 5fa93b0d2d..8ef7ecbc86 100644 --- a/pcb_calculator/CMakeLists.txt +++ b/pcb_calculator/CMakeLists.txt @@ -10,6 +10,7 @@ include_directories( ) set( PCB_CALCULATOR_SRCS + ${CMAKE_SOURCE_DIR}/common/base_units.cpp attenuators.cpp board_classes_values.cpp colorcode.cpp