cmake: install pdb files only for MSVC build

This commit is contained in:
Zdenko Podobný 2024-06-10 12:43:33 +02:00
parent 0f815d5dde
commit 4bd125b032
2 changed files with 60 additions and 19 deletions

View File

@ -927,13 +927,19 @@ install(
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
RENAME tesseract.pc)
install(TARGETS tesseract DESTINATION bin)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION bin OPTIONAL)
endif()
install(
TARGETS libtesseract
EXPORT TesseractTargets
RUNTIME DESTINATION bin
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if (MSVC)
install(FILES $<TARGET_PDB_FILE:libtesseract> DESTINATION bin OPTIONAL)
endif()
install(
EXPORT TesseractTargets
NAMESPACE Tesseract::

View File

@ -126,7 +126,9 @@ install(
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
generate_export_header(common_training EXPORT_MACRO_NAME
TESS_COMMON_TRAINING_API)
install(FILES $<TARGET_PDB_FILE:common_training> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:common_training> DESTINATION bin OPTIONAL)
endif()
project_group(common_training "Training Tools")
# ##############################################################################
@ -142,7 +144,9 @@ if(NOT DISABLED_LEGACY_ENGINE)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:ambiguous_words> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:ambiguous_words> DESTINATION bin OPTIONAL)
endif()
endif()
# ##############################################################################
@ -158,7 +162,9 @@ if(NOT DISABLED_LEGACY_ENGINE)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:classifier_tester> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:classifier_tester> DESTINATION bin OPTIONAL)
endif()
endif()
# ##############################################################################
@ -173,7 +179,9 @@ install(
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:combine_tessdata> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:combine_tessdata> DESTINATION bin OPTIONAL)
endif()
# ##############################################################################
# EXECUTABLE cntraining
@ -188,7 +196,9 @@ if(NOT DISABLED_LEGACY_ENGINE)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:cntraining> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:cntraining> DESTINATION bin OPTIONAL)
endif()
endif()
# ##############################################################################
@ -203,7 +213,10 @@ install(
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:dawg2wordlist> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:dawg2wordlist> DESTINATION bin OPTIONAL)
endif()
# ##############################################################################
# EXECUTABLE mftraining
# ##############################################################################
@ -217,7 +230,9 @@ if(NOT DISABLED_LEGACY_ENGINE)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:mftraining> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:mftraining> DESTINATION bin OPTIONAL)
endif()
endif()
# ##############################################################################
@ -233,7 +248,9 @@ if(NOT DISABLED_LEGACY_ENGINE)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:shapeclustering> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:shapeclustering> DESTINATION bin OPTIONAL)
endif()
endif()
# ##############################################################################
@ -248,9 +265,11 @@ install(
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:wordlist2dawg> DESTINATION bin OPTIONAL)
if(ICU_FOUND)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:wordlist2dawg> DESTINATION bin OPTIONAL)
endif()
if(ICU_FOUND)
if(NOT SW_BUILD)
include_directories(${ICU_INCLUDE_DIRS})
endif()
@ -279,7 +298,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES $<TARGET_PDB_FILE:unicharset_training> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:unicharset_training> DESTINATION bin OPTIONAL)
endif()
generate_export_header(unicharset_training EXPORT_MACRO_NAME
TESS_UNICHARSET_TRAINING_API)
project_group(unicharset_training "Training Tools")
@ -296,7 +317,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:combine_lang_model> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:combine_lang_model> DESTINATION bin OPTIONAL)
endif()
# ############################################################################
# EXECUTABLE lstmeval
@ -310,7 +333,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:lstmeval> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:lstmeval> DESTINATION bin OPTIONAL)
endif()
# ############################################################################
# EXECUTABLE lstmtraining
@ -324,7 +349,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:lstmtraining> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:lstmtraining> DESTINATION bin OPTIONAL)
endif()
# ############################################################################
# EXECUTABLE merge_unicharsets
@ -338,7 +365,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:merge_unicharsets> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:merge_unicharsets> DESTINATION bin OPTIONAL)
endif()
# ############################################################################
# EXECUTABLE set_unicharset_properties
@ -352,7 +381,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:set_unicharset_properties> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:set_unicharset_properties> DESTINATION bin OPTIONAL)
endif()
# ############################################################################
# EXECUTABLE unicharset_extractor
@ -367,7 +398,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:unicharset_extractor> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:unicharset_extractor> DESTINATION bin OPTIONAL)
endif()
# ############################################################################
@ -424,7 +457,9 @@ if(ICU_FOUND)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
install(FILES $<TARGET_PDB_FILE:text2image> DESTINATION bin OPTIONAL)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:text2image> DESTINATION bin OPTIONAL)
endif()
endif()
endif(ICU_FOUND)