Modernize setting link map linker flags
This commit is contained in:
parent
0ba116a3ee
commit
912f1d5cec
|
@ -91,7 +91,7 @@ endif()
|
|||
unset( S3DSG_VERSION_FILE CACHE )
|
||||
|
||||
# Define a flag to expose the appropriate EXPORT macro at build time
|
||||
target_compile_definitions( kicad_3dsg PRIVATE -DCOMPILE_SGLIB )
|
||||
target_compile_definitions( kicad_3dsg PRIVATE COMPILE_SGLIB )
|
||||
|
||||
target_link_libraries( kicad_3dsg ${wxWidgets_LIBRARIES} )
|
||||
|
||||
|
|
|
@ -53,6 +53,15 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
|||
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
|
||||
set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
|
||||
|
||||
|
||||
# Create a flag to identify the non-Apple unix systems
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( UNIX_NOT_APPLE ON )
|
||||
else()
|
||||
set( UNIX_NOT_APPLE OFF )
|
||||
endif()
|
||||
|
||||
|
||||
#
|
||||
# KiCad build options should be added below.
|
||||
#
|
||||
|
@ -175,6 +184,13 @@ cmake_dependent_option( KICAD_WIN32_BUILD_PARALLEL_CL_MP
|
|||
OFF "WIN32"
|
||||
OFF )
|
||||
|
||||
# Advanced option to make link maps (only available on linux)
|
||||
cmake_dependent_option( KICAD_MAKE_LINK_MAPS
|
||||
"Create link maps for artifacts"
|
||||
ON "UNIX_NOT_APPLE"
|
||||
OFF )
|
||||
mark_as_advanced( KICAD_MAKE_LINK_MAPS )
|
||||
|
||||
####################################
|
||||
# Debugging/profiling
|
||||
####################################
|
||||
|
@ -967,17 +983,6 @@ add_subdirectory( doxygen )
|
|||
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config.h.cmake
|
||||
${CMAKE_BINARY_DIR}/config.h )
|
||||
|
||||
###
|
||||
# Generate Map file
|
||||
###
|
||||
if( KICAD_MAKE_LINK_MAPS )
|
||||
# Currently only works on linux/gcc
|
||||
if( UNIX AND NOT APPLE )
|
||||
set( MAKE_LINK_MAPS true )
|
||||
else()
|
||||
set( MAKE_LINK_MAPS false )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
#================================================
|
||||
# "make uninstall" rules
|
||||
|
|
|
@ -94,10 +94,9 @@ set_source_files_properties( cvpcb.cpp PROPERTIES
|
|||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( cvpcb_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=_cvpcb.kiface.map" )
|
||||
endif()
|
||||
target_link_options( cvpcb_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_cvpcb.kiface.map>
|
||||
)
|
||||
|
||||
# these 2 binaries are a matched set, keep them together:
|
||||
if( APPLE )
|
||||
|
|
|
@ -525,15 +525,13 @@ set_source_files_properties( eeschema.cpp PROPERTIES
|
|||
# if building eeschema, then also build eeschema_kiface if out of date.
|
||||
add_dependencies( eeschema eeschema_kiface )
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
# generate link map with cross reference
|
||||
set_target_properties( eeschema_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=${KIFACE_PREFIX}eeschema${KIFACE_SUFFIX}.map"
|
||||
# Generate link map with cross reference
|
||||
target_link_options( eeschema_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=${KIFACE_PREFIX}eeschema${KIFACE_SUFFIX}.map>
|
||||
)
|
||||
set_target_properties( eeschema PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=eeschema.map"
|
||||
target_link_options( eeschema PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=eeschema.map>
|
||||
)
|
||||
endif()
|
||||
|
||||
# these 2 binaries are a matched set, keep them together:
|
||||
if( APPLE )
|
||||
|
|
|
@ -120,11 +120,9 @@ target_include_directories( gerbview PRIVATE
|
|||
$<TARGET_PROPERTY:thread-pool,INTERFACE_INCLUDE_DIRECTORIES>
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( gerbview PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=gerbview.map" )
|
||||
endif()
|
||||
|
||||
target_link_options( gerbview PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=gerbview.map>
|
||||
)
|
||||
|
||||
# The objects for the main gerbview program
|
||||
add_library( gerbview_kiface_objects OBJECT
|
||||
|
@ -164,10 +162,9 @@ set_source_files_properties( gerbview.cpp PROPERTIES
|
|||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( gerbview_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=_gerbview.kiface.map" )
|
||||
endif()
|
||||
target_link_options( gerbview_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_gerbview.kiface.map>
|
||||
)
|
||||
|
||||
# if building gerbview, then also build gerbview_kiface if out of date.
|
||||
add_dependencies( gerbview gerbview_kiface )
|
||||
|
|
|
@ -88,10 +88,9 @@ target_link_libraries( pl_editor
|
|||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( pl_editor PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=pl_editor.map" )
|
||||
endif()
|
||||
target_link_options( pl_editor PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=pl_editor.map>
|
||||
)
|
||||
|
||||
# the main pl_editor program, in DSO form.
|
||||
add_library( pl_editor_kiface MODULE
|
||||
|
@ -120,10 +119,9 @@ set_source_files_properties( pl_editor.cpp PROPERTIES
|
|||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( pl_editor_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=_pl_editor.kiface.map" )
|
||||
endif()
|
||||
target_link_options( pl_editor_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_pl_editor.kiface.map>
|
||||
)
|
||||
|
||||
# if building pl_editor, then also build pl_editor_kiface if out of date.
|
||||
add_dependencies( pl_editor pl_editor_kiface )
|
||||
|
|
|
@ -92,10 +92,9 @@ target_link_libraries( pcb_calculator
|
|||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( pcb_calculator PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=pcb_calculator.map" )
|
||||
endif()
|
||||
target_link_options( pcb_calculator PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=pcb_calculator.map>
|
||||
)
|
||||
|
||||
# the main pcb_calculator program, in DSO form.
|
||||
add_library( pcb_calculator_kiface MODULE
|
||||
|
@ -118,10 +117,9 @@ set_source_files_properties( pcb_calculator.cpp PROPERTIES
|
|||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( pcb_calculator_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=_pcb_calculator.kiface.map" )
|
||||
endif()
|
||||
target_link_options( pcb_calculator_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_pcb_calculator.kiface.map>
|
||||
)
|
||||
|
||||
# if building pcb_calculator, then also build pcb_calculator_kiface if out of date.
|
||||
add_dependencies( pcb_calculator pcb_calculator_kiface )
|
||||
|
|
|
@ -1,13 +1,3 @@
|
|||
|
||||
if( UNIX AND NOT APPLE )
|
||||
# Setting this ON slows down linking and is a advanced (=hidden) developer option for
|
||||
# linux, not a user option.
|
||||
option( PCBNEW_LINK_MAPS
|
||||
"Developer: create linker map files for pcbnew binaries, not typical for Debug builds"
|
||||
)
|
||||
mark_as_advanced( PCBNEW_LINK_MAPS )
|
||||
endif()
|
||||
|
||||
add_compile_definitions( PCBNEW )
|
||||
|
||||
add_subdirectory(connectivity)
|
||||
|
@ -613,10 +603,9 @@ target_link_libraries( pcbnew
|
|||
${wxWidgets_LIBRARIES}
|
||||
)
|
||||
|
||||
if( PCBNEW_LINK_MAPS )
|
||||
set_target_properties( pcbnew PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map" )
|
||||
endif()
|
||||
target_link_options( pcbnew PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=pcbnew.map>
|
||||
)
|
||||
|
||||
# the main pcbnew program, in DSO form.
|
||||
add_library( pcbnew_kiface_objects OBJECT
|
||||
|
@ -707,14 +696,9 @@ set_source_files_properties( pcbnew.cpp PROPERTIES
|
|||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||
)
|
||||
|
||||
if( PCBNEW_LINK_MAPS )
|
||||
set_target_properties( pcbnew_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=_pcbnew.kiface.map"
|
||||
target_link_options( pcbnew_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_pcbnew.kiface.map>
|
||||
)
|
||||
set_target_properties( pcbnew PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map"
|
||||
)
|
||||
endif()
|
||||
|
||||
# if building pcbnew, then also build pcbnew_kiface if out of date.
|
||||
add_dependencies( pcbnew pcbnew_kiface )
|
||||
|
|
|
@ -61,10 +61,9 @@ set_target_properties( scripting_kiface PROPERTIES
|
|||
SUFFIX ${KIFACE_SUFFIX}
|
||||
)
|
||||
|
||||
if( MAKE_LINK_MAPS )
|
||||
set_target_properties( scripting_kiface PROPERTIES
|
||||
LINK_FLAGS "-Wl,-cref,-Map=_scripting.kiface.map" )
|
||||
endif()
|
||||
target_link_options( scripting_kiface PRIVATE
|
||||
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_scripting.kiface.map>
|
||||
)
|
||||
|
||||
if( APPLE )
|
||||
set_target_properties( scripting_kiface PROPERTIES
|
||||
|
|
Loading…
Reference in New Issue