mirror of
https://github.com/natnat-mc/moonbuild
synced 2026-05-28 19:59:40 +02:00
Producing rockspec 2.0.0-1
This commit is contained in:
@@ -1,2 +1 @@
|
||||
*.lua
|
||||
/out/*
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
tasks:
|
||||
build: =>
|
||||
sh "moon bin/moonbuild.moon -jy"
|
||||
release: =>
|
||||
error "no version provided" unless @v
|
||||
tasks.build!
|
||||
sh "rockbuild -m -t #{@v} upload"
|
||||
Executable
+2601
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
package: moonbuild
|
||||
source:
|
||||
url: git://github.com/natnat-mc/moonbuild
|
||||
description:
|
||||
summary: Small build system in between make and a build.sh
|
||||
detailed: >
|
||||
moonbuild is a small build system that simplifies your
|
||||
build definitions by allowing you to use declarative as
|
||||
well as imperative rules.
|
||||
It represents the build as a DAG with explicit ordering,
|
||||
and doesn't give you any default confusing rules (unlike
|
||||
make).
|
||||
If you can, installing luaposix and/or luafilesystem
|
||||
will speed up builds and increase stability.
|
||||
homepage: https://github.com/natnat-mc/moonbuild
|
||||
dependencies:
|
||||
- lua >= 5.1
|
||||
- argparse >= 0.7.1-1
|
||||
- moonscript >= 0.5.0-1
|
||||
build:
|
||||
type: builtin
|
||||
install:
|
||||
bin:
|
||||
moonbuild: out/moonbuild
|
||||
@@ -0,0 +1,24 @@
|
||||
build = {
|
||||
install = {
|
||||
bin = {
|
||||
moonbuild = "out/moonbuild"
|
||||
}
|
||||
},
|
||||
type = "builtin"
|
||||
}
|
||||
dependencies = {
|
||||
"lua >= 5.1",
|
||||
"argparse >= 0.7.1-1",
|
||||
"moonscript >= 0.5.0-1"
|
||||
}
|
||||
description = {
|
||||
detailed = "moonbuild is a small build system that simplifies your build definitions by allowing you to use declarative as well as imperative rules. It represents the build as a DAG with explicit ordering, and doesn't give you any default confusing rules (unlike make). If you can, installing luaposix and/or luafilesystem will speed up builds and increase stability.\n",
|
||||
summary = "Small build system in between make and a build.sh"
|
||||
}
|
||||
package = "moonbuild"
|
||||
rockspec_format = "3.0"
|
||||
source = {
|
||||
tag = "v2.0.0",
|
||||
url = "git://github.com/natnat-mc/moonbuild"
|
||||
}
|
||||
version = "2.0.0-1"
|
||||
+168
@@ -0,0 +1,168 @@
|
||||
-- project name
|
||||
var 'NAME', 'raytrace'
|
||||
|
||||
-- tools to use
|
||||
public var 'CPP', 'g++'
|
||||
public var 'LD', 'g++'
|
||||
public var 'MOC', 'moc'
|
||||
|
||||
-- compile flags
|
||||
var 'CFLAGS', {'-fPIC', '-fopenmp', '-Wall', '-Wextra', '-Isrc', '--std=c++1', '-O3'}
|
||||
var 'LDFLAGS', {'-fPIC', '-fopenmp'}
|
||||
var 'PKGS', {'Qt5Widgets'}
|
||||
|
||||
-- extra cli flags
|
||||
public var 'XCFLAGS'
|
||||
public var 'XLDFLAGS'
|
||||
public var 'XPKGS'
|
||||
public var 'XLIBS'
|
||||
|
||||
-- find all files for project
|
||||
var 'SOURCES', _.wildcard 'src/**.cpp'
|
||||
var 'HEADERS', _.wildcard 'src/**.h'
|
||||
var 'QT_HEADERS', _.wildcard 'src/**.hh'
|
||||
|
||||
-- complete our flags
|
||||
var 'PKGS', {PKGS, XPKGS}
|
||||
var 'CFLAGS', {CFLAGS, XCFLAGS, _.pkgconfig.cflags PKGS}
|
||||
var 'LDFLAGS', {LDFLAGS, LDCFLAGS}
|
||||
var 'LIBS', {XLIBS, _.pkgconfig.libs PKGS}
|
||||
|
||||
-- determine our subtargets
|
||||
var 'BINARY', "out/#{NAME}"
|
||||
var 'OBJECTS', _.patsubst SOURCES, 'src/%.cpp', 'build/%.o'
|
||||
var 'MOC_SOURCES', _.patsubst QT_HEADERS, 'src/%.hh', 'build/%.moc.cpp'
|
||||
var 'MOC_OBJECTS', _.patsubst MOC_SOURCES, '%.cpp', '%.o'
|
||||
var 'OBJECTS', {OBJECTS, MOC_OBJECTS}
|
||||
|
||||
|
||||
-- build everything
|
||||
with public default target 'all'
|
||||
\depends BINARY
|
||||
|
||||
-- clean build objects
|
||||
with public target 'clean'
|
||||
\fn => _.cmd 'rm', '-f', ALL_OBJECTS, MOC_SOURCES
|
||||
|
||||
-- clean everything
|
||||
with public target 'mrproper'
|
||||
\after 'clean'
|
||||
\fn => _.cmd 'rm', '-f', BINARY
|
||||
|
||||
-- build and run
|
||||
with public target 'run'
|
||||
\depends BINARY
|
||||
\fn => _.cmd "./#{BINARY}"
|
||||
|
||||
-- produce the binary from all objects
|
||||
with target BINARY
|
||||
\produces BINARY
|
||||
\depends OBJECTS
|
||||
\fn => _.cmd LD, LDFLAGS, '-o', @outfile, @infiles, LIBS
|
||||
\mkdirs!
|
||||
|
||||
-- produce the objects from the sources
|
||||
with target OBJECTS, pattern: 'build/%.o'
|
||||
\produces 'build/%.o'
|
||||
\depends 'src/%.cpp'
|
||||
\depends => _.cdeps[CPP] @infile, CFLAGS
|
||||
\fn => _.cmd CPP, CFLAGS, '-o', @outfile, '-c', @infile
|
||||
\mkdirs!
|
||||
|
||||
-- produce the objects from the moc-generated sources
|
||||
with target MOC_OBJECTS, pattern: 'build/%.moc.o'
|
||||
\produces 'build/%.moc.o'
|
||||
\depends 'build/%.moc.cpp'
|
||||
\fn => _.cmd CPP, CFLAGS, '-o', @outfile, '-c', @infile
|
||||
|
||||
-- generate moc sources from the qt headers
|
||||
with target MOC_SOURCES, pattern: 'build/%.moc.cpp'
|
||||
\produces 'build/%.moc.cpp'
|
||||
\depends 'src/%.hh'
|
||||
\fn => _.cmd MOC, '-o', @outfile, @infile
|
||||
\mkdirs!
|
||||
|
||||
[[
|
||||
var: string, Serializable -> Variable
|
||||
creates a variable in the global shared state
|
||||
|
||||
public: Variable -> Variable
|
||||
makes a variable overwritable with a CLI flag or through environment variables
|
||||
|
||||
target: string|array, TargetOptions? -> Target
|
||||
creates a target matching the given name or names, with the given options
|
||||
|
||||
public: Target -> Target
|
||||
makes a target listable on the CLI
|
||||
|
||||
default: Target -> Target
|
||||
makes a target run automatically if no target is specified
|
||||
|
||||
init: (nil -> nil) -> nil
|
||||
adds a function to run in the init environment after the CLI options are processed
|
||||
|
||||
typedef Serializable
|
||||
| string
|
||||
| boolean
|
||||
| number
|
||||
| nil
|
||||
| array<Serializable>
|
||||
| map<string|boolean|number, Serializable>
|
||||
a value that can be flattened and passed to another environment
|
||||
|
||||
typedef List
|
||||
| nil
|
||||
| string
|
||||
| array<List>
|
||||
a list of strings that can get flattened to array<string> unambiguously
|
||||
|
||||
typedef TargetOptions: table
|
||||
- pattern: string? [@name or '%']
|
||||
a pattern that is matched when trying the target, it is also used to fill in '%' in the target
|
||||
- priority: int? [0]
|
||||
higher values make moonbuild try the target before lower-priority targets
|
||||
|
||||
class Target
|
||||
- produces: List -> Target
|
||||
adds objects to the list of productions
|
||||
- depends: List -> Target
|
||||
adds objects to the list of dependencies
|
||||
- depends: (TargetContext -> List) -> Target
|
||||
adds objects to the list of dependencies when the target is first tried
|
||||
- after: List -> Target
|
||||
adds targets to the ordering list
|
||||
- fn: (TargetContext -> nil) -> Target
|
||||
adds a function to run to build the target
|
||||
- sync: nil -> Target
|
||||
forces the target to run synchronously and sequentially
|
||||
- mkdirs: nil -> Target
|
||||
always ensures the parent directories of the productions exist, creating them if they don't
|
||||
|
||||
class TargetContext
|
||||
- name: string
|
||||
the name the target is running as
|
||||
- infiles: List
|
||||
the list of input files
|
||||
- infile: string?
|
||||
the first input file
|
||||
- outfiles: List
|
||||
the list of output files
|
||||
- outfile: string?
|
||||
the first output file
|
||||
|
||||
environment Global
|
||||
- _ library
|
||||
- VARIABLES
|
||||
- standard Lua library
|
||||
|
||||
environment Top: Global
|
||||
- target
|
||||
- var
|
||||
- init
|
||||
- public
|
||||
- default
|
||||
|
||||
environment Init: Global
|
||||
- target
|
||||
- var
|
||||
]]
|
||||
Reference in New Issue
Block a user