Fri, 05 Jun 2015 18:33:51 +0300
Major rework, lots of internal maintenance, version editor removed
36 | 1 | project (zcinema) |
2 | cmake_minimum_required (VERSION 2.6) | |
3 | ||
4 | if (USE_QT5) | |
5 | find_package (Qt5Widgets REQUIRED) | |
6 | find_package (Qt5Core REQUIRED) | |
7 | find_package (Qt5OpenGL REQUIRED) | |
8 | find_package (Qt5Network REQUIRED) | |
9 | set (CMAKE_AUTOMOC ON) | |
10 | else() | |
11 | find_package (Qt4 REQUIRED) | |
12 | endif() | |
13 | ||
14 | include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR}) | |
15 | ||
16 | set (ZCINEMA_SOURCES | |
17 | src/cfg.cpp | |
18 | src/config.cpp | |
19 | src/demo.cpp | |
20 | src/main.cpp | |
21 | src/misc.cpp | |
22 | src/prompts.cpp | |
23 | ) | |
24 | ||
25 | set (ZCINEMA_HEADERS | |
26 | src/cfg.h | |
27 | src/config.h | |
28 | src/demo.h | |
29 | src/main.h | |
30 | src/misc.h | |
31 | src/prompts.h | |
32 | src/types.h | |
33 | ) | |
34 | ||
35 | set (ZCINEMA_FORMS | |
36 | ui/findfile.ui | |
37 | ui/demoprompt.ui | |
38 | ui/unknownversion.ui | |
39 | ui/versionEditor.ui | |
40 | ui/configbox.ui | |
41 | ui/addversion.ui | |
42 | ) | |
43 | ||
44 | set (ZCINEMA_RESOURCES zcinema.qrc) | |
45 | ||
46 | if (NOT MSVC) | |
47 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall") | |
48 | endif() | |
49 | ||
50 | include_directories ("${PROJECT_BINARY_DIR}") | |
51 | include_directories ("${PROJECT_BINARY_DIR}/src") | |
52 | ||
53 | if (USE_QT5) | |
54 | qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS}) | |
55 | qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES}) | |
56 | qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) | |
57 | add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_MOC} | |
58 | ${ZCINEMA_QRC} ${ZCINEMA_FORMS_HEADERS}) | |
59 | else() | |
60 | qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS}) | |
61 | qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) | |
62 | qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES}) | |
63 | add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES} ${ZCINEMA_RCC} | |
64 | ${ZCINEMA_FORMS_HEADERS} ${ZCINEMA_MOC}) | |
65 | endif() | |
66 | ||
67 | if (USE_QT5) | |
68 | target_link_libraries (${PROJECT_NAME} Qt5::Widgets Qt5::Network Qt5::OpenGL ${OPENGL_LIBRARIES}) | |
69 | else() | |
70 | target_link_libraries (${PROJECT_NAME} | |
71 | ${QT_QTCORE_LIBRARY} | |
72 | ${QT_QTGUI_LIBRARY} | |
73 | ${QT_QTNETWORK_LIBRARY} | |
74 | ${QT_QTOPENGL_LIBRARY} | |
75 | ${OPENGL_LIBRARIES} | |
76 | ) | |
77 | endif() | |
78 | ||
79 | # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword | |
80 | # which clang doesn't seem to like. | |
81 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
82 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") | |
83 | endif() | |
84 | ||
85 | install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) |