@@ -14,6 +14,10 @@ myci_add_source_files(srcs
1414 RECURSIVE
1515)
1616
17+ enable_language (OBJCXX )
18+
19+ list (APPEND srcs ../../src/${name} /glue/macos/glue.mm)
20+
1721myci_declare_library (${name} -opengl
1822 SOURCES
1923 ${srcs}
@@ -33,34 +37,44 @@ myci_declare_library(${name}-opengl
3337 NO_EXPORT
3438)
3539
36- myci_declare_library (${name} -opengles
37- SOURCES
38- ${srcs}
39- PUBLIC_INCLUDE_DIRECTORIES
40- ../../src
41- # header files are installed by ${name}-opengl target
42- # INSTALL_INCLUDE_DIRECTORIES
43- # ../../src/${name}
44- PREPROCESSOR_DEFINITIONS
45- "RUISAPP_RENDER_OPENGLES"
46- DEPENDENCIES
47- nitki
48- ruis
49- ruis-render-opengles
50- LINUX_ONLY_DEPENDENCIES
51- PkgConfig::gdk-3.0
52- PkgConfig::x11
53- PkgConfig::egl
54- WINDOWS_ONLY_DEPENDENCIES
55- unofficial-angle/unofficial::angle::libEGL
56- NO_EXPORT
57- )
40+ # no opengles build on MACOS for now
41+ if (NOT APPLE )
42+ myci_declare_library (${name} -opengles
43+ SOURCES
44+ ${srcs}
45+ PUBLIC_INCLUDE_DIRECTORIES
46+ ../../src
47+ # header files are installed by ${name}-opengl target
48+ # INSTALL_INCLUDE_DIRECTORIES
49+ # ../../src/${name}
50+ PREPROCESSOR_DEFINITIONS
51+ "RUISAPP_RENDER_OPENGLES"
52+ DEPENDENCIES
53+ nitki
54+ ruis
55+ ruis-render-opengles
56+ LINUX_ONLY_DEPENDENCIES
57+ PkgConfig::gdk-3.0
58+ PkgConfig::x11
59+ PkgConfig::egl
60+ WINDOWS_ONLY_DEPENDENCIES
61+ unofficial-angle/unofficial::angle::libEGL
62+ NO_EXPORT
63+ )
64+ endif ()
5865
59- myci_export (
60- TARGETS
61- ${name} -opengl
62- ${name} -opengles
63- )
66+ if (APPLE )
67+ myci_export (
68+ TARGETS
69+ ${name} -opengl
70+ )
71+ else ()
72+ myci_export (
73+ TARGETS
74+ ${name} -opengl
75+ ${name} -opengles
76+ )
77+ endif ()
6478
6579set (app_srcs)
6680myci_add_source_files (app_srcs
@@ -79,12 +93,23 @@ myci_declare_application(${name}-opengl-test
7993 ruisapp::ruisapp-opengl
8094)
8195
82- myci_declare_application (${name} -opengles-test
83- GUI
84- SOURCES
85- ${app_srcs}
86- RESOURCE_DIRECTORY
87- ../../tests/app/res
88- DEPENDENCIES
89- ruisapp::ruisapp-opengles
90- )
96+ if (APPLE )
97+ target_link_libraries (${name} -opengl-test
98+ PRIVATE
99+ # Link the Cocoa framework directly using the -framework flag string.
100+ # The quotes are important so CMake passes it as a single linker argument.
101+ "-framework Cocoa"
102+ )
103+ endif ()
104+
105+ if (NOT APPLE )
106+ myci_declare_application (${name} -opengles-test
107+ GUI
108+ SOURCES
109+ ${app_srcs}
110+ RESOURCE_DIRECTORY
111+ ../../tests/app/res
112+ DEPENDENCIES
113+ ruisapp::ruisapp-opengles
114+ )
115+ endif ()
0 commit comments