diff options
-rw-r--r-- | CMakeLists.txt | 80 | ||||
-rw-r--r-- | include/CMakeLists.txt | 41 | ||||
-rw-r--r-- | lib/CMakeLists.txt | 89 | ||||
-rw-r--r-- | samples/CMakeLists.txt | 48 | ||||
-rw-r--r-- | test/CMakeLists.txt | 63 | ||||
-rw-r--r-- | test/py/libvfio_user.py | 5 |
6 files changed, 1 insertions, 325 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 3e3d881..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,80 +0,0 @@ -# -# Copyright (c) 2019 Nutanix Inc. All rights reserved. -# -# Authors: Thanos Makatos <thanos@nutanix.com> -# Swapnil Ingle <swapnil.ingle@nutanix.com> -# Felipe Franciosi <felipe@nutanix.com> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * 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. -# * Neither the name of Nutanix nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 <COPYRIGHT HOLDER> 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. -# - -cmake_minimum_required (VERSION 2.6) -if (CMAKE_MAJOR_VERSION LESS 3) - project(libvfio-user C) -else() - project(libvfio-user LANGUAGES C) -endif() -include(GNUInstallDirs) - -find_package(PkgConfig REQUIRED) -pkg_check_modules(JSON REQUIRED json-c) - -# for LSP -set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) - -# for the benefit of the gcov rules -set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1) - -include_directories(${CMAKE_SOURCE_DIR}/include) -include_directories(${CMAKE_SOURCE_DIR}/lib) -include_directories(${JSON_INCLUDE_DIRS}) - -set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb") -# -# NB: this intentionally does not define NDEBUG: we want our assert()s even in a -# release build. -# -set(CMAKE_C_FLAGS_RELEASE "-O3") - -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -D_GNU_SOURCE -Wall -Werror -Wextra") -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -Wno-missing-field-initializers -Wmissing-declarations") -set(CMAKE_C_FLAGS - "${CMAKE_C_FLAGS} -fvisibility=hidden") - -if (WITH_TRAN_PIPE EQUAL 1) - add_definitions(-DWITH_TRAN_PIPE) -endif() - -# public headers -add_subdirectory(include) - -# shared libraries -add_subdirectory(lib) - -# samples -add_subdirectory(samples) - -# test -add_subdirectory(test) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt deleted file mode 100644 index ae6bd1d..0000000 --- a/include/CMakeLists.txt +++ /dev/null @@ -1,41 +0,0 @@ -# -# Copyright (c) 2019 Nutanix Inc. All rights reserved. -# -# Authors: Thanos Makatos <thanos@nutanix.com> -# Swapnil Ingle <swapnil.ingle@nutanix.com> -# Felipe Franciosi <felipe@nutanix.com> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * 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. -# * Neither the name of Nutanix nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 <COPYRIGHT HOLDER> 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. -# - -set(VFIO_USER_HEADERS_DIR ${CMAKE_INSTALL_INCLUDEDIR}/vfio-user) - -install(FILES "libvfio-user.h" DESTINATION ${VFIO_USER_HEADERS_DIR}) -install(FILES "pci_caps/common.h" DESTINATION ${VFIO_USER_HEADERS_DIR}/pci_caps) -install(FILES "pci_caps/dsn.h" DESTINATION ${VFIO_USER_HEADERS_DIR}/pci_caps) -install(FILES "pci_caps/msi.h" DESTINATION ${VFIO_USER_HEADERS_DIR}/pci_caps) -install(FILES "pci_caps/msix.h" DESTINATION ${VFIO_USER_HEADERS_DIR}/pci_caps) -install(FILES "pci_caps/pm.h" DESTINATION ${VFIO_USER_HEADERS_DIR}/pci_caps) -install(FILES "pci_caps/px.h" DESTINATION ${VFIO_USER_HEADERS_DIR}/pci_caps) -install(FILES "pci_defs.h" DESTINATION ${VFIO_USER_HEADERS_DIR}) -install(FILES "vfio-user.h" DESTINATION ${VFIO_USER_HEADERS_DIR}) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt deleted file mode 100644 index 968f911..0000000 --- a/lib/CMakeLists.txt +++ /dev/null @@ -1,89 +0,0 @@ -# -# Copyright (c) 2019 Nutanix Inc. All rights reserved. -# -# Authors: Thanos Makatos <thanos@nutanix.com> -# Swapnil Ingle <swapnil.ingle@nutanix.com> -# Felipe Franciosi <felipe@nutanix.com> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * 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. -# * Neither the name of Nutanix nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 <COPYRIGHT HOLDER> 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. -# - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - -# -# FIXME: we're not updating this yet, so it has no meaning. -# -set(LIBMAJOR 0) -set(LIBMINOR 0) -set(LIBPATCH 1) - -set(LIBOBJS - $<TARGET_OBJECTS:pci_caps> - $<TARGET_OBJECTS:dma> - $<TARGET_OBJECTS:irq> - $<TARGET_OBJECTS:libvfio-user> - $<TARGET_OBJECTS:migration> - $<TARGET_OBJECTS:pci> - $<TARGET_OBJECTS:tran> - $<TARGET_OBJECTS:tran_sock>) - -if (WITH_TRAN_PIPE EQUAL 1) - set(LIBOBJS ${LIBOBJS} - $<TARGET_OBJECTS:tran_pipe>) - - add_library(tran_pipe OBJECT tran_pipe.c) -endif() - -add_library(pci_caps OBJECT pci_caps.c) -add_library(dma OBJECT dma.c) -add_library(irq OBJECT irq.c) -add_library(libvfio-user OBJECT libvfio-user.c) -add_library(migration OBJECT migration.c) -add_library(pci OBJECT pci.c) -add_library(tran OBJECT tran.c) -add_library(tran_sock OBJECT tran_sock.c) - -add_library(vfio-user-shared SHARED ${LIBOBJS}) -target_link_libraries(vfio-user-shared json-c pthread) -set_target_properties(vfio-user-shared PROPERTIES - LINKER_LANGUAGE C) -set_target_properties(vfio-user-shared PROPERTIES - OUTPUT_NAME vfio-user - CLEAN_DIRECT_OUTPUT 1) -set_target_properties(vfio-user-shared PROPERTIES - SOVERSION ${LIBMAJOR} - VERSION ${LIBMAJOR}.${LIBMINOR}.${LIBPATCH}) - -add_library(vfio-user-static STATIC ${LIBOBJS}) -target_link_libraries(vfio-user-static json-c pthread) -set_target_properties(vfio-user-static PROPERTIES - LINKER_LANGUAGE C) -set_target_properties(vfio-user-static PROPERTIES - OUTPUT_NAME vfio-user - CLEAN_DIRECT_OUTPUT 1) - -install(TARGETS vfio-user-shared - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install(TARGETS vfio-user-static - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt deleted file mode 100644 index 42f74c7..0000000 --- a/samples/CMakeLists.txt +++ /dev/null @@ -1,48 +0,0 @@ -# -# Copyright (c) 2019 Nutanix Inc. All rights reserved. -# -# Authors: Thanos Makatos <thanos@nutanix.com> -# Swapnil Ingle <swapnil.ingle@nutanix.com> -# Felipe Franciosi <felipe@nutanix.com> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * 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. -# * Neither the name of Nutanix nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 <COPYRIGHT HOLDER> 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. -# - -add_executable(client client.c - ../lib/tran.c - ../lib/tran_sock.c - ../lib/migration.c) -target_link_libraries(client json-c pthread) - -add_executable(server server.c) -target_link_libraries(server vfio-user-static) - -add_executable(null null.c) -target_link_libraries(null vfio-user-static pthread) - -LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/lib) -add_executable(gpio-pci-idio-16 gpio-pci-idio-16.c) -target_link_libraries(gpio-pci-idio-16 vfio-user-shared) - -add_executable(lspci lspci.c) -target_link_libraries(lspci vfio-user-static) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt deleted file mode 100644 index 44ba014..0000000 --- a/test/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -# -# Copyright (c) 2020 Nutanix Inc. All rights reserved. -# -# Authors: Thanos Makatos <thanos@nutanix.com> -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * 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. -# * Neither the name of Nutanix nor the names of its contributors may be -# used to endorse or promote products derived from this software without -# specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 <COPYRIGHT HOLDER> 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 (WITH_ASAN EQUAL 1) - unset(valgrind) -else() - set(valgrind_path "/usr/bin/valgrind") - set(valgrind_args "--error-exitcode=1 --exit-on-first-error=yes --leak-check=full --quiet") - set(valgrind_args "${valgrind_args} --show-leak-kinds=all --track-origins=yes") - set(valgrind_args "${valgrind_args} --suppressions=${CMAKE_CURRENT_SOURCE_DIR}/valgrind.supp") - separate_arguments(valgrind_args) - set(valgrind ${valgrind_path} ${valgrind_args}) -endif() - -add_executable(unit-tests unit-tests.c mocks.c - ../lib/dma.c - ../lib/irq.c - ../lib/libvfio-user.c - ../lib/migration.c - ../lib/pci.c - ../lib/pci_caps.c - ../lib/tran.c - ../lib/tran_pipe.c - ../lib/tran_sock.c) - -target_link_libraries(unit-tests PUBLIC cmocka dl json-c) - -target_compile_definitions(unit-tests PUBLIC UNIT_TEST) - -enable_testing() -add_test(NAME unit-tests COMMAND ${valgrind} ${CMAKE_CURRENT_BINARY_DIR}/unit-tests) -add_test(NAME lspci COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test-lspci.sh) -add_test(NAME client-server COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test-client-server.sh) - -if (NOT WITH_ASAN EQUAL 1) -add_test(NAME linkage COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test-linkage.sh - ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_C_COMPILER}) -endif() diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py index 25ae90e..246a4f1 100644 --- a/test/py/libvfio_user.py +++ b/test/py/libvfio_user.py @@ -224,10 +224,7 @@ VFU_MIGR_CALLBACKS_VERS = 1 SOCK_PATH = b"/tmp/vfio-user.sock.%d" % os.getpid() topdir = os.path.realpath(os.path.dirname(__file__) + "/../..") -build_type = os.getenv("BUILD_TYPE", default="dbg") -libname = "%s/build/%s/lib/libvfio-user.so" % (topdir, build_type) -if not os.path.exists(libname): - libname = os.path.join(os.getenv("LIBVFIO_SO_DIR"), "libvfio-user.so") +libname = os.path.join(os.getenv("LIBVFIO_SO_DIR"), "libvfio-user.so") lib = c.CDLL(libname, use_errno=True) libc = c.CDLL("libc.so.6", use_errno=True) |