@@ -17,8 +17,12 @@ set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
17
17
#######################################################################################################################
18
18
# Find Qt
19
19
20
+ if (APPLE )
21
+ set (MODULES_FIXME PrintSupport )
22
+ endif ()
23
+
20
24
find_package (PkgConfig REQUIRED )
21
- find_package (Qt5 COMPONENTS REQUIRED Core Widgets )
25
+ find_package (Qt5 COMPONENTS REQUIRED Core Widgets ${MODULES_FIXME} )
22
26
23
27
if (NOT (APPLE OR WIN32 ))
24
28
find_package (X11 REQUIRED )
@@ -30,13 +34,23 @@ endif()
30
34
#######################################################################################################################
31
35
# Import carla stuff
32
36
37
+ set (CARLA_BUILD_FRAMEWORKS TRUE CACHE BOOL "Build Carla libs as frameworks" )
33
38
add_subdirectory (carla/cmake )
34
39
35
40
#######################################################################################################################
36
41
# Setup Chibi target
37
42
38
43
add_executable (Chibi )
39
44
45
+ set_target_properties (Chibi
46
+ PROPERTIES
47
+ AUTOMOC ON
48
+ AUTOUIC ON
49
+ AUTORCC ON
50
+ MACOSX_BUNDLE TRUE
51
+ WIN32_EXECUTABLE TRUE
52
+ )
53
+
40
54
target_compile_definitions (Chibi
41
55
PRIVATE
42
56
$< $< BOOL:${X11_FOUND} > :HAVE_X11>
@@ -61,8 +75,9 @@ target_link_libraries(Chibi
61
75
carla::utils
62
76
Qt5::Core
63
77
Qt5::Widgets
78
+ $< $< BOOL:${APPLE} > :$< LINK_LIBRARY:Qt5::PrintSupport> >
64
79
$< $< BOOL:${APPLE} > :$< LINK_LIBRARY:FRAMEWORK,Cocoa.framework> >
65
- $< $< BOOL:${X11_FOUND} > :Qt ::X11Extras>
80
+ $< $< BOOL:${X11_FOUND} > :Qt5 ::X11Extras>
66
81
$< $< BOOL:${X11_FOUND} > :X11>
67
82
)
68
83
@@ -78,15 +93,27 @@ target_sources(Chibi
78
93
$< $< BOOL:${WIN32} > :carla/resources/ico/carla.rc>
79
94
)
80
95
81
- set_target_properties (Chibi
82
- PROPERTIES
83
- AUTOMOC ON
84
- AUTOUIC ON
85
- AUTORCC ON
86
- )
87
-
88
96
if (APPLE )
89
97
set_source_files_properties (
90
98
chibiembedwidget.cpp
91
99
PROPERTIES COMPILE_FLAGS -ObjC++ )
100
+
101
+ get_target_property (QtWidgetsLocation Qt5::Widgets LIB_LOCATION )
102
+ get_filename_component (QtPluginsDir "${QtWidgetsLocation} /../../qt5/plugins" ABSOLUTE )
103
+
104
+ add_custom_command (TARGET Chibi POST_BUILD
105
+ COMMAND ln -sf cmake "${CMAKE_CURRENT_BINARY_DIR} /carla/lib"
106
+ )
107
+ add_custom_command (TARGET Chibi POST_BUILD
108
+ COMMAND macdeployqt $< TARGET_BUNDLE_DIR:Chibi>
109
+ )
110
+ add_custom_command (TARGET Chibi POST_BUILD
111
+ COMMAND mkdir -p "$<TARGET_BUNDLE_DIR:Chibi>/Contents/PlugIns/platforms" "$<TARGET_BUNDLE_DIR:Chibi>/Contents/PlugIns/styles"
112
+ )
113
+ add_custom_command (TARGET Chibi POST_BUILD
114
+ COMMAND cp "${QtPluginsDir} /platforms/libqcocoa.dylib" "$<TARGET_BUNDLE_DIR:Chibi>/Contents/PlugIns/platforms/"
115
+ )
116
+ add_custom_command (TARGET Chibi POST_BUILD
117
+ COMMAND cp "${QtPluginsDir} /styles/libqmacstyle.dylib" "$<TARGET_BUNDLE_DIR:Chibi>/Contents/PlugIns/styles/"
118
+ )
92
119
endif ()
0 commit comments