Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
t1ha: add meson.build (initial draft).
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkelfj authored and erthink committed Apr 4, 2018
1 parent cc0a518 commit 12a4bc5
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
62 changes: 62 additions & 0 deletions meson.build
@@ -0,0 +1,62 @@
## meson.build for t1ha v2.0.1

project('t1ha', 'c')

cc = meson.get_compiler('c')
t1ha_sources = files(
'src/t1ha0.c',
'src/t1ha1.c',
'src/t1ha2.c')

t1ha_objects = []
t1ha_c_args = []
t1ha_link_with = []

foreach a : ['-Wall', '-ffunction-sections', '-std=c99']
if cc.has_argument(a)
t1ha_c_args += a
endif
endforeach

if true
t1ha_c_args = ['-Dt1ha_EXPORTS']
if cc.has_argument('-fvisibility=hidden')
t1ha_c_args += '-fvisibility=hidden'
endif
endif

if target_machine.cpu_family().startswith('x86')
t1ha_ia32aes_noavx_c_args = t1ha_c_args
t1ha_ia32aes_avx_c_args = t1ha_c_args
t1ha_ia32aes_avx2_c_args = t1ha_c_args

if cc.get_id() == 'msvc'
t1ha_ia32aes_avx_c_args += '/arch:AVX'
t1ha_ia32aes_avx2_c_args += '/arch:AVX2'
else
t1ha_ia32aes_noavx_c_args += ['-mno-avx2', '-mno-avx', '-maes', '-mtune=native']
t1ha_ia32aes_avx_c_args += ['-mno-avx2', '-mavx', '-maes', '-mtune=native']
t1ha_ia32aes_avx2_c_args += ['-mavx2', '-mavx', '-maes', '-mtune=native']
endif

# Need a staging lib since meson cannot set c_args per object.
# Need all versions since th1a0 hash checks processor and chooses
# the appropriate version at runtime.
lib = static_library('t1ha_ia32aes_noavx_stage',
'src/t1ha0_ia32aes_noavx.c', c_args: t1ha_ia32aes_noavx_c_args)
t1ha_objects += lib.extract_objects('src/t1ha0_ia32aes_noavx.c')

lib = static_library('t1ha_ia32aes_avx_stage',
'src/t1ha0_ia32aes_avx.c', c_args: t1ha_ia32aes_avx_c_args)
t1ha_objects += lib.extract_objects('src/t1ha0_ia32aes_avx.c')

lib = static_library('t1ha_ia32aes_avx2_stage',
'src/t1ha0_ia32aes_avx2.c', c_args: t1ha_ia32aes_avx2_c_args)
t1ha_objects += lib.extract_objects('src/t1ha0_ia32aes_avx2.c')
endif

libt1ha = static_library('t1ha', t1ha_sources, c_args: t1ha_c_args, objects: t1ha_objects)

## this makes it possible to use the source and objects in parent project without using libt1ha directly.
#lib_objects += t1ha_objects
#lib_sources += t1ha_sources
1 change: 1 addition & 0 deletions t1ha.files
@@ -1,3 +1,4 @@
meson.build
tests/xxhash/xxhash.h
tests/xxhash/xxhash.c
tests/common.h
Expand Down

0 comments on commit 12a4bc5

Please sign in to comment.