Skip to content

Commit

Permalink
Merge branch 'feature/P16-24-cmake' into 'master'
Browse files Browse the repository at this point in the history
Resolve P16-24 "Feature/ cmake"

Closes P16-24

See merge request pixie/pixie_sdk!14
  • Loading branch information
xia-stan committed Feb 8, 2021
2 parents 204d489 + 10ecab8 commit 2c7cad9
Show file tree
Hide file tree
Showing 11 changed files with 275 additions and 337 deletions.
30 changes: 30 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.11)
project(pixie_sdk)

#---- Setup our install path
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/xia/${PROJECT_NAME} CACHE PATH "..." FORCE)
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(STATUS "Install Path: ${CMAKE_INSTALL_PREFIX}")

#---- Setup the default build type
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING
"Build type, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif (NOT CMAKE_BUILD_TYPE)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

#---- Add the module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/Cmake/modules/")

#---- Check for the Broadcom APIs
find_package(BroadcomAPI REQUIRED)
IF(${CMAKE_VERSION} VERSION_LESS "3.13")
link_directories(${PLX_LIBRARY_DIR})
ENDIF(${CMAKE_VERSION} VERSION_LESS "3.13")

#---- Build everything
add_subdirectory(sys)
add_subdirectory(app)
add_subdirectory(utilities)
add_subdirectory(tests)
30 changes: 30 additions & 0 deletions Cmake/modules/FindBroadcomAPI.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Find the Broadcom PCI/PCIe library
#
# PLX_LIBRARY_DIR - Location of the PlxApi* files.
# PLX_INCLUDE_DIR - Location of the Plx header files.
# PLX_STATIC_LIB - List of the static library.
# PLX_SHARED_LIB - List of the shared library.
# PLX_FOUND - true if at least one of the libraries and the includes was found.
#

find_path(PLX_LIBRARY_DIR
NAMES PlxApi.a PlxApi.so
HINTS $ENV{PLX_SDK_DIR}
PATHS /usr/local/broadcom/current /usr/src/PlxSdk
PATH_SUFFIXES PlxApi/Library Linux/PlxApi/Library)

find_path(PLX_INCLUDE_DIR
NAMES Plx.h PlxTypes.h PlxApi.h
HINTS $ENV{PLX_SDK_DIR}
PATHS /usr/local/broadcom/current /usr/src/PlxSdk
PATH_SUFFIXES Include)

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(BroadcomAPI DEFAULT_MSG PLX_LIBRARY_DIR PLX_INCLUDE_DIR)

if (BroadcomAPI_FOUND)
set(PLX_SHARED_LIB -l:PlxApi.so)
set(PLX_STATIC_LIB -l:PlxApi.a)
endif (BroadcomAPI_FOUND)

mark_as_advanced(PLX_SHARED_LIB PLX_STATIC_LIB PLX_LIBRARY_DIR PLX_INCLUDE_DIR)
26 changes: 26 additions & 0 deletions Cmake/modules/FindPixieSDK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Find the Pixie SDK
#
# XIA_LIBRARY_DIR
# XIA_INCLUDE_DIR
# XIA_LIBRARIES

find_path(XIA_LIBRARY_DIR
NAMES libPixie16App.so libPixie16Sys.so
HINTS $ENV{XIA_PIXIE_SDK}
PATHS /usr/local/xia/pixie_sdk
PATH_SUFFIXES lib
DOC "Path to pixie library.")

find_path(XIA_INCLUDE_DIR
NAMES pixie16app_defs.h pixie16sys_defs.h
HINTS $ENV{XIA_PIXIE_SDK}
PATHS /usr/local/xia/pixie_sdk
PATH_SUFFIXES include
DOC "Path to XIA includes.")

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(PIXIE_SDK DEFAULT_MSG XIA_LIBRARY_DIR)

if (PIXIE_SDK_FOUND)
set(XIA_LIBRARIES -lPixie16App -lPixie16Sys)
endif ()
60 changes: 60 additions & 0 deletions EULA
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
XIA LLC

End-User License Agreement

NOTICE TO USER:

THIS IS A CONTRACT. PLEASE READ IT CAREFULLY. BY INSTALLING THIS SOFTWARE OR DOWNLOADING THE ASSOCIATED INSTALLATION PROGRAM YOU ACCEPT ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE WITH THE TERMS AND CONDITIONS OF THIS AGREEMENT, YOU WILL NOT BE ABLE TO USE THE SOFTWARE.

REGARDLESS OF HOW YOU ACQUIRE THE SOFTWARE (ELECTRONICALLY, PRELOADED, ON MEDIA OR OTHERWISE), BY USING IT YOU AGREE TO THE TERMS OF THIS AGREEMENT.


This XIA LLC (“XIA”) End-User License Agreement (“Agreement”) sets forth the terms and conditions under which you are licensed to use the Software. Software means (A) all of the contents of the disk(s), CD-ROMS(s), or other media with which this agreement is provided, including but not limited to (i) XIA or third-party software; (ii) related explanatory written materials (“Documentation”); and (B) modified versions, upgrades, updates, additions, and copies of the Software, if any, licensed to you by XIA (collectively, “Updates”). XIA grants to you a nonexclusive license to use the Software, provided that you agree to the following:

1. Use of the Software
(i) The term “Permitted Number of Computers” means the number of computers for which you have purchased or been granted licenses by XIA.
(ii) You may install one copy of the Software onto a hard disk or other storage device of up to the Permitted Number of Computers.
(iii) You may install one copy of the Software on a single file server of the purpose of downloading and installing the Software onto a hard disk or other storage device of up to the Permitted Number of Computers that are on the same network as the file server. No other network use is permitted.
(iv) You may make one backup copy of the Software, provided your backup copy is not installed or used on any computer. You must reproduce the copyright notice(s) on such copy of the Software.

2. Restrictions
(i) You may not copy, transfer, rent, modify, use or merge the Software, or the associated documentation, in whole or in part, except as expressly permitted in the Agreement.
(ii) You may not reverse assemble, decompile, or otherwise reverse engineer the Software.
(iii) You may not remove any proprietary, copyright, trade secret or warning legend from the Software or any Documentation.
(iv) You may not modify, sell, rent, transfer (except temporarily in the event of a computer malfunction), resell for profit, or distribute this license or the Software, or create derivative works based on the Software, or any part thereof or any interest therein.

3. Copyright
The software and any copies that are owned by XIA, and its structure, organization, and code are the valuable trade secrets of XIA. The Software is also protected by United States Copyright Law and International Treaty Provisions. You must treat the Software just as would any other copyrighted material, such as a book. You may not copy the Software, except as set forth in the “Use of the Software” section. Any copies that you are permitted to make pursuant to this Agreement must contain the same copyright and other proprietary notices that appear on or in the Software. You agree not to modify, adapt or translate the Software. You also agree not to reverse engineer, decompile, disassemble, or otherwise attempt to discover the source code of the Software. Trademarks shall be used in accordance with accepted trademark practice, including identification of trademark owners’ names. Trademarks can only be used to identify printed output produced by the Software and such use does not grant you any rights of ownership in that trademark. Except as stated above, this Agreement does not grant you and intellectual property rights in the Software. This Agreement provides the terms and conditions under which you are licensed to use the Software. It is not an agreement for the sale of the Software to you.

4. DISCLAIMER OF WARRANTIES
XIA MAKES NO WARRANTIES, EXPRESS, IMPLIED, OR STATUTORY, AS TO ANY OTHER MATTERS, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT OF THIRD-PARTY RIGHTS, MERCHANTABILITY, OR FITNESS FOR ANY PARTICULAR PURPOSE. XIA DOES NOT AND CANNOT WARRANT THE PERFORMANCE OR RESULTS YOU MAY OBTAIN BY USING THE SOFTWARE.

Some states or jurisdictions do not allow the exclusion of implied warranties or limitations on how long an implied warranty may last, so the above limitations may not apply to you. To the extent permissible, any implied warranties are limited to ninety (90) days.

5. Limitation of Liability
IN NO EVENT WILL XIA BE LIABLE TO YOU FOR ANY CONSEQUENTIAL, INDIRECT, INCIDENTAL, PUNITIVE, OR SPECIAL DAMAGES, INCLUDING ANY LOST PROFITS OR LOST SAVINGS, EVEN IF A REPRESENTATIVE OF XIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, OR FOR ANY CLAIM BY ANY THIRD PARTY.

Some states or jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so the above limitations may not apply to you.

6. Governing Law and General Provisions
This Agreement will be governed by the laws in force in the State of California excluding the application of its conflicts of law rules. This Agreement will not be governed by the United Nations Convention on Contracts for the International Sale of Goods, the application of which is expressly excluded. If any part of this Agreement is found void and unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. You agree that the Software will not be shipped, transferred, or exported into any country or used in any manner prohibited by the United States Export Administration Act or any other export laws, restrictions, or regulations. This Agreement shall automatically terminate upon failure by you to comply with its terms, in which event you must destroy all copies of the Software. This Agreement may only be modified by a writing signed by an authorized officer of XIA, although XIA may vary the terms of this Agreement in connection with the licensing of any Updates to you.

7. Notice to U.S. Government End Users
The Software and Documentation are “Commercial Items”, as that term is defined at 48 C.F.R. 2.101, consisting of “Commercial Computer Software” and “Commercial Computer Software Documentation”, as such terms are used in 48 C.F.R. 12.212 or 48 C.F.R. 227.7202 as applicable. Consistent with 48 C.F.R. 12.212 or 48 C.F.R. 227-7202-1 through 227.7202-4, as applicable, the Commercial Computer Software and Commercial Computer Software Documentation are being licensed to U.S. Government end users (A) only as Commercial Items and (B) with only those rights as are granted to all other end users pursuant to the terms and conditions herein. Unpublished-rights reserved under the copyright laws of the United States. XIA, 8450 Central Ave, Newark, CA 94560.

8. Verification of Compliance with Licenses
If you are a business or organization, you agree that upon request of XIA or XIA’s authorized representative, you will within thirty (30) days fully document and certify that your use of any and all XIA software at the time of the request is in conformity with your valid licenses from XIA.

9. Sample Programs
The Software may contain sample programs that are furnished by XIA as examples. These examples have not been thoroughly tested under all conditions. XIA, therefore, cannot guarantee or imply reliability, serviceability, or function of these sample programs. You may copy, modify, and distribute these sample programs in any form without payment to XIA, for the purposes of developing, using, marketing and distributing application programs conforming to the application programming interface for the operating platform for which the sample programs are written, provided that:

· You agree to defend, hold harmless and indemnify XIA from and against any and all claims, liabilities, damages, expenses and costs arising out of or in connection with your use or distribution of the sample programs, modifications thereof, or your application program(s); and
· You do not state that XIA certifies or guarantees the operation of the sample programs or modifications thereof, with any hardware and/or software. Each copy or partial copy of the sample programs, or any modifications thereof, must include a copyright notice as follows:

Copyright (c) 2020 XIA LLC

Portions of this code are derived from XIA Sample Programs.

Copyright (c) 2020 XIA LLC. All rights reserved.

These sample programs may require additional software to operate. The right to redistribute a sample program does not include the right to redistribute software that is a prerequisite for its operation. In particular, your right to redistribute a sample program does not include the right to redistribute the Software.
109 changes: 55 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,61 @@ start runs, load firmware).
## Dependencies
* gcc/g++ 7+
* linux-kernel headers
* [Broadcom PCI/PCIe SDK](https://www.broadcom.com/products/pcie-switches-bridges/software-dev-kits) - See next section.
* Python 3.6+
* [Broadcom PCI/PCIe SDK](https://www.broadcom.com/products/pcie-switches-bridges/software-dev-kits) - See below.

### Broadcomm PCI/PCIe SDK
## Installation
### Dependencies
* Cmake 3.11+
* You have already installed the PLX drivers.
* You have `PLX_SDK_DIR` exported in your environment.

### Instructions
These installation instructions assume that you
1. Clone the project from [https://git.xia.com/pixie/pixie_sdk.git](https://git.xia.com/pixie/pixie_sdk.git)
```shell script
[user@localhost ~]$ git clone https://gitlab.com/xiallc/pixie_sdk.git
```
2. Navigate to the cloned project
```shell script
[user@localhost ~]$ cd pixie_sdk
```
2. Configure and build the project
```shell script
[user@localhost pixie_sdk]$ mkdir build; cd build; cmake ../
```
2. Compile the project
```shell
[user@localhost pixie_sdk]$ make
```
2. (**Optional**) Install the software system wide. Defaults to `/usr/local/xia/pixie_sdk`
```shell script
[user@localhost pixie_sdk]$ sudo make install
```
2. (**Optional**) Install the software to a user specified location
```shell script
[user@localhost pixie_sdk]$ cmake ../ -DCMAKE_INSTALL_PREFIX=/path/to/installation/location/; sudo make install
```

## Utility programs
We provide some basic programs that you can use to test the functionality of the API. These programs do not encompass
the full functionality of the API. They are **not recommended for production use**. Users may use these codes as a
basis for developing their own applications.

[View the README.md](https://git.xia.com/pixie/pixie_sdk/-/blob/master/utilities/README.md)

## Testing the software
TO BE FILLED IN LATER

### Procedure for making Pixie-16 testing programs
*NOTE:* Pixie-16 testing programs should ONLY be compiled with Pixie-16
static libraries.

1. Open a command line window, go to C:\Program Files\Microsoft Visual Studio 8\VC\bin, and then type 'vcvars32.bat' to set up VC tools environment.
2. Go to C:\path\to\project\root\software, and type 'make clean'
3. Go to C:\path\to\project\root\software\testing, and type 'rm *.exe'
4. Go back to C:\path\to\project\root\software, and type 'make tests'.

## Broadcomm PCI/PCIe SDK
This software uses the [Broadcom PLX 9054 driver](https://www.broadcom.com/products/pcie-switches-bridges/software-dev-kits)
to communicate with the Pixie modules. Broadcom does not provide clear installation instructions for
Linux systems. Here we'll provide instructions for Broadcom PCI/PCIe SDK v8.00 on CentOS 8.
Expand Down Expand Up @@ -54,59 +105,9 @@ Linux systems. Here we'll provide instructions for Broadcom PCI/PCIe SDK v8.00 o
[user@localhost ~]$ sudo -E ${PLX_SDK_DIR}/Bin/Plx_load 9054
```
## Installation
Our build system is (WAF)[https://waf.io]. It's python based and lightweight. The entire script lives with this
repository so you don't have any dependencies other than Python 3.6+.

### Dependencies
* You have Python 3.5+ installed on your system.
* You have already installed the PLX drivers.
* You have `PLX_SDK_DIR` exported in your environment.

### Instructions
These installation instructions assume that you
1. Clone the project from [https://git.xia.com/pixie/pixie_sdk.git](https://git.xia.com/pixie/pixie_sdk.git)
```shell script
[user@localhost ~]$ git clone https://git.xia.com/pixie/pixie_sdk.git
```
2. Navigate to the cloned project
```shell script
[user@localhost ~]$ cd pixie_sdk
```
2. Configure and build the project
```shell script
[user@localhost pixie_sdk]$ python3 waf configure build
```
2. (**Optional**) Install the software system wide. Defaults to `/usr/local/`
```shell script
[user@localhost pixie_sdk]$ sudo python3 waf install
```
2. (**Optional**) Install the software to a user specified location
```shell script
[user@localhost pixie_sdk]$ python3 waf configure install --prefix=/path/to/installation/location/
```

## Utility programs
We provide some basic programs that you can use to test the functionality of the API. These programs do not encompass
the full functionality of the API. They are **not recommended for production use**. Users may use these codes as a
basis for developing their own applications.

[View the README.md](https://git.xia.com/pixie/pixie_sdk/-/blob/master/utilities/README.md)

## Testing the software
TO BE FILLED IN LATER

### Procedure for making Pixie-16 testing programs
*NOTE:* Pixie-16 testing programs should ONLY be compiled with Pixie-16
static libraries.

1. Open a command line window, go to C:\Program Files\Microsoft Visual Studio 8\VC\bin, and then type 'vcvars32.bat' to set up VC tools environment.
2. Go to C:\path\to\project\root\software, and type 'make clean'
3. Go to C:\path\to\project\root\software\testing, and type 'rm *.exe'
4. Go back to C:\path\to\project\root\software, and type 'make tests'.
## Copyright
Copyright (c) 2005 - 2020, XIA LLC
Copyright (c) 2005 - 2021, XIA LLC
All rights reserved.
## License
Expand Down
19 changes: 19 additions & 0 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#------------- BUILD APP --------------------------
add_library(Pixie16App SHARED
${PROJECT_SOURCE_DIR}/app/pixie16app.c
${PROJECT_SOURCE_DIR}/app/utilities.c)
target_include_directories(Pixie16App PUBLIC
${PROJECT_SOURCE_DIR}/app
${PROJECT_SOURCE_DIR}/sys
${PROJECT_SOURCE_DIR}/vendor/analog_devices
${PLX_INCLUDE_DIR})
target_link_libraries(Pixie16App PUBLIC Pixie16Sys ${PLX_SHARED_LIB})
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
target_link_directories(Pixie16App PUBLIC PLX_LIBRARY_DIR)
ENDIF()
target_compile_definitions(Pixie16App PUBLIC PLX_LITTLE_ENDIAN PCI_CODE PLX_LINUX PRINT_DEBUG_MSG)
target_compile_options(Pixie16App PUBLIC -g -Wall)

file(GLOB PIXIE16APP_PUBLIC_HEADERS *.h)
set_target_properties(Pixie16App PROPERTIES PUBLIC_HEADER "${PIXIE16APP_PUBLIC_HEADERS}")
install(TARGETS Pixie16App LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include)
20 changes: 20 additions & 0 deletions sys/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#------------- BUILD SYS --------------------------
add_library(Pixie16Sys SHARED
${PROJECT_SOURCE_DIR}/sys/communication.c
${PROJECT_SOURCE_DIR}/sys/i2cm24c64.c
${PROJECT_SOURCE_DIR}/sys/pixie16sys.c
${PROJECT_SOURCE_DIR}/sys/tools.c)
target_include_directories(Pixie16Sys PUBLIC
${PROJECT_SOURCE_DIR}/sys
${PROJECT_SOURCE_DIR}/vendor/analog_devices
${PLX_INCLUDE_DIR})
target_link_libraries(Pixie16Sys PUBLIC ${PLX_SHARED_LIB} dl)
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
target_link_directories(Pixie16Sys PUBLIC {PLX_LIBRARY_DIR})
ENDIF()
target_compile_definitions(Pixie16Sys PUBLIC PLX_LITTLE_ENDIAN PCI_CODE PLX_LINUX PRINT_DEBUG_MSG)
target_compile_options(Pixie16Sys PUBLIC -g -Wall)

file(GLOB PIXIE16SYS_PUBLIC_HEADERS *.h)
set_target_properties(Pixie16Sys PROPERTIES PUBLIC_HEADER "${PIXIE16SYS_PUBLIC_HEADERS}")
install(TARGETS Pixie16Sys LIBRARY DESTINATION lib PUBLIC_HEADER DESTINATION include)
21 changes: 21 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#------------- BUILD TESTS --------------------------
add_executable(test test.cpp
unit/app/test_pixie16app.cpp
unit/app/test_utilities.cpp
unit/sys/test_pixie16sys.cpp
unit/sys/test_tools.cpp
unit/sys/test_i2cm24c64.cpp
unit/sys/test_communication.cpp)
target_include_directories(test PUBLIC
${PROJECT_SOURCE_DIR}/vendor/doctest
${PROJECT_SOURCE_DIR}/utilities/include
${PROJECT_SOURCE_DIR}/api
${PROJECT_SOURCE_DIR}/sys
${PROJECT_SOURCE_DIR}/vendor/analog_devices
${PLX_INCLUDE_DIR})
target_link_libraries(test PUBLIC Pixie16App Pixie16Sys ${PLX_STATIC_LIB} dl m)
IF(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.13")
target_link_directories(test PUBLIC PLX_LIBRARY_DIR)
ENDIF()
target_compile_definitions(test PUBLIC PLX_LITTLE_ENDIAN PCI_CODE PLX_LINUX PRINT_DEBUG_MSG)
target_compile_options(test PUBLIC -g -Wall)
Loading

0 comments on commit 2c7cad9

Please sign in to comment.