From ab1ba559a43b591355b3050e73159929bbc6f3b0 Mon Sep 17 00:00:00 2001 From: BO ZHANG Date: Tue, 1 Nov 2022 21:57:27 +0800 Subject: [PATCH] added C example --- cextern/helloworld.c | 15 +++++++++++++++ install_local.sh | 2 +- setup.py | 7 ++++++- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 cextern/helloworld.c diff --git a/cextern/helloworld.c b/cextern/helloworld.c new file mode 100644 index 0000000..6c28d43 --- /dev/null +++ b/cextern/helloworld.c @@ -0,0 +1,15 @@ +// Simple C program to display "Hello World" + +// Header file for input output functions +#include + +// main function - +// where the execution of program begins +int main() +{ + + // prints hello world + printf("Hello World"); + + return 0; +} \ No newline at end of file diff --git a/install_local.sh b/install_local.sh index 7e06325..f34deeb 100644 --- a/install_local.sh +++ b/install_local.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash rm -rf build rm -rf dist -#python setup.py build_ext --inplace +python setup.py build_ext #python setup.py install python setup.py sdist pip install dist/*.tar.gz --force-reinstall diff --git a/setup.py b/setup.py index 366e9b0..70a1a8c 100644 --- a/setup.py +++ b/setup.py @@ -37,4 +37,9 @@ setuptools.setup( # 'astropy', # ], python_requires='>=3.9', -) + ext_modules=[ + setuptools.Extension( + name="csst_proto.cext.helloworld", sources=["cextern/helloworld.c"] + ) + ] +) \ No newline at end of file -- GitLab