From 3a93b6f7e86d6892bda56ddf6ee2c9e0e10fb2eb Mon Sep 17 00:00:00 2001 From: TasGitHub-IFX Date: Thu, 16 May 2024 11:43:00 +0200 Subject: [PATCH] Updated TAS Client API to version 1.0.1 --- CMakeLists.txt | 6 +++--- README.md | 26 ++++++++++++++++++++------ apps/tas_rw_api_demo/CMakeLists.txt | 1 - conanfile.py | 2 +- python/CMakeLists.txt | 20 +++++++++++++++----- src/tas_client/CMakeLists.txt | 1 - src/tas_socket/CMakeLists.txt | 1 - 7 files changed, 39 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4763a07..ce62b5c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,12 +15,12 @@ cmake_minimum_required(VERSION "${MIN_VER_CMAKE}" FATAL_ERROR) # Project definition # ----------------------------------------------------------------------------- project(tas_client_api - VERSION 1.0.0 + VERSION 1.0.1 DESCRIPTION "Infineon's Tool Access Socket (TAS) Client API" - HOMEPAGE_URL "https://www.infineon.com/DAS" + HOMEPAGE_URL "https://github.com/Infineon/tas_client_api" LANGUAGES CXX ) -set(TAS_CLIENT_COPYRIGHT "(c) Infineon Technologies AG 2023") +set(TAS_CLIENT_COPYRIGHT "(c) Infineon Technologies AG 2024") # ----------------------------------------------------------------------------- # Break in case of popular CMake configuration mistakes diff --git a/README.md b/README.md index 72ad2db..f3303fb 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,6 @@ This readme file gives an overview how to build and run the code. -## Important branches to know -develop --> Development is done continuously on this branch -master --> Fully tested released source code - ## Prerequisite for building locally This project uses [conan](https://conan.io) as dependency manager and consequently CMake as the build environment. All required packages and build tools are retrieved from the [ConanCenter](https://conan.io/center). See conanfile.py @@ -18,6 +14,9 @@ for the list of dependencies. Therefore, to build this project you will need: - Target compiler: msvc, gcc, etc. - [Doxygen](https://www.doxygen.nl/), if you want to build the API reference documentation +### Prerequisite for building the python wrapper +Python packages: setuptools, wheel, virtualenv + ### Conan If not already installed, install conan: ``` @@ -31,9 +30,13 @@ conan profile detect The generated profile can be then found under *\/.conan2/profiles*. The default configuration is Release. More information about conan profiles can be found here https://docs.conan.io/2.0/reference/config_files/profiles.html. Edit the default conan profile with your favorite text editor so that the **C++17 standard** is used. +``` +compiler.cppstd=17 +``` +Note: make sure your compiler supports C++17. ## Building -First generate the build environment by invoking conan from the root of this repository: +First generate the build environment by invoking conan **from the root of this repository**: ``` conan install . conan install . -s build_type=Debug --build=missing @@ -106,4 +109,15 @@ The project is configured in way that the binaries can be installed to a specifi ``` cmake --install build --prefix=install ``` -where build is the build directory, and prefix options defines the root install / export folder. \ No newline at end of file +where build is the build directory, and prefix options defines the root install / export folder. + +## Python wrapper +Building the python wrapper using the above steps requires -o python=True conan option when invoking the conan install command. + +If you want to use a specific Python version or you have multiple version installed you can tell CMake which one to use +by modifying the following CMake file: python\CMakeLists.txt before executing the above commands. +``` +set(Python3_ROOT_DIR "") +``` + +The generated python wheel will be located under: build\python\dist diff --git a/apps/tas_rw_api_demo/CMakeLists.txt b/apps/tas_rw_api_demo/CMakeLists.txt index 2d970cc..647b467 100644 --- a/apps/tas_rw_api_demo/CMakeLists.txt +++ b/apps/tas_rw_api_demo/CMakeLists.txt @@ -57,7 +57,6 @@ if (MSVC) target_compile_options(${EXE_NAME} PRIVATE /W3 /MP - /std:c++20 "$<$:" "/O2" ">" diff --git a/conanfile.py b/conanfile.py index f2caccf..5f08a85 100644 --- a/conanfile.py +++ b/conanfile.py @@ -83,7 +83,7 @@ def system_requirements(self): def requirements(self): # define dependencies - self.requires("pybind11/2.10.4") + self.requires("pybind11/2.12.0") def build_requirements(self): # define build tools dependencies diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 7efe7d8..bdfef1b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -3,12 +3,22 @@ if (NOT TAS_CLIENT_API_BUILD_PYTHON) return() endif() -# Based on pybind11 this should be after python. -# However, with Python debug libs installed there are issues. -# Pybind11 issue: https://github.com/pybind/pybind11/issues/3403 -# Non-compliant fix is to swap these two. -find_package(pybind11 CONFIG) +# Uncomment and spcify the root of Python installation if specific version should be used, otherwise the system default +# is selected +if (WIN32) + #set(Python3_ROOT_DIR "C:\\Program Files\\Python311") +elseif (UNIX) + #set(Python3_ROOT_DIR "/usr/bin/python3.11") +endif() + +# Look for python executable find_package(Python3 COMPONENTS Interpreter Development) +# Based on pybind11 this should be after find_package(Python3). However, with Python debug libs installed there is an issues. +find_package(pybind11 CONFIG) + +# Solution for an open issue due to installed python debug libs: https://github.com/pybind/pybind11/issues/3403 +set_target_properties(Python3::Module PROPERTIES + MAP_IMPORTED_CONFIG_DEBUG ";RELEASE") if (NOT pybind11_FOUND) message(FATAL_ERROR "pybind11 not found ${pybind11_FOUND}. Dependecies managed by conan, run 'conan install .' first") diff --git a/src/tas_client/CMakeLists.txt b/src/tas_client/CMakeLists.txt index 99ff99e..fec32c1 100644 --- a/src/tas_client/CMakeLists.txt +++ b/src/tas_client/CMakeLists.txt @@ -101,7 +101,6 @@ if (MSVC) target_compile_options(${LIB_NAME} PRIVATE /W3 /MP - /std:c++20 "$<$:" "/O2" ">" diff --git a/src/tas_socket/CMakeLists.txt b/src/tas_socket/CMakeLists.txt index 3d484a8..1d47485 100644 --- a/src/tas_socket/CMakeLists.txt +++ b/src/tas_socket/CMakeLists.txt @@ -72,7 +72,6 @@ if (MSVC) target_compile_options(${LIB_NAME} PRIVATE /W3 /MP - /std:c++20 "$<$:" "/O2" ">"