CMakeLists.txt

Sun, 28 Nov 2021 23:47:55 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 28 Nov 2021 23:47:55 +0200
changeset 65
e679dd5cd159
parent 62
d4857a7aa5a1
child 67
c34057d3c94e
permissions
-rw-r--r--

Removed more unnecessary c ode

36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 project (zcinema)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 cmake_minimum_required (VERSION 2.6)
49
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
3 cmake_policy (SET CMP0020 NEW)
62
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
4 find_package (Qt5Widgets REQUIRED)
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
5 find_package (Qt5Core REQUIRED)
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 include_directories (${QT_INCLUDES} ${CMAKE_CURRENT_BINARY_DIR})
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
9 set (ZCINEMA_LAUNCHER_SOURCES
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
10 launcher/demo.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
11 launcher/main.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
12 launcher/prompts.cpp
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
15 set (ZCINEMA_COMMON_SOURCES
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
16 commonlib/config.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
17 commonlib/misc.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
18 commonlib/version.cpp
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
19 )
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
20
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
21 set (ZCINEMA_CONFIG_SOURCES
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
22 config/configwindow.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
23 config/addversionprompt.cpp
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
24 config/main.cpp
54
0b3a5bc4e8a8 VersionGuiEntry is now a proper class.
Teemu Piippo <tsapii@utu.fi>
parents: 50
diff changeset
25 config/versionguientry.cpp
44
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
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 set (ZCINEMA_HEADERS
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
29 commonlib/config.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
30 commonlib/misc.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
31 commonlib/types.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
32 commonlib/version.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
33 config/addversionprompt.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
34 config/configwindow.h
54
0b3a5bc4e8a8 VersionGuiEntry is now a proper class.
Teemu Piippo <tsapii@utu.fi>
parents: 50
diff changeset
35 config/versionguientry.h
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
36 launcher/demo.h
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
37 launcher/prompts.h
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 set (ZCINEMA_FORMS
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 ui/findfile.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 ui/demoprompt.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 ui/unknownversion.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 ui/configbox.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 ui/addversion.ui
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 )
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 set (ZCINEMA_RESOURCES zcinema.qrc)
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 if (NOT MSVC)
48
e121ea9dba93 Now C++03 compatible
Teemu Piippo <crimsondusk64@gmail.com>
parents: 47
diff changeset
51 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W -Wall")
49
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
52 else()
50
5dc8b48f80b3 Removed the not very useful apply button from the config window
Teemu Piippo <tsapii@utu.fi>
parents: 49
diff changeset
53 # Some Qt headers (QMap and QHash) trigger C4180, disable that.
5dc8b48f80b3 Removed the not very useful apply button from the config window
Teemu Piippo <tsapii@utu.fi>
parents: 49
diff changeset
54 add_definitions ("/wd4180 /D_CRT_SECURE_NO_WARNINGS /nologo")
49
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
55 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Za")
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
56 endif()
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
57
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
58 if (MINGW)
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
59 set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++ -lpthread -static")
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 include_directories ("${PROJECT_BINARY_DIR}")
46
07578e081ae8 Renamed the src* directories into commonlib/, config/ and launcher/
Teemu Piippo <crimsondusk64@gmail.com>
parents: 44
diff changeset
63 include_directories ("${PROJECT_SOURCE_DIR}")
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64
62
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
65 qt5_generate_moc (ZCINEMA_MOC ${ZCINEMA_HEADERS})
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
66 qt5_add_resources (ZCINEMA_QRC ${ZCINEMA_RESOURCES})
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
67 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
68
62
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
69 add_library (${PROJECT_NAME}-common STATIC
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
70 ${ZCINEMA_COMMON_SOURCES}
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
71 ${ZCINEMA_QRC}
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
72 ${ZCINEMA_FORMS_HEADERS})
49
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
73 add_executable (${PROJECT_NAME} WIN32 ${ZCINEMA_LAUNCHER_SOURCES} zcinema.rc)
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
74 add_executable (${PROJECT_NAME}-config WIN32 ${ZCINEMA_CONFIG_SOURCES} zcinema.rc)
62
d4857a7aa5a1 Drop Qt4 support
Teemu Piippo <teemu@hecknology.net>
parents: 54
diff changeset
75 target_link_libraries (${PROJECT_NAME}-common Qt5::Widgets)
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
76 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
77 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
78
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
79 add_custom_target (make_hginfo
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
80 COMMAND python
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
81 "${CMAKE_SOURCE_DIR}/updaterevision.py"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
82 "${CMAKE_CURRENT_BINARY_DIR}/hginfo.h"
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
83 WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
84
44
d0bf58f3560f Split the project into two executables (the launcher and the configurator)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 43
diff changeset
85 add_dependencies (${PROJECT_NAME}-common make_hginfo)
49
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
86 set_target_properties (${PROJECT_NAME} PROPERTIES AUTOMOC 1)
7a27d14a4df1 Got it to compile under Windows
Teemu Piippo <tsapii@utu.fi>
parents: 48
diff changeset
87 set_target_properties (${PROJECT_NAME}-config PROPERTIES AUTOMOC 1)
40
809a75a7113b Added updaterevision.py, use it for hg info
Teemu Piippo <crimsondusk64@gmail.com>
parents: 37
diff changeset
88
36
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 # With clang, we need to set -Wno-deprecated since Qt headers seem to use the register keyword
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 # which clang doesn't seem to like.
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated")
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 endif()
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94
b8fa9171be6e Converted to CMake
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95 install (TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)

mercurial