-
-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding C# to the build system (using the Mono toolchain) (#1012)
* Added C# compilation through the mono-devel package * Moved out void functions inside functions as it doesn't work with the mono compiler * Removed mono-devel from Dockerfile * Revert "Removed mono-devel from Dockerfile" This reverts commit 8ee8f63. * fixed incorrect naming typo
- Loading branch information
Showing
6 changed files
with
103 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
from SCons.Builder import Builder | ||
import SCons.Util | ||
|
||
class ToolMCSWarning(SCons.Warnings.SConsWarning): | ||
pass | ||
|
||
class MCSNotFound(ToolMCSWarning): | ||
pass | ||
|
||
SCons.Warnings.enableWarningClass(ToolMCSWarning) | ||
|
||
def _detect(env): | ||
try: | ||
return env['mcs'] | ||
except KeyError: | ||
pass | ||
|
||
mcs = env.WhereIs('mcs') | ||
if mcs: | ||
return mcs | ||
|
||
SCons.Warnings.warn(MCSNotFound, 'Could not find mcs executable') | ||
|
||
def exists(env): | ||
env.Detect('mcs') | ||
|
||
def generate(env): | ||
env['MCS'] = _detect(env) | ||
env['MCSFLAGS'] = [] | ||
|
||
mcs_builder = Builder( | ||
action='"$MCS" -out:$TARGET $MCSFLAGS $SOURCES', | ||
src_suffix='.cs', | ||
suffix='$PROGSUFFIX', | ||
) | ||
|
||
env.Append(BUILDERS={'MCS': mcs_builder}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
Import('files_to_compile env') | ||
|
||
language = files_to_compile[0].language | ||
chapter = files_to_compile[0].chapter | ||
|
||
from collections import defaultdict | ||
chapter_files = defaultdict(list) | ||
|
||
for file_info in files_to_compile: | ||
chapter_files[file_info.chapter].append(file_info.path) | ||
|
||
for chapter, files in chapter_files.items(): | ||
build_target = f'#/build/{language}/{chapter}/{chapter}' | ||
build_result = env.MCS(build_target, [str(file) for file in files]) | ||
env.Alias(str(chapter), build_result) |