Skip to content

Commit

Permalink
revert to 6df6763
Browse files Browse the repository at this point in the history
  • Loading branch information
kjmeagher committed Nov 1, 2024
1 parent 611f23f commit 769d373
Show file tree
Hide file tree
Showing 2 changed files with 145 additions and 144 deletions.
269 changes: 135 additions & 134 deletions subprojects/packagefiles/cfitsio/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -10,123 +10,123 @@ project(
SOVERSION = 10

cc = meson.get_compiler('c')
lib_deps = []
exe_deps = []
libm = cc.find_library('m', required: false)
zlib = dependency('zlib', method: 'pkg-config', required:true, fallback: ['zlib', 'zlib_dep'])
lib_deps = [libm, zlib]
has_fortran = false

if cc.has_header('unistd.h')
add_project_arguments('-DHAVE_UNISTD_H',language: 'c')
# if cc.has_header_symbol('unistd.h', 'ftruncate')
# add_project_arguments('-DHAVE_FTRUNCATE', language: 'c')
# endif
else
add_project_arguments('-DYY_NO_UNISTD_H', language: 'c')
if not libm.found()
lib_deps += libm
exe_deps += libm
endif


# # if cc.get_id() != 'msvc'
# if host_machine.system() != 'windows'
lib_deps += dependency('zlib', method: 'pkg-config', required:true, fallback: ['zlib', 'zlib_dep'])

# has_fortran = add_languages(
# 'fortran',
# native: false,
# required: get_option('fortran'),
# )
if cc.get_id() != 'msvc'

# threads = dependency('threads', required: get_option('reentrant'))
# if threads.found()
# add_project_arguments('-D_REENTRANT', language: 'c')
# lib_deps += threads
# endif
has_fortran = add_languages(
'fortran',
native: false,
required: get_option('fortran'),
)

# bzip2 = cc.find_library('bz2', has_headers:['bzlib.h'], required: get_option('bzip2'))
# if not bzip2.found() and get_option('bzip2').enabled()
# bzip2_proj = subproject('bzip2')
# bzip2 = libsimple_proj.get_variable('bzip2_dep')
# endif
# if bzip2.found()
# add_project_arguments('-DHAVE_BZIP2=1', language: 'c')
# lib_deps += bzip2
# endif
threads = dependency('threads', required: get_option('reentrant'))
if threads.found()
add_project_arguments('-D_REENTRANT', language: 'c')
lib_deps += threads
endif

# bzip2 = cc.find_library('bzip2', required: false)
bzip2 = dependency(
'bzip2',
method: 'pkg-config',
required: get_option('bzip2'),
fallback: ['bzip2', 'bzip2_dep'],
)
if bzip2.found()
add_project_arguments('-DHAVE_BZIP2=1', language: 'c')
lib_deps += bzip2
endif


# else
# has_fortran = false
# add_project_arguments('-DYY_NO_UNISTD_H', language: 'c')
# endif
if cc.has_header_symbol('unistd.h', 'ftruncate')
add_project_arguments('-DHAVE_UNISTD_H', '-DHAVE_FTRUNCATE', language: 'c')
endif

# if host_machine.system() != 'windows'
# curl = dependency(
# 'libcurl',
# method: 'pkg-config',
# required: get_option('curl'),
# )
# if curl.found()
# add_project_arguments('-DCFITSIO_HAVE_CURL', language: 'c')
# lib_deps += curl
# endif
# endif
else
has_fortran = false
add_project_arguments('-DYY_NO_UNISTD_H', language: 'c')
endif

# if get_option('hera')
# add_project_arguments('-DBUILD_HERA=1', language: 'c')
# endif
if target_machine.system() != 'windows'
curl = dependency(
'libcurl',
method: 'pkg-config',
required: get_option('curl'),
)
if curl.found()
add_project_arguments('-DCFITSIO_HAVE_CURL', language: 'c')
lib_deps += curl
endif
endif

if get_option('hera')
add_project_arguments('-DBUILD_HERA=1', language: 'c')
endif

# if cc.get_id() != 'msvc' and cc.has_function('gethostbyname') and cc.has_function(
# 'connect',
# )
# add_project_arguments('-DHAVE_NET_SERVICES', language: 'c')
# if cc.has_header_symbol('stdio.h', 'fmemopen')
# add_project_arguments('-DHAVE_FMEMOPEN', language: 'c')
# endif
# endif
if cc.get_id() != 'msvc' and cc.has_function('gethostbyname') and cc.has_function(
'connect',
)
add_project_arguments('-DHAVE_NET_SERVICES', language: 'c')
if cc.has_header_symbol('stdio.h', 'fmemopen')
add_project_arguments('-DHAVE_FMEMOPEN', language: 'c')
endif
endif

# # if get_option('sse2')
# # if cc.has_argument('-msse2')
# # add_project_arguments('-msse2', language: 'c')
# # elif cc.get_id() == 'msvc'
# # add_project_arguments('-D__SSE2__=1', language: 'c')
# # endif
# # endif
if get_option('sse2')
if cc.has_argument('-msse2')
add_project_arguments('-msse2', language: 'c')
elif cc.get_id() == 'msvc'
add_project_arguments('-D__SSE2__=1', language: 'c')
endif
endif

# # if get_option('ssse3')
# # if cc.has_argument('-mssse3')
# # add_project_arguments('-mssse3', language: 'c')
# # elif cc.get_id() == 'msvc'
# # add_project_arguments('-D__SSE2__=1', '-D__SSSE3__=1', language: 'c')
# # endif
# # endif
if get_option('ssse3')
if cc.has_argument('-mssse3')
add_project_arguments('-mssse3', language: 'c')
elif cc.get_id() == 'msvc'
add_project_arguments('-D__SSE2__=1', '-D__SSSE3__=1', language: 'c')
endif
endif



# shmem_prefix = [
# '#include <sys/ipc.h>',
# '#include <sys/shm.h>',
# '#include <sys/sem.h>',
# ]
# flock_prefix = ['#include <sys/flock.h>']
shmem_prefix = [
'#include <sys/ipc.h>',
'#include <sys/shm.h>',
'#include <sys/sem.h>',
]
flock_prefix = ['#include <sys/flock.h>']

# have_shmem_services = true
# foreach func : ['shmat', 'shmdt', 'shmget', 'semget']
# have_shmem_services = have_shmem_services and cc.has_function(
# func,
# prefix: shmem_prefix,
# )
# endforeach
# if have_shmem_services
# add_project_arguments('-DHAVE_SHMEM_SERVICES', language: 'c')
# if cc.has_type('flock_t', prefix: flock_prefix)
# add_project_arguments('-DHAVE_FLOCK_T', language: 'c')
# endif
# if cc.has_type('union semun', prefix: shmem_prefix)
# add_project_arguments('-DHAVE_UNION_SEMUN', language: 'c')
# endif
# endif
have_shmem_services = true
foreach func : ['shmat', 'shmdt', 'shmget', 'semget']
have_shmem_services = have_shmem_services and cc.has_function(
func,
prefix: shmem_prefix,
)
endforeach
if have_shmem_services
add_project_arguments('-DHAVE_SHMEM_SERVICES', language: 'c')
if cc.has_type('flock_t', prefix: flock_prefix)
add_project_arguments('-DHAVE_FLOCK_T', language: 'c')
endif
if cc.has_type('union semun', prefix: shmem_prefix)
add_project_arguments('-DHAVE_UNION_SEMUN', language: 'c')
endif
endif

# if cc.has_type('long long')
# add_project_arguments('-DHAVE_LONGLONG', language: 'c')
# endif
if cc.has_type('long long')
add_project_arguments('-DHAVE_LONGLONG', language: 'c')
endif

install_headers('fitsio.h', 'fitsio2.h', 'longnam.h')

Expand Down Expand Up @@ -203,7 +203,7 @@ if has_fortran
]
endif

libcfitsio = shared_library(
libcfitsio = library(
'cfitsio',
libcfitsio_SOURCES,
dependencies: lib_deps,
Expand All @@ -213,6 +213,7 @@ libcfitsio = shared_library(
)

cfitsio_dep = declare_dependency(
include_directories: include_directories('.'),
link_with: libcfitsio,
)

Expand All @@ -226,57 +227,57 @@ pkg.generate(
)

if get_option('utils')
executable(
'fitscopy',
'utilities/fitscopy.c',
dependencies: [cfitsio_dep, lib_deps],
install: true,
)
executable(
'fitsverify',
'utilities/ftverify.c',
'utilities/fvrf_data.c',
'utilities/fvrf_file.c',
'utilities/fvrf_head.c',
'utilities/fvrf_key.c',
'utilities/fvrf_misc.c',
c_args: '-DSTANDALONE',
dependencies: [cfitsio_dep, lib_deps],
install: true,
)
executable(
'fpack',
'utilities/fpack.c',
'utilities/fpackutil.c',
dependencies: [cfitsio_dep, lib_deps],
install: true,
)
executable(
'funpack',
'utilities/funpack.c',
'utilities/fpackutil.c',
dependencies: [cfitsio_dep, lib_deps],
link_with: libcfitsio,
install: true,
)
executable(
'fitscopy',
'utilities/fitscopy.c',
dependencies: cfitsio_dep,
install: true,
)
executable(
'fitsverify',
'utilities/ftverify.c',
'utilities/fvrf_data.c',
'utilities/fvrf_file.c',
'utilities/fvrf_head.c',
'utilities/fvrf_key.c',
'utilities/fvrf_misc.c',
c_args: '-DSTANDALONE',
dependencies: cfitsio_dep,
install: true,
)
executable(
'fpack',
'utilities/fpack.c',
'utilities/fpackutil.c',
dependencies: exe_deps + cfitsio_dep,
install: true,
)
executable(
'funpack',
'utilities/funpack.c',
'utilities/fpackutil.c',
dependencies: exe_deps + cfitsio_dep,
link_with: libcfitsio,
install: true,
)
endif

test(
'cookbook',
executable('cookbook', 'utilities/cookbook.c', dependencies: [cfitsio_dep, lib_deps]),
executable('cookbook', 'utilities/cookbook.c', dependencies: cfitsio_dep),
)
cmp = find_program('test_compare.py')
testprog = executable(
'testprog',
'utilities/testprog.c',
dependencies: [cfitsio_dep, lib_deps],
dependencies: cfitsio_dep,
)
test('testprog', cmp, args: [testprog, meson.current_source_dir()])
if has_fortran
testf77 = executable(
'testf77',
'utilities/testf77.f',
dependencies: [cfitsio_dep, lib_deps],
dependencies: cfitsio_dep,
)
test('testf77', cmp, args: [testf77, meson.current_source_dir()])
endif
Expand Down
20 changes: 10 additions & 10 deletions subprojects/packagefiles/cfitsio/meson.options
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ option(
type: 'boolean',
description: 'Build fpack, funpack, fitscopy, and fitsverify executables',
)
# option(
# 'sse2',
# type: 'boolean',
# description: 'Enable use of instructions in the SSE2 extended instruction set',
# )
# option(
# 'ssse3',
# type: 'boolean',
# description: 'Enable use of instructions in the SSSE3 extended instruction set',
# )
option(
'sse2',
type: 'boolean',
description: 'Enable use of instructions in the SSE2 extended instruction set',
)
option(
'ssse3',
type: 'boolean',
description: 'Enable use of instructions in the SSSE3 extended instruction set',
)
option('hera', type: 'boolean', description: 'Build for HERA (ASD use only)')
option(
'bzip2',
Expand Down

0 comments on commit 769d373

Please sign in to comment.