somehow i managed to improve the build system

to become even more awesome
This commit is contained in:
2019-12-12 10:17:17 -08:00
parent 0372f0ee9c
commit d954a9832b
2 changed files with 19 additions and 9 deletions

9
main.c
View File

@@ -1,4 +1,4 @@
#include "cythoned/bridge.h" #include "build/bridge.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@@ -17,15 +17,16 @@
#define TAG_INSTR 9 #define TAG_INSTR 9
#define TAG_TERMT 10 #define TAG_TERMT 10
#define COMM 5 #define COMM 25
#define ITER 500 #define ITER 100
#define BS 32 #define BS 32
#define EMB 32 #define EMB 32
#define WIN 2 #define WIN 2
#define FLPC 1 #define FLPC 1
#define in_range(i, x) (size_t i = 0; i < (x); i++) #define in_range(i, x) (size_t i = 0; i < (x); i++)
// I am honestly VERY sorry for this but power corrupts even the best of us // I am honestly VERY sorry for this
// but the power of macros corrupts even the best of us
#define INFO_PRINTF(fmt, ...) \ #define INFO_PRINTF(fmt, ...) \
do { fprintf(stderr, fmt, __VA_ARGS__); } while(0) do { fprintf(stderr, fmt, __VA_ARGS__); } while(0)

View File

@@ -11,9 +11,18 @@ numpy_header = include_directories(run_command(
'python3', '-c', 'import numpy;print(numpy.get_include())' 'python3', '-c', 'import numpy;print(numpy.get_include())'
).stdout().strip()) ).stdout().strip())
executable( cython = find_program('cython')
'fedavg_mpi', 'main.c', 'cythoned/bridge.c', bridge = custom_target('bridge',
output: ['bridge.c', 'bridge.h'],
input: 'bridge.pyx',
command: [cython, '-3', '@INPUT@', '-o', 'bridge.c'])
executable('fedavg_mpi',
'main.c', bridge,
dependencies: [mpi, python], dependencies: [mpi, python],
include_directories: numpy_header, include_directories: numpy_header,
link_args: '-Wl,-w' link_args: '-Wl,-w')
)
run_command('cp',
meson.current_build_dir() + 'compile_commands.json',
meson.current_source_dir())