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 )
|
unset( S3DSG_VERSION_FILE CACHE )
|
||||||
|
|
||||||
# Define a flag to expose the appropriate EXPORT macro at build time
|
# 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} )
|
target_link_libraries( kicad_3dsg ${wxWidgets_LIBRARIES} )
|
||||||
|
|
||||||
|
@ -108,4 +108,4 @@ install( TARGETS
|
||||||
if( KICAD_WIN32_INSTALL_PDBS )
|
if( KICAD_WIN32_INSTALL_PDBS )
|
||||||
# Get the PDBs to copy over for MSVC
|
# Get the PDBs to copy over for MSVC
|
||||||
install(FILES $<TARGET_PDB_FILE:kicad_3dsg> DESTINATION ${KICAD_BIN})
|
install(FILES $<TARGET_PDB_FILE:kicad_3dsg> DESTINATION ${KICAD_BIN})
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -53,6 +53,15 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
|
||||||
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
|
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
|
||||||
set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
|
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.
|
# KiCad build options should be added below.
|
||||||
#
|
#
|
||||||
|
@ -175,6 +184,13 @@ cmake_dependent_option( KICAD_WIN32_BUILD_PARALLEL_CL_MP
|
||||||
OFF "WIN32"
|
OFF "WIN32"
|
||||||
OFF )
|
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
|
# Debugging/profiling
|
||||||
####################################
|
####################################
|
||||||
|
@ -967,17 +983,6 @@ add_subdirectory( doxygen )
|
||||||
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config.h.cmake
|
configure_file( ${PROJECT_SOURCE_DIR}/cmake/config.h.cmake
|
||||||
${CMAKE_BINARY_DIR}/config.h )
|
${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
|
# "make uninstall" rules
|
||||||
|
|
|
@ -94,10 +94,9 @@ set_source_files_properties( cvpcb.cpp PROPERTIES
|
||||||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( cvpcb_kiface PRIVATE
|
||||||
set_target_properties( cvpcb_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_cvpcb.kiface.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=_cvpcb.kiface.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# these 2 binaries are a matched set, keep them together:
|
# these 2 binaries are a matched set, keep them together:
|
||||||
if( APPLE )
|
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.
|
# if building eeschema, then also build eeschema_kiface if out of date.
|
||||||
add_dependencies( eeschema eeschema_kiface )
|
add_dependencies( eeschema eeschema_kiface )
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
# Generate link map with cross reference
|
||||||
# generate link map with cross reference
|
target_link_options( eeschema_kiface PRIVATE
|
||||||
set_target_properties( eeschema_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=${KIFACE_PREFIX}eeschema${KIFACE_SUFFIX}.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=${KIFACE_PREFIX}eeschema${KIFACE_SUFFIX}.map"
|
)
|
||||||
)
|
target_link_options( eeschema PRIVATE
|
||||||
set_target_properties( eeschema PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=eeschema.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=eeschema.map"
|
)
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# these 2 binaries are a matched set, keep them together:
|
# these 2 binaries are a matched set, keep them together:
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
|
|
|
@ -120,11 +120,9 @@ target_include_directories( gerbview PRIVATE
|
||||||
$<TARGET_PROPERTY:thread-pool,INTERFACE_INCLUDE_DIRECTORIES>
|
$<TARGET_PROPERTY:thread-pool,INTERFACE_INCLUDE_DIRECTORIES>
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( gerbview PRIVATE
|
||||||
set_target_properties( gerbview PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=gerbview.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=gerbview.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# The objects for the main gerbview program
|
# The objects for the main gerbview program
|
||||||
add_library( gerbview_kiface_objects OBJECT
|
add_library( gerbview_kiface_objects OBJECT
|
||||||
|
@ -164,10 +162,9 @@ set_source_files_properties( gerbview.cpp PROPERTIES
|
||||||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( gerbview_kiface PRIVATE
|
||||||
set_target_properties( gerbview_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_gerbview.kiface.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=_gerbview.kiface.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# if building gerbview, then also build gerbview_kiface if out of date.
|
# if building gerbview, then also build gerbview_kiface if out of date.
|
||||||
add_dependencies( gerbview gerbview_kiface )
|
add_dependencies( gerbview gerbview_kiface )
|
||||||
|
|
|
@ -88,10 +88,9 @@ target_link_libraries( pl_editor
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( pl_editor PRIVATE
|
||||||
set_target_properties( pl_editor PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=pl_editor.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=pl_editor.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# the main pl_editor program, in DSO form.
|
# the main pl_editor program, in DSO form.
|
||||||
add_library( pl_editor_kiface MODULE
|
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"
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( pl_editor_kiface PRIVATE
|
||||||
set_target_properties( pl_editor_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_pl_editor.kiface.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=_pl_editor.kiface.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# if building pl_editor, then also build pl_editor_kiface if out of date.
|
# if building pl_editor, then also build pl_editor_kiface if out of date.
|
||||||
add_dependencies( pl_editor pl_editor_kiface )
|
add_dependencies( pl_editor pl_editor_kiface )
|
||||||
|
|
|
@ -92,10 +92,9 @@ target_link_libraries( pcb_calculator
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( pcb_calculator PRIVATE
|
||||||
set_target_properties( pcb_calculator PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=pcb_calculator.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=pcb_calculator.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# the main pcb_calculator program, in DSO form.
|
# the main pcb_calculator program, in DSO form.
|
||||||
add_library( pcb_calculator_kiface MODULE
|
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"
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( pcb_calculator_kiface PRIVATE
|
||||||
set_target_properties( pcb_calculator_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_pcb_calculator.kiface.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=_pcb_calculator.kiface.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# if building pcb_calculator, then also build pcb_calculator_kiface if out of date.
|
# if building pcb_calculator, then also build pcb_calculator_kiface if out of date.
|
||||||
add_dependencies( pcb_calculator pcb_calculator_kiface )
|
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_compile_definitions( PCBNEW )
|
||||||
|
|
||||||
add_subdirectory(connectivity)
|
add_subdirectory(connectivity)
|
||||||
|
@ -613,10 +603,9 @@ target_link_libraries( pcbnew
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
if( PCBNEW_LINK_MAPS )
|
target_link_options( pcbnew PRIVATE
|
||||||
set_target_properties( pcbnew PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=pcbnew.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=pcbnew.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
# the main pcbnew program, in DSO form.
|
# the main pcbnew program, in DSO form.
|
||||||
add_library( pcbnew_kiface_objects OBJECT
|
add_library( pcbnew_kiface_objects OBJECT
|
||||||
|
@ -707,14 +696,9 @@ set_source_files_properties( pcbnew.cpp PROPERTIES
|
||||||
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
COMPILE_DEFINITIONS "BUILD_KIWAY_DLL;COMPILING_DLL"
|
||||||
)
|
)
|
||||||
|
|
||||||
if( PCBNEW_LINK_MAPS )
|
target_link_options( pcbnew_kiface PRIVATE
|
||||||
set_target_properties( pcbnew_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_pcbnew.kiface.map>
|
||||||
LINK_FLAGS "-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.
|
# if building pcbnew, then also build pcbnew_kiface if out of date.
|
||||||
add_dependencies( pcbnew pcbnew_kiface )
|
add_dependencies( pcbnew pcbnew_kiface )
|
||||||
|
|
|
@ -61,10 +61,9 @@ set_target_properties( scripting_kiface PROPERTIES
|
||||||
SUFFIX ${KIFACE_SUFFIX}
|
SUFFIX ${KIFACE_SUFFIX}
|
||||||
)
|
)
|
||||||
|
|
||||||
if( MAKE_LINK_MAPS )
|
target_link_options( scripting_kiface PRIVATE
|
||||||
set_target_properties( scripting_kiface PROPERTIES
|
$<$<BOOL:${KICAD_MAKE_LINK_MAPS}>:-Wl,-cref,-Map=_scripting.kiface.map>
|
||||||
LINK_FLAGS "-Wl,-cref,-Map=_scripting.kiface.map" )
|
)
|
||||||
endif()
|
|
||||||
|
|
||||||
if( APPLE )
|
if( APPLE )
|
||||||
set_target_properties( scripting_kiface PROPERTIES
|
set_target_properties( scripting_kiface PROPERTIES
|
||||||
|
|
Loading…
Reference in New Issue