2025-11-08 02:14:29 +00:00
new_object ( "src/*.c" ) ;
my $ gl_libs = "" ;
2026-03-31 16:54:01 -07:00
if ( param_get ( "tiny" ) ) {
add_cflags ( "-Oz" ) ;
2026-04-06 17:29:09 +09:00
if ( defined ( $ ENV { CC } ) && grep ( /^clang$/ , $ ENV { CC } ) ) {
2026-04-26 14:01:33 -07:00
add_libs ( "-flto=full" ) ;
add_cflags ( "-flto=full" ) ;
2026-03-31 17:15:25 -07:00
}
2026-04-26 14:01:33 -07:00
add_cflags ( "-fdata-sections -ffunction-sections" ) ;
add_libs ( "-Wl,--gc-sections" ) ;
# these don't actually disable either, they're here for the final output.
param_set ( "wayland" , 0 ) ;
2026-04-28 15:08:00 +09:00
param_set ( "dbus" , 0 ) ;
2026-03-31 16:54:01 -07:00
}
2025-11-11 12:15:48 +00:00
if ( param_get ( "classic-theme" ) ) {
add_cflags ( "-DUSE_CLASSIC_THEME" ) ;
}
2025-11-29 22:37:15 +00:00
if ( grep ( /^x11$/ , @ backends ) ) {
2025-11-08 22:48:42 +00:00
add_cflags ( "-DUSE_X11" ) ;
new_object ( "src/backend/x11.c" ) ;
2025-11-08 02:14:29 +00:00
2025-11-08 22:48:42 +00:00
$ gl_libs = "-lGL -lGLU" ;
2025-11-08 22:50:00 +00:00
if ( param_get ( "xrender" ) ) {
add_cflags ( "-DUSE_XRENDER" ) ;
}
2025-11-08 22:48:42 +00:00
}
2025-11-29 22:12:58 +00:00
2025-11-29 22:37:15 +00:00
if ( grep ( /^gdi$/ , @ backends ) ) {
2025-11-08 22:48:42 +00:00
add_cflags ( "-DUSE_GDI" ) ;
new_object ( "src/backend/gdi.c" ) ;
add_libs ( "-lgdi32" ) ;
2025-11-08 02:14:29 +00:00
2025-11-08 22:48:42 +00:00
$ gl_libs = "-lopengl32 -lglu32" ;
}
2025-11-08 02:14:29 +00:00
2026-04-15 20:21:20 -07:00
if ( grep ( /^classicmacos$/ , @ backends ) ) {
2026-04-16 23:40:29 +09:00
2026-04-15 20:21:20 -07:00
#add_cflags("-DCLASSIC_MAC_OS");
new_object ( "src/backend/classicmacos.c" ) ;
$ gl_libs = "" ;
}
2025-12-09 20:11:01 -06:00
if ( grep ( /^wayland$/ , @ backends ) ) {
add_cflags ( "-DUSE_WAYLAND" ) ;
2026-07-09 21:45:30 -07:00
new_object ( "src/backend/cairo.c" ) ;
2026-05-04 21:07:39 -07:00
new_object ( "src/backend/wayland/wayland.c" ) ;
new_object ( "src/backend/wayland/buffer.c" ) ;
new_object ( "src/backend/wayland/interfaces.c" ) ;
new_object ( "src/backend/wayland/region.c" ) ;
2025-12-09 20:11:01 -06:00
2025-12-30 22:26:19 -07:00
if ( param_get ( "opengl" ) ) {
2026-03-24 17:38:21 -07:00
add_cflags ( "-DWAYLAND_LOAD_OPENGL" ) ;
2025-12-30 22:26:19 -07:00
}
2026-03-24 17:38:21 -07:00
scan_wayland_protocol_core ( ) ;
2026-03-27 14:40:07 +09:00
scan_wayland_protocol ( "stable" , "xdg-shell" , "" ) ;
scan_wayland_protocol ( "stable" , "viewporter" , "" ) ;
scan_wayland_protocol ( "stable" , "tablet" , "-v2" ) ;
scan_wayland_protocol ( "staging" , "xdg-toplevel-icon" , "-v1" ) ;
scan_wayland_protocol ( "staging" , "cursor-shape" , "-v1" ) ;
scan_wayland_protocol ( "unstable" , "xdg-decoration" , "-unstable-v1" ) ;
scan_wayland_protocol ( "unstable" , "primary-selection" , "-unstable-v1" ) ;
2026-03-24 23:44:30 -07:00
scan_wayland_protocol ( "unstable" , "pointer-constraints" , "-unstable-v1" ) ;
2026-03-29 09:42:34 +09:00
scan_wayland_protocol ( "unstable" , "relative-pointer" , "-unstable-v1" ) ;
2026-07-07 23:04:58 -07:00
scan_wayland_protocol_from_file ( "wlr-layer-shell" , "wlr-layer-shell-unstable-v1.xml" ) ;
2025-12-09 20:11:01 -06:00
2025-12-30 22:26:19 -07:00
$ gl_libs = "-lGL -lGLU" ;
2025-12-09 20:11:01 -06:00
}
2026-04-26 14:01:33 -07:00
if ( not ( param_get ( "dbus" ) ) && not ( param_get ( "tiny" ) ) ) {
2026-04-18 21:52:02 +09:00
$ cflags =~ s/( |^)-DUSE_DBUS( |$)/ / ;
}
2026-04-16 23:40:29 +09:00
if ( grep ( /( |^)-DUSE_DBUS( |$)/ , $ cflags ) ) {
add_cflags ( `pkg-config --cflags dbus-1` ) ;
}
2026-04-13 17:44:27 -07:00
if ( grep ( /^cocoa$/ , @ backends ) || param_get ( "gnustep" ) ) {
2026-01-09 21:35:23 -07:00
add_cflags ( "-DUSE_COCOA" ) ;
new_object ( "src/backend/cocoa.m" ) ;
2026-01-09 14:43:44 -07:00
2026-04-16 23:40:29 +09:00
if ( param_get ( "gnustep" ) ) {
add_incdir ( "-I" . `gnustep-config --variable=GNUSTEP_SYSTEM_HEADERS` ) ;
add_libdir ( "-L" . `gnustep-config --variable=GNUSTEP_SYSTEM_LIBRARIES` ) ;
2026-04-13 20:07:00 -07:00
add_cflags ( "-fobjc-runtime=gnustep-2.0 -fblocks" ) ;
add_ldflags ( "-lobjc -lgnustep-base -lm -lgnustep-gui" ) ;
2026-04-13 17:44:27 -07:00
}
2026-03-04 22:56:04 -07:00
if ( param_get ( "opengl" ) ) {
new_object ( "src/widget/opengl_cocoa.m" ) ;
}
2026-04-20 16:02:33 -05:00
# John Apple my man literally everybody and their mother who knows what opengl is knows its deprecated on macos and i'm not having you spam the console with this
2026-03-04 22:56:04 -07:00
add_cflags ( "-DGL_SILENCE_DEPRECATION" ) ;
$ gl_libs = "-framework OpenGL" ;
2026-01-09 14:43:44 -07:00
}
2026-04-28 15:06:38 +00:00
if ( grep ( /^haiku$/ , @ backends ) ) {
2026-04-28 16:30:01 +00:00
add_cflags ( "-DUSE_HAIKU" ) ;
2026-04-28 12:59:25 +00:00
new_object ( "src/backend/haiku.cc" ) ;
2026-04-28 17:44:59 +00:00
add_libs ( "-lbe" ) ;
2026-04-28 15:06:38 +00:00
}
2025-11-08 22:48:42 +00:00
if ( param_get ( "stb-image" ) ) {
add_cflags ( "-DUSE_STB_IMAGE" ) ;
2026-04-06 17:29:09 +09:00
if ( param_get ( "tiny" ) ) {
2026-03-31 16:54:01 -07:00
add_cflags ( "-DSTB_IMAGE_STATIC" ) ;
add_cflags ( "-DSTB_IMAGE_IMPLEMENTATION" ) ;
}
2026-03-29 09:42:34 +09:00
}
else {
2026-03-29 09:36:30 +09:00
new_object ( "external/libjpeg/src/*.c" ) ;
new_object ( "external/libpng/src/*.c" ) ;
add_incdir ( "-Iexternal/libjpeg/include -Iexternal/libpng/include" ) ;
2025-11-08 02:14:29 +00:00
}
2025-11-08 22:48:42 +00:00
if ( param_get ( "stb-truetype" ) ) {
add_cflags ( "-DUSE_STB_TRUETYPE" ) ;
2025-11-08 02:14:29 +00:00
}
2026-04-26 19:43:32 -07:00
if ( param_get ( "allow-sloppy-focus" ) ) {
add_cflags ( "-DALLOW_SLOPPY_FOCUS" ) ;
}
2026-03-29 09:36:30 +09:00
add_incdir ( "-Iexternal/libz/include" ) ;
2025-11-08 22:48:42 +00:00
if ( param_get ( "freetype2" ) ) {
add_cflags ( "-DUSE_FREETYPE2" ) ;
2026-03-31 12:44:32 -07:00
if ( ! $ cross ) {
2025-11-08 22:48:42 +00:00
add_cflags ( `pkg-config --cflags freetype2` ) ;
}
2025-11-08 02:14:29 +00:00
}
2025-11-12 03:03:51 +00:00
if ( param_get ( "vulkan" ) && param_get ( "vulkan-string-helper" ) ) {
add_cflags ( "-DHAS_VK_ENUM_STRING_HELPER" ) ;
}
2025-11-08 02:14:29 +00:00
new_object ( "src/icon/*.c" ) ;
new_object ( "src/cursor/*.c" ) ;
2026-03-04 13:59:28 -06:00
new_object ( "src/text/*.c" ) ;
new_object ( "src/text/font/*.c" ) ;
2025-11-08 02:14:29 +00:00
2025-12-15 14:09:30 +09:00
new_object ( "src/widget/box.c" ) ;
2025-11-08 02:14:29 +00:00
new_object ( "src/widget/button.c" ) ;
2026-05-06 00:12:06 +09:00
new_object ( "src/widget/calendar.c" ) ;
2025-11-08 02:14:29 +00:00
new_object ( "src/widget/checkbox.c" ) ;
2025-11-12 17:40:52 +00:00
new_object ( "src/widget/combobox.c" ) ;
2025-11-08 02:14:29 +00:00
new_object ( "src/widget/entry.c" ) ;
new_object ( "src/widget/frame.c" ) ;
new_object ( "src/widget/image.c" ) ;
new_object ( "src/widget/label.c" ) ;
new_object ( "src/widget/listbox.c" ) ;
new_object ( "src/widget/menu.c" ) ;
new_object ( "src/widget/numberentry.c" ) ;
new_object ( "src/widget/progressbar.c" ) ;
new_object ( "src/widget/radiobox.c" ) ;
new_object ( "src/widget/scrollbar.c" ) ;
2025-11-16 00:33:44 +00:00
new_object ( "src/widget/separator.c" ) ;
2025-11-08 02:14:29 +00:00
new_object ( "src/widget/submenu.c" ) ;
2026-04-30 08:37:50 +09:00
new_object ( "src/widget/subwindow.c" ) ;
2026-05-07 18:30:24 +09:00
new_object ( "src/widget/tab.c" ) ;
2026-05-14 21:10:22 +09:00
new_object ( "src/widget/table.c" ) ;
2025-11-19 03:47:01 +00:00
new_object ( "src/widget/treeview.c" ) ;
2025-11-08 02:14:29 +00:00
new_object ( "src/widget/viewport.c" ) ;
new_object ( "src/widget/window.c" ) ;
2025-11-08 22:48:42 +00:00
2026-04-16 23:53:29 +09:00
new_object ( "src/widget/opengl.c" ) ;
new_object ( "src/widget/vulkan.c" ) ;
2025-11-08 22:48:42 +00:00
if ( param_get ( "opengl" ) ) {
2026-04-16 23:53:29 +09:00
add_cflags ( "-DMW_OPENGL" ) ;
2025-11-08 02:14:29 +00:00
}
2025-11-08 22:48:42 +00:00
if ( param_get ( "vulkan" ) ) {
2026-04-14 20:03:59 -07:00
add_cflags ( "-DMW_VULKAN" ) ;
2025-11-08 02:14:29 +00:00
}
new_object ( "src/dialog/*.c" ) ;
new_object ( "src/abstract/*.c" ) ;
new_object ( "external/*.c" ) ;
2026-03-29 09:36:30 +09:00
new_object ( "external/libz/src/*.c" ) ;
2025-11-08 02:14:29 +00:00
new_example ( "examples/basic/example" ) ;
new_example ( "examples/basic/rotate" ) ;
new_example ( "examples/basic/image" ) ;
new_example ( "examples/basic/scrollbar" ) ;
new_example ( "examples/basic/checkbox" ) ;
new_example ( "examples/basic/radiobox" ) ;
new_example ( "examples/basic/messagebox" ) ;
new_example ( "examples/basic/viewport" ) ;
new_example ( "examples/basic/listbox" ) ;
new_example ( "examples/basic/progressbar" ) ;
new_example ( "examples/basic/colorpicker" ) ;
2025-11-15 19:27:56 +00:00
new_example ( "examples/basic/combobox" ) ;
2025-11-21 15:07:12 +00:00
new_example ( "examples/basic/treeview" ) ;
2025-12-15 14:09:30 +09:00
new_example ( "examples/basic/box" ) ;
2025-12-18 17:46:23 -07:00
new_example ( "examples/basic/clipboard" ) ;
2025-12-21 14:38:07 +09:00
new_example ( "examples/basic/sevensegment" ) ;
2026-01-27 17:02:40 +09:00
new_example ( "examples/basic/calculator" ) ;
2026-04-28 00:31:21 -07:00
new_example ( "examples/basic/filechooser" ) ;
2026-03-27 15:25:02 +09:00
new_example ( "examples/basic/periodic" ) ;
2026-05-02 02:00:51 +09:00
new_example ( "examples/basic/subwindow" ) ;
2026-05-07 18:51:42 +09:00
new_example ( "examples/basic/tab" ) ;
2025-11-08 02:14:29 +00:00
2025-11-08 22:48:42 +00:00
if ( param_get ( "opengl" ) ) {
new_example ( "examples/gldemos/boing" , $ gl_libs ) ;
new_example ( "examples/gldemos/clock" , $ gl_libs ) ;
new_example ( "examples/gldemos/cube" , $ gl_libs ) ;
new_example ( "examples/gldemos/gears" , $ gl_libs ) ;
new_example ( "examples/gldemos/triangle" , $ gl_libs ) ;
new_example ( "examples/gldemos/tripaint" , $ gl_libs ) ;
2025-11-08 02:14:29 +00:00
}
2025-11-08 22:48:42 +00:00
if ( param_get ( "vulkan" ) ) {
new_example ( "examples/vkdemos/vulkan" ) ;
2025-11-08 02:14:29 +00:00
}
1 ;