nitlanguage
/
nit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
misc: update README on info for the Nit omnifunc
[nit.git]
/
src
/
c_tools.nit
diff --git
a/src/c_tools.nit
b/src/c_tools.nit
index
07934dd
..
6fa1f05
100644
(file)
--- a/
src/c_tools.nit
+++ b/
src/c_tools.nit
@@
-49,9
+49,9
@@
class CCompilationUnit
fun add_local_function( efc : CFunction )
do
fun add_local_function( efc : CFunction )
do
- body_decl.add( "{efc.signature};\n" )
- body_impl.add( "\n" )
- body_impl.add( efc.to_writer )
+ body_decl.add "static {efc.signature};\n"
+ body_impl.add "\n"
+ body_impl.add efc.to_writer
end
fun add_exported_function( efc : CFunction )
end
fun add_exported_function( efc : CFunction )
@@
-115,20
+115,17
@@
class ExternFile
fun compiles_to_o_file: Bool do return false
fun add_to_jar: Bool do return false
fun compiles_to_o_file: Bool do return false
fun add_to_jar: Bool do return false
+
+ # Additional libraries needed for the compilation
+ # Will be used with pkg-config
+ var pkgconfigs = new Array[String]
end
# An extern C file to compile
class ExternCFile
super ExternFile
end
# An extern C file to compile
class ExternCFile
super ExternFile
- init (filename, cflags: String)
- do
- super filename
-
- self.cflags = cflags
- end
-
- # Additionnal specific CC compiler -c flags
+ # Custom options for the C compiler (CFLAGS)
var cflags: String
redef fun hash do return filename.hash
var cflags: String
redef fun hash do return filename.hash
@@
-143,7
+140,11
@@
class ExternCFile
redef fun makefile_rule_content do
var ff = filename.basename("")
var o = makefile_rule_name
redef fun makefile_rule_content do
var ff = filename.basename("")
var o = makefile_rule_name
- return "$(CC) $(CFLAGS) {self.cflags} -c -o {o} {ff}"
+ var pkg = ""
+ if not pkgconfigs.is_empty then
+ pkg = "`pkg-config --cflags {pkgconfigs.join(" ")}`"
+ end
+ return "$(CC) $(CFLAGS) {self.cflags} {pkg} -c -o {o} {ff}"
end
redef fun compiles_to_o_file do return true
end
redef fun compiles_to_o_file do return true