meta: add build system
This commit is contained in:
@@ -0,0 +1,20 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.31)
|
||||||
|
project(bshell C)
|
||||||
|
|
||||||
|
find_package(Python COMPONENTS Interpreter REQUIRED)
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${Python_EXECUTABLE}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/tools/build-id.py
|
||||||
|
OUTPUT_VARIABLE bshell_version)
|
||||||
|
|
||||||
|
file(GLOB_RECURSE bshell_sources
|
||||||
|
bshell/*.c
|
||||||
|
bshell/*.h)
|
||||||
|
|
||||||
|
message(STATUS "B Shell version: ${bshell_version}")
|
||||||
|
|
||||||
|
add_executable(bshell ${bshell_sources})
|
||||||
|
|
||||||
|
target_compile_definitions(bshell PUBLIC
|
||||||
|
BSHELL_VERSION="${bshell_version}")
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
func test-function($name) {
|
||||||
|
echo "Hello, $name!"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Example of instantiating an FX runtime object.
|
||||||
|
$obj = new-object -type-name fx.string -arguments "John Doe"
|
||||||
|
|
||||||
|
test-function -name $obj
|
||||||
Executable
+36
@@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# vim: ft=python
|
||||||
|
# -*- mode: python -*-
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
def is_arg_set(name):
|
||||||
|
for arg in sys.argv:
|
||||||
|
if arg == '--{}'.format(name):
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def get_arg(name):
|
||||||
|
ret_next = False
|
||||||
|
for arg in sys.argv:
|
||||||
|
if ret_next:
|
||||||
|
return arg
|
||||||
|
|
||||||
|
if arg == '--{}'.format(name):
|
||||||
|
ret_next = True
|
||||||
|
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
|
current_tag = subprocess.check_output(['git', 'describe', '--tags', '--abbrev=0']).decode('utf-8').strip()
|
||||||
|
|
||||||
|
build_id = '{}'.format(current_tag)
|
||||||
|
|
||||||
|
if sys.stdout.isatty():
|
||||||
|
print('{}'.format(build_id))
|
||||||
|
else:
|
||||||
|
print('{}'.format(build_id), end='')
|
||||||
Reference in New Issue
Block a user