Browse Source

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.
newinvert
Ian McInerney 3 years ago
parent
commit
ea62b145ff
  1. 1
      3d-viewer/CMakeLists.txt
  2. 2
      common/CMakeLists.txt
  3. 1
      eeschema/CMakeLists.txt
  4. 3
      gerbview/CMakeLists.txt
  5. 4
      kicad/CMakeLists.txt
  6. 5
      kicad/pcm/CMakeLists.txt
  7. 1
      libs/CMakeLists.txt
  8. 18
      libs/core/CMakeLists.txt
  9. 3
      libs/core/Readme.md
  10. 0
      libs/core/include/core/arraydim.h
  11. 0
      libs/core/include/core/kicad_algo.h
  12. 0
      libs/core/include/core/minoptmax.h
  13. 0
      libs/core/include/core/spinlock.h
  14. 0
      libs/core/include/core/wx_stl_compat.h
  15. 7
      libs/kimath/CMakeLists.txt
  16. 2
      pagelayout_editor/CMakeLists.txt
  17. 3
      pcbnew/CMakeLists.txt
  18. 1
      qa/unittests/libs/kimath/CMakeLists.txt

1
3d-viewer/CMakeLists.txt

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

2
common/CMakeLists.txt

@ -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
)

1
eeschema/CMakeLists.txt

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

3
gerbview/CMakeLists.txt

@ -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}
)

4
kicad/CMakeLists.txt

@ -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()

5
kicad/pcm/CMakeLists.txt

@ -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

1
libs/CMakeLists.txt

@ -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

@ -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

@ -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.

0
include/core/arraydim.h → libs/core/include/core/arraydim.h

0
include/core/kicad_algo.h → libs/core/include/core/kicad_algo.h

0
include/core/minoptmax.h → libs/core/include/core/minoptmax.h

0
include/core/spinlock.h → libs/core/include/core/spinlock.h

0
include/core/wx_stl_compat.h → libs/core/include/core/wx_stl_compat.h

7
libs/kimath/CMakeLists.txt

@ -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}
)

2
pagelayout_editor/CMakeLists.txt

@ -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

3
pcbnew/CMakeLists.txt

@ -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

1
qa/unittests/libs/kimath/CMakeLists.txt

@ -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}
)

Loading…
Cancel
Save