CMakeLists.txt 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. set(editor_SRCS
  2. StdInc.cpp
  3. main.cpp
  4. launcherdirs.cpp
  5. jsonutils.cpp
  6. mainwindow.cpp
  7. BitmapHandler.cpp
  8. maphandler.cpp
  9. Animation.cpp
  10. graphics.cpp
  11. windownewmap.cpp
  12. generatorprogress.cpp
  13. mapview.cpp
  14. objectbrowser.cpp
  15. mapsettings.cpp
  16. playersettings.cpp
  17. playerparams.cpp
  18. scenelayer.cpp
  19. mapcontroller.cpp
  20. validator.cpp
  21. inspector/inspector.cpp
  22. inspector/townbulidingswidget.cpp
  23. inspector/armywidget.cpp
  24. inspector/messagewidget.cpp
  25. inspector/rewardswidget.cpp
  26. inspector/questwidget.cpp
  27. resourceExtractor/ResourceConverter.cpp
  28. )
  29. set(editor_HEADERS
  30. StdInc.h
  31. launcherdirs.h
  32. jsonutils.h
  33. mainwindow.h
  34. BitmapHandler.h
  35. maphandler.h
  36. Animation.h
  37. graphics.h
  38. windownewmap.h
  39. generatorprogress.h
  40. mapview.h
  41. objectbrowser.h
  42. mapsettings.h
  43. playersettings.h
  44. playerparams.h
  45. scenelayer.h
  46. mapcontroller.h
  47. validator.h
  48. inspector/inspector.h
  49. inspector/townbulidingswidget.h
  50. inspector/armywidget.h
  51. inspector/messagewidget.h
  52. inspector/rewardswidget.h
  53. inspector/questwidget.h
  54. resourceExtractor/ResourceConverter.h
  55. )
  56. set(editor_FORMS
  57. mainwindow.ui
  58. windownewmap.ui
  59. generatorprogress.ui
  60. mapsettings.ui
  61. playersettings.ui
  62. playerparams.ui
  63. validator.ui
  64. inspector/townbulidingswidget.ui
  65. inspector/armywidget.ui
  66. inspector/messagewidget.ui
  67. inspector/rewardswidget.ui
  68. inspector/questwidget.ui
  69. )
  70. assign_source_group(${editor_SRCS} ${editor_HEADERS} mapeditor.rc)
  71. # Tell CMake to run moc when necessary:
  72. set(CMAKE_AUTOMOC ON)
  73. if(POLICY CMP0071)
  74. cmake_policy(SET CMP0071 NEW)
  75. endif()
  76. # As moc files are generated in the binary dir, tell CMake
  77. # to always look for includes there:
  78. set(CMAKE_INCLUDE_CURRENT_DIR ON)
  79. if(TARGET Qt6::Core)
  80. qt_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
  81. else()
  82. qt5_wrap_ui(editor_UI_HEADERS ${editor_FORMS})
  83. endif()
  84. if(WIN32)
  85. set(editor_ICON mapeditor.rc)
  86. endif()
  87. add_executable(vcmieditor WIN32 ${editor_SRCS} ${editor_HEADERS} ${editor_UI_HEADERS} ${editor_ICON})
  88. if(WIN32)
  89. set_target_properties(vcmieditor
  90. PROPERTIES
  91. OUTPUT_NAME "VCMI_mapeditor"
  92. PROJECT_LABEL "VCMI_mapeditor"
  93. )
  94. # FIXME: Can't to get CMP0020 working with Vcpkg and CMake 3.8.2
  95. # So far I tried:
  96. # - cmake_minimum_required set to 2.8.11 globally and in this file
  97. # - cmake_policy in all possible places
  98. # - used NO_POLICY_SCOPE to make sure no other parts reset policies
  99. # Still nothing worked, warning kept appearing and WinMain didn't link automatically
  100. target_link_libraries(vcmieditor Qt${QT_VERSION_MAJOR}::WinMain)
  101. endif()
  102. if(APPLE)
  103. # This makes Xcode project prettier by moving mapeditor_autogen directory into vcmiclient subfolder
  104. set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmieditor)
  105. endif()
  106. target_link_libraries(vcmieditor vcmi Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network)
  107. target_include_directories(vcmieditor
  108. PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
  109. )
  110. vcmi_set_output_dir(vcmieditor "")
  111. enable_pch(vcmieditor)
  112. # Copy to build directory for easier debugging
  113. add_custom_command(TARGET vcmieditor POST_BUILD
  114. COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
  115. COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/mapeditor/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/mapeditor/icons
  116. )
  117. install(TARGETS vcmieditor DESTINATION ${BIN_DIR})
  118. # copy whole directory
  119. install(DIRECTORY icons DESTINATION ${DATA_DIR}/mapeditor)
  120. # Install icons and desktop file on Linux
  121. if(NOT WIN32 AND NOT APPLE)
  122. install(FILES "vcmieditor.desktop" DESTINATION share/applications)
  123. install(FILES "icons/mapeditor.32x32.png" DESTINATION share/icons/hicolor/32x32/apps RENAME vcmieditor.png)
  124. install(FILES "icons/mapeditor.48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME vcmieditor.png)
  125. install(FILES "icons/mapeditor.64x64.png" DESTINATION share/icons/hicolor/64x64/apps RENAME vcmieditor.png)
  126. install(FILES "icons/mapeditor.128x128.png" DESTINATION share/icons/hicolor/128x128/apps RENAME vcmieditor.png)
  127. install(FILES "icons/mapeditor.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmieditor.png)
  128. endif()