Skip to content
Snippets Groups Projects
Commit ce7d2320 authored by Izzard, Robert Dr (Maths & Physics)'s avatar Izzard, Robert Dr (Maths & Physics)
Browse files

clean up meson building: add symlinking options for

backwards compatibility
parent 25138450
No related branches found
No related tags found
No related merge requests found
......@@ -10,8 +10,8 @@
############################################################
# TODO:
#
# fix precompiled headers (meson seems broken with these)
# shared_library build
# automate symlink of libbinary_c.so
#
# 'accurate', 'generic', 'gprof'/'gcov' builds
# test non-debug version (meson builds generic by default)
# profile-guided optimization
......@@ -25,7 +25,7 @@ project(
'binary_c','c',
version : '2.1.3',
default_options : [
'c_std=gnu99'
'c_std=gnu99',
]
)
compiler = meson.get_compiler('c')
......@@ -277,19 +277,9 @@ data_objects = run_command('meson/data_object_list.sh').stdout().strip().split('
############################################################
# source files
sourcefiles = run_command('meson/sourcefiles.sh',).stdout().strip().split('\n')
c_sourcefiles = run_command('meson/c_sourcefiles.sh',).stdout().strip().split('\n')
h_sourcefiles = run_command('meson/h_sourcefiles.sh',).stdout().strip().split('\n')
############################################################
# precompile headers
#
##### BROKEN! #####
#
############################################################
if compiler.get_id() == 'clang'
pch_flags = '-MF binary_c.h.gch.d binary_c.h -o binary_c.h.pch'
else
pch_flags = '-MF binary_c.h.gch.d -x c-header binary_c.h'
endif
############################################################
# full list of libraries with which we wish to link
......@@ -326,23 +316,82 @@ foreach _arg : ['all','format','strict-prototypes','format-signedness']
endforeach
cflags += warn_flags
############################################################
# make executable
executable = executable(
'binary_c',
sources : sourcefiles,
#c_pch : 'pch/binary_c_pch.h',
include_directories: include_directories(incdirs),
dependencies : [libgsl_dep],
c_args : [ cflags, quoted_cflags_list ],
link_args : libs,
objects : data_objects,
)
# make precompiled headers
if compiler.get_id() == 'clang'
pch_cflags = [ ]
pch_sourcefiles = [ 'binary_c.h.pch' ]
else
pch_cflags = [ '-x', 'c-header' ]
pch_sourcefiles = [ 'binary_c.h.gch' ]
endif
pch_cflags_array = cflags + pch_cflags
pch_compiler = compiler.cmd_array() + pch_cflags_array
precompiled_headers = custom_target(
'binary_c.h.gch',
build_by_default : true,
input : ['src/binary_c.h'],
output : pch_sourcefiles,
command : [ pch_compiler, '-gdwarf-2', '@INPUT@' ],
depend_files : [h_sourcefiles],
)
############################################################
# TODO:
# symlink shared_library to binary_c/src directory
libbinary_c_symlink = custom_target(
'symlink_libbinary_c',
build_by_default: false,
output: [ 'libbinary_c_symlink' ],
command: [ 'sh', '-c', '../meson/symlink_libbinary_c.sh' ],
)
############################################################
#
# make shared library
#
# shared_library('binary_c')
binary_c_shared_library = shared_library(
'binary_c',
build_by_default : false,
install: true,
#install_dir: binary_c_src,
sources : [c_sourcefiles, h_sourcefiles, precompiled_headers],
include_directories: include_directories(incdirs),
dependencies : [ libgsl_dep ],
c_args : [ cflags, quoted_cflags_list, '-fvisibility=hidden','-H' ],
link_args : libs,
objects : data_objects,
)
############################################################
# make executable
binary_c_executable = executable(
'binary_c',
install: true,
sources : [c_sourcefiles, h_sourcefiles, precompiled_headers],
include_directories: include_directories(incdirs),
dependencies : [ libgsl_dep ],
c_args : [ cflags, quoted_cflags_list, '-H' ],
link_args : libs,
objects : data_objects,
)
############################################################
# symlink executable to binary_c directory
binary_c_symlink = custom_target('symlink_binary_c',
build_by_default: true,
output: ['binary_c_symlinked'],
command: [ 'sh', '-c', '../meson/symlink_binary_c.sh' ],
depends : [ binary_c_executable ],
)
#!/bin/bash
# list binary_c C source files for meson
ls src/*.c src/*/*.c
#!/bin/bash
# list binary_c header source files for meson
ls src/*.h src/*/*.h
#!/bin/bash
# list binary_c source files for meson
ls src/*.c
ls src/*/*.c
#!/bin/bash
# script to symlink a completed binary_c executable
# to the binary_c root directory.
ln -sfr binary_c ../
#!/bin/bash
# script to symlink a completed binary_c executable
# to the binary_c root directory.
ln -sfr libbinary_c.so ../src/
#define _GNU_SOURCE
#include "../binary_c.h"
#include "buffering_macros.h"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment