summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-11-17 10:46:03 +0100
committerSuren A. Chilingaryan <csa@suren.me>2019-11-17 10:46:03 +0100
commit23f22348c5281fff685c1fa89255e7e1e76266a4 (patch)
treefb05ad7fb39357ff8785068b3a1512101d685f41
parent3d93df54d024f49895db6277e873dccd10b5baec (diff)
downloadufo-roof-23f22348c5281fff685c1fa89255e7e1e76266a4.tar.gz
ufo-roof-23f22348c5281fff685c1fa89255e7e1e76266a4.tar.bz2
ufo-roof-23f22348c5281fff685c1fa89255e7e1e76266a4.tar.xz
ufo-roof-23f22348c5281fff685c1fa89255e7e1e76266a4.zip
cmake build and gcc warnings
-rw-r--r--.gitignore13
-rw-r--r--CMakeLists.txt1
-rw-r--r--common/cmake/ConfigurePaths.cmake90
-rw-r--r--common/cmake/FindFFTW3.cmake133
-rw-r--r--common/cmake/FindGObjectIntrospection.cmake61
-rw-r--r--common/cmake/FindOCLFFT.cmake14
-rw-r--r--common/cmake/FindOpenCL.cmake135
-rw-r--r--common/cmake/FindVala.cmake65
-rw-r--r--common/cmake/PkgConfigVars.cmake30
-rw-r--r--src/CMakeLists.txt8
-rw-r--r--src/ufo-roof-buffer.c8
-rw-r--r--src/ufo-roof-buffer.h4
-rw-r--r--src/ufo-roof-build-task.c6
-rw-r--r--src/ufo-roof-error.h44
-rw-r--r--src/ufo-roof-read-file.c4
-rw-r--r--src/ufo-roof-read-socket.c4
-rw-r--r--src/ufo-roof-read.h2
-rw-r--r--src/ufo-roof.h2
18 files changed, 583 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..8e4b968
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+*~
+*.pyc
+*.so
+*.o
+CMakeFiles/
+CTestTestfile.cmake
+cmake_install.cmake
+CMakeCache.txt
+Makefile
+/tags
+/tests/venv
+/build/
+/_build/
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 37c38fc..df85ded 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 2.8)
+
project(ufo C CXX)
set(TARNAME "ufo-roof")
diff --git a/common/cmake/ConfigurePaths.cmake b/common/cmake/ConfigurePaths.cmake
new file mode 100644
index 0000000..df9c03c
--- /dev/null
+++ b/common/cmake/ConfigurePaths.cmake
@@ -0,0 +1,90 @@
+# - pre-configured paths for CMake
+#
+# Usage:
+# configure_paths(<PREFIX>)
+#
+# Checks if configure-like prefix and installation paths were passed by the user
+# and sets up corresponding variables for use in install() commands and to fill
+# out .pc files:
+#
+# PREFIX_PREFIX defaults to ... CMAKE_INSTALL_PREFIX
+# PREFIX_EPREFIX PREFIX_PREFIX
+# PREFIX_SBINDIR PREFIX_EPREFIX/sbin
+# PREFIX_SYSCONFDIR PREFIX_PREFIX/etc
+# PREFIX_LOCALSTATEDIR PREFIX_PREFIX/var
+# PREFIX_BINDIR PREFIX_EPREFIX/bin
+# PREFIX_LIBDIR PREFIX_EPREFIX/lib
+# PREFIX_INCLUDEDIR PREFIX_PREFIX/include
+# PREFIX_PKGCONFIGDIR PREFIX_LIBDIR/pkgconfig
+# PREFIX_TYPELIBDIR PREFIX_LIBDIR/girepository-1.0
+# PREFIX_DATAROOTDIR PREFIX_PREFIX/share
+# PREFIX_DATADIR PREFIX_DATAROOTDIR
+# PREFIX_INFODIR PREFIX_DATAROOTDIR/info
+# PREFIX_MANDIR PREFIX_DATAROOTDIR/man
+# PREFIX_LOCALEDIR PREFIX_DATAROOTDIR/locale
+# PREFIX_GIRDIR PREFIX_DATAROOTDIR/gir-1.0
+
+# Copyright (C) 2013 Matthias Vogelgesang <matthias.vogelgesang@gmail.com>
+#
+# Redistribution and use, with or without modification, are permitted
+# provided that the following conditions are met:
+#
+# 1. Redistributions must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+# 2. The name of the author may not be used to endorse or promote
+# products derived from this software without specific prior
+# written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+if(__configure_paths)
+ return()
+endif()
+
+set(__configure_paths YES)
+
+macro(_set_var _prefix _var _user _override _description)
+ set(_name "${_prefix}_${_var}")
+
+ set("${_name}" "${_user}")
+
+ if("${_name}" STREQUAL "")
+ set("${_name}" "${_override}")
+ endif()
+
+ set(${_name} "${${_name}}" CACHE PATH "${_description}")
+ mark_as_advanced(${_name})
+endmacro()
+
+function(configure_paths _prefix)
+ _set_var("${_prefix}" "PREFIX" "${PREFIX}" "${CMAKE_INSTALL_PREFIX}" "install architecture-independent files in PREFIX")
+ _set_var("${_prefix}" "EPREFIX" "${EXEC_PREFIX}" "${${_prefix}_PREFIX}" "install architecture-dependent files in EPREFIX")
+
+ _set_var("${_prefix}" "SBINDIR" "${SBINDIR}" "${${_prefix}_EPREFIX}/sbin" "system admin executabls")
+ _set_var("${_prefix}" "SYSCONFDIR" "${SYSCONFDIR}" "${${_prefix}_PREFIX}/etc" "read-only single-machine data")
+ _set_var("${_prefix}" "LOCALSTATEDIR" "${LOCALSTATEDIR}" "${${_prefix}_PREFIX}/var" "modifiable single-machine data")
+ _set_var("${_prefix}" "BINDIR" "${BINDIR}" "${${_prefix}_EPREFIX}/bin" "user executables")
+ _set_var("${_prefix}" "LIBDIR" "${LIBDIR}" "${${_prefix}_EPREFIX}/lib" "object code libraries")
+ _set_var("${_prefix}" "INCLUDEDIR" "${INCLUDEDIR}" "${${_prefix}_PREFIX}/include" "C header files")
+ _set_var("${_prefix}" "PKGCONFIGDIR" "${PKGCONFIGDIR}" "${${_prefix}_LIBDIR}/pkgconfig" "pkg-config files")
+ _set_var("${_prefix}" "TYPELIBDIR" "${TYPELIBDIR}" "${${_prefix}_LIBDIR}/girepository-1.0" "GObject run-time introspection data")
+ _set_var("${_prefix}" "DATAROOTDIR" "${DATAROOTDIR}" "${${_prefix}_PREFIX}/share" "read-only arch.-independent data root")
+ _set_var("${_prefix}" "DATADIR" "${DATADIR}" "${${_prefix}_DATAROOTDIR}" "read-only architecture-independent data")
+ _set_var("${_prefix}" "INFODIR" "${INFODIR}" "${${_prefix}_DATAROOTDIR}/info" "info documentation")
+ _set_var("${_prefix}" "MANDIR" "${MANDIR}" "${${_prefix}_DATAROOTDIR}/man" "man documentation")
+ _set_var("${_prefix}" "LOCALEDIR" "${LOCALEDIR}" "${${_prefix}_DATAROOTDIR}/locale" "locale-dependent data")
+ _set_var("${_prefix}" "GIRDIR" "${GIRDIR}" "${${_prefix}_DATAROOTDIR}/gir-1.0" "GObject introspection data")
+endfunction()
+
+# vim: tw=0:
diff --git a/common/cmake/FindFFTW3.cmake b/common/cmake/FindFFTW3.cmake
new file mode 100644
index 0000000..252fcd9
--- /dev/null
+++ b/common/cmake/FindFFTW3.cmake
@@ -0,0 +1,133 @@
+#
+# Try to find FFTW3 library
+# (see www.fftw.org)
+# Once run this will define:
+#
+# FFTW3_FOUND
+# FFTW3_INCLUDE_DIR
+# FFTW3_LIBRARIES
+# FFTW3_LINK_DIRECTORIES
+#
+# You may set one of these options before including this file:
+# FFTW3_USE_SSE2
+#
+# TODO: _F_ versions.
+#
+# Jan Woetzel 05/2004
+# www.mip.informatik.uni-kiel.de
+# --------------------------------
+
+ FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h
+ ${FFTW3_DIR}/include
+ ${FFTW3_HOME}/include
+ ${FFTW3_DIR}
+ ${FFTW3_HOME}
+ $ENV{FFTW3_DIR}/include
+ $ENV{FFTW3_HOME}/include
+ $ENV{FFTW3_DIR}
+ $ENV{FFTW3_HOME}
+ /usr/include
+ /usr/local/include
+ $ENV{SOURCE_DIR}/fftw3
+ $ENV{SOURCE_DIR}/fftw3/include
+ $ENV{SOURCE_DIR}/fftw
+ $ENV{SOURCE_DIR}/fftw/include
+ )
+#MESSAGE("DBG FFTW3_INCLUDE_DIR=${FFTW3_INCLUDE_DIR}")
+
+
+SET(FFTW3_POSSIBLE_LIBRARY_PATH
+ ${FFTW3_DIR}/lib
+ ${FFTW3_HOME}/lib
+ ${FFTW3_DIR}
+ ${FFTW3_HOME}
+ $ENV{FFTW3_DIR}/lib
+ $ENV{FFTW3_HOME}/lib
+ $ENV{FFTW3_DIR}
+ $ENV{FFTW3_HOME}
+ /usr/lib
+ /usr/local/lib
+ $ENV{SOURCE_DIR}/fftw3
+ $ENV{SOURCE_DIR}/fftw3/lib
+ $ENV{SOURCE_DIR}/fftw
+ $ENV{SOURCE_DIR}/fftw/lib
+)
+
+
+# the lib prefix is containe din filename onf W32, unfortuantely. JW
+# teh "general" lib:
+FIND_LIBRARY(FFTW3_FFTW_LIBRARY
+ NAMES fftw3 libfftw libfftw3 libfftw3-3
+ PATHS
+ ${FFTW3_POSSIBLE_LIBRARY_PATH}
+ )
+#MESSAGE("DBG FFTW3_FFTW_LIBRARY=${FFTW3_FFTW_LIBRARY}")
+
+FIND_LIBRARY(FFTW3_FFTWF_LIBRARY
+ NAMES fftwf3 fftw3f fftwf libfftwf libfftwf3 libfftw3f libfftw3f-3
+ PATHS
+ ${FFTW3_POSSIBLE_LIBRARY_PATH}
+ )
+#MESSAGE("DBG FFTW3_FFTWF_LIBRARY=${FFTW3_FFTWF_LIBRARY}")
+
+FIND_LIBRARY(FFTW3_FFTWL_LIBRARY
+ NAMES fftwl3 fftw3l fftwl libfftwl libfftwl3 libfftw3l libfftw3l-3
+ PATHS
+ ${FFTW3_POSSIBLE_LIBRARY_PATH}
+ )
+#MESSAGE("DBG FFTW3_FFTWF_LIBRARY=${FFTW3_FFTWL_LIBRARY}")
+
+
+FIND_LIBRARY(FFTW3_FFTW_SSE2_LIBRARY
+ NAMES fftw_sse2 fftw3_sse2 libfftw_sse2 libfftw3_sse2
+ PATHS
+ ${FFTW3_POSSIBLE_LIBRARY_PATH}
+ )
+#MESSAGE("DBG FFTW3_FFTW_SSE2_LIBRARY=${FFTW3_FFTW_SSE2_LIBRARY}")
+
+FIND_LIBRARY(FFTW3_FFTWF_SSE_LIBRARY
+ NAMES fftwf_sse fftwf3_sse fftw3f_sse libfftwf_sse libfftwf3_sse libfftw3f_sse
+ PATHS
+ ${FFTW3_POSSIBLE_LIBRARY_PATH}
+ )
+#MESSAGE("DBG FFTW3_FFTWF_SSE_LIBRARY=${FFTW3_FFTWF_SSE_LIBRARY}")
+
+
+# --------------------------------
+# select one of the above
+# default:
+IF (FFTW3_FFTW_LIBRARY)
+ SET(FFTW3_LIBRARIES ${FFTW3_FFTW_LIBRARY})
+ENDIF (FFTW3_FFTW_LIBRARY)
+# specialized:
+IF (FFTW3_USE_SSE2 AND FFTW3_FFTW_SSE2_LIBRARY)
+ SET(FFTW3_LIBRARIES ${FFTW3_FFTW_SSE2_LIBRARY})
+ENDIF (FFTW3_USE_SSE2 AND FFTW3_FFTW_SSE2_LIBRARY)
+
+# --------------------------------
+
+IF(FFTW3_LIBRARIES)
+ IF (FFTW3_INCLUDE_DIR)
+
+ # OK, found all we need
+ SET(FFTW3_FOUND TRUE)
+ GET_FILENAME_COMPONENT(FFTW3_LINK_DIRECTORIES ${FFTW3_LIBRARIES} PATH)
+
+ ELSE (FFTW3_INCLUDE_DIR)
+ MESSAGE("FFTW3 include dir not found. Set FFTW3_DIR to find it.")
+ ENDIF(FFTW3_INCLUDE_DIR)
+ELSE(FFTW3_LIBRARIES)
+ MESSAGE("FFTW3 lib not found. Set FFTW3_DIR to find it.")
+ENDIF(FFTW3_LIBRARIES)
+
+
+MARK_AS_ADVANCED(
+ FFTW3_INCLUDE_DIR
+ FFTW3_LIBRARIES
+ FFTW3_FFTW_LIBRARY
+ FFTW3_FFTW_SSE2_LIBRARY
+ FFTW3_FFTWF_LIBRARY
+ FFTW3_FFTWF_SSE_LIBRARY
+ FFTW3_FFTWL_LIBRARY
+ FFTW3_LINK_DIRECTORIES
+)
diff --git a/common/cmake/FindGObjectIntrospection.cmake b/common/cmake/FindGObjectIntrospection.cmake
new file mode 100644
index 0000000..2073c3c
--- /dev/null
+++ b/common/cmake/FindGObjectIntrospection.cmake
@@ -0,0 +1,61 @@
+# - try to find gobject-introspection
+#
+# Once done this will define
+#
+# INTROSPECTION_FOUND - system has gobject-introspection
+# INTROSPECTION_SCANNER - the gobject-introspection scanner, g-ir-scanner
+# INTROSPECTION_COMPILER - the gobject-introspection compiler, g-ir-compiler
+# INTROSPECTION_GENERATE - the gobject-introspection generate, g-ir-generate
+# INTROSPECTION_GIRDIR
+# INTROSPECTION_TYPELIBDIR
+# INTROSPECTION_CFLAGS
+# INTROSPECTION_LIBS
+#
+# Copyright (C) 2010, Pino Toscano, <pino@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro(_GIR_GET_PKGCONFIG_VAR _outvar _varname)
+ execute_process(
+ COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_varname} gobject-introspection-1.0
+ OUTPUT_VARIABLE _result
+ RESULT_VARIABLE _null
+ )
+
+ if (_null)
+ else()
+ string(REGEX REPLACE "[\r\n]" " " _result "${_result}")
+ string(REGEX REPLACE " +$" "" _result "${_result}")
+ separate_arguments(_result)
+ set(${_outvar} ${_result} CACHE INTERNAL "")
+ endif()
+endmacro(_GIR_GET_PKGCONFIG_VAR)
+
+find_package(PkgConfig)
+if(PKG_CONFIG_FOUND)
+ if(PACKAGE_FIND_VERSION_COUNT GREATER 0)
+ set(_gir_version_cmp ">=${PACKAGE_FIND_VERSION}")
+ endif()
+ pkg_check_modules(_pc_gir gobject-introspection-1.0${_gir_version_cmp})
+ if(_pc_gir_FOUND)
+ set(INTROSPECTION_FOUND TRUE)
+ _gir_get_pkgconfig_var(INTROSPECTION_SCANNER "g_ir_scanner")
+ _gir_get_pkgconfig_var(INTROSPECTION_COMPILER "g_ir_compiler")
+ _gir_get_pkgconfig_var(INTROSPECTION_GENERATE "g_ir_generate")
+ _gir_get_pkgconfig_var(INTROSPECTION_GIRDIR "girdir")
+ _gir_get_pkgconfig_var(INTROSPECTION_TYPELIBDIR "typelibdir")
+ set(INTROSPECTION_CFLAGS "${_pc_gir_CFLAGS}")
+ set(INTROSPECTION_LIBS "${_pc_gir_LIBS}")
+ endif()
+endif()
+
+mark_as_advanced(
+ INTROSPECTION_SCANNER
+ INTROSPECTION_COMPILER
+ INTROSPECTION_GENERATE
+ INTROSPECTION_GIRDIR
+ INTROSPECTION_TYPELIBDIR
+ INTROSPECTION_CFLAGS
+ INTROSPECTION_LIBS
+)
diff --git a/common/cmake/FindOCLFFT.cmake b/common/cmake/FindOCLFFT.cmake
new file mode 100644
index 0000000..fd9c156
--- /dev/null
+++ b/common/cmake/FindOCLFFT.cmake
@@ -0,0 +1,14 @@
+# Try to find liboclfft and clFFT.h. Once found the following variables will be
+# defined:
+#
+# OCLFFT_FOUND
+# OCLFFT_INCLUDE_DIRS
+# OCLFFT_LIBRARIES
+
+find_path(OCLFFT_INCLUDE_DIRS clFFT.h)
+find_library(OCLFFT_LIBRARIES oclfft)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OCLFFT DEFAULT_MSG OCLFFT_INCLUDE_DIRS OCLFFT_LIBRARIES)
+
+mark_as_advanced(OCLFFT_INCLUDE_DIRS OCLFFT_LIBRARIES)
diff --git a/common/cmake/FindOpenCL.cmake b/common/cmake/FindOpenCL.cmake
new file mode 100644
index 0000000..db92a0f
--- /dev/null
+++ b/common/cmake/FindOpenCL.cmake
@@ -0,0 +1,135 @@
+#.rst:
+# FindOpenCL
+# ----------
+#
+# Try to find OpenCL
+#
+# Once done this will define::
+#
+# OpenCL_FOUND - True if OpenCL was found
+# OpenCL_INCLUDE_DIRS - include directories for OpenCL
+# OpenCL_LIBRARIES - link against this library to use OpenCL
+# OpenCL_VERSION_STRING - Highest supported OpenCL version (eg. 1.2)
+# OpenCL_VERSION_MAJOR - The major version of the OpenCL implementation
+# OpenCL_VERSION_MINOR - The minor version of the OpenCL implementation
+#
+# The module will also define two cache variables::
+#
+# OpenCL_INCLUDE_DIR - the OpenCL include directory
+# OpenCL_LIBRARY - the path to the OpenCL library
+#
+
+#=============================================================================
+# Copyright 2014 Matthaeus G. Chajdas
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+find_package(PackageHandleStandardArgs)
+
+function(_FIND_OPENCL_VERSION)
+ include(CheckSymbolExists)
+ include(CMakePushCheckState)
+ set(CMAKE_REQUIRED_QUIET ${OpenCL_FIND_QUIETLY})
+
+ CMAKE_PUSH_CHECK_STATE()
+ foreach(VERSION "2_0" "1_2" "1_1" "1_0")
+ set(CMAKE_REQUIRED_INCLUDES "${OpenCL_INCLUDE_DIR}")
+
+ if(APPLE)
+ CHECK_SYMBOL_EXISTS(
+ CL_VERSION_${VERSION}
+ "${OpenCL_INCLUDE_DIR}/OpenCL/cl.h"
+ OPENCL_VERSION_${VERSION})
+ else()
+ CHECK_SYMBOL_EXISTS(
+ CL_VERSION_${VERSION}
+ "${OpenCL_INCLUDE_DIR}/CL/cl.h"
+ OPENCL_VERSION_${VERSION})
+ endif()
+
+ if(OPENCL_VERSION_${VERSION})
+ string(REPLACE "_" "." VERSION "${VERSION}")
+ set(OpenCL_VERSION_STRING ${VERSION} PARENT_SCOPE)
+ string(REGEX MATCHALL "[0-9]+" version_components "${VERSION}")
+ list(GET version_components 0 major_version)
+ list(GET version_components 1 minor_version)
+ set(OpenCL_VERSION_MAJOR ${major_version} PARENT_SCOPE)
+ set(OpenCL_VERSION_MINOR ${minor_version} PARENT_SCOPE)
+ break()
+ endif()
+ endforeach()
+ CMAKE_POP_CHECK_STATE()
+endfunction()
+
+find_path(OpenCL_INCLUDE_DIR
+ NAMES
+ CL/cl.h OpenCL/cl.h
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV NVSDKCOMPUTE_ROOT
+ ENV CUDA_PATH
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ include
+ OpenCL/common/inc
+ "AMD APP/include")
+
+_FIND_OPENCL_VERSION()
+
+if(WIN32)
+ if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86"
+ lib/x86
+ lib/Win32
+ OpenCL/common/lib/Win32)
+ elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ find_library(OpenCL_LIBRARY
+ NAMES OpenCL
+ PATHS
+ ENV "PROGRAMFILES(X86)"
+ ENV AMDAPPSDKROOT
+ ENV INTELOCLSDKROOT
+ ENV CUDA_PATH
+ ENV NVSDKCOMPUTE_ROOT
+ ENV ATISTREAMSDKROOT
+ PATH_SUFFIXES
+ "AMD APP/lib/x86_64"
+ lib/x86_64
+ lib/x64
+ OpenCL/common/lib/x64)
+ endif()
+else()
+ find_library(OpenCL_LIBRARY NAMES OpenCL)
+endif()
+
+set(OpenCL_LIBRARIES ${OpenCL_LIBRARY})
+set(OpenCL_INCLUDE_DIRS ${OpenCL_INCLUDE_DIR})
+
+find_package_handle_standard_args(
+ OpenCL
+ DEFAULT_MSG
+ OpenCL_LIBRARY OpenCL_INCLUDE_DIRS)
+
+mark_as_advanced(
+ OpenCL_INCLUDE_DIR
+ OpenCL_LIBRARY)
diff --git a/common/cmake/FindVala.cmake b/common/cmake/FindVala.cmake
new file mode 100644
index 0000000..2d1ed14
--- /dev/null
+++ b/common/cmake/FindVala.cmake
@@ -0,0 +1,65 @@
+##
+# Copyright 2009 Jakob Westhoff. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+# The views and conclusions contained in the software and documentation are those
+# of the authors and should not be interpreted as representing official policies,
+# either expressed or implied, of Jakob Westhoff
+##
+
+##
+# Find module for the Vala compiler (valac)
+#
+# This module determines wheter a Vala compiler is installed on the current
+# system and where its executable is.
+#
+# Call the module using "find_package(Vala) from within your CMakeLists.txt.
+#
+# The following variables will be set after an invocation:
+#
+# VALA_FOUND Whether the vala compiler has been found or not
+# VALA_EXECUTABLE Full path to the valac executable if it has been found
+# VALA_VERSION Version number of the available valac
+##
+
+
+# Search for the valac executable in the usual system paths.
+find_program(VALA_EXECUTABLE
+ NAMES valac)
+
+# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call.
+# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka.
+# VALA_EXECUTABLE is set)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Vala DEFAULT_MSG VALA_EXECUTABLE)
+
+mark_as_advanced(VALA_EXECUTABLE)
+
+# Determine the valac version
+if(VALA_FOUND)
+ execute_process(COMMAND ${VALA_EXECUTABLE} "--version"
+ OUTPUT_VARIABLE "VALA_VERSION")
+ string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION})
+ string(STRIP ${VALA_VERSION} "VALA_VERSION")
+endif(VALA_FOUND)
diff --git a/common/cmake/PkgConfigVars.cmake b/common/cmake/PkgConfigVars.cmake
new file mode 100644
index 0000000..f295457
--- /dev/null
+++ b/common/cmake/PkgConfigVars.cmake
@@ -0,0 +1,30 @@
+# - determine variables defined in pkg-config files
+#
+# Usage:
+# pkg_check_variable(<PKG_NAME> <VARIABLE_NAME>)
+#
+# Checks for a variable in the given package and translates to a call such as
+# `pkg-config --variable=<VARIABLE_NAME> <PKG_NAME>`. The output is a cached
+# variable named
+#
+# <PKG_NAME>_<VARIABLE_NAME>
+#
+# Note that both names are uppercased and any dashes replaced by underscores.
+#
+
+find_package(PkgConfig REQUIRED)
+
+function(pkg_check_variable _pkg _name)
+ string(TOUPPER ${_pkg} _pkg_upper)
+ string(TOUPPER ${_name} _name_upper)
+ string(REPLACE "-" "_" _pkg_upper ${_pkg_upper})
+ string(REPLACE "-" "_" _name_upper ${_name_upper})
+ set(_output_name "${_pkg_upper}_${_name_upper}")
+
+ execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} --variable=${_name} ${_pkg}
+ OUTPUT_VARIABLE _pkg_result
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+ set("${_output_name}" "${_pkg_result}" CACHE STRING "pkg-config variable
+ ${_name} of ${_pkg}")
+endfunction()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0913528..95f7160 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -28,7 +28,7 @@ set(ufofilter_LIBS
${UFO_LIBRARIES}
${OpenCL_LIBRARIES})
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -pedantic -Wall -Wextra -fPIC -Wno-unused-parameter -Wno-deprecated-declarations")
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu18 -pedantic -Wall -Wextra -fPIC -Wno-unused-parameter -Wno-deprecated-declarations")
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES)
#}}}
@@ -42,8 +42,8 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${OpenCL_INCLUDE_DIRS}
${UFO_INCLUDE_DIRS})
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
- ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+#configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
+# ${CMAKE_CURRENT_BINARY_DIR}/config.h)
foreach(_src ${ufofilter_SRCS})
@@ -68,7 +68,7 @@ foreach(_src ${ufofilter_SRCS})
add_library(${target} SHARED ${_src} ${common_SRCS} ${${_aux_src}})
endif()
- target_link_libraries(${target} ${ufofilter_LIBS} ${${_aux_libs}} ufoaux)
+ target_link_libraries(${target} ${ufofilter_LIBS} ${${_aux_libs}})
list(APPEND all_targets ${target})
diff --git a/src/ufo-roof-buffer.c b/src/ufo-roof-buffer.c
index f071481..eaf9b35 100644
--- a/src/ufo-roof-buffer.c
+++ b/src/ufo-roof-buffer.c
@@ -20,7 +20,7 @@ UfoRoofBuffer *ufo_roof_buffer_new(UfoRoofConfig *cfg, GError **error) {
// printf("Configuration: dataset: %u - %u fragments (%u streams x %u) x %u bytes\n", buffer->dataset_size, buffer->fragments_per_dataset, cfg->n_streams, buffer->fragments_per_stream, buffer->fragment_size);
buffer->ring_buffer = malloc(buffer->ring_size * buffer->dataset_size);
- buffer->n_fragments = (_Atomic int*)calloc(buffer->ring_size, sizeof(_Atomic int));
+ buffer->n_fragments = (_Atomic guint*)calloc(buffer->ring_size, sizeof(_Atomic int));
buffer->stream_fragment = (guint*)calloc(cfg->n_streams, sizeof(guint));
if ((!buffer->ring_buffer)||(!buffer->n_fragments)||(!buffer->stream_fragment)) {
@@ -73,7 +73,7 @@ gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, gu
// FIXME: Send semi-complete buffers further?
// FIXME: Or shall we drop more if larger buffers are allocated?
- for (int i = buffer->current_id; i <= (dataset_id - buffer->ring_size); i++)
+ for (guint i = buffer->current_id; i <= (dataset_id - buffer->ring_size); i++)
buffer->n_fragments[i%buffer->ring_size] = 0;
buffer->current_id = dataset_id - buffer->ring_size + 1;
@@ -83,8 +83,8 @@ gboolean ufo_roof_buffer_set_fragment(UfoRoofBuffer *buffer, guint stream_id, gu
}
// FIXME: This is builds events as it read from file in roof v.1 code. We can assemble fan projections directly here.
- void *dataset_buffer = buffer->ring_buffer + buffer_id * buffer->dataset_size;
- void *fragment_buffer = dataset_buffer + (stream_id * buffer->fragments_per_stream + fragment_id) * buffer->fragment_size;
+ uint8_t *dataset_buffer = buffer->ring_buffer + buffer_id * buffer->dataset_size;
+ uint8_t *fragment_buffer = dataset_buffer + (stream_id * buffer->fragments_per_stream + fragment_id) * buffer->fragment_size;
/* printf("buffer: %u (%u), packet: %u (%ux%u %u), packet_size: %u [%x]\n",
buffer_id, dataset_id, stream_id * buffer->fragments_per_stream + fragment_id, stream_id, buffer->fragments_per_stream, fragment_id, buffer->fragment_size,
diff --git a/src/ufo-roof-buffer.h b/src/ufo-roof-buffer.h
index bb71791..367f2d5 100644
--- a/src/ufo-roof-buffer.h
+++ b/src/ufo-roof-buffer.h
@@ -7,8 +7,8 @@ struct _UfoRoofBuffer {
guint current_id; // The ID of the first (active) dataset in the buffer
guint ring_size; // Number of datasets to buffer
- void *ring_buffer; // The ring buffer
- _Atomic int *n_fragments; // Number of completed fragments in each buffer
+ uint8_t *ring_buffer; // The ring buffer
+ _Atomic guint *n_fragments; // Number of completed fragments in each buffer
guint *stream_fragment; // Currently processed fragment in the stream (for ordered streams)
// int *fragments; // Mark individual completed fragments (if we care for partial data)
diff --git a/src/ufo-roof-build-task.c b/src/ufo-roof-build-task.c
index 81c84ce..fa2fdcd 100644
--- a/src/ufo-roof-build-task.c
+++ b/src/ufo-roof-build-task.c
@@ -162,14 +162,14 @@ ufo_roof_build_task_process (UfoTask *task,
// UfoRequisition in_req;
// ufo_buffer_get_requisition (inputs[0], &in_req);
- void *data = ufo_buffer_get_host_array(inputs[0], NULL);
+ uint8_t *data = (uint8_t*)ufo_buffer_get_host_array(inputs[0], NULL);
UfoRoofPacketBlockHeader *header = UFO_ROOF_PACKET_BLOCK_HEADER(data, cfg);
if (priv->stop)
return FALSE;
- for (int i = 0; i < header->n_packets; i++) {
- int packet_id = 0;
+ for (guint i = 0; i < header->n_packets; i++) {
+ guint packet_id = 0;
// Otherwise considered consecutive and handled by the buffer
if (cfg->header_size >= sizeof(UfoRoofPacketHeader)) {
diff --git a/src/ufo-roof-error.h b/src/ufo-roof-error.h
index ed0ae2b..5491f31 100644
--- a/src/ufo-roof-error.h
+++ b/src/ufo-roof-error.h
@@ -10,49 +10,49 @@
error = NULL; \
} while (0)
-#define roof_set_error(error, type, msg...) do { \
- if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \
+#define roof_set_error(error, type, ...) do { \
+ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \
} while (0)
-#define roof_error(error, type, msg...) do { \
- if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \
+#define roof_error(error, type, ...) do { \
+ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \
return; \
} while (0)
-#define roof_propagate_error(error, err, msg...) do { \
- g_propagate_prefixed_error(error, err, msg); \
+#define roof_propagate_error(error, err, ...) do { \
+ g_propagate_prefixed_error(error, err, __VA_ARGS__); \
return; \
} while (0)
-#define roof_error_with_retval(error, retval, type, msg...) do { \
- if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, msg); \
+#define roof_error_with_retval(error, retval, type, ...) do { \
+ if (error) g_set_error(error, UFO_TASK_ERROR, UFO_TASK_ERROR_##type, __VA_ARGS__); \
return retval; \
} while (0)
-#define roof_propagate_error_with_retval(error, retval, err, msg...) do { \
- g_propagate_prefixed_error(error, err, msg); \
+#define roof_propagate_error_with_retval(error, retval, err, ...) do { \
+ g_propagate_prefixed_error(error, err, __VA_ARGS__); \
return retval; \
} while (0)
-#define roof_setup_error(error, msg...) \
- roof_error(error, SETUP, msg)
+#define roof_setup_error(error, ...) \
+ roof_error(error, SETUP, __VA_ARGS__)
-#define roof_new_error(error, msg...) \
- roof_error_with_retval(error, NULL, SETUP, msg)
+#define roof_new_error(error, ...) \
+ roof_error_with_retval(error, NULL, SETUP, __VA_ARGS__)
-#define roof_network_error(error, msg...) \
- roof_error(error, SETUP, msg)
+#define roof_network_error(error, ...) \
+ roof_error(error, SETUP, __VA_ARGS__)
-#define root_set_network_error(error, msg...) \
- roof_set_error(error, SETUP, msg)
+#define root_set_network_error(error, ...) \
+ roof_set_error(error, SETUP, __VA_ARGS__)
-#define roof_network_error_with_retval(error, retval, msg...) \
- roof_error_with_retval(error, retval, SETUP, msg)
+#define roof_network_error_with_retval(error, retval, ...) \
+ roof_error_with_retval(error, retval, SETUP, __VA_ARGS__)
-#define roof_memory_error(error, msg...) \
- roof_error(error, SETUP, msg)
+#define roof_memory_error(error, ...) \
+ roof_error(error, SETUP, __VA_ARGS__)
#endif /* __UFO_ROOF_ERROR_H */
diff --git a/src/ufo-roof-read-file.c b/src/ufo-roof-read-file.c
index de8391e..a5eb69b 100644
--- a/src/ufo-roof-read-file.c
+++ b/src/ufo-roof-read-file.c
@@ -23,14 +23,14 @@ static void ufo_roof_read_file_free(UfoRoofReadInterface *iface) {
if (reader->fname)
g_free(reader->fname);
- if (reader->fd >= 0)
+ if (reader->fd)
fclose(reader->fd);
free(reader);
}
}
-static guint ufo_roof_read_file(UfoRoofReadInterface *iface, void *buffers, GError **error) {
+static guint ufo_roof_read_file(UfoRoofReadInterface *iface, uint8_t *buffers, GError **error) {
UfoRoofReadFile *reader = (UfoRoofReadFile*)iface;
UfoRoofConfig *cfg = reader->cfg;
diff --git a/src/ufo-roof-read-socket.c b/src/ufo-roof-read-socket.c
index b72e9d0..f213d99 100644
--- a/src/ufo-roof-read-socket.c
+++ b/src/ufo-roof-read-socket.c
@@ -29,7 +29,7 @@ static void ufo_roof_read_socket_free(UfoRoofReadInterface *iface) {
}
}
-static guint ufo_roof_read_socket(UfoRoofReadInterface *iface, void *buf, GError **error) {
+static guint ufo_roof_read_socket(UfoRoofReadInterface *iface, uint8_t *buf, GError **error) {
struct timespec timeout_ts;
UfoRoofReadSocket *reader = (UfoRoofReadSocket*)iface;
@@ -44,7 +44,7 @@ static guint ufo_roof_read_socket(UfoRoofReadInterface *iface, void *buf, GError
// FIXME: Is it optimal? Auto-tune max_packets? Combine read & build?
memset(msg, 0, sizeof(msg));
memset(msgvec, 0, sizeof(msgvec));
- for (int i = 0; i < cfg->max_packets; i++) {
+ for (guint i = 0; i < cfg->max_packets; i++) {
msgvec[i].iov_base = buf + i * cfg->max_packet_size;
msgvec[i].iov_len = cfg->max_packet_size;
msg[i].msg_hdr.msg_iov = &msgvec[i];
diff --git a/src/ufo-roof-read.h b/src/ufo-roof-read.h
index 50dbdf3..5f0853c 100644
--- a/src/ufo-roof-read.h
+++ b/src/ufo-roof-read.h
@@ -5,7 +5,7 @@
typedef struct _UfoRoofReadInterface UfoRoofReadInterface;
-typedef guint (*UfoRoofReaderRead)(UfoRoofReadInterface *reader, void *buf, GError **error);
+typedef guint (*UfoRoofReaderRead)(UfoRoofReadInterface *reader, uint8_t *buf, GError **error);
typedef void (*UfoRoofReaderClose)(UfoRoofReadInterface *reader);
struct _UfoRoofReadInterface {
diff --git a/src/ufo-roof.h b/src/ufo-roof.h
index c3edda2..d9d3a57 100644
--- a/src/ufo-roof.h
+++ b/src/ufo-roof.h
@@ -5,7 +5,7 @@
#include "ufo-roof-error.h"
#define UFO_ROOF_PACKET_HEADER(buf) ((UfoRoofPacketHeader*)(buf))
-#define UFO_ROOF_PACKET_BLOCK_HEADER(buf, cfg) ((UfoRoofPacketBlockHeader*)(((void*)buf) + cfg->max_packets * cfg->max_packet_size))
+#define UFO_ROOF_PACKET_BLOCK_HEADER(buf, cfg) ((UfoRoofPacketBlockHeader*)(((uint8_t*)buf) + cfg->max_packets * cfg->max_packet_size))
typedef struct {
uint32_t packet_id; // Sequential Packet ID (numbered from 0)