Skip to content

Commit

Permalink
cmake: install pdb files only for MSVC build
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenop committed Jun 10, 2024
1 parent 0f815d5 commit 4bd125b
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 19 deletions.
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
71 changes: 53 additions & 18 deletions src/training/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

# ##############################################################################
Expand All @@ -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()

# ##############################################################################
Expand All @@ -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()

# ##############################################################################
Expand All @@ -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
Expand All @@ -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()

# ##############################################################################
Expand All @@ -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
# ##############################################################################
Expand All @@ -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()

# ##############################################################################
Expand All @@ -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()

# ##############################################################################
Expand All @@ -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()
Expand Down Expand Up @@ -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")
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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()

# ############################################################################

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 4bd125b

Please sign in to comment.