diff --git a/doc/build-from-source.md b/doc/build-from-source.md index 2cc9c245..fdab4d1f 100644 --- a/doc/build-from-source.md +++ b/doc/build-from-source.md @@ -137,21 +137,27 @@ pip install . -v -C setup-args=-Doptimization=2 ```` +```{admonition} Advanced compilation configuration + +The environment variables `CC`, `CXX`, `CFLAGS`, `CXXFLAGS` and `LDFLAGS` +are honored. So for example, one could compile with +`CXXFLAGS="-march=native -Ofast"`. + +Note that Fluidsim builds are not sensible to the [`~/.pythranrc` file](pythranrc)! + +``` + ```{todo} -- How to use `-march=native -Ofast`? How to differentiate a native build from a +- How to differentiate a native build from a regular build to produce binaries usable on other computers? -- How to do what was done with the `[compiler]` section of `~/.pythranrc` (described [here](https://pythran.readthedocs.io/en/latest/MANUAL.html#customizing-your-pythranrc))? - - How to know which compilers and compilation flags are used? -- How to `USE_XSIMD`? How to check if XSIMD was indeed used? +- How to check if XSIMD was indeed used? - How to produce a wheel for other architectures (cross-compilation)? -- Default for `pythran-complex-hook`? Depending on OS? - ``` ### Setup a full developer environment with editable installation diff --git a/fluidsim/meson.build b/fluidsim/meson.build index 095bfdb3..6c993aa0 100644 --- a/fluidsim/meson.build +++ b/fluidsim/meson.build @@ -9,6 +9,7 @@ run_command( 'sh', '-c', 'echo transonic_backend=' + backend + ' > ' + 'build_conf.txt', + check: true, ) diff --git a/meson.build b/meson.build index a2adffc2..4100bfa1 100644 --- a/meson.build +++ b/meson.build @@ -61,6 +61,12 @@ print(incdir)''' pythran = find_program('pythran', native: true) + cpp_args_pythran = [ + '-DENABLE_PYTHON_MODULE', + '-D__PYTHRAN__=3', + '-DPYTHRAN_BLAS_NONE' + ] + if get_option('use-xsimd') == true # xsimd is unvendored from pythran by conda-forge, and due to a compiler # activation bug the default /include/ may not be visible (see @@ -70,19 +76,18 @@ print(incdir)''' include_directories: incdir_pythran, dependencies: xsimd_dep, ) + cpp_args_pythran += ['-DUSE_XSIMD'] else pythran_dep = declare_dependency( include_directories: incdir_pythran, ) endif - cpp_args_pythran = [ - '-DENABLE_PYTHON_MODULE', - '-D__PYTHRAN__=3', - '-DPYTHRAN_BLAS_NONE' - ] pythran_complex_hook = get_option('pythran-complex-hook') + if pythran_complex_hook == 'os-dependent' + pythran_complex_hook = host_machine.system() == 'linux' + endif endif diff --git a/meson.options b/meson.options index 1594ab0d..ff44f3cd 100644 --- a/meson.options +++ b/meson.options @@ -6,10 +6,11 @@ option( 'pythran,python,numba (default), cython, numpy, numba; ' + 'or comma separated value representing multi-backends' ) -option('use-xsimd', type: 'boolean', value: true, description: 'use xsimd') +option('use-xsimd', type: 'boolean', value: true, description: 'Use xsimd') option( 'pythran-complex-hook', - type: 'boolean', - value: true, + type : 'combo', + choices : ['os-dependent', 'true', 'false'], + value : 'os-dependent', description: 'Pythran complex_hook option' )