Skip to content

Commit

Permalink
libofs: finish migration to opae-libs repo
Browse files Browse the repository at this point in the history
  • Loading branch information
r-rojo committed Mar 12, 2021
1 parent f552e4d commit b75690c
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ option(OPAE_BUILD_TESTS "Enable building of OPAE unit tests" OFF)
mark_as_advanced(OPAE_BUILD_TESTS)

include(OPAE)
include(OFS)

get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
if ("${LIB64}" STREQUAL "TRUE")
Expand Down Expand Up @@ -155,6 +156,7 @@ endif (OPAE_BUILD_LIBOPAEVFIO)
opae_add_subdirectory(external)
opae_add_subdirectory(libopaemem)
opae_add_subdirectory(libopae-c)
opae_add_subdirectory(libofs)

if (OPAE_BUILD_LIBOPAEUIO)
opae_add_subdirectory(libopaeuio)
Expand Down
5 changes: 2 additions & 3 deletions cmake/modules/OFS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
macro(ofs_add_driver yml_file driver)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${driver}.h
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/scripts/ofs_parse.py ${CMAKE_CURRENT_LIST_DIR}/${yml_file} headers c ${CMAKE_CURRENT_BINARY_DIR} --driver ${driver}
COMMAND ${PYTHON_EXECUTABLE} ${OPAE_LIBS_ROOT}/scripts/ofs_parse.py ${CMAKE_CURRENT_LIST_DIR}/${yml_file} headers c ${CMAKE_CURRENT_BINARY_DIR} --driver ${driver}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS
${CMAKE_CURRENT_LIST_DIR}/${yml_file}
Expand All @@ -40,9 +40,8 @@ macro(ofs_add_driver yml_file driver)
)
target_include_directories(${driver} PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/ofs/libofs>
$<BUILD_INTERFACE:${OPAE_LIBS_ROOT}/ofs/libofs>
$<BUILD_INTERFACE:${OPAE_INCLUDE_PATH}>
$<INSTALL_INTERFACE:opae>
)

target_link_libraries(${driver} PUBLIC
Expand Down
38 changes: 38 additions & 0 deletions include/ofs/ofs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright(c) 2017, Intel Corporation
//
// 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 Intel Corporation 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 THE COPYRIGHT OWNER 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.
/*
* \file ofs.h
* \brief OFS UMD (User Mode Driver) API
*
*/

#ifndef OFS_H
#define OFS_H

#include <ofs/ofs_primitives.h>


#endif /* !OFS_H */
File renamed without changes.
3 changes: 2 additions & 1 deletion libofs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ opae_add_shared_library(
)

target_include_directories(ofs
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
$<BUILD_INTERFACE:${OPAE_INCLUDE_PATH}>
)

target_link_libraries(ofs
Expand Down
2 changes: 1 addition & 1 deletion libofs/ofs_primitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
// 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.
#include "ofs_primitives.h"
#include <ofs/ofs_primitives.h>

2 changes: 1 addition & 1 deletion scripts/ofs_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def write_header(self, output, language='c'):
elif language == 'cpp':
writer.writeline('#pragma once')
writer.writeline('#include <opae/fpga.h>')
writer.writeline('#include "ofs_primitives.h"')
writer.writeline('#include <ofs/ofs.h>')

if language == 'c':
writer.writeline('\n#ifdef __cplusplus')
Expand Down
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ add_subdirectory(opae-c)
add_subdirectory(opae-cxx)
add_subdirectory(pyopae)
add_subdirectory(xfpga)
add_subdirectory(libofs)
add_subdirectory(ofs_driver)
2 changes: 1 addition & 1 deletion tests/libofs/test_libofs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include <chrono>
#include <future>
#include <thread>
#include <ofs/ofs.h>

#include "gtest/gtest.h"
#include "ofs_primitives.h"

using hrc = std::chrono::high_resolution_clock;

Expand Down
2 changes: 1 addition & 1 deletion tests/ofs_driver/test_ofs_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
#include <future>
#include <thread>
#include <uuid/uuid.h>
#include <ofs/ofs.h>
#include "gtest/gtest.h"
#include "ofs_test.h"


union uuid_bytes {
struct {
uint64_t lo;
Expand Down

0 comments on commit b75690c

Please sign in to comment.