alien.inline.compile: write library files to resource:alien-inline-libs

db4
Jeremy Hughes 2009-07-10 12:45:27 +12:00
parent 5b46a22297
commit 8281c2fb55
2 changed files with 11 additions and 6 deletions

View File

@ -2,12 +2,19 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays combinators fry generalizations
io.encodings.ascii io.files io.files.temp io.launcher kernel
locals make sequences system vocabs.parser words ;
locals make sequences system vocabs.parser words io.directories
io.pathnames ;
IN: alien.inline.compiler
SYMBOL: C
SYMBOL: C++
: inline-libs-directory ( -- path )
"alien-inline-libs" resource-path dup make-directories ;
: inline-library-file ( name -- path )
inline-libs-directory prepend-path ;
: library-suffix ( -- str )
os {
{ [ dup macosx? ] [ drop ".dylib" ] }
@ -16,10 +23,8 @@ SYMBOL: C++
} cond ;
: library-path ( str -- str' )
'[
"lib-" % current-vocab name>> %
"-" % _ % library-suffix %
] "" make temp-file ;
'[ "lib" % "-" % _ % library-suffix % ]
"" make inline-library-file ;
: src-suffix ( lang -- str )
{

View File

@ -58,7 +58,7 @@ SYMBOL: c-strings
PRIVATE>
: define-c-library ( name -- )
c-library set
[ current-vocab name>> % "_" % % ] "" make c-library set
V{ } clone c-strings set
V{ } clone compiler-args set ;