git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@636 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
NishiOwO
2025-11-08 02:14:29 +00:00
parent 159e2781ce
commit c53ded6223
26 changed files with 340 additions and 234 deletions

4
pl/ostype/Linux.pl Normal file
View File

@@ -0,0 +1,4 @@
# $Id$
use_backend("x11");
1;

6
pl/ostype/NetBSD.pl Normal file
View File

@@ -0,0 +1,6 @@
# $Id$
add_incdir("-I/usr/X11R7/include -I/usr/pkg/include");
add_libdir("-L/usr/X11R7/lib -Wl,-R/usr/X11R7/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib");
use_backend("x11");
1;

9
pl/ostype/Windows.pl Normal file
View File

@@ -0,0 +1,9 @@
# $Id$
$library_prefix = "";
$library_suffix = ".dll";
$executable_suffix = ".exe";
$math = "";
add_ldflags("-Wl,--out-implib,src/libMw.a -static-libgcc");
use_backend("gdi");
1;

92
pl/rules.pl Normal file
View File

@@ -0,0 +1,92 @@
# $Id$
new_object("src/*.c");
my $gl_libs = "";
if($backend eq "x11"){
add_cflags("-DUSE_X11");
new_object("src/backend/x11.c");
add_libs("-lX11 -lXrender -lXcursor");
$gl_libs = "-lGL -lGLU";
}elsif($backend eq "gdi"){
add_cflags("-DUSE_GDI");
new_object("src/backend/gdi.c");
add_libs("-lgdi32");
$gl_libs = "-lopengl32 -lglu32";
}
if(param_get("stb-image")){
add_cflags("-DUSE_STB_IMAGE");
}
if(param_get("stb-truetype")){
add_cflags("-DUSE_STB_TRUETYPE");
}
if(param_get("freetype2")){
add_cflags("-DUSE_FREETYPE2");
if(not($cross)){
add_cflags(`pkg-config --cflags freetype2`);
add_libs(`pkg-config --libs freetype2`);
}
}
new_object("src/icon/*.c");
new_object("src/font/*.c");
new_object("src/cursor/*.c");
new_object("src/widget/button.c");
new_object("src/widget/checkbox.c");
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");
new_object("src/widget/submenu.c");
new_object("src/widget/viewport.c");
new_object("src/widget/window.c");
if(param_get("opengl")){
new_object("src/widget/opengl.c");
}
if(param_get("vulkan")){
new_object("src/widget/vulkan.c");
}
new_object("src/dialog/*.c");
new_object("src/abstract/*.c");
new_object("external/*.c");
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");
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);
}
if(param_get("vulkan")){
new_example("examples/vkdemos/vulkan");
}
1;

69
pl/utils.pl Normal file
View File

@@ -0,0 +1,69 @@
# $Id$
sub add_incdir {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$incdir = "${incdir} ${input}";
}
sub add_cflags {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$cflags = "${cflags} ${input}";
}
sub add_libdir {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$libdir = "${libdir} ${input}";
}
sub add_ldflags {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$ldflags = "${ldflags} ${input}";
}
sub add_libs {
my $input = $_[0];
$input =~ s/\r?\n/ /g;
$libs = "${libs} ${input}";
}
sub new_example {
if(@_ == 2){
$examples_libs{"$_[0]${executable_suffix}"} = $_[1];
}
push(@examples_targets, "${_[0]}${executable_suffix}");
}
sub new_object {
my @l = glob($_[0]);
foreach my $e (@l){
$e =~ s/\.c$/$object_suffix/;
push(@library_targets, $e);
}
}
sub use_backend {
$backend = $_[0];
}
our %params = ();
sub param_set {
$params{$_[0]} = $_[1];
}
sub param_get {
if(not(defined($params{$_[0]}))){
return 0;
}else{
return $params{$_[0]};
}
}
1;