2018-02-27 17:20:46 +01:00
|
|
|
cmake_minimum_required (VERSION 2.8.12)
|
2013-11-01 16:54:24 +01:00
|
|
|
|
2018-11-27 08:40:24 +01:00
|
|
|
project ( cafTestApplication )
|
|
|
|
|
|
|
|
|
|
# Open GL
|
|
|
|
|
find_package( OpenGL )
|
|
|
|
|
|
2015-07-29 14:19:43 +02:00
|
|
|
# Qt
|
|
|
|
|
|
2013-11-01 16:54:24 +01:00
|
|
|
# Qt MOC
|
2018-11-27 08:40:24 +01:00
|
|
|
set (MOC_HEADER_FILES
|
2013-11-01 16:54:24 +01:00
|
|
|
MainWindow.h
|
|
|
|
|
WidgetLayoutTest.h
|
2017-09-08 14:43:14 +02:00
|
|
|
CustomObjectEditor.h
|
2017-11-02 08:50:07 +01:00
|
|
|
MenuItemProducer.h
|
2013-11-01 16:54:24 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Resource file
|
|
|
|
|
set( QRC_FILES
|
2019-08-29 11:48:43 +02:00
|
|
|
${QRC_FILES}
|
2013-11-01 16:54:24 +01:00
|
|
|
textedit.qrc
|
|
|
|
|
)
|
|
|
|
|
|
2019-05-31 10:22:30 +02:00
|
|
|
if (NOT DEFINED(CEE_USE_QT5))
|
|
|
|
|
option(CEE_USE_QT5 "Use Qt5" OFF)
|
|
|
|
|
endif(NOT DEFINED(CEE_USE_QT5))
|
2019-05-28 10:50:39 +02:00
|
|
|
|
|
|
|
|
if (CEE_USE_QT5)
|
|
|
|
|
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets OpenGL)
|
|
|
|
|
set(QT_LIBRARIES Qt5::Core Qt5::Gui Qt5::Widgets Qt5::OpenGL)
|
|
|
|
|
qt5_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
|
2018-11-27 08:40:24 +01:00
|
|
|
qt5_add_resources( QRC_FILES_CPP ${QRC_FILES} )
|
|
|
|
|
else()
|
2019-05-28 10:50:39 +02:00
|
|
|
find_package(Qt4 COMPONENTS REQUIRED QtCore QtGui QtMain QtOpenGl)
|
|
|
|
|
include(${QT_USE_FILE})
|
|
|
|
|
qt4_wrap_cpp(MOC_SOURCE_FILES ${MOC_HEADER_FILES} )
|
2018-11-27 08:40:24 +01:00
|
|
|
qt4_add_resources( QRC_FILES_CPP ${QRC_FILES} )
|
2019-05-28 10:50:39 +02:00
|
|
|
endif(CEE_USE_QT5)
|
|
|
|
|
|
|
|
|
|
option(USE_COMMAND_FRAMEWORK "Use Caf Command Framework" ON)
|
2013-11-01 16:54:24 +01:00
|
|
|
|
2015-07-29 14:19:43 +02:00
|
|
|
if (USE_COMMAND_FRAMEWORK)
|
|
|
|
|
include_directories (
|
|
|
|
|
${cafCommand_SOURCE_DIR}
|
|
|
|
|
)
|
|
|
|
|
ADD_DEFINITIONS(-DTAP_USE_COMMAND_FRAMEWORK)
|
|
|
|
|
endif(USE_COMMAND_FRAMEWORK)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set( PROJECT_FILES
|
2013-11-01 16:54:24 +01:00
|
|
|
Main.cpp
|
|
|
|
|
MainWindow.cpp
|
2017-09-08 14:43:14 +02:00
|
|
|
MainWindow.h
|
2013-11-01 16:54:24 +01:00
|
|
|
WidgetLayoutTest.cpp
|
2017-09-08 14:43:14 +02:00
|
|
|
WidgetLayoutTest.h
|
2017-09-08 13:48:10 +02:00
|
|
|
ManyGroups.cpp
|
2017-09-08 14:43:14 +02:00
|
|
|
ManyGroups.h
|
|
|
|
|
CustomObjectEditor.cpp
|
|
|
|
|
CustomObjectEditor.h
|
2017-11-02 08:50:07 +01:00
|
|
|
MenuItemProducer.cpp
|
|
|
|
|
MenuItemProducer.h
|
2015-07-29 14:19:43 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# add the executable
|
|
|
|
|
add_executable ( ${PROJECT_NAME}
|
|
|
|
|
${PROJECT_FILES}
|
2018-11-27 08:40:24 +01:00
|
|
|
${MOC_SOURCE_FILES}
|
2013-11-01 16:54:24 +01:00
|
|
|
${QRC_FILES_CPP}
|
2019-09-02 13:39:48 +02:00
|
|
|
$<TARGET_OBJECTS:cafCommandFeatures> # Needed for cmake version < 3.12. Remove when we can use target_link_libraries with OBJECT libraries
|
2013-11-01 16:54:24 +01:00
|
|
|
)
|
|
|
|
|
|
2015-07-29 14:19:43 +02:00
|
|
|
set (TAP_LINK_LIBRARIES
|
2013-11-01 16:54:24 +01:00
|
|
|
cafUserInterface
|
2015-07-29 14:19:43 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
if (USE_COMMAND_FRAMEWORK)
|
|
|
|
|
set (TAP_LINK_LIBRARIES
|
|
|
|
|
${TAP_LINK_LIBRARIES}
|
|
|
|
|
cafCommand
|
2019-09-02 13:39:48 +02:00
|
|
|
#cafCommandFeatures # Not possible using cmake version < 3.12. Use when we can use target_link_libraries with OBJECT libraries
|
2015-07-29 14:19:43 +02:00
|
|
|
)
|
|
|
|
|
endif(USE_COMMAND_FRAMEWORK)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
target_link_libraries ( ${PROJECT_NAME}
|
|
|
|
|
${TAP_LINK_LIBRARIES}
|
2018-11-27 08:40:24 +01:00
|
|
|
${QT_LIBRARIES}
|
2013-11-01 16:54:24 +01:00
|
|
|
)
|
|
|
|
|
|
2015-07-29 14:19:43 +02:00
|
|
|
source_group("" FILES ${PROJECT_FILES})
|
|
|
|
|
|
2019-05-28 10:50:39 +02:00
|
|
|
if (CEE_USE_QT5)
|
2018-11-27 08:40:24 +01:00
|
|
|
foreach (qtlib ${QT_LIBRARIES})
|
|
|
|
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different $<TARGET_FILE:${qtlib}> $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
2019-05-28 10:50:39 +02:00
|
|
|
)
|
2018-11-27 08:40:24 +01:00
|
|
|
endforeach(qtlib)
|
|
|
|
|
else()
|
|
|
|
|
# Copy Qt Dlls
|
|
|
|
|
if (MSVC)
|
2019-05-28 10:50:39 +02:00
|
|
|
set (QTLIBLIST QtCore QtGui QtOpenGl QtXml)
|
2018-11-27 08:40:24 +01:00
|
|
|
foreach (qtlib ${QTLIBLIST})
|
2019-05-28 10:50:39 +02:00
|
|
|
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${QT_BINARY_DIR}/$<IF:$<CONFIG:Debug>,${qtlib}d4.dll,${qtlib}4.dll> $<TARGET_FILE_DIR:${PROJECT_NAME}>
|
|
|
|
|
)
|
2018-11-27 08:40:24 +01:00
|
|
|
endforeach( qtlib )
|
|
|
|
|
endif(MSVC)
|
2019-05-28 10:50:39 +02:00
|
|
|
endif(CEE_USE_QT5)
|
|
|
|
|
|
2019-02-01 06:56:11 +01:00
|
|
|
|
2019-02-11 07:13:08 +01:00
|
|
|
# cotire
|
|
|
|
|
if (COMMAND caf_apply_cotire)
|
|
|
|
|
caf_apply_cotire("${PROJECT_NAME}")
|
2019-02-01 06:56:11 +01:00
|
|
|
endif()
|