let embedding files be configurable

This commit is contained in:
Yuichi Nishiwaki 2014-05-19 13:39:28 +09:00
parent 7431eaf71c
commit 10db8b9a2b
2 changed files with 5 additions and 11 deletions

View File

@ -2,20 +2,13 @@
use strict;
my @files = (
'piclib/built-in.scm',
'piclib/srfi/1.scm',
'piclib/srfi/26.scm',
'piclib/srfi/95.scm'
);
print <<EOL;
#include "picrin.h"
#include "picrin/error.h"
EOL
foreach my $file (@files) {
foreach my $file (@ARGV) {
my $var = &escape_v($file);
print "const char *$var =\n";
@ -37,7 +30,7 @@ pic_load_piclib(pic_state *pic)
pic_try {
EOL
foreach my $file (@files) {
foreach my $file (@ARGV) {
my $var = &escape_v($file);
print " pic_load_cstr(pic, $var);\n";
}
@ -60,6 +53,6 @@ EOL
sub escape_v {
($_) = @_;
s/\.scm$//g;
s/[\/-]/_/g;
s/[^[A-Za-z0-9_]/_/g;
$_;
}

View File

@ -8,10 +8,11 @@ set(XFILE_SOURCES extlib/xfile/xfile.c)
# piclib
find_package(Perl REQUIRED)
file(GLOB_RECURSE PICLIB_SCHEME_LIBS ${PROJECT_SOURCE_DIR}/piclib/*.scm)
set(PICLIB_SOURCES ${PROJECT_SOURCE_DIR}/src/load_piclib.c)
add_custom_command(
OUTPUT ${PICLIB_SOURCES}
COMMAND ${PERL_EXECUTABLE} etc/mkloader.pl > ${PROJECT_SOURCE_DIR}/src/load_piclib.c
COMMAND ${PERL_EXECUTABLE} etc/mkloader.pl ${PICLIBS} > ${PROJECT_SOURCE_DIR}/src/load_piclib.c
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)