Eeschema: build with object libraries
This is done to allow access to the eeschema library internals for purposes of test and script access, as the DLL library has highly restrictive -fvisibility settings that otherwise prevent the tests being able to access 99.9% of the eeschema library functions (only a single function is APIEXPORT'ed, therefore that's the only test we can do). Using object libraries is a bit of a hack, and makes for a slower link when done for multiple targets, but with the currently supported CMake versions, it's about as good as we can get. A better solution in the longer term may be to break eeschema_kiface(_objects) into many smaller libraries, each of which has a much more defined scope, rather than one big interlinked amorphous lump. This has the advantage that each module is testable in isolation, and we get better organisation of inter-dependencies in the codebase. Then, the kiface DLL will gather these sub-libs and present what is needed on the visible DLL API. Thus, we get both a testable suite of library functions, and a restricted kiface DLL interface.
This commit is contained in:
parent
e1f6230e8c
commit
0617bffce0
|
@ -145,7 +145,6 @@ set( EESCHEMA_SRCS
|
|||
edit_bitmap.cpp
|
||||
edit_component_in_schematic.cpp
|
||||
edit_label.cpp
|
||||
eeschema.cpp
|
||||
eeschema_config.cpp
|
||||
erc.cpp
|
||||
fields_grid_table.cpp
|
||||
|
@ -332,21 +331,30 @@ target_link_libraries( eeschema
|
|||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
|
||||
# the DSO (KIFACE) housing the main eeschema code:
|
||||
add_library( eeschema_kiface SHARED
|
||||
# the main Eeschema program, in DSO form.
|
||||
add_library( eeschema_kiface_objects OBJECT
|
||||
${EESCHEMA_SRCS}
|
||||
${EESCHEMA_COMMON_SRCS}
|
||||
)
|
||||
|
||||
# CMake <3.9 can't link anything to object libraries,
|
||||
# but we only need include directories, as we will link the kiface MODULE
|
||||
target_include_directories( eeschema_kiface_objects PRIVATE
|
||||
$<TARGET_PROPERTY:common,INCLUDE_DIRECTORIES>
|
||||
$<TARGET_PROPERTY:legacy_gal,INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
add_library( eeschema_kiface MODULE
|
||||
eeschema.cpp
|
||||
$<TARGET_OBJECTS:eeschema_kiface_objects>
|
||||
)
|
||||
|
||||
target_link_libraries( eeschema_kiface
|
||||
gal
|
||||
legacy_gal
|
||||
common
|
||||
${wxWidgets_LIBRARIES}
|
||||
${GDI_PLUS_LIBRARIES}
|
||||
)
|
||||
target_include_directories( eeschema_kiface PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if( KICAD_SPICE )
|
||||
target_link_libraries( eeschema_kiface
|
||||
|
|
|
@ -23,17 +23,11 @@
|
|||
|
||||
|
||||
include_directories( BEFORE ${INC_BEFORE} )
|
||||
include_directories( AFTER ${INC_AFTER} )
|
||||
|
||||
|
||||
add_executable( qa_eeschema
|
||||
# A single top to load the pcnew kiface
|
||||
# ../../common/single_top.cpp
|
||||
|
||||
# stuff from common due to...units?
|
||||
../../common/base_units.cpp
|
||||
../../common/eda_text.cpp
|
||||
|
||||
# stuff from common which is needed...why?
|
||||
../../common/colors.cpp
|
||||
../../common/observable.cpp
|
||||
|
@ -44,18 +38,28 @@ add_executable( qa_eeschema
|
|||
test_module.cpp
|
||||
|
||||
test_eagle_plugin.cpp
|
||||
|
||||
# Older CMakes cannot link OBJECT libraries
|
||||
# https://cmake.org/pipermail/cmake/2013-November/056263.html
|
||||
$<TARGET_OBJECTS:eeschema_kiface_objects>
|
||||
)
|
||||
|
||||
target_link_libraries( qa_eeschema
|
||||
eeschema_kiface
|
||||
common
|
||||
gal
|
||||
legacy_gal
|
||||
qa_utils
|
||||
unit_test_utils
|
||||
${GDI_PLUS_LIBRARIES}
|
||||
${Boost_LIBRARIES}
|
||||
)
|
||||
|
||||
target_include_directories( qa_eeschema PUBLIC
|
||||
# Paths for eeschema lib usage (should really be in eeschema/common
|
||||
# target_include_directories and made PUBLIC)
|
||||
${CMAKE_SOURCE_DIR}/eeschema
|
||||
${INC_AFTER}
|
||||
)
|
||||
|
||||
# Eeschema tests, so pretend to be eeschema (for units, etc)
|
||||
target_compile_definitions( qa_eeschema
|
||||
PUBLIC EESCHEMA
|
||||
|
|
Loading…
Reference in New Issue