-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
149 lines (128 loc) · 4.5 KB
/
CMakeLists.txt
File metadata and controls
149 lines (128 loc) · 4.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
cmake_minimum_required(VERSION 3.31.6)
project(mediamatrix)
# Find required packages
find_package(Qt6 COMPONENTS Core Gui Widgets REQUIRED)
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Enable Qt features
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# Set GnuCOBOL paths
set(GNUCOBOL_DIR "C:/GnuCOBOL")
set(GNUCOBOL_INCLUDE_DIR "${GNUCOBOL_DIR}/include")
set(GNUCOBOL_LIB_DIR "${GNUCOBOL_DIR}/lib_x64")
# Add include directories
include_directories(
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mediamatrix
${CMAKE_SOURCE_DIR}/include/mediamatrix/core
${GNUCOBOL_INCLUDE_DIR}
)
# C wrapper library
add_library(mm_wrapper SHARED
src/core/mm_wrapper.c
)
target_include_directories(mm_wrapper PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mediamatrix
${CMAKE_SOURCE_DIR}/include/mediamatrix/core
${GNUCOBOL_INCLUDE_DIR}
)
# Link against the COBOL library
target_link_libraries(mm_wrapper PRIVATE
${CMAKE_BINARY_DIR}/mediamatrix.lib
${GNUCOBOL_LIB_DIR}/libcob.lib
)
# GUI executable
set(GUI_SOURCES
src/gui/main.cpp
src/gui/mm_main_window.cpp
src/gui/mm_item_dialog.cpp
)
set(GUI_HEADERS
include/mediamatrix/gui/mm_main_window.h
include/mediamatrix/gui/mm_item_dialog.h
)
add_executable(mediamatrix_gui ${GUI_SOURCES} ${GUI_HEADERS})
target_include_directories(mediamatrix_gui PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mediamatrix
${CMAKE_SOURCE_DIR}/include/mediamatrix/core
"D:/Qt/6.8.1/msvc2022_64/include"
"D:/Qt/6.8.1/msvc2022_64/include/QtCore"
"D:/Qt/6.8.1/msvc2022_64/include/QtGui"
"D:/Qt/6.8.1/msvc2022_64/include/QtWidgets"
)
target_link_libraries(mediamatrix_gui PRIVATE
Qt6::Core
Qt6::Gui
Qt6::Widgets
mm_wrapper
)
# Console application
add_library(mediamatrix_console SHARED
src/core/mm_wrapper.c
)
target_include_directories(mediamatrix_console PRIVATE
${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/include/mediamatrix
${CMAKE_SOURCE_DIR}/include/mediamatrix/core
${GNUCOBOL_INCLUDE_DIR}
)
target_link_libraries(mediamatrix_console PRIVATE
mm_wrapper
${CMAKE_BINARY_DIR}/mediamatrix.lib
${GNUCOBOL_LIB_DIR}/libcob.lib
)
# Copy DLLs and plugins to output directory
add_custom_command(TARGET mediamatrix_gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:Qt6::Core>
$<TARGET_FILE:Qt6::Gui>
$<TARGET_FILE:Qt6::Widgets>
${CMAKE_BINARY_DIR}/mediamatrix.dll
$<TARGET_FILE_DIR:mediamatrix_gui>
COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:mediamatrix_gui>/plugins/platforms
COMMAND ${CMAKE_COMMAND} -E copy_directory
${Qt6_DIR}/../../../plugins/platforms
$<TARGET_FILE_DIR:mediamatrix_gui>/plugins/platforms
)
# Create qt.conf file
file(WRITE ${CMAKE_BINARY_DIR}/qt.conf "[Paths]\nPlugins = ./plugins")
add_custom_command(TARGET mediamatrix_gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/qt.conf
$<TARGET_FILE_DIR:mediamatrix_gui>/qt.conf
)
# Create data directory
add_custom_command(TARGET mediamatrix_gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory
$<TARGET_FILE_DIR:mediamatrix_gui>/data
)
# Copy GnuCOBOL DLLs to output directory
add_custom_command(TARGET mediamatrix_gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${GNUCOBOL_DIR}/bin_x64/libcob.dll"
"${GNUCOBOL_DIR}/bin_x64/libdb48.dll"
"${GNUCOBOL_DIR}/bin_x64/liblzma.dll"
"${GNUCOBOL_DIR}/bin_x64/libxml2.dll"
"${GNUCOBOL_DIR}/bin_x64/mpir.dll"
"${GNUCOBOL_DIR}/bin_x64/pdcurses.dll"
"${GNUCOBOL_DIR}/bin_x64/zlib1.dll"
$<TARGET_FILE_DIR:mediamatrix_gui>
)
# Copy Qt plugins to output directory
add_custom_command(TARGET mediamatrix_gui POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:mediamatrix_gui>/plugins"
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:mediamatrix_gui>/plugins/platforms"
COMMAND ${CMAKE_COMMAND} -E make_directory "$<TARGET_FILE_DIR:mediamatrix_gui>/plugins/styles"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${Qt6_DIR}/../../../plugins/platforms/qwindows.dll"
"$<TARGET_FILE_DIR:mediamatrix_gui>/plugins/platforms/"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${Qt6_DIR}/../../../plugins/styles/qmodernwindowsstyle.dll"
"$<TARGET_FILE_DIR:mediamatrix_gui>/plugins/styles/"
)