add initial RTOS support

now without io devices and console

git-svn-id: svn://db.shs.com.ru/pip@683 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
2019-02-04 23:57:53 +00:00
parent b0285fd251
commit 79e17eb928
17 changed files with 303 additions and 218 deletions

View File

@@ -8,12 +8,13 @@ include(PIPMacros.cmake)
# Options # Options
option(ICU "Unicode support" 1) option(ICU "Unicode support" ON)
option(STD_IOSTREAM "Building with std iostream operators support" 0) option(STD_IOSTREAM "Building with std iostream operators support" OFF)
option(INTROSPECTION_CONTAINERS "Build with containers introspection" 0) option(INTROSPECTION_CONTAINERS "Build with containers introspection" OFF)
option(INTROSPECTION_THREADS "Build with threads introspection" 0) option(INTROSPECTION_THREADS "Build with threads introspection" OFF)
option(LIB "System install" 1) option(LIB "System install" ON)
option(DEBUG "Build with -g3" 0) option(STATIC_LIB OFF)
option(DEBUG "Build with -g3" OFF)
# Basic # Basic
@@ -42,6 +43,18 @@ set(PIP_LIBS_TARGETS pip)
set(LIBS_MAIN) set(LIBS_MAIN)
set(LIBS_STATUS) set(LIBS_STATUS)
if (DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
set(STATIC_LIB ON)
endif()
if(STATIC_LIB)
set(PIP_LIB_TYPE STATIC)
message(STATUS "Building PIP static library")
else()
set(PIP_LIB_TYPE SHARED)
message(STATUS "Building PIP shared library")
endif()
#if(LIB) #if(LIB)
if(WIN32) if(WIN32)
if(MINGW) if(MINGW)
@@ -106,6 +119,12 @@ endif()
# Main lib # Main lib
set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt") set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt")
if(PIP_FREERTOS)
list(REMOVE_ITEM PIP_FOLDERS "io_devices")
include_directories("${PIP_SRC_MAIN}/io_devices")
list(REMOVE_ITEM PIP_FOLDERS "console")
include_directories("${PIP_SRC_MAIN}/console")
endif()
include_directories("${PIP_SRC_MAIN}") include_directories("${PIP_SRC_MAIN}")
set(PIP_MAIN_FOLDERS) set(PIP_MAIN_FOLDERS)
foreach(F ${PIP_FOLDERS}) foreach(F ${PIP_FOLDERS})
@@ -133,6 +152,12 @@ gather_src("${PIP_SRC_OPENCL}" CPP_LIB_OPENCL HDRS PHDRS)
gather_src("${PIP_SRC_IO_UTILS}" CPP_LIB_IO_UTILS HDRS PHDRS) gather_src("${PIP_SRC_IO_UTILS}" CPP_LIB_IO_UTILS HDRS PHDRS)
if(PIP_FREERTOS)
add_definitions(-DPIP_FREERTOS)
set(ICU OFF)
set(LIB OFF)
endif()
# Check Bessel functions # Check Bessel functions
set(CMAKE_REQUIRED_INCLUDES math.h) set(CMAKE_REQUIRED_INCLUDES math.h)
set(CMAKE_REQUIRED_LIBRARIES m) set(CMAKE_REQUIRED_LIBRARIES m)
@@ -178,68 +203,69 @@ CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2)
if(DEBUG) if(DEBUG)
add_definitions(-DPIP_DEBUG) add_definitions(-DPIP_DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3")
message(STATUS "Building debug version") message(STATUS "Building PIP debug version")
else() else()
set(CMAKE_BUILD_TYPE "Release") set(CMAKE_BUILD_TYPE "Release")
message(STATUS "Building release version") message(STATUS "Building PIP release version")
endif() endif()
# Check if std::iostream operators support # Check if std::iostream operators support
if(STD_IOSTREAM) if(STD_IOSTREAM)
add_definitions(-DPIP_STD_IOSTREAM) add_definitions(-DPIP_STD_IOSTREAM)
message(STATUS "Building with std iostream operators support") message(STATUS "Building PIP with std iostream operators support")
else() else()
message(STATUS "Building without std iostream operators support") message(STATUS "Building PIP without std iostream operators support")
endif() endif()
# Check if STL containers is on (to enable use "-DSTL=" argument of cmake) # Check if STL containers is on (to enable use "-DSTL=" argument of cmake)
if(STL) if(STL)
message(STATUS "Building with STL containers") message(STATUS "Building PIP with STL containers")
add_definitions(-DPIP_CONTAINERS_STL) add_definitions(-DPIP_CONTAINERS_STL)
else() else()
message(STATUS "Building with PIP containers") message(STATUS "Building PIP with PIP containers")
endif() endif()
# Check if ICU used for PIString and PIChar # Check if ICU used for PIString and PIChar
if(ICU) if(ICU)
message(STATUS "Building with ICU") message(STATUS "Building PIP with ICU")
add_definitions(-DPIP_ICU) add_definitions(-DPIP_ICU)
list(APPEND LIBS_MAIN icuuc) list(APPEND LIBS_MAIN icuuc)
else() else()
message(STATUS "Building without ICU, attention!") message(STATUS "Building PIP without ICU, attention!")
endif() endif()
# Check if PIP should be built with containers introspection # Check if PIP should be built with containers introspection
if(INTROSPECTION_CONTAINERS) if(INTROSPECTION_CONTAINERS)
message(STATUS "Building with containers introspection") message(STATUS "Building PIP with containers introspection")
add_definitions(-DPIP_INTROSPECTION_CONTAINERS) add_definitions(-DPIP_INTROSPECTION_CONTAINERS)
else() else()
message(STATUS "Building without containers introspection") message(STATUS "Building PIP without containers introspection")
endif() endif()
# Check if PIP should be built with threads introspection # Check if PIP should be built with threads introspection
if(INTROSPECTION_THREADS) if(INTROSPECTION_THREADS)
message(STATUS "Building with threads introspection") message(STATUS "Building PIP with threads introspection")
add_definitions(-DPIP_INTROSPECTION_THREADS) add_definitions(-DPIP_INTROSPECTION_THREADS)
else() else()
message(STATUS "Building without threads introspection") message(STATUS "Building PIP without threads introspection")
endif() endif()
# Check if RT timers exists # Check if RT timers exists
if(PIP_TIMER_RT_0 AND PIP_TIMER_RT_1 AND PIP_TIMER_RT_2) if(PIP_TIMER_RT_0 AND PIP_TIMER_RT_1 AND PIP_TIMER_RT_2)
add_definitions(-DPIP_TIMER_RT) add_definitions(-DPIP_TIMER_RT)
message(STATUS "Building with timers: Thread, ThreadRT, Pool") message(STATUS "Building PIP with timers: Thread, ThreadRT, Pool")
else() else()
message(STATUS "Building with timers: Thread, Pool") message(STATUS "Building PIP with timers: Thread, Pool")
endif() endif()
# Add main library # Add main library
if(APPLE) if(APPLE)
add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE) add_definitions(-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE)
@@ -266,18 +292,22 @@ else()
endif() endif()
endif() endif()
set(PIP_LIBS) set(PIP_LIBS)
foreach(LIB_ ${LIBS_MAIN}) if(PIP_FREERTOS)
set(PIP_LIBS ${LIBS_MAIN})
else()
foreach(LIB_ ${LIBS_MAIN})
find_library(${LIB_}_FOUND ${LIB_}) find_library(${LIB_}_FOUND ${LIB_})
if(${LIB_}_FOUND) if(${LIB_}_FOUND)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${${LIB_}_FOUND}) list(APPEND CMAKE_REQUIRED_LIBRARIES ${${LIB_}_FOUND})
list(APPEND PIP_LIBS ${${LIB_}_FOUND}) list(APPEND PIP_LIBS ${${LIB_}_FOUND})
endif() endif()
endforeach() endforeach()
endif()
list(APPEND LIBS_STATUS ${LIBS_MAIN}) list(APPEND LIBS_STATUS ${LIBS_MAIN})
if(WIN32) if(WIN32)
list(APPEND CPP_LIB_MAIN "pip_resource_win.rc") list(APPEND CPP_LIB_MAIN "pip_resource_win.rc")
add_definitions(-DPSAPI_VERSION=1) add_definitions(-DPSAPI_VERSION=1)
add_library(pip SHARED ${CPP_LIB_MAIN} ${HDRS} ${PHDRS}) add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN} ${HDRS} ${PHDRS})
if(${C_COMPILER} STREQUAL "cl.exe") if(${C_COMPILER} STREQUAL "cl.exe")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot /W0") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /O2 /Ob2 /Ot /W0")
else() else()
@@ -287,13 +317,11 @@ if(WIN32)
else() else()
set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -O3 -fPIC") set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -O3 -fPIC")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
if(DEFINED ENV{QNX_HOST}) if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32")
add_library(pip STATIC ${CPP_LIB_MAIN})
else() else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
add_library(pip SHARED ${CPP_LIB_MAIN})
endif() endif()
add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN})
endif() endif()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
include(GenerateExportHeader) include(GenerateExportHeader)
@@ -301,57 +329,57 @@ generate_export_header(pip)
list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h") list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h")
target_link_libraries(pip ${PIP_LIBS}) target_link_libraries(pip ${PIP_LIBS})
if (NOT PIP_FREERTOS)
# Check if USB is supported # Check if USB is supported
find_library(usb_FOUND usb SHARED) find_library(usb_FOUND usb SHARED)
if(usb_FOUND) if(usb_FOUND)
message(STATUS "Building with USB support") message(STATUS "Building PIP with USB support")
add_definitions(-DPIP_USB) add_definitions(-DPIP_USB)
add_library(pip_usb SHARED ${CPP_LIB_USB}) add_library(pip_usb ${PIP_LIB_TYPE} ${CPP_LIB_USB})
target_link_libraries(pip_usb pip ${usb_FOUND}) target_link_libraries(pip_usb pip ${usb_FOUND})
list(APPEND LIBS_STATUS usb) list(APPEND LIBS_STATUS usb)
list(APPEND PIP_LIBS_TARGETS pip_usb) list(APPEND PIP_LIBS_TARGETS pip_usb)
else() else()
message(STATUS "Building without USB support") message(STATUS "Building PIP without USB support")
endif() endif()
# Check if PIP support cryptographic encryption/decryption using sodium library # Check if PIP support cryptographic encryption/decryption using sodium library
find_library(sodium_FOUND sodium) find_library(sodium_FOUND sodium)
if(sodium_FOUND) if(sodium_FOUND)
message(STATUS "Building with crypt support") message(STATUS "Building PIP with crypt support")
add_definitions(-DPIP_CRYPT) add_definitions(-DPIP_CRYPT)
add_library(pip_crypt SHARED ${CPP_LIB_CRYPT}) add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT})
target_link_libraries(pip_crypt pip ${sodium_FOUND}) target_link_libraries(pip_crypt pip ${sodium_FOUND})
list(APPEND LIBS_STATUS sodium) list(APPEND LIBS_STATUS sodium)
list(APPEND PIP_LIBS_TARGETS pip_crypt) list(APPEND PIP_LIBS_TARGETS pip_crypt)
else() else()
message(STATUS "Building without crypt support") message(STATUS "Building PIP without crypt support")
endif() endif()
# Check if PIP support compress/decompress using zlib library # Check if PIP support compress/decompress using zlib library
find_library(zlib_FOUND NAMES z zlib) find_library(zlib_FOUND NAMES z zlib)
if(zlib_FOUND) if(zlib_FOUND)
message(STATUS "Building with zlib compress support") message(STATUS "Building PIP with zlib compress support")
add_definitions(-DPIP_COMPRESS) add_definitions(-DPIP_COMPRESS)
add_library(pip_compress SHARED ${CPP_LIB_COMPRESS}) add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS})
target_link_libraries(pip_compress pip ${zlib_FOUND}) target_link_libraries(pip_compress pip ${zlib_FOUND})
list(APPEND LIBS_STATUS zlib) list(APPEND LIBS_STATUS zlib)
list(APPEND PIP_LIBS_TARGETS pip_compress) list(APPEND PIP_LIBS_TARGETS pip_compress)
else() else()
message(STATUS "Building without compress support") message(STATUS "Building PIP without compress support")
endif() endif()
# Check if PIP support fftw3 for PIFFT using in math module # Check if PIP support fftw3 for PIFFT using in math module
set(FFTW_LIB_NAME fftw3) set(FFTW_LIB_NAME fftw3)
set(FFTW_LIB_SUFFIXES "" "f" "l" "q") set(FFTW_LIB_SUFFIXES "" "f" "l" "q")
set(FFTW_LIB_SUFFIXES2 "" "-3") set(FFTW_LIB_SUFFIXES2 "" "-3")
set(FFTW_LIBS) set(FFTW_LIBS)
set(PIP_FFTW_FOUND) set(PIP_FFTW_FOUND)
set(CMAKE_REQUIRED_INCLUDES fftw3.h) set(CMAKE_REQUIRED_INCLUDES fftw3.h)
foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES) foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
set(FFTW_BREAK false) set(FFTW_BREAK false)
foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2) foreach(FFTW_S2_ IN LISTS FFTW_LIB_SUFFIXES2)
if(NOT FFTW_BREAK) if(NOT FFTW_BREAK)
@@ -380,22 +408,22 @@ foreach(FFTW_S_ IN LISTS FFTW_LIB_SUFFIXES)
endif() endif()
endif() endif()
endforeach() endforeach()
endforeach() endforeach()
if(FFTW_LIBS) if(FFTW_LIBS)
message(STATUS "Building with fftw3 support: ${FFTW_LIBS}") message(STATUS "Building PIP with fftw3 support: ${FFTW_LIBS}")
add_library(pip_fftw SHARED ${CPP_LIB_FFTW}) add_library(pip_fftw ${PIP_LIB_TYPE} ${CPP_LIB_FFTW})
target_link_libraries(pip_fftw pip ${FFTW_LIBS}) target_link_libraries(pip_fftw pip ${FFTW_LIBS})
list(APPEND LIBS_STATUS ${FFTW_LIBS}) list(APPEND LIBS_STATUS ${FFTW_LIBS})
list(APPEND PIP_LIBS_TARGETS pip_fftw) list(APPEND PIP_LIBS_TARGETS pip_fftw)
else() else()
message(STATUS "Building without fftw3 support") message(STATUS "Building PIP without fftw3 support")
endif() endif()
# Check if PIP support OpenCL # Check if PIP support OpenCL
find_package(OpenCL QUIET) find_package(OpenCL QUIET)
if(OpenCL_FOUND) if(OpenCL_FOUND)
message(STATUS "Building with OpenCL support") message(STATUS "Building PIP with OpenCL support")
if(APPLE) if(APPLE)
include_directories(${OpenCL_INCLUDE_DIRS}/Headers) include_directories(${OpenCL_INCLUDE_DIRS}/Headers)
else() else()
@@ -403,35 +431,35 @@ if(OpenCL_FOUND)
endif() endif()
add_definitions(-DPIP_OPENCL) add_definitions(-DPIP_OPENCL)
pip_resources(CL_RES "src_opencl/resources.conf") pip_resources(CL_RES "src_opencl/resources.conf")
add_library(pip_opencl SHARED ${CPP_LIB_OPENCL} ${CL_RES}) add_library(pip_opencl ${PIP_LIB_TYPE} ${CPP_LIB_OPENCL} ${CL_RES})
add_dependencies(pip_opencl pip_rc) add_dependencies(pip_opencl pip_rc)
target_link_libraries(pip_opencl pip OpenCL::OpenCL) target_link_libraries(pip_opencl pip OpenCL::OpenCL)
list(APPEND LIBS_STATUS OpenCL) list(APPEND LIBS_STATUS OpenCL)
list(APPEND PIP_LIBS_TARGETS pip_opencl) list(APPEND PIP_LIBS_TARGETS pip_opencl)
set(OpenCL_FOUND ${OpenCL_LIBRARIES}) set(OpenCL_FOUND ${OpenCL_LIBRARIES})
else() else()
message(STATUS "Building without OpenCL support") message(STATUS "Building PIP without OpenCL support")
endif() endif()
# Check if PIP IO Utils library supports crypt # Check if PIP IO Utils library supports crypt
set(IO_UTILS_LIBS pip) set(IO_UTILS_LIBS pip)
add_library(pip_io_utils SHARED ${CPP_LIB_IO_UTILS}) add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS})
if(sodium_FOUND) if(sodium_FOUND)
message(STATUS "Building IO Utils library with crypt support") message(STATUS "Building PIP IO Utils library with crypt support")
list(APPEND IO_UTILS_LIBS pip_crypt) list(APPEND IO_UTILS_LIBS pip_crypt)
else() else()
message(STATUS "Building IO Utils library without crypt support, attention!") message(STATUS "Building PIP IO Utils library without crypt support, attention!")
endif() endif()
target_link_libraries(pip_io_utils ${IO_UTILS_LIBS}) target_link_libraries(pip_io_utils ${IO_UTILS_LIBS})
list(APPEND PIP_LIBS_TARGETS pip_io_utils) list(APPEND PIP_LIBS_TARGETS pip_io_utils)
# Test program
add_executable(pip_test "main.cpp")
target_link_libraries(pip_test pip)
# Test program endif(NOT PIP_FREERTOS)
add_executable(pip_test "main.cpp")
target_link_libraries(pip_test pip)
# Install # Install
# Check if system or local install will be used (to system install use "-DLIB=" argument of cmake) # Check if system or local install will be used (to system install use "-DLIB=" argument of cmake)
@@ -473,39 +501,46 @@ if(LIB)
file(GLOB CMAKES "*.cmake") file(GLOB CMAKES "*.cmake")
install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules)
else() else()
if(NOT PIP_FREERTOS)
install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin) install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION bin)
install(FILES ${HDRS} DESTINATION include) install(FILES ${HDRS} DESTINATION include)
message(STATUS "Install ${PROJECT_NAME} to local \"bin\"") message(STATUS "Install ${PROJECT_NAME} to local \"bin\"")
endif()
endif() endif()
if(NOT PIP_FREERTOS)
# Auxiliary # Auxiliary
add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal") add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal")
# Utils # Utils
add_subdirectory("utils/system_test") add_subdirectory("utils/system_test")
add_subdirectory("utils/remote_console") add_subdirectory("utils/remote_console")
add_subdirectory("utils/code_model_generator") add_subdirectory("utils/code_model_generator")
add_subdirectory("utils/resources_compiler") add_subdirectory("utils/resources_compiler")
add_subdirectory("utils/udp_file_transfer") add_subdirectory("utils/udp_file_transfer")
if(sodium_FOUND) if(sodium_FOUND)
add_subdirectory("utils/system_daemon") add_subdirectory("utils/system_daemon")
add_subdirectory("utils/crypt_tool") add_subdirectory("utils/crypt_tool")
endif()
endif() endif()
# Libraries messages # Libraries messages
message(STATUS "Building modules: ${PIP_LIBS_TARGETS}") message(STATUS "Building PIP modules: ${PIP_LIBS_TARGETS}")
if(DEFINED LIBPROJECT) if(DEFINED LIBPROJECT)
set(PIP_LIBS_TARGETS ${PIP_LIBS_TARGETS} PARENT_SCOPE) set(PIP_LIBS_TARGETS ${PIP_LIBS_TARGETS} PARENT_SCOPE)
endif() endif()
foreach(LIB_ ${LIBS_STATUS}) if(NOT PIP_FREERTOS)
foreach(LIB_ ${LIBS_STATUS})
message(STATUS "Library ${LIB_} -> " ${${LIB_}_FOUND}) message(STATUS "Library ${LIB_} -> " ${${LIB_}_FOUND})
if(NOT ${LIB_}_FOUND) if(NOT ${LIB_}_FOUND)
message(WARNING "Library ${LIB_} not found, please install it") message(WARNING "Library ${LIB_} not found, please install it")
endif() endif()
endforeach() endforeach()
endif()
# #
@@ -514,7 +549,7 @@ endforeach()
# find_package(Doxygen QUIET) # find_package(Doxygen QUIET)
# if(Doxygen_FOUND) # if(Doxygen_FOUND)
# message(STATUS "Building with documentation via Doxygen") # message(STATUS "Building PIP with documentation via Doxygen")
# #set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in) # #set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in)
# set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile) # set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile)
@@ -532,10 +567,10 @@ endforeach()
# ) # )
# install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc) # install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc)
# endif() # endif()
if (NOT PIP_FREERTOS)
include(PIPDocumentation.cmake) include(PIPDocumentation.cmake)
find_package(Doxygen) find_package(Doxygen)
if(DOXYGEN_FOUND) if(DOXYGEN_FOUND)
set(DOXY_PROJECT_NUMBER "${_PIP_FULL_VERSION}") set(DOXY_PROJECT_NUMBER "${_PIP_FULL_VERSION}")
set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"") set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"") set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${_PIP_FULL_VERSION}\"")
@@ -555,5 +590,6 @@ if(DOXYGEN_FOUND)
string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}") string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}")
add_documentation(doc Doxyfile.in) add_documentation(doc Doxyfile.in)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip COMPONENT doc EXCLUDE_FROM_ALL OPTIONAL) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip COMPONENT doc EXCLUDE_FROM_ALL OPTIONAL)
endif()
endif() endif()

View File

@@ -45,7 +45,7 @@ typedef PIByteArray(*AccessFunction)(const void *, const char *);
struct PIP_EXPORT TypeInfo { struct PIP_EXPORT TypeInfo {
TypeInfo(const PIString & n = PIString(), const PIString & t = PIString(), PICodeInfo::TypeFlags f = 0, int b = -1) {name = n; type = t; flags = f; bits = b;} TypeInfo(const PIString & n = PIString(), const PIString & t = PIString(), PICodeInfo::TypeFlags f = 0, int b = -1) {name = n; type = t; flags = f; bits = b;}
const bool isBitfield() const {return bits > 0;} bool isBitfield() const {return bits > 0;}
MetaMap meta; MetaMap meta;
PIString name; PIString name;
PIString type; PIString type;

View File

@@ -41,4 +41,5 @@ typedef LONG(NTAPI*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
#include <iostream> #include <iostream>
#endif // PIINCLUDES_P_H #endif // PIINCLUDES_P_H

View File

@@ -23,9 +23,11 @@
#include "pisignals.h" #include "pisignals.h"
#include "piobject.h" #include "piobject.h"
#include "pisysteminfo.h" #include "pisysteminfo.h"
#include "pidir.h"
#include "piprocess.h"
#include "piresourcesstorage.h" #include "piresourcesstorage.h"
#ifndef FREERTOS
# include "pidir.h"
# include "piprocess.h"
#endif
#ifdef WINDOWS #ifdef WINDOWS
# include <winsock2.h> # include <winsock2.h>
extern FILETIME __pi_ftjan1970; extern FILETIME __pi_ftjan1970;
@@ -44,7 +46,9 @@
} }
#else #else
# include <pwd.h> # include <pwd.h>
# ifndef FREERTOS
# include <sys/utsname.h> # include <sys/utsname.h>
# endif
# include <pthread.h> # include <pthread.h>
# ifdef BLACKBERRY # ifdef BLACKBERRY
# include <signal.h> # include <signal.h>
@@ -88,6 +92,7 @@ PRIVATE_DEFINITION_START(PIInit)
#endif #endif
PRIVATE_DEFINITION_END(PIInit) PRIVATE_DEFINITION_END(PIInit)
#ifndef FREERTOS
void __sighandler__(PISignals::Signal s) { void __sighandler__(PISignals::Signal s) {
//piCout << Hex << int(s); //piCout << Hex << int(s);
if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput) if (s == PISignals::StopTTYInput || s == PISignals::StopTTYOutput)
@@ -95,6 +100,7 @@ void __sighandler__(PISignals::Signal s) {
if (s == PISignals::UserDefined1) if (s == PISignals::UserDefined1)
dumpApplicationToFile(PIDir::home().path() + PIDir::separator + PIStringAscii("_PIP_DUMP_") + PIString::fromNumber(PIProcess::currentPID())); dumpApplicationToFile(PIDir::home().path() + PIDir::separator + PIStringAscii("_PIP_DUMP_") + PIString::fromNumber(PIProcess::currentPID()));
} }
#endif
#ifdef ANDROID #ifdef ANDROID
@@ -109,6 +115,7 @@ PIInit::PIInit() {
PISystemInfo * sinfo = PISystemInfo::instance(); PISystemInfo * sinfo = PISystemInfo::instance();
sinfo->execDateTime = PIDateTime::current(); sinfo->execDateTime = PIDateTime::current();
setFileCharset("UTF-8"); setFileCharset("UTF-8");
#ifndef FREERTOS
#ifndef ANDROID #ifndef ANDROID
PISignals::setSlot(__sighandler__); PISignals::setSlot(__sighandler__);
PISignals::grabSignals(PISignals::UserDefined1); PISignals::grabSignals(PISignals::UserDefined1);
@@ -211,11 +218,14 @@ PIInit::PIInit() {
#endif #endif
#ifdef MAC_OS #ifdef MAC_OS
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock); host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &__pi_mac_clock);
#endif
#endif #endif
char cbuff[1024]; char cbuff[1024];
memset(cbuff, 0, 1024); memset(cbuff, 0, 1024);
#ifndef FREERTOS
if (gethostname(cbuff, 1023) == 0) if (gethostname(cbuff, 1023) == 0)
sinfo->hostname = cbuff; sinfo->hostname = cbuff;
#endif
#ifdef WINDOWS #ifdef WINDOWS
SYSTEM_INFO sysinfo; SYSTEM_INFO sysinfo;
GetSystemInfo(&sysinfo); GetSystemInfo(&sysinfo);
@@ -248,11 +258,13 @@ PIInit::PIInit() {
if (l) if (l)
sinfo->user = l; sinfo->user = l;
} }
# ifndef FREERTOS
struct utsname uns; struct utsname uns;
if (uname(&uns) == 0) { if (uname(&uns) == 0) {
sinfo->OS_version = uns.release; sinfo->OS_version = uns.release;
sinfo->architecture = uns.machine; sinfo->architecture = uns.machine;
} }
# endif
#endif #endif
sinfo->OS_name = sinfo->OS_name =
#ifdef WINDOWS #ifdef WINDOWS
@@ -269,12 +281,16 @@ PIInit::PIInit() {
# else # else
# ifdef FREE_BSD # ifdef FREE_BSD
PIStringAscii("FreeBSD"); PIStringAscii("FreeBSD");
# else
# ifdef FREERTOS
PIStringAscii("FreeRTOS");
# else # else
uns.sysname; uns.sysname;
# endif # endif
# endif # endif
# endif # endif
# endif # endif
# endif
#endif #endif
} }

View File

@@ -18,9 +18,10 @@
*/ */
#include "piobject.h" #include "piobject.h"
#include "pifile.h"
#include "pisysteminfo.h" #include "pisysteminfo.h"
#ifndef FREERTOS
# include "pifile.h"
#endif
/** \class PIObject /** \class PIObject
* \brief This is base class for any classes which use events -> handlers mechanism. * \brief This is base class for any classes which use events -> handlers mechanism.
@@ -585,7 +586,7 @@ void dumpApplication() {
//printf("dump application done\n"); //printf("dump application done\n");
} }
#ifndef FREERTOS
bool dumpApplicationToFile(const PIString & path) { bool dumpApplicationToFile(const PIString & path) {
PIFile f(path + "_tmp"); PIFile f(path + "_tmp");
f.setName("__S__DumpFile"); f.setName("__S__DumpFile");
@@ -600,3 +601,4 @@ bool dumpApplicationToFile(const PIString & path) {
PIFile::rename(path + "_tmp", path); PIFile::rename(path + "_tmp", path);
return true; return true;
} }
#endif

View File

@@ -25,11 +25,14 @@
#include "pistring.h" #include "pistring.h"
#include <ctime> #ifdef FREERTOS
#ifdef QNX # include "time.h"
#else
# include <ctime>
# ifdef QNX
# include <time.h> # include <time.h>
# endif
#endif #endif
//! \brief Sleep for "msecs" milliseconds //! \brief Sleep for "msecs" milliseconds
PIP_EXPORT void msleep(int msecs); PIP_EXPORT void msleep(int msecs);

View File

@@ -1,7 +1,7 @@
#include "pican.h" #include "pican.h"
#include "pipropertystorage.h" #include "pipropertystorage.h"
#include "piincludes_p.h" #include "piincludes_p.h"
#if !defined(WINDOWS) && !defined(MAC_OS) #if !defined(WINDOWS) && !defined(MAC_OS) && !defined(FREERTOS)
# define PIP_CAN # define PIP_CAN
#endif #endif
#ifdef PIP_CAN #ifdef PIP_CAN

View File

@@ -45,18 +45,23 @@
# define ANDROID # define ANDROID
# endif # endif
#endif #endif
#ifdef PIP_FREERTOS
# define FREERTOS
#endif
#ifndef WINDOWS #ifndef WINDOWS
# ifndef QNX # ifndef QNX
# ifndef FREE_BSD # ifndef FREE_BSD
# ifndef MAC_OS # ifndef MAC_OS
# ifndef ANDROID # ifndef ANDROID
# ifndef BLACKBERRY # ifndef BLACKBERRY
# ifndef FREERTOS
# define LINUX # define LINUX
# endif # endif
# endif # endif
# endif # endif
# endif # endif
# endif # endif
# endif
#endif #endif
#ifndef WINDOWS #ifndef WINDOWS

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_FREERTOS
#include "picodec.h" #include "picodec.h"
@@ -39,3 +41,5 @@ PIByteArray PICodec::exec_iconv(const PIString & from, const PIString & to, cons
waitForFinish(); waitForFinish();
return readOutput(); return readOutput();
} }
#endif // PIP_FREERTOS

View File

@@ -20,6 +20,8 @@
#ifndef PICODEC_H #ifndef PICODEC_H
#define PICODEC_H #define PICODEC_H
#ifndef PIP_FREERTOS
#include "piprocess.h" #include "piprocess.h"
class PIP_EXPORT PICodec: protected PIProcess class PIP_EXPORT PICodec: protected PIProcess
@@ -48,4 +50,5 @@ private:
}; };
#endif // PIP_FREERTOS
#endif // PICODEC_H #endif // PICODEC_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_FREERTOS
#include "pilibrary.h" #include "pilibrary.h"
#include "piincludes_p.h" #include "piincludes_p.h"
#ifndef WINDOWS #ifndef WINDOWS
@@ -107,3 +109,5 @@ void PILibrary::getLastError() {
else liberror.clear(); else liberror.clear();
#endif #endif
} }
#endif // PIP_FREERTOS

View File

@@ -16,10 +16,12 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#
#ifndef PILIBRARY_H #ifndef PILIBRARY_H
#define PILIBRARY_H #define PILIBRARY_H
#ifndef PIP_FREERTOS
#include "pistring.h" #include "pistring.h"
class PIP_EXPORT PILibrary { class PIP_EXPORT PILibrary {
@@ -45,4 +47,5 @@ private:
}; };
#endif // PIP_FREERTOS
#endif // PILIBRARY_H #endif // PILIBRARY_H

View File

@@ -17,6 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef PIP_FREERTOS
#include "piincludes_p.h" #include "piincludes_p.h"
#include "piprocess.h" #include "piprocess.h"
#ifndef WINDOWS #ifndef WINDOWS
@@ -26,7 +28,6 @@
#ifdef MAC_OS #ifdef MAC_OS
# include <crt_externs.h> # include <crt_externs.h>
#endif #endif
PRIVATE_DEFINITION_START(PIProcess) PRIVATE_DEFINITION_START(PIProcess)
#ifdef WINDOWS #ifdef WINDOWS
STARTUPINFOA si; STARTUPINFOA si;
@@ -38,7 +39,6 @@ PRIVATE_DEFINITION_START(PIProcess)
PRIVATE_DEFINITION_END(PIProcess) PRIVATE_DEFINITION_END(PIProcess)
PIProcess::PIProcess(): PIThread() { PIProcess::PIProcess(): PIThread() {
exit_code = -1; exit_code = -1;
#ifdef WINDOWS #ifdef WINDOWS
@@ -307,3 +307,5 @@ PIString PIProcess::getEnvironmentVariable(const PIString & variable) {
return PIString(); return PIString();
} }
#endif // PIP_FREERTOS

View File

@@ -23,6 +23,8 @@
#ifndef PIPROCESS_H #ifndef PIPROCESS_H
#define PIPROCESS_H #define PIPROCESS_H
#ifndef PIP_FREERTOS
#include "pithread.h" #include "pithread.h"
#include "pifile.h" #include "pifile.h"
@@ -102,4 +104,5 @@ private:
}; };
#endif // PIP_FREERTOS
#endif // PIPROCESS_H #endif // PIPROCESS_H

View File

@@ -83,6 +83,7 @@ PISystemMonitor::ProcessStats::ProcessStats() {
} }
#ifndef FREERTOS
bool PISystemMonitor::startOnProcess(int pID, int interval_ms) { bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
stop(); stop();
self_ = false; self_ = false;
@@ -109,13 +110,12 @@ bool PISystemMonitor::startOnProcess(int pID, int interval_ms) {
return start(interval_ms); return start(interval_ms);
} }
bool PISystemMonitor::startOnSelf(int interval_ms) { bool PISystemMonitor::startOnSelf(int interval_ms) {
bool ret = startOnProcess(PIProcess::currentPID(), interval_ms); bool ret = startOnProcess(PIProcess::currentPID(), interval_ms);
self_ = true; self_ = true;
return ret; return ret;
} }
#endif
PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const { PIVector<PISystemMonitor::ThreadStats> PISystemMonitor::threadsStatistic() const {
mutex_.lock(); mutex_.lock();

View File

@@ -70,9 +70,10 @@ public:
ullong space_used; ullong space_used;
ullong space_free;*/ ullong space_free;*/
}; };
#ifndef FREERTOS
bool startOnProcess(int pID, int interval_ms = 1000); bool startOnProcess(int pID, int interval_ms = 1000);
bool startOnSelf(int interval_ms = 1000); bool startOnSelf(int interval_ms = 1000);
#endif
void stop(); void stop();
const ProcessStats & statistic() const {return stat;} const ProcessStats & statistic() const {return stat;}

View File

@@ -31,7 +31,7 @@
# include <sys/syscall.h> # include <sys/syscall.h>
# define gettid() syscall(SYS_gettid) # define gettid() syscall(SYS_gettid)
#endif #endif
#if defined(MAC_OS) || defined(BLACKBERRY) #if defined(MAC_OS) || defined(BLACKBERRY) || defined(FREERTOS)
# include <pthread.h> # include <pthread.h>
#endif #endif
__THREAD_FUNC_RET__ thread_function(void * t) {PIThread::__thread_func__(t); return 0;} __THREAD_FUNC_RET__ thread_function(void * t) {PIThread::__thread_func__(t); return 0;}
@@ -335,6 +335,7 @@ int PIThread::priority2System(PIThread::Priority p) {
void PIThread::setPriority(PIThread::Priority prior) { void PIThread::setPriority(PIThread::Priority prior) {
#ifndef FREERTOS // FreeRTOS can't change priority runtime
priority_ = prior; priority_ = prior;
#ifndef WINDOWS #ifndef WINDOWS
if (!running_ || (PRIVATE->thread == 0)) return; if (!running_ || (PRIVATE->thread == 0)) return;
@@ -354,6 +355,7 @@ void PIThread::setPriority(PIThread::Priority prior) {
if (!running_ || (PRIVATE->thread == 0)) return; if (!running_ || (PRIVATE->thread == 0)) return;
SetThreadPriority(PRIVATE->thread, priority2System(priority_)); SetThreadPriority(PRIVATE->thread, priority2System(priority_));
#endif #endif
#endif //FREERTOS
} }