2017-08-15 20:17:00 +02:00
|
|
|
# Detailed information about CMake compatibility available on Qt website
|
|
|
|
# https://doc.qt.io/qt-5/cmake-manual.html
|
2016-08-12 08:38:26 +02:00
|
|
|
include_directories(${CMAKE_HOME_DIRECTORY} ${CMAKE_HOME_DIRECTORY}/include ${CMAKE_CURRENT_SOURCE_DIR})
|
2014-10-12 16:33:38 +03:00
|
|
|
include_directories(${ZLIB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS})
|
2013-08-22 17:22:49 +03:00
|
|
|
|
|
|
|
set(launcher_modmanager_SRCS
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/cdownloadmanager_moc.cpp
|
|
|
|
modManager/cmodlist.cpp
|
|
|
|
modManager/cmodlistmodel_moc.cpp
|
|
|
|
modManager/cmodlistview_moc.cpp
|
|
|
|
modManager/cmodmanager.cpp
|
|
|
|
modManager/imageviewer_moc.cpp
|
2013-08-22 17:22:49 +03:00
|
|
|
)
|
|
|
|
|
2017-07-13 01:44:58 +02:00
|
|
|
set(launcher_modmanager_HEADERS
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/cdownloadmanager_moc.h
|
|
|
|
modManager/cmodlist.h
|
|
|
|
modManager/cmodlistmodel_moc.h
|
|
|
|
modManager/cmodlistview_moc.h
|
|
|
|
modManager/cmodmanager.h
|
|
|
|
modManager/imageviewer_moc.h
|
2017-07-13 01:44:58 +02:00
|
|
|
)
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
set(launcher_settingsview_SRCS
|
2017-08-15 20:17:00 +02:00
|
|
|
settingsView/csettingsview_moc.cpp
|
2013-08-22 17:22:49 +03:00
|
|
|
)
|
|
|
|
|
2017-07-13 01:44:58 +02:00
|
|
|
set(launcher_settingsview_HEADERS
|
2017-08-15 20:17:00 +02:00
|
|
|
settingsView/csettingsview_moc.h
|
2017-07-13 01:44:58 +02:00
|
|
|
)
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
set(launcher_SRCS
|
2017-08-15 20:17:00 +02:00
|
|
|
StdInc.cpp
|
|
|
|
${launcher_modmanager_SRCS}
|
|
|
|
${launcher_settingsview_SRCS}
|
|
|
|
main.cpp
|
|
|
|
mainwindow_moc.cpp
|
|
|
|
launcherdirs.cpp
|
|
|
|
jsonutils.cpp
|
2013-08-22 17:22:49 +03:00
|
|
|
)
|
|
|
|
|
2017-07-13 01:44:58 +02:00
|
|
|
set(launcher_HEADERS
|
2017-08-15 20:17:00 +02:00
|
|
|
StdInc.h
|
|
|
|
${launcher_modmanager_HEADERS}
|
|
|
|
${launcher_settingsview_HEADERS}
|
|
|
|
mainwindow_moc.h
|
|
|
|
launcherdirs.h
|
|
|
|
jsonutils.h
|
2017-07-13 01:44:58 +02:00
|
|
|
)
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
set(launcher_FORMS
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/cmodlistview_moc.ui
|
|
|
|
modManager/imageviewer_moc.ui
|
|
|
|
settingsView/csettingsview_moc.ui
|
|
|
|
mainwindow_moc.ui
|
2013-08-22 17:22:49 +03:00
|
|
|
)
|
|
|
|
|
2017-08-15 20:17:00 +02:00
|
|
|
assign_source_group(${launcher_SRCS} ${launcher_HEADERS} VCMI_launcher.rc)
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
# Tell CMake to run moc when necessary:
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
|
|
|
|
2018-02-23 21:20:20 +02:00
|
|
|
if(POLICY CMP0071)
|
|
|
|
cmake_policy(SET CMP0071 NEW)
|
|
|
|
endif()
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
# As moc files are generated in the binary dir, tell CMake
|
|
|
|
# to always look for includes there:
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
2017-08-15 20:17:00 +02:00
|
|
|
if("${CMAKE_VERSION}" VERSION_LESS 2.8.12)
|
|
|
|
# Executables fail to build with Qt 5 in the default configuration
|
|
|
|
# without -fPIE. We add that here.
|
|
|
|
set(CMAKE_CXX_FLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS} ${CMAKE_CXX_FLAGS}")
|
|
|
|
endif()
|
2013-08-22 17:22:49 +03:00
|
|
|
|
|
|
|
qt5_wrap_ui(launcher_UI_HEADERS ${launcher_FORMS})
|
|
|
|
|
2014-07-11 00:57:17 +03:00
|
|
|
if(WIN32)
|
2017-08-15 20:17:00 +02:00
|
|
|
set(launcher_ICON VCMI_launcher.rc)
|
2014-07-11 00:57:17 +03:00
|
|
|
endif()
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2017-08-15 20:17:00 +02:00
|
|
|
add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON})
|
|
|
|
|
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(vcmilauncher
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "VCMI_launcher"
|
|
|
|
PROJECT_LABEL "VCMI_launcher"
|
|
|
|
)
|
|
|
|
|
|
|
|
# FIXME: Can't to get CMP0020 working with Vcpkg and CMake 3.8.2
|
|
|
|
# So far I tried:
|
|
|
|
# - cmake_minimum_required set to 2.8.11 globally and in this file
|
|
|
|
# - cmake_policy in all possible places
|
|
|
|
# - used NO_POLICY_SCOPE to make sure no other parts reset policies
|
|
|
|
# Still nothing worked, warning kept appearing and WinMain didn't link automatically
|
|
|
|
target_link_libraries(vcmilauncher Qt5::WinMain)
|
2014-10-12 16:40:49 +03:00
|
|
|
endif()
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2017-08-11 04:31:23 +02:00
|
|
|
if(APPLE)
|
|
|
|
# This makes Xcode project prettier by moving vcmilauncher_autogen directory into vcmiclient subfolder
|
|
|
|
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmilauncher)
|
|
|
|
endif()
|
|
|
|
|
2017-08-24 03:52:02 +02:00
|
|
|
target_link_libraries(vcmilauncher vcmi Qt5::Widgets Qt5::Network)
|
2017-08-15 20:17:00 +02:00
|
|
|
|
2017-07-04 22:46:49 +02:00
|
|
|
vcmi_set_output_dir(vcmilauncher "")
|
|
|
|
|
2014-03-23 19:36:16 +03:00
|
|
|
# temporary(?) disabled - generation of PCH takes too much time since cotire is trying to collect all Qt headers
|
|
|
|
#set_target_properties(vcmilauncher PROPERTIES ${PCH_PROPERTIES})
|
|
|
|
#cotire(vcmilauncher)
|
2014-02-01 16:37:26 +03:00
|
|
|
|
2017-08-12 20:58:09 +02:00
|
|
|
# Copy to build directory for easier debugging
|
|
|
|
add_custom_command(TARGET vcmilauncher POST_BUILD
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/launcher/icons ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons
|
|
|
|
)
|
|
|
|
|
|
|
|
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
|
|
|
|
# copy whole directory
|
|
|
|
install(DIRECTORY icons DESTINATION ${DATA_DIR}/launcher)
|
|
|
|
# Install icons and desktop file on Linux
|
|
|
|
if(NOT WIN32 AND NOT APPLE)
|
|
|
|
install(FILES "vcmilauncher.desktop" DESTINATION share/applications)
|
2013-08-22 17:22:49 +03:00
|
|
|
endif()
|