Sat, 06 Jun 2015 23:06:14 +0300
Compilation tweaks
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/demo.cpp | |
18 | src/main.cpp | |
19 | src/prompts.cpp | |
20 | ) | |
21 | ||
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
22 | set (ZCINEMA_COMMON_SOURCES |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
23 | src-common/config.cpp |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
24 | src-common/misc.cpp |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
25 | src-common/version.cpp |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
26 | ) |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
27 | |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
28 | set (ZCINEMA_CONFIG_SOURCES |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
29 | src-config/configwindow.cpp |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
30 | src-config/addversionprompt.cpp |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
31 | src-config/main.cpp |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
32 | ) |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
33 | |
36 | 34 | set (ZCINEMA_HEADERS |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
35 | src-common/config.h |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
36 | src-common/misc.h |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
37 | src-common/types.h |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
38 | src-common/version.h |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
39 | src-config/addversionprompt.h |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
40 | src-config/configwindow.h |
36 | 41 | src/demo.h |
42 | src/prompts.h | |
43 | ) | |
44 | ||
45 | set (ZCINEMA_FORMS | |
46 | ui/findfile.ui | |
47 | ui/demoprompt.ui | |
48 | ui/unknownversion.ui | |
49 | ui/versionEditor.ui | |
50 | ui/configbox.ui | |
51 | ui/addversion.ui | |
52 | ) | |
53 | ||
54 | set (ZCINEMA_RESOURCES zcinema.qrc) | |
55 | ||
56 | if (NOT MSVC) | |
57 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -W -Wall") | |
58 | endif() | |
59 | ||
60 | include_directories ("${PROJECT_BINARY_DIR}") | |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
61 | include_directories ("${PROJECT_SOURCE_DIR}/src") |
36 | 62 | include_directories ("${PROJECT_BINARY_DIR}/src") |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
63 | include_directories ("${PROJECT_SOURCE_DIR}/src-common") |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
64 | include_directories ("${PROJECT_BINARY_DIR}/src-common") |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
65 | include_directories ("${PROJECT_SOURCE_DIR}/src-config") |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
66 | include_directories ("${PROJECT_BINARY_DIR}/src-config") |
36 | 67 | |
68 | if (USE_QT5) | |
69 | qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS}) | |
70 | qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES}) | |
71 | qt5_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) | |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
72 | |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
73 | add_library (${PROJECT_NAME}-common STATIC |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
74 | ${ZCINEMA_COMMON_SOURCES} |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
75 | ${ZCINEMA_MOC} |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
76 | ${ZCINEMA_QRC} |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
77 | ${ZCINEMA_FORMS_HEADERS}) |
36 | 78 | else() |
79 | qt4_wrap_cpp (ZCINEMA_MOC ${ZCINEMA_HEADERS}) | |
80 | qt4_wrap_ui (ZCINEMA_FORMS_HEADERS ${ZCINEMA_FORMS}) | |
81 | qt4_add_resources (ZCINEMA_RCC ${ZCINEMA_RESOURCES}) | |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
82 | |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
83 | add_library (${PROJECT_NAME}-common STATIC |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
84 | ${ZCINEMA_COMMON_SOURCES} |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
85 | ${ZCINEMA_MOC} |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
86 | ${ZCINEMA_RCC} |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
87 | ${ZCINEMA_FORMS_HEADERS}) |
36 | 88 | endif() |
89 | ||
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
90 | add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_SOURCES}) |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
91 | add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES}) |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
92 | |
36 | 93 | if (USE_QT5) |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
94 | target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets) |
36 | 95 | else() |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
96 | target_link_libraries (${PROJECT_NAME}-common ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY}) |
36 | 97 | endif() |
98 | ||
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
99 | target_link_libraries (${PROJECT_NAME} ${PROJECT_NAME}-common) |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
100 | target_link_libraries (${PROJECT_NAME}-config ${PROJECT_NAME}-common) |
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
101 | |
40
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
102 | add_custom_target (make_hginfo |
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
103 | COMMAND python |
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
104 | "${CMAKE_SOURCE_DIR}/updaterevision.py" |
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
105 | "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h" |
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
106 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) |
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
107 | |
44
d0bf58f3560f
Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
43
diff
changeset
|
108 | add_dependencies (${PROJECT_NAME}-common make_hginfo) |
40
809a75a7113b
Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents:
37
diff
changeset
|
109 | |
36 | 110 | # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword |
111 | # which clang doesn't seem to like. | |
112 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") | |
113 | set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated") | |
114 | endif() | |
115 | ||
116 | install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin) |