Introduce core interface library

This library is meant to move non-EDA items (language extensions,
library extensions, etc.) into the lowest-level of our dependency chain.
This library should never depend on anyother non-thirdparty code in the
kicad codebase.
This commit is contained in:
Ian McInerney 2023-04-05 00:34:46 +01:00
parent b05de51a8d
commit ea62b145ff
18 changed files with 48 additions and 3 deletions

View File

@ -114,6 +114,7 @@ target_link_libraries( 3d-viewer
PRIVATE
gal
kimath
core
nlohmann_json
Boost::headers
${wxWidgets_LIBRARIES}

View File

@ -483,6 +483,7 @@ target_link_libraries( common
libcontext
kimath
kiplatform
core
fmt::fmt
gal
scripting
@ -618,6 +619,7 @@ target_link_libraries( pcbcommon PUBLIC
delaunator
kimath
kiplatform
core
threadpool
)

View File

@ -483,6 +483,7 @@ target_link_libraries( eeschema_kiface
markdown_lib
scripting
sexpr
core
Boost::headers
${wxWidgets_LIBRARIES}
${NGSPICE_LIBRARY}

View File

@ -112,6 +112,7 @@ target_link_libraries( gerbview
# There's way too much crap coming in from common yet.
gal
common
core
nlohmann_json
${wxWidgets_LIBRARIES}
)
@ -137,6 +138,7 @@ target_link_libraries( gerbview_kiface_objects
PUBLIC
common
gal
core
)
# the main gerbview program, in DSO form.
@ -153,6 +155,7 @@ target_link_libraries( gerbview_kiface
nlohmann_json
gal
common
core
gerbview_kiface_objects
${wxWidgets_LIBRARIES}
)

View File

@ -118,6 +118,7 @@ if( APPLE )
target_link_libraries( kicad
nlohmann_json
common
core
${wxWidgets_LIBRARIES}
)
@ -129,6 +130,7 @@ if( APPLE )
nlohmann_json
common
${wxWidgets_LIBRARIES}
core
)
else()
target_link_libraries( kicad
@ -136,6 +138,7 @@ else()
common
gal
common #repeated due to a circular dependency between gal and common
core
${wxWidgets_LIBRARIES}
)
@ -144,6 +147,7 @@ else()
common
gal
common #repeated due to a circular dependency between gal and common
core
${wxWidgets_LIBRARIES}
)
endif()

View File

@ -55,7 +55,10 @@ add_library( pcm_settings STATIC
# This is a circular dependency but it's not a problem for static libs.
# Refactoring this would need separating kicad_settings, settings manager
# and pgm_base out of common.
target_link_libraries( pcm_settings common )
target_link_libraries( pcm_settings
common
core
)
target_include_directories(
pcm_settings

View File

@ -22,6 +22,7 @@
#
# Build file for generic re-useable libraries
add_subdirectory( core )
add_subdirectory( kimath )
add_subdirectory( kiplatform )
add_subdirectory( sexpr )

18
libs/core/CMakeLists.txt Normal file
View File

@ -0,0 +1,18 @@
# Add all the warnings to the files
if( COMPILER_SUPPORTS_WARNINGS )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARN_FLAGS_CXX}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_FLAGS_C}")
endif()
add_library( core INTERFACE
# Just a header library right now
)
target_link_libraries( core INTERFACE
${wxWidgets_LIBRARIES}
)
target_include_directories( core INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}/include
)

3
libs/core/Readme.md Normal file
View File

@ -0,0 +1,3 @@
This library contains base non-EDA items and extensions to libraries that are used throughout
the KiCad codebase. This library should never depend on any parts of the KiCad code outside the
thirdparty directory, since this is meant to be the lowest-level library in the dependency chain.

View File

@ -38,6 +38,7 @@ add_library( kimath STATIC
)
target_link_libraries( kimath
core
clipper
clipper2
othermath
@ -49,9 +50,13 @@ target_link_libraries( kimath
target_include_directories( kimath PUBLIC
${PROJECT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/include
# This include REALLY shouldn't be here, but shape_arc.h grew a dependency on the units somehow
${CMAKE_SOURCE_DIR}/include
)
target_include_directories( kimath PRIVATE
${PROJECT_SOURCE_DIR}/include # core/kicad_algo.h is needed for shape_arc
# This include REALLY shouldn't be here, but shape_arc grew a dependency on the units somehow
${CMAKE_SOURCE_DIR}/include
${wxWidgets_LIBRARIES}
)

View File

@ -85,6 +85,7 @@ target_link_libraries( pl_editor
# There's way too much crap coming in from common yet.
gal
common
core
${wxWidgets_LIBRARIES}
)
@ -102,6 +103,7 @@ add_library( pl_editor_kiface MODULE
target_link_libraries( pl_editor_kiface
gal
common
core
${wxWidgets_LIBRARIES}
)
set_target_properties( pl_editor_kiface PROPERTIES

View File

@ -595,6 +595,7 @@ target_link_libraries( pcbnew
common
gal
scripting
core
nlohmann_json
rectpack2d
argparse::argparse
@ -625,6 +626,7 @@ make_lexer(
target_link_libraries( pcbnew_kiface_objects
PRIVATE
common
core
dxflib_qcad
nanosvg
tinyspline_lib
@ -672,6 +674,7 @@ set( PCBNEW_KIFACE_LIBRARIES
common
gal
scripting
core
dxflib_qcad
tinyspline_lib
idf3

View File

@ -76,7 +76,6 @@ target_link_libraries( qa_kimath
)
target_include_directories( qa_kimath PRIVATE
${CMAKE_SOURCE_DIR}/include # Needed for core/optional.h
${CMAKE_SOURCE_DIR}/qa/mocks/include
${CMAKE_CURRENT_SOURCE_DIR}
)