diff --git a/CMakeLists.txt b/CMakeLists.txt index 678f5e13..fc58688e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake project(pip) set(_PIP_MAJOR 1) set(_PIP_MINOR 99) -set(_PIP_REVISION 2) +set(_PIP_REVISION 3) set(_PIP_SUFFIX _prebeta) set(_PIP_COMPANY SHS) set(_PIP_DOMAIN org.SHS) @@ -14,6 +14,7 @@ endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) set(PIP_BUILD 1) include(CheckFunctionExists) +include(GenerateExportHeader) include(DeployMacros) include(PIPMacros) if(NOT DEFINED BUILD_NUMBER) @@ -45,60 +46,89 @@ set(CMAKE_CXX_STANDARD 11) # Basic -macro(gather_src DIR CPP H H_P) - set(CS) - set(HS) - set(PHS) - file(GLOB CS "${DIR}/*.cpp") - file(GLOB HS "${DIR}/*.h") - file(GLOB PHS "${DIR}/*_p.h") - list(REMOVE_ITEM HS "${PHS}") - list(APPEND ${CPP} ${CS}) - list(APPEND ${H} ${HS}) - list(APPEND ${H_P} ${PHS}) -endmacro() - -set(PIP_SRC_MAIN "lib/main") -set(PIP_SRC_CONSOLE "lib/console") -set(PIP_SRC_CRYPT "lib/crypt") -set(PIP_SRC_COMPRESS "lib/compress") -set(PIP_SRC_USB "lib/usb") -set(PIP_SRC_FFTW "lib/fftw") -set(PIP_SRC_OPENCL "lib/opencl") -set(PIP_SRC_IO_UTILS "lib/io_utils") -set(PIP_SRC_CLOUD "lib/cloud") -set(PIP_SRC_LUA "lib/lua") -set(PIP_SRC_DIRS ${PIP_SRC_MAIN} - ${PIP_SRC_CONSOLE} - ${PIP_SRC_CRYPT} - ${PIP_SRC_COMPRESS} - ${PIP_SRC_USB} - ${PIP_SRC_FFTW} - ${PIP_SRC_OPENCL} - ${PIP_SRC_IO_UTILS} - ${PIP_SRC_CLOUD} - ${PIP_SRC_LUA} -) -set(PIP_LIBS_TARGETS pip) +set(PIP_MODULES) set(LIBS_MAIN) set(LIBS_STATUS) set(HDRS) set(PHDRS) set(HDR_DIRS) - -set(PIP_STD_IOSTREAM "no") -set(PIP_ICU "no") -set(PIP_INTROSPECTION "no") -set(PIP_USB "no") -set(PIP_CRYPT "no") -set(PIP_CLOUD "no") -set(PIP_COMPRESS "no") -set(PIP_FFTW "no") -set(PIP_OPENCL "no") -set(PIP_LUA "no") -set(PIP_IOUTILS "yes") set(PIP_UTILS_LIST) set(PIP_TESTS_LIST) +set(PIP_EXPORTS) + +set(PIP_SRC_MODULES "console;crypt;compress;usb;fftw;opencl;io_utils;cloud;lua") +foreach(_m ${PIP_SRC_MODULES}) + set(PIP_MSG_${_m} "no") +endforeach() + +macro(pip_module NAME LIBS LABEL INCLUDES MSG) + set(CPPS) + set(HS) + set(PHS) + set(CRES) + file(GLOB_RECURSE CPPS "lib/${NAME}/*.cpp") + file(GLOB_RECURSE HS "lib/${NAME}/*.h") + file(GLOB_RECURSE PHS "lib/${NAME}/*_p.h") + file(GLOB_RECURSE RES "lib/${NAME}/*conf.h") + list(REMOVE_ITEM HS "${PHS}") + list(APPEND HDRS ${HS}) + list(APPEND PHDRS ${PHS}) + + set(_target "pip_${NAME}") + set(_libs "${LIBS}") + if ("${NAME}" STREQUAL "main") + set(_target "pip") + else() + list(APPEND _libs "pip") + endif() + string(TOUPPER "${_target}" DEF_NAME) + + set(PIP_MSG_${NAME} "yes${MSG}") + import_version(${_target} PIP) + set_deploy_property(${_target} ${PIP_LIB_TYPE} + LABEL "${LABEL}" + FULLNAME "${_PIP_DOMAIN}.${_target}" + COMPANY "${_PIP_COMPANY}" + INFO "Platform-Independent Primitives") + make_rc(${_target} _RC) + + set(LINK_LIBS) + foreach (_l ${_libs}) + if (${${_l}_FOUND}) + list(APPEND LINK_LIBS ${${_l}_LIBRARIES}) + else() + list(APPEND LINK_LIBS ${_l}) + endif() + endforeach() + + if (NOT "${RES}" STREQUAL "") + pip_resources(CRES "${RES}") + endif() + add_definitions(-D${DEF_NAME}) + add_library(${_target} ${PIP_LIB_TYPE} ${CPPS} ${CRES} ${_RC}) + if (NOT "${RES}" STREQUAL "") + add_dependencies(${_target} pip_rc) + endif() + if (NOT "${INCLUDES}" STREQUAL "") + target_include_directories(${_target} PRIVATE ${INCLUDES}) + endif() + generate_export_header(${_target}) + list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/${_target}_export.h") + list(APPEND PIP_EXPORTS "${DEF_NAME}_EXPORT") + target_link_libraries(${_target} ${LINK_LIBS}) + list(APPEND PIP_MODULES ${_target}) + if (NOT "${LIBS}" STREQUAL "") + list(APPEND LIBS_STATUS ${LIBS}) + endif() +endmacro() + +macro(pip_find_lib NAME) + find_library(${NAME}_LIBRARIES ${NAME} ${ARGN}) + set(${NAME}_FOUND FALSE) + if(${NAME}_LIBRARIES) + set(${NAME}_FOUND TRUE) + endif() +endmacro() if (DEFINED ENV{QNX_HOST} OR PIP_FREERTOS) set(STATIC_LIB ON) @@ -122,11 +152,6 @@ set_version(PIP BUILD "${BUILD_NUMBER}" SUFFIX "${_PIP_SUFFIX}" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/piversion.h") -set_deploy_property(pip ${PIP_LIB_TYPE} - LABEL "PIP main library" - FULLNAME "${_PIP_DOMAIN}.pip" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PIP_SRC_MAIN}/piversion.h") file(REMOVE "${CMAKE_CURRENT_SOURCE_DIR}/${PIP_SRC_MAIN}/piversion.h") endif() @@ -184,49 +209,25 @@ endif() get_filename_component(C_COMPILER "${CMAKE_C_COMPILER}" NAME) -# Sources - # Main lib -set(PIP_FOLDERS "." "core" "containers" "thread" "system" "io_devices" "io_utils" "console" "math" "code" "geo" "resources" "opencl" "crypt" "introspection" "cloud" "lua") -include_directories("${PIP_SRC_MAIN}") +#set(PIP_FOLDERS ".;core;containers;thread;system;io_devices;io_utils;console;math;code;geo;resources;opencl;crypt;introspection;cloud;lua") +file(GLOB PIP_FOLDERS LIST_DIRECTORIES TRUE "${CMAKE_CURRENT_SOURCE_DIR}/lib/main/*") +list(APPEND PIP_FOLDERS "${CMAKE_CURRENT_SOURCE_DIR}/lib/main") set(PIP_MAIN_FOLDERS) foreach(F ${PIP_FOLDERS}) - list(APPEND PIP_MAIN_FOLDERS "\"${PROJECT_SOURCE_DIR}/${PIP_SRC_MAIN}/${F}\"") - include_directories("${PIP_SRC_MAIN}/${F}") - gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS) + if (IS_DIRECTORY "${F}") + list(APPEND PIP_MAIN_FOLDERS "${F}") + include_directories("${F}") + endif() endforeach(F) +if (DEFINED LIBPROJECT) + set(PIP_MAIN_FOLDERS "${PIP_MAIN_FOLDERS}" PARENT_SCOPE) +endif() if (TESTS) add_subdirectory(tests) endif() -# Crypt lib -gather_src("${PIP_SRC_CRYPT}" CPP_LIB_CRYPT HDRS PHDRS) - -# Console lib -gather_src("${PIP_SRC_CONSOLE}" CPP_LIB_CONSOLE HDRS PHDRS) - -# Compress lib -gather_src("${PIP_SRC_COMPRESS}" CPP_LIB_COMPRESS HDRS PHDRS) - -# USB lib -gather_src("${PIP_SRC_USB}" CPP_LIB_USB HDRS PHDRS) - -# FFTW lib -gather_src("${PIP_SRC_FFTW}" CPP_LIB_FFTW HDRS PHDRS) - -# OpenCL lib -gather_src("${PIP_SRC_OPENCL}" CPP_LIB_OPENCL HDRS PHDRS) - -# IO Utils lib -gather_src("${PIP_SRC_IO_UTILS}" CPP_LIB_IO_UTILS HDRS PHDRS) - -# Cloud lib -gather_src("${PIP_SRC_CLOUD}" CPP_LIB_CLOUD HDRS PHDRS) - -# LUA lib -gather_src("${PIP_SRC_LUA}" CPP_LIB_LUA HDRS PHDRS) - if(PIP_FREERTOS) add_definitions(-DPIP_FREERTOS) set(ICU OFF) @@ -269,9 +270,9 @@ if((NOT DEFINED ENV{QNX_HOST}) AND (NOT APPLE) AND (NOT WIN32) AND (NOT DEFINED list(APPEND LIBS_MAIN rt) set(CMAKE_REQUIRED_LIBRARIES rt) endif() -CHECK_FUNCTION_EXISTS(timer_create PIP_TIMER_RT_0) +CHECK_FUNCTION_EXISTS(timer_create PIP_TIMER_RT_0) CHECK_FUNCTION_EXISTS(timer_settime PIP_TIMER_RT_1) -CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2) +CHECK_FUNCTION_EXISTS(timer_delete PIP_TIMER_RT_2) # Check if build debug version @@ -286,6 +287,7 @@ endif() # Check if std::iostream operators support +set(PIP_STD_IOSTREAM "no") if(STD_IOSTREAM) set(PIP_STD_IOSTREAM "yes") add_definitions(-DPIP_STD_IOSTREAM) @@ -293,6 +295,7 @@ endif() # Check if ICU used for PIString and PIChar +set(PIP_ICU "no") if(ICU) set(PIP_ICU "yes") add_definitions(-DPIP_ICU) @@ -303,6 +306,7 @@ endif() # Check if PIP should be built with introspection set(_PIP_DEFS "") set(_PIP_DEFS_FILE "${CMAKE_CURRENT_BINARY_DIR}/pip_defs.h") +set(PIP_INTROSPECTION "no") if(INTROSPECTION) set(PIP_INTROSPECTION "yes") add_definitions(-DPIP_INTROSPECTION) @@ -360,21 +364,12 @@ if(PIP_FREERTOS) set(PIP_LIBS ${LIBS_MAIN}) else() foreach(LIB_ ${LIBS_MAIN}) - find_library(${LIB_}_LIBRARIES ${LIB_}) - set(${LIB_}_FOUND FALSE) - if(${LIB_}_LIBRARIES) - set(${LIB_}_FOUND TRUE) - list(APPEND CMAKE_REQUIRED_LIBRARIES ${${LIB_}_LIBRARIES}) - list(APPEND PIP_LIBS ${${LIB_}_LIBRARIES}) - endif() + pip_find_lib(${LIB_}) endforeach() endif() -list(APPEND LIBS_STATUS ${LIBS_MAIN}) import_version(pip PIP) if(WIN32) - make_rc(pip _RC) add_definitions(-DPSAPI_VERSION=1) - add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN} ${HDRS} ${PHDRS} ${_RC}) if(${C_COMPILER} STREQUAL "cl.exe") set(CMAKE_CXX_FLAGS "/O2 /Ob2 /Ot /W0") endif() @@ -382,93 +377,37 @@ else() set(${CMAKE_CXX_FLAGS} "${CMAKE_CXX_FLAGS} -fPIC") if(DEFINED ENV{QNX_HOST} OR PIP_FREERTOS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-32") - else() endif() - add_library(pip ${PIP_LIB_TYPE} ${CPP_LIB_MAIN}) endif() set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}") -include(GenerateExportHeader) -generate_export_header(pip) -list(APPEND HDRS "${CMAKE_CURRENT_BINARY_DIR}/pip_export.h") -target_link_libraries(pip ${PIP_LIBS}) + + +pip_module(main "${LIBS_MAIN}" "PIP main library" "" "") + if (NOT CROSSTOOLS) if (NOT PIP_FREERTOS) - # Check if USB is supported - find_library(usb_LIBRARIES usb SHARED) - set(usb_FOUND FALSE) - if(usb_LIBRARIES) - set(usb_FOUND TRUE) - set(PIP_USB "yes") - import_version(pip_usb pip) - set_deploy_property(pip_usb ${PIP_LIB_TYPE} - LABEL "PIP usb support" - FULLNAME "${_PIP_DOMAIN}.pip_usb" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_usb _RC) - add_definitions(-DPIP_USB) - add_library(pip_usb ${PIP_LIB_TYPE} ${CPP_LIB_USB} ${_RC}) - target_link_libraries(pip_usb pip ${usb_LIBRARIES}) - list(APPEND LIBS_STATUS usb) - list(APPEND PIP_LIBS_TARGETS pip_usb) + + + pip_module(console "" "PIP console support" "" "") + + + pip_find_lib(usb) + if(usb_FOUND) + pip_module(usb "usb" "PIP usb support" "" "") endif() - # Add console library - import_version(pip_console pip) - set_deploy_property(pip_console ${PIP_LIB_TYPE} - LABEL "PIP console support" - FULLNAME "${_PIP_DOMAIN}.pip_console" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_console _RC) - add_library(pip_console ${PIP_LIB_TYPE} ${CPP_LIB_CONSOLE} ${_RC}) - target_link_libraries(pip_console pip) - list(APPEND PIP_LIBS_TARGETS pip_console) - - - # Check if PIP support cryptographic encryption/decryption using sodium library - find_library(sodium_LIBRARIES sodium) - set(sodium_FOUND FALSE) - if(sodium_LIBRARIES) - set(sodium_FOUND TRUE) - set(PIP_CRYPT "yes") - set(PIP_IOUTILS "yes (+crypt)") - set(PIP_CLOUD "yes") - import_version(pip_crypt pip) - set_deploy_property(pip_crypt ${PIP_LIB_TYPE} - LABEL "PIP crypt support" - FULLNAME "${_PIP_DOMAIN}.pip_crypt" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_crypt _RC) - add_definitions(-DPIP_CRYPT) - add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT} ${_RC}) - target_link_libraries(pip_crypt pip ${sodium_LIBRARIES}) - list(APPEND LIBS_STATUS sodium) - list(APPEND PIP_LIBS_TARGETS pip_crypt) + pip_find_lib(zlib NAMES z zlib) + if(zlib_FOUND) + pip_module(compress "zlib" "PIP compression support" "" "") endif() - # Check if PIP support compress/decompress using zlib library - find_library(zlib_LIBRARIES NAMES z zlib) - set(zlib_FOUND FALSE) - if(zlib_LIBRARIES) - set(zlib_FOUND TRUE) - set(PIP_COMPRESS "yes") - import_version(pip_compress pip) - set_deploy_property(pip_compress ${PIP_LIB_TYPE} - LABEL "PIP compression support" - FULLNAME "${_PIP_DOMAIN}.pip_compress" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_compress _RC) - add_definitions(-DPIP_COMPRESS) - add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS} ${_RC}) - target_link_libraries(pip_compress pip ${zlib_LIBRARIES}) - list(APPEND LIBS_STATUS zlib) - list(APPEND PIP_LIBS_TARGETS pip_compress) + pip_find_lib(sodium) + if(sodium_FOUND) + pip_module(crypt "sodium" "PIP crypt support" "" "") + pip_module(cloud "pip_crypt" "PIP crypt support" "" "") endif() @@ -513,106 +452,38 @@ if (NOT CROSSTOOLS) endforeach() endforeach() if(FFTW_LIBS) - set(PIP_FFTW "yes (${FFTW_LIBS})") - import_version(pip_fftw pip) - set_deploy_property(pip_fftw ${PIP_LIB_TYPE} - LABEL "PIP FFTW support" - FULLNAME "${_PIP_DOMAIN}.pip_fftw" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_fftw _RC) - add_library(pip_fftw ${PIP_LIB_TYPE} ${CPP_LIB_FFTW} ${_RC}) - target_link_libraries(pip_fftw pip ${FFTW_ABS_LIBS}) - list(APPEND LIBS_STATUS ${FFTW_LIBS}) - list(APPEND PIP_LIBS_TARGETS pip_fftw) + pip_module(fftw "${FFTW_LIBS}" "PIP FFTW support" "" "") endif() - # Check if PIP support OpenCL - find_package(OpenCL QUIET) + find_package(OpenCL QUIET) #OpenCL_VERSION_STRING if(OpenCL_FOUND) - set(PIP_OPENCL "yes (${OpenCL_VERSION_STRING})") - import_version(pip_opencl pip) - set_deploy_property(pip_opencl ${PIP_LIB_TYPE} - LABEL "PIP OpenCL support" - FULLNAME "${_PIP_DOMAIN}.pip_opencl" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_opencl _RC) - if(APPLE) - include_directories(${OpenCL_INCLUDE_DIRS}/Headers) - else() - include_directories(${OpenCL_INCLUDE_DIRS}) - endif() - add_definitions(-DPIP_OPENCL) - pip_resources(CL_RES "${PIP_SRC_OPENCL}/resources.conf") - add_library(pip_opencl ${PIP_LIB_TYPE} ${CPP_LIB_OPENCL} ${CL_RES} ${_RC}) - add_dependencies(pip_opencl pip_rc) + set(_opencl_lib OpenCL::OpenCL) if(${CMAKE_VERSION} VERSION_LESS "3.7.0") - target_link_libraries(pip_opencl pip OpenCL) - else() - target_link_libraries(pip_opencl pip OpenCL::OpenCL) + target_link_libraries(_opencl_lib OpenCL) endif() - list(APPEND LIBS_STATUS OpenCL) - list(APPEND PIP_LIBS_TARGETS pip_opencl) + pip_module(opencl "${_opencl_lib}" "PIP OpenCL support" "" " (${OpenCL_VERSION_STRING})") endif() - # Check if PIP IO Utils library supports crypt - set(IO_UTILS_LIBS pip) - import_version(pip_io_utils pip) - set_deploy_property(pip_io_utils ${PIP_LIB_TYPE} - LABEL "PIP I/O utilites" - FULLNAME "${_PIP_DOMAIN}.pip_io_utils" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_io_utils _RC) - add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS} ${_RC}) if(sodium_FOUND) - list(APPEND IO_UTILS_LIBS pip_crypt) + pip_module(io_utils "pip_crypt" "PIP I/O support" "" " (+crypt)") + else() + pip_module(io_utils "" "PIP I/O support" "" "") endif() - target_link_libraries(pip_io_utils ${IO_UTILS_LIBS}) - list(APPEND PIP_LIBS_TARGETS pip_io_utils) - # Build cloud library if crypt enabled - if(sodium_FOUND) - import_version(pip_cloud pip) - set_deploy_property(pip_cloud ${PIP_LIB_TYPE} - LABEL "PIP cloud transport support" - FULLNAME "${_PIP_DOMAIN}.pip_cloud" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_cloud _RC) - add_definitions(-DPIP_CLOUD) - add_library(pip_cloud ${PIP_LIB_TYPE} ${CPP_LIB_CLOUD} ${_RC}) - target_link_libraries(pip_cloud pip pip_crypt) - list(APPEND PIP_LIBS_TARGETS pip_cloud) - endif() - # Check Lua support if(MINGW) set(LUA_INCLUDE_DIR ${MINGW_INCLUDE}) endif() find_package(Lua QUIET) if (LUA_FOUND) - set(PIP_LUA "yes (${LUA_VERSION_STRING})") - import_version(pip_lua pip) - set_deploy_property(pip_lua ${PIP_LIB_TYPE} - LABEL "PIP Lua support" - FULLNAME "${_PIP_DOMAIN}.pip_lua" - COMPANY "${_PIP_COMPANY}" - INFO "Platform-Independent Primitives") - make_rc(pip_lua _RC) - add_definitions(-DPIP_LUA) - include_directories(${LUA_INCLUDE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd) + pip_module(lua "LUA" "PIP Lua support" "${LUA_INCLUDE_DIR};${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd" " (${LUA_VERSION_STRING})") list(APPEND HDR_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd/LuaBridge") - add_library(pip_lua ${PIP_LIB_TYPE} ${CPP_LIB_LUA} ${_RC}) - target_link_libraries(pip_lua pip ${LUA_LIBRARIES}) - list(APPEND LIBS_STATUS LUA) - list(APPEND PIP_LIBS_TARGETS pip_lua) endif() + # Test program if(PIP_UTILS) add_executable(pip_test "main.cpp") @@ -624,25 +495,29 @@ if (NOT CROSSTOOLS) else() - set(PIP_CRYPT "yes") - set(PIP_COMPRESS "yes") + set(PIP_MSG_crypt "yes") + set(PIP_MSG_compress "yes") + set(PIP_MODULES pip) add_definitions(-DPIP_CRYPT) add_library(pip_crypt ${PIP_LIB_TYPE} ${CPP_LIB_CRYPT}) target_link_libraries(pip_crypt pip) - list(APPEND PIP_LIBS_TARGETS pip_crypt) + list(APPEND PIP_MODULES pip_crypt) set(IO_UTILS_LIBS pip) add_library(pip_io_utils ${PIP_LIB_TYPE} ${CPP_LIB_IO_UTILS}) list(APPEND IO_UTILS_LIBS pip_crypt) target_link_libraries(pip_io_utils ${IO_UTILS_LIBS}) - list(APPEND PIP_LIBS_TARGETS pip_io_utils) + list(APPEND PIP_MODULES pip_io_utils) add_definitions(-DPIP_COMPRESS) add_library(pip_compress ${PIP_LIB_TYPE} ${CPP_LIB_COMPRESS}) target_link_libraries(pip_compress pip) - list(APPEND PIP_LIBS_TARGETS pip_compress) + list(APPEND PIP_MODULES pip_compress) endif() endif() +string(REPLACE ";" "," PIP_EXPORTS_STR "${PIP_EXPORTS}") +target_compile_definitions(pip PRIVATE "PICODE_DEFINES=\"${PIP_EXPORTS_STR}\"") + # Install # Check if system or local install will be used (to system install use "-DLIB=" argument of cmake) if(LIB) @@ -654,9 +529,9 @@ if(LIB) if(HDR_DIRS) install(DIRECTORY ${HDR_DIRS} DESTINATION ${MINGW_INCLUDE}/pip) endif() - install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION ${MINGW_LIB}) + install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION ${MINGW_LIB}) endif() - install(TARGETS ${PIP_LIBS_TARGETS} RUNTIME DESTINATION ${MINGW_BIN}) + install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION ${MINGW_BIN}) find_library(STDLIB "stdc++-6" PATHS ${MINGW_BIN} NO_DEFAULT_PATH) find_library(STDLIB "stdc++-6") #message("${STDLIB}") @@ -675,17 +550,17 @@ if(LIB) install(DIRECTORY ${HDR_DIRS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/pip) endif() endif() - install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) + install(TARGETS ${PIP_MODULES} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib) endif() file(GLOB CMAKES "cmake/*.cmake" "cmake/*.in" "cmake/android_debug.keystore") install(FILES ${CMAKES} DESTINATION ${CMAKE_ROOT}/Modules) else() if(NOT PIP_FREERTOS) if(WIN32) - install(TARGETS ${PIP_LIBS_TARGETS} RUNTIME DESTINATION bin) - install(TARGETS ${PIP_LIBS_TARGETS} ARCHIVE DESTINATION lib) + install(TARGETS ${PIP_MODULES} RUNTIME DESTINATION bin) + install(TARGETS ${PIP_MODULES} ARCHIVE DESTINATION lib) else() - install(TARGETS ${PIP_LIBS_TARGETS} DESTINATION lib) + install(TARGETS ${PIP_MODULES} DESTINATION lib) endif() install(FILES ${HDRS} DESTINATION include/pip) if(HDR_DIRS) @@ -698,7 +573,7 @@ if(NOT PIP_FREERTOS) # Auxiliary if (NOT CROSSTOOLS) - add_subdirectory("${PIP_SRC_MAIN}/auxiliary/piterminal") + add_subdirectory("utils/piterminal") endif() # Utils @@ -720,8 +595,8 @@ endif() # Libraries messages if(DEFINED LIBPROJECT) - set(PIP_LIBS_TARGETS ${PIP_LIBS_TARGETS} PARENT_SCOPE) - list(APPEND _ALL_TARGETS ${PIP_LIBS_TARGETS}) + set(PIP_MODULES ${PIP_MODULES} PARENT_SCOPE) + list(APPEND _ALL_TARGETS ${PIP_MODULES}) set(_ALL_TARGETS ${_ALL_TARGETS} PARENT_SCOPE) endif() @@ -735,8 +610,9 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS)) set(DOXY_PROJECT_NUMBER "${PIP_VERSION}") set(DOXY_QHP_CUST_FILTER_ATTRS "\"PIP ${PIP_VERSION}\"") set(DOXY_QHP_SECT_FILTER_ATTRS "\"PIP ${PIP_VERSION}\"") - set(DOXY_EXAMPLE_PATH "\"${PROJECT_SOURCE_DIR}/doc/examples\"") - set(DOXY_IMAGE_PATH "\"${PROJECT_SOURCE_DIR}/doc/images\"") + set(DOXY_EXAMPLE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/examples\"") + set(DOXY_IMAGE_PATH "\"${CMAKE_CURRENT_SOURCE_DIR}/doc/images\"") + set(DOXY_EXCLUDE "\"${CMAKE_CURRENT_SOURCE_DIR}/lib/lua/3rd\"") if(DOXYGEN_DOT_EXECUTABLE) string(REPLACE "\\" "" _DOT_PATH "${DOXYGEN_DOT_PATH}") set(DOXY_DOT_PATH "\"${_DOT_PATH}\"") @@ -744,11 +620,12 @@ if ((NOT PIP_FREERTOS) AND (NOT CROSSTOOLS)) set(DOXY_DIA_PATH "\"${_DOT_PATH}\"") endif() set(DOXY_INPUT) - foreach(F ${PIP_SRC_DIRS}) - list(APPEND DOXY_INPUT "\"${PROJECT_SOURCE_DIR}/${F}\"") + foreach(F ${PIP_MAIN_FOLDERS}) + list(APPEND DOXY_INPUT "\"${F}\"") endforeach(F) - string(REPLACE ";" " " DOXY_INPUT "${DOXY_INPUT}") - string(REPLACE ";" " " DOXY_INCLUDE_PATH "${PIP_MAIN_FOLDERS}") + string(REPLACE ";" " " DOXY_INPUT "\"${CMAKE_CURRENT_SOURCE_DIR}/lib\"") + string(REPLACE ";" " " DOXY_INCLUDE_PATH "${DOXY_INPUT}") + string(REPLACE ";" " " DOXY_DEFINES "${PIP_EXPORTS};DOXYGEN;PIOBJECT;PIOBJECT_SUBCLASS") add_documentation(doc doc/Doxyfile.in) install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc/html DESTINATION ../share/doc/pip COMPONENT doc EXCLUDE_FROM_ALL OPTIONAL) endif() @@ -756,6 +633,7 @@ endif() +list(REMOVE_ITEM LIBS_STATUS ${PIP_MODULES}) message("----------PIP----------") message(" Version: ${PIP_VERSION} ") message(" Linkage: ${PIP_LIB_TYPE_MSG}") @@ -778,15 +656,9 @@ if(INTROSPECTION) endif() message("") message(" Modules:") -message(" USB : ${PIP_USB}") -message(" Console : yes") -message(" Crypt : ${PIP_CRYPT}") -message(" Compress : ${PIP_COMPRESS}") -message(" FFTW : ${PIP_FFTW}") -message(" OpenCL : ${PIP_OPENCL}") -message(" IOUtils : ${PIP_IOUTILS}") -message(" Cloud : ${PIP_CLOUD}") -message(" Lua : ${PIP_LUA}") +foreach(_m ${PIP_SRC_MODULES}) + message(" ${_m}: ${PIP_MSG_${_m}}") +endforeach() if (PIP_TESTS_LIST) message("") message(" Tests:") @@ -803,10 +675,12 @@ if(NOT PIP_FREERTOS) message("") message(" Using libraries:") foreach(LIB_ ${LIBS_STATUS}) - if(${LIB_}_FOUND) - message(" ${LIB_} -> ${${LIB_}_LIBRARIES}") - else() - message(" ${LIB_} not found, may fail") + if (NOT TARGET ${LIB_}) + if(${LIB_}_FOUND) + message(" ${LIB_} -> ${${LIB_}_LIBRARIES}") + else() + message(" ${LIB_} not found, may fail") + endif() endif() endforeach() endif() diff --git a/cmake/PIPDocumentation.cmake b/cmake/PIPDocumentation.cmake index e034bad2..9e9a099a 100644 --- a/cmake/PIPDocumentation.cmake +++ b/cmake/PIPDocumentation.cmake @@ -1,27 +1,6 @@ -macro(CONFIGURE_DOXYGEN_FILE DOXYGEN_CONFIG_FILE FILE_NAME_SUFFIX) - if(EXISTS ${PROJECT_SOURCE_DIR}/${DOXYGEN_CONFIG_FILE}) - file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${FILE_NAME_SUFFIX}") - file(READ ${PROJECT_SOURCE_DIR}/${DOXYGEN_CONFIG_FILE} DOXYFILE_CONTENTS) - string(REPLACE "\\\n" " " DOXYFILE_CONTENTS "${DOXYFILE_CONTENTS}") - string(REPLACE "\n" ";" DOXYFILE_LINES "${DOXYFILE_CONTENTS}") - foreach(LINE IN LISTS DOXYFILE_LINES) - if(LINE STRGREATER "") - string(REGEX MATCH "^[a-zA-Z]([^ ])+" DOXY_PARAM ${LINE}) - if(DEFINED DOXY_${DOXY_PARAM}) - STRING(REGEX REPLACE "=([^\n])+" "= ${DOXY_${DOXY_PARAM}}" LINE ${LINE}) - endif(DEFINED DOXY_${DOXY_PARAM}) - endif() - file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${FILE_NAME_SUFFIX} "${LINE}\n") - endforeach() - else() - MESSAGE(SEND_ERROR "Doxygen configuration file '${DOXYGEN_CONFIG_FILE}' not found, can`t generate documentation") - endif() -endmacro(CONFIGURE_DOXYGEN_FILE) - - macro(ADD_DOCUMENTATION TARGET DOXYGEN_CONFIG_FILE) if(DOXYGEN_FOUND) - configure_doxygen_file(${DOXYGEN_CONFIG_FILE} ${TARGET}) + configure_file("${PROJECT_SOURCE_DIR}/${DOXYGEN_CONFIG_FILE}" "${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${TARGET}") add_custom_target("genereate.${TARGET}" COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doxyfile-${TARGET}) add_custom_target("${TARGET}" COMMAND ${CMAKE_COMMAND} -D COMPONENT=doc -P cmake_install.cmake) add_dependencies("${TARGET}" "genereate.${TARGET}") diff --git a/doc/Doxyfile.in b/doc/Doxyfile.in index 462dd31b..cbc2f526 100644 --- a/doc/Doxyfile.in +++ b/doc/Doxyfile.in @@ -38,7 +38,7 @@ PROJECT_NAME = PIP # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.8.0 +PROJECT_NUMBER = ${DOXY_PROJECT_NUMBER} # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a @@ -816,13 +816,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = src_main \ - src_crypt \ - src_fftw \ - src_io_utils \ - src_compress \ - src_opencl \ - src_usb +INPUT = ${DOXY_INPUT} # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -895,7 +889,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = +EXCLUDE = ${DOXY_EXCLUDE} # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -928,7 +922,7 @@ EXCLUDE_SYMBOLS = # that contain example code fragments that are included (see the \include # command). -EXAMPLE_PATH = doc/examples +EXAMPLE_PATH = ${DOXY_EXAMPLE_PATH} # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and @@ -948,7 +942,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = doc/images +IMAGE_PATH = ${DOXY_IMAGE_PATH} # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -1459,14 +1453,14 @@ QHP_CUST_FILTER_NAME = PIP # filters). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_CUST_FILTER_ATTRS = PIP +QHP_CUST_FILTER_ATTRS = ${DOXY_QHP_CUST_FILTER_ATTRS} # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: # http://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. -QHP_SECT_FILTER_ATTRS = PIP +QHP_SECT_FILTER_ATTRS = ${DOXY_QHP_SECT_FILTER_ATTRS} # The QHG_LOCATION tag can be used to specify the location of Qt's # qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the @@ -2152,15 +2146,7 @@ SEARCH_INCLUDES = YES # preprocessor. # This tag requires that the tag SEARCH_INCLUDES is set to YES. -INCLUDE_PATH = src_main/code \ - src_main/containers \ - src_main/core \ - src_main/math \ - src_main/system \ - src_main/thread \ - src_main/console \ - src_main/io_devices \ - src_main/io_utils +INCLUDE_PATH = ${DOXY_INCLUDE_PATH} # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the @@ -2178,8 +2164,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = DOXYGEN \ - PIP_EXPORT +PREDEFINED = ${DOXY_DEFINES} + # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The @@ -2272,14 +2258,14 @@ CLASS_DIAGRAMS = YES # the mscgen tool resides. If left empty the tool is assumed to be found in the # default search path. -MSCGEN_PATH = "C:/Program Files/doxygen/graphviz/bin" +MSCGEN_PATH = ${DOXY_MSCGEN_PATH} # You can include diagrams made with dia in doxygen documentation. Doxygen will # then run dia to produce the diagram and insert it in the documentation. The # DIA_PATH tag allows you to specify the directory where the dia binary resides. # If left empty dia is assumed to be found in the default search path. -DIA_PATH = "C:/Program Files/doxygen/graphviz/bin" +DIA_PATH = ${DOXY_DIA_PATH} # If set to YES the inheritance and collaboration graphs will hide inheritance # and usage relations if the target is undocumented or is not a class. @@ -2472,7 +2458,7 @@ INTERACTIVE_SVG = NO # found. If left blank, it is assumed the dot tool can be found in the path. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_PATH = "C:/Program Files/doxygen/graphviz/bin" +DOT_PATH = ${DOXY_DOT_PATH} # The DOTFILE_DIRS tag can be used to specify one or more directories that # contain dot files that are included in the documentation (see the \dotfile diff --git a/lib/fftw/pifft_p.h b/lib/fftw/pifft_p.h index b4551a94..04c61169 100644 --- a/lib/fftw/pifft_p.h +++ b/lib/fftw/pifft_p.h @@ -36,7 +36,7 @@ template -class PIP_EXPORT PIFFTW_Private +class PIFFTW_Private { public: explicit PIFFTW_Private() { diff --git a/lib/main/cloud/piccloudclient.h b/lib/main/cloud/piccloudclient.h index 30eea971..8765c38d 100644 --- a/lib/main/cloud/piccloudclient.h +++ b/lib/main/cloud/piccloudclient.h @@ -23,10 +23,11 @@ #ifndef PICCLOUDCLIENT_H #define PICCLOUDCLIENT_H +#include "pip_cloud_export.h" #include "piiodevice.h" -class PIP_EXPORT PICloudClient { +class PIP_CLOUD_EXPORT PICloudClient { public: //! explicit PICloudClient(); diff --git a/lib/main/cloud/piccloudserver.h b/lib/main/cloud/piccloudserver.h index eb65d1de..cf0e4e23 100644 --- a/lib/main/cloud/piccloudserver.h +++ b/lib/main/cloud/piccloudserver.h @@ -23,10 +23,11 @@ #ifndef PICCLOUDSERVER_H #define PICCLOUDSERVER_H +#include "pip_cloud_export.h" #include "piiodevice.h" -class PIP_EXPORT PICloudServer { +class PIP_CLOUD_EXPORT PICloudServer { public: //! explicit PICloudServer(); diff --git a/lib/main/cloud/piccloudtcp.h b/lib/main/cloud/piccloudtcp.h index 2d0c0703..ea0e4f5c 100644 --- a/lib/main/cloud/piccloudtcp.h +++ b/lib/main/cloud/piccloudtcp.h @@ -23,9 +23,10 @@ #ifndef PICCLOUDTCP_H #define PICCLOUDTCP_H +#include "pip_cloud_export.h" #include "pistring.h" -class PIP_EXPORT PICloudTCP { +class PIP_CLOUD_EXPORT PICloudTCP { public: //! PICloudTCP(); diff --git a/lib/main/code/picodeinfo.h b/lib/main/code/picodeinfo.h index 5b182fc5..97506149 100644 --- a/lib/main/code/picodeinfo.h +++ b/lib/main/code/picodeinfo.h @@ -30,7 +30,7 @@ class PIVariant; namespace PICodeInfo { -enum PIP_EXPORT TypeFlag { +enum TypeFlag { NoFlag, Const = 0x01, Static = 0x02, @@ -153,10 +153,10 @@ inline PICout operator <<(PICout s, const PICodeInfo::EnumInfo & v) { return s; } -extern PIMap * classesInfo; -extern PIMap * enumsInfo; -extern PIMap * accessValueFunctions; -extern PIMap * accessTypeFunctions; +extern PIP_EXPORT PIMap * classesInfo; +extern PIP_EXPORT PIMap * enumsInfo; +extern PIP_EXPORT PIMap * accessValueFunctions; +extern PIP_EXPORT PIMap * accessTypeFunctions; inline PIByteArray getMemberValue(const void * p, const char * class_name, const char * member_name) { if (!p || !class_name || !member_name || !accessValueFunctions) return PIByteArray(); @@ -172,11 +172,11 @@ inline const char * getMemberType(const char * class_name, const char * member_n return af(member_name); } -PIVariant getMemberAsVariant(const void * p, const char * class_name, const char * member_name); +PIP_EXPORT PIVariant getMemberAsVariant(const void * p, const char * class_name, const char * member_name); } -class __PICodeInfoInitializer__ { +class PIP_EXPORT __PICodeInfoInitializer__ { public: __PICodeInfoInitializer__() { if (_inited_) return; diff --git a/lib/main/code/picodeparser.cpp b/lib/main/code/picodeparser.cpp index d4301feb..99c02061 100644 --- a/lib/main/code/picodeparser.cpp +++ b/lib/main/code/picodeparser.cpp @@ -186,6 +186,9 @@ void PICodeParser::clear() { evaluator.clearCustomVariables(); cur_def_vis = Global; anon_num = 0; + PIStringList defs = PIStringAscii(PICODE_DEFINES).split(","); + piForeachC (PIString & d, defs) + defines << Define(d, ""); defines << Define(PIStringAscii("PICODE"), "") << custom_defines; } diff --git a/lib/main/code/picodeparser.h b/lib/main/code/picodeparser.h index 9eaf2821..716dda9a 100644 --- a/lib/main/code/picodeparser.h +++ b/lib/main/code/picodeparser.h @@ -33,8 +33,8 @@ class PIP_EXPORT PICodeParser { public: PICodeParser(); - enum PIP_EXPORT Visibility {Global, Public, Protected, Private}; - enum PIP_EXPORT Attribute { + enum Visibility {Global, Public, Protected, Private}; + enum Attribute { NoAttributes = 0x0, Const = 0x01, Static = 0x02, diff --git a/lib/main/console/pikbdlistener.h b/lib/main/console/pikbdlistener.h index 5ea90cd6..d1eab548 100644 --- a/lib/main/console/pikbdlistener.h +++ b/lib/main/console/pikbdlistener.h @@ -228,7 +228,7 @@ private: static const EscSeq esc_seq[]; #endif - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) KBFunc ret_func; int exit_key; bool exit_enabled, is_active; diff --git a/lib/main/console/piscreen.h b/lib/main/console/piscreen.h index 493fc84e..34439e1b 100644 --- a/lib/main/console/piscreen.h +++ b/lib/main/console/piscreen.h @@ -23,11 +23,12 @@ #ifndef PISCREEN_H #define PISCREEN_H +#include "pip_console_export.h" #include "piscreentile.h" #include "piscreendrawer.h" -class PIP_EXPORT PIScreen: public PIThread, public PIScreenTypes::PIScreenBase +class PIP_CONSOLE_EXPORT PIScreen: public PIThread, public PIScreenTypes::PIScreenBase { PIOBJECT_SUBCLASS(PIScreen, PIThread) class SystemConsole; @@ -100,7 +101,7 @@ public: //! \} private: - class SystemConsole { + class PIP_CONSOLE_EXPORT SystemConsole { public: SystemConsole(); ~SystemConsole(); @@ -124,7 +125,7 @@ private: #else PIString formatString(const PIScreenTypes::Cell & c); #endif - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_CONSOLE_EXPORT) int width, height, pwidth, pheight; int mouse_x, mouse_y; PIVector > cells, pcells; diff --git a/lib/main/console/piscreenconsole.h b/lib/main/console/piscreenconsole.h index 4b745b1d..7d0582ff 100644 --- a/lib/main/console/piscreenconsole.h +++ b/lib/main/console/piscreenconsole.h @@ -25,12 +25,13 @@ #ifndef PISCREENCONSOLE_H #define PISCREENCONSOLE_H +#include "pip_console_export.h" #include "piscreentiles.h" /// NOTE: incomplete class /// TODO: write TileVars -class PIP_EXPORT TileVars: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileVars: public PIScreenTile { public: TileVars(const PIString & n = PIString()); protected: @@ -68,7 +69,7 @@ protected: -class PIP_EXPORT PIScreenConsoleTile : public PIScreenTile +class PIP_CONSOLE_EXPORT PIScreenConsoleTile : public PIScreenTile { public: PIScreenConsoleTile(); diff --git a/lib/main/console/piscreendrawer.h b/lib/main/console/piscreendrawer.h index 3efd48fd..6a118adb 100644 --- a/lib/main/console/piscreendrawer.h +++ b/lib/main/console/piscreendrawer.h @@ -23,10 +23,11 @@ #ifndef PISCREENDRAWER_H #define PISCREENDRAWER_H +#include "pip_console_export.h" #include "piscreentypes.h" #include "pistring.h" -class PIP_EXPORT PIScreenDrawer +class PIP_CONSOLE_EXPORT PIScreenDrawer { friend class PIScreen; PIScreenDrawer(PIVector > & c); diff --git a/lib/main/console/piscreentile.h b/lib/main/console/piscreentile.h index e9ab7b30..28e7dcd7 100644 --- a/lib/main/console/piscreentile.h +++ b/lib/main/console/piscreentile.h @@ -23,12 +23,13 @@ #ifndef PISCREENTILE_H #define PISCREENTILE_H +#include "pip_console_export.h" #include "piscreentypes.h" #include "pikbdlistener.h" class PIScreenDrawer; -class PIP_EXPORT PIScreenTile: public PIObject { +class PIP_CONSOLE_EXPORT PIScreenTile: public PIObject { friend class PIScreen; PIOBJECT_SUBCLASS(PIScreenTile, PIObject) public: diff --git a/lib/main/console/piscreentiles.h b/lib/main/console/piscreentiles.h index b6c41a25..ee617156 100644 --- a/lib/main/console/piscreentiles.h +++ b/lib/main/console/piscreentiles.h @@ -23,10 +23,11 @@ #ifndef PISCREENTILES_H #define PISCREENTILES_H +#include "pip_console_export.h" #include "piscreentile.h" -class PIP_EXPORT TileSimple: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileSimple: public PIScreenTile { PIOBJECT_SUBCLASS(TileSimple, PIScreenTile) public: typedef PIPair Row; @@ -43,7 +44,7 @@ protected: class TileList; -class PIP_EXPORT TileScrollBar: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileScrollBar: public PIScreenTile { PIOBJECT_SUBCLASS(TileScrollBar, PIScreenTile) friend class TileList; public: @@ -66,7 +67,7 @@ protected: }; -class PIP_EXPORT TileList: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileList: public PIScreenTile { PIOBJECT_SUBCLASS(TileList, PIScreenTile) public: TileList(const PIString & n = PIString()); @@ -98,7 +99,7 @@ protected: }; -class PIP_EXPORT TileButton: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileButton: public PIScreenTile { PIOBJECT_SUBCLASS(TileButton, PIScreenTile) public: TileButton(const PIString & n = PIString()); @@ -118,7 +119,7 @@ protected: -class PIP_EXPORT TileButtons: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileButtons: public PIScreenTile { PIOBJECT_SUBCLASS(TileButtons, PIScreenTile) public: TileButtons(const PIString & n = PIString()); @@ -143,7 +144,7 @@ protected: }; -class PIP_EXPORT TileCheck: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileCheck: public PIScreenTile { PIOBJECT_SUBCLASS(TileCheck, PIScreenTile) public: TileCheck(const PIString & n = PIString()); @@ -162,7 +163,7 @@ protected: }; -class PIP_EXPORT TileProgress: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileProgress: public PIScreenTile { PIOBJECT_SUBCLASS(TileProgress, PIScreenTile) public: TileProgress(const PIString & n = PIString()); @@ -178,7 +179,7 @@ protected: }; -class PIP_EXPORT TilePICout: public TileList { +class PIP_CONSOLE_EXPORT TilePICout: public TileList { PIOBJECT_SUBCLASS(TilePICout, PIScreenTile) public: TilePICout(const PIString & n = PIString()); @@ -191,7 +192,7 @@ protected: }; -class PIP_EXPORT TileInput: public PIScreenTile { +class PIP_CONSOLE_EXPORT TileInput: public PIScreenTile { PIOBJECT_SUBCLASS(TileInput, PIScreenTile) public: TileInput(const PIString & n = PIString()); diff --git a/lib/main/console/piscreentypes.h b/lib/main/console/piscreentypes.h index 34c3349b..2d88cea7 100644 --- a/lib/main/console/piscreentypes.h +++ b/lib/main/console/piscreentypes.h @@ -23,6 +23,7 @@ #ifndef PISCREENTYPES_H #define PISCREENTYPES_H +#include "pip_console_export.h" #include "pivariant.h" class PIScreenTile; @@ -30,7 +31,7 @@ class PIScreenTile; namespace PIScreenTypes { //! Color for chars or background - enum PIP_EXPORT Color { + enum Color { Default /** Default */, Black /** Black */, Red /** Red */, @@ -44,7 +45,7 @@ namespace PIScreenTypes { }; //! Flags for chars - enum PIP_EXPORT CharFlag { + enum CharFlag { Bold /** Bold or bright */ = 0x1, Blink /** Blink text */ = 0x2, Underline /** Underline text */ = 0x4, @@ -52,14 +53,14 @@ namespace PIScreenTypes { }; //! Alignment - enum PIP_EXPORT Alignment { + enum Alignment { Left /** Left */ , Center /** Center */ , Right /** Right */ }; //! Size policy - enum PIP_EXPORT SizePolicy { + enum SizePolicy { Fixed /** Fixed size */ , Preferred /** Preferred size */ , Expanding /** Maximum available size */ , @@ -67,13 +68,13 @@ namespace PIScreenTypes { }; //! Direction - enum PIP_EXPORT Direction { + enum Direction { Horizontal /** Horizontal */ , Vertical /** Vertical */ }; //! Focus flags - enum PIP_EXPORT FocusFlag { + enum FocusFlag { CanHasFocus /** Tile can has focus */ = 0x1, NextByTab /** Focus passed to next tile by tab key */ = 0x2, NextByArrowsHorizontal /** Focus passed to next tile by arrow keys left or right */ = 0x4, @@ -87,7 +88,7 @@ namespace PIScreenTypes { typedef PIFlags CharFlags; typedef PIFlags FocusFlags; - union PIP_EXPORT CellFormat { + union PIP_CONSOLE_EXPORT CellFormat { CellFormat(ushort f = 0) {raw_format = f;} CellFormat(Color col_char, Color col_back = Default, CharFlags flags_ = 0) { color_char = col_char; @@ -104,7 +105,7 @@ namespace PIScreenTypes { bool operator !=(const CellFormat & c) const {return raw_format != c.raw_format;} }; - struct PIP_EXPORT Cell { + struct PIP_CONSOLE_EXPORT Cell { Cell(PIChar c = PIChar(' '), CellFormat f = CellFormat()) {symbol = c; format = f;} CellFormat format; PIChar symbol; @@ -120,7 +121,7 @@ namespace PIScreenTypes { } }; - struct PIP_EXPORT TileEvent { + struct PIP_CONSOLE_EXPORT TileEvent { TileEvent(int t = -1, const PIVariant & d = PIVariant()): type(t), data(d) {} int type; PIVariant data; diff --git a/lib/main/console/piterminal.h b/lib/main/console/piterminal.h index 040892dd..b519d6bd 100644 --- a/lib/main/console/piterminal.h +++ b/lib/main/console/piterminal.h @@ -23,11 +23,12 @@ #ifndef PITERMINAL_H #define PITERMINAL_H +#include "pip_console_export.h" #include "pikbdlistener.h" #include "piscreentypes.h" -class PIP_EXPORT PITerminal: public PIThread +class PIP_CONSOLE_EXPORT PITerminal: public PIThread { PIOBJECT_SUBCLASS(PITerminal, PIThread) public: @@ -63,7 +64,7 @@ private: int termType(const PIString & t); #endif - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_CONSOLE_EXPORT) int dsize_x, dsize_y; int size_x, size_y, cursor_x, cursor_y; bool cursor_blink, cursor_visible; diff --git a/lib/main/containers/pipair.h b/lib/main/containers/pipair.h index 670b240a..0e91ed31 100644 --- a/lib/main/containers/pipair.h +++ b/lib/main/containers/pipair.h @@ -30,7 +30,7 @@ class PICout; template -class PIP_EXPORT PIPair { +class PIPair { public: PIPair() {first = Type0(); second = Type1();} PIPair(const Type0 & value0, const Type1 & value1) {first = value0; second = value1;} diff --git a/lib/main/containers/piqueue.h b/lib/main/containers/piqueue.h index cebd1d76..5c56b1b0 100644 --- a/lib/main/containers/piqueue.h +++ b/lib/main/containers/piqueue.h @@ -30,7 +30,7 @@ template -class PIP_EXPORT PIQueue: public PIDeque { +class PIQueue: public PIDeque { public: PIQueue() {} virtual ~PIQueue() {} diff --git a/lib/main/containers/piset.h b/lib/main/containers/piset.h index 5a819f78..50603403 100644 --- a/lib/main/containers/piset.h +++ b/lib/main/containers/piset.h @@ -35,7 +35,7 @@ * has logarithmic complexity. */ template -class PIP_EXPORT PISet: public PIMap { +class PISet: public PIMap { typedef PIMap _CSet; public: diff --git a/lib/main/containers/pistack.h b/lib/main/containers/pistack.h index 02e62318..5b65fa90 100644 --- a/lib/main/containers/pistack.h +++ b/lib/main/containers/pistack.h @@ -28,7 +28,7 @@ #include "pivector.h" template -class PIP_EXPORT PIStack: public PIVector { +class PIStack: public PIVector { public: PIStack() {;} virtual ~PIStack() {;} diff --git a/lib/main/core/pibase.h b/lib/main/core/pibase.h index 0fb52771..e0b1dd0a 100644 --- a/lib/main/core/pibase.h +++ b/lib/main/core/pibase.h @@ -192,10 +192,10 @@ // Private data macros -#define PRIVATE_DECLARATION \ +#define PRIVATE_DECLARATION(e) \ struct __Private__; \ friend struct __Private__; \ - struct __PrivateInitializer__ { \ + struct e __PrivateInitializer__ { \ __PrivateInitializer__(); \ __PrivateInitializer__(const __PrivateInitializer__ & o); \ ~__PrivateInitializer__(); \ diff --git a/lib/main/core/pibytearray.h b/lib/main/core/pibytearray.h index 47f61f78..79fdf39b 100644 --- a/lib/main/core/pibytearray.h +++ b/lib/main/core/pibytearray.h @@ -138,7 +138,7 @@ inline std::ostream & operator <<(std::ostream & s, const PIByteArray & ba); #endif //! \relatesalso PIByteArray \brief Output to PICout operator -PICout operator <<(PICout s, const PIByteArray & ba); +PIP_EXPORT PICout operator <<(PICout s, const PIByteArray & ba); #define PBA_OPERATOR_TO int os = s.size_s(); s.enlarge(sizeof(v)); memcpy(s.data(os), &v, sizeof(v)); @@ -212,7 +212,7 @@ inline PIByteArray & operator >>(PIByteArray & s, ldouble & v) {assert(s.size() //! \relatesalso PIByteArray \brief Restore operator template inline PIByteArray & operator >>(PIByteArray & s, PIFlags & v) {PBA_OPERATOR_FROM return s;} //! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details -PIByteArray & operator >>(PIByteArray & s, PIByteArray & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PIByteArray & v); //! \relatesalso PIByteArray \brief Restore operator, see \ref PIByteArray_sec1 for details inline PIByteArray & operator >>(PIByteArray & s, PIByteArray::RawData v) {assert(s.size_s() >= v.s); if (v.s > 0) memcpy((void*)(v.d), s.data(), v.s); s.remove(0, v.s); return s;} diff --git a/lib/main/core/pichar.h b/lib/main/core/pichar.h index cf7dbe0f..5b18db41 100644 --- a/lib/main/core/pichar.h +++ b/lib/main/core/pichar.h @@ -25,9 +25,9 @@ #include "piincludes.h" -extern char * __syslocname__; -extern char * __sysoemname__; -extern char * __utf8name__; +extern PIP_EXPORT char * __syslocname__; +extern PIP_EXPORT char * __sysoemname__; +extern PIP_EXPORT char * __utf8name__; class PIP_EXPORT PIChar { diff --git a/lib/main/core/picout.h b/lib/main/core/picout.h index 19eab8ec..6e4b39d6 100644 --- a/lib/main/core/picout.h +++ b/lib/main/core/picout.h @@ -46,7 +46,7 @@ class PIObject; namespace PICoutManipulators { //! \brief Enum contains special characters - enum PIP_EXPORT PICoutSpecialChar { + enum PICoutSpecialChar { Null /*! Null-character, '\\0' */, NewLine /*! New line character, '\\n' */, Tab /*! Tab character, '\\t' */, @@ -55,7 +55,7 @@ namespace PICoutManipulators { }; //! \brief Enum contains immediate action - enum PIP_EXPORT PICoutAction { + enum PICoutAction { Flush /*! Flush the output */, Backspace /*! Remove last symbol */, ShowCursor /*! Show cursor */, @@ -67,7 +67,7 @@ namespace PICoutManipulators { }; //! \brief Enum contains control of PICout - enum PIP_EXPORT PICoutControl { + enum PICoutControl { AddNone /*! No controls */ = 0x0, AddSpaces /*! Spaces will be appear after each output */ = 0x1, AddNewLine /*! New line will be appear after all output */ = 0x2, @@ -78,7 +78,7 @@ namespace PICoutManipulators { }; //! \brief Enum contains output format - enum PIP_EXPORT PICoutFormat { + enum PICoutFormat { Bin /*! Binary representation of integers */ = 0x01, Oct /*! Octal representation of integers */ = 0x02, Dec /*! Decimal representation of integers */ = 0x04, @@ -128,7 +128,7 @@ public: ~PICout(); - class Notifier { + class PIP_EXPORT Notifier { public: static Notifier * instance(); static PIObject * object(); @@ -291,7 +291,7 @@ private: void applyFormat(PICoutManipulators::PICoutFormat f); static OutputDevices devs; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) bool fo_, cc_, fc_, act_; int cnb_, attr_, id_; PIString * buffer_; diff --git a/lib/main/core/piflags.h b/lib/main/core/piflags.h index 202027f9..d7584dd5 100644 --- a/lib/main/core/piflags.h +++ b/lib/main/core/piflags.h @@ -32,7 +32,7 @@ * \snippet piincludes.cpp flags */ template -class PIP_EXPORT PIFlags { +class PIFlags { public: //! Constructor with flags = 0 PIFlags(): flags(0) {;} diff --git a/lib/main/core/piincludes.h b/lib/main/core/piincludes.h index 7d74775e..ba158476 100644 --- a/lib/main/core/piincludes.h +++ b/lib/main/core/piincludes.h @@ -39,7 +39,7 @@ class PICout; struct lconv; -extern lconv * currentLocale; +extern PIP_EXPORT lconv * currentLocale; /*! \fn errorString() * \brief Return readable error description in format "code - " */ diff --git a/lib/main/core/piinit.h b/lib/main/core/piinit.h index d72d7b1f..e0dad2c8 100644 --- a/lib/main/core/piinit.h +++ b/lib/main/core/piinit.h @@ -63,7 +63,7 @@ private: explicit PIInit(); void setFileCharset(const char *charset); bool fileExists(const PIString & p); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) char * file_charset; }; diff --git a/lib/main/core/piobject.h b/lib/main/core/piobject.h index 9bb9aeb8..6bf52e8c 100644 --- a/lib/main/core/piobject.h +++ b/lib/main/core/piobject.h @@ -800,7 +800,7 @@ public: static bool isTypeOf(const void * o) {return isTypeOf((PIObject*)o);} static PIString simplifyType(const char * a); - struct __MetaFunc { + struct PIP_EXPORT __MetaFunc { __MetaFunc(): addr(0), addrV(0) {;} bool isNull() const {return addr == 0;} PIString arguments() const; @@ -813,7 +813,7 @@ public: PIStringList types; PIStringList names; }; - struct __MetaData { + struct PIP_EXPORT __MetaData { __MetaData() {scope_list << PIStringAscii("PIObject"); scope_id << PIStringAscii("PIObject").hash();} void addScope(const PIString & s, uint shash); PIStringList scope_list; @@ -919,7 +919,7 @@ private: }; -void dumpApplication(); -bool dumpApplicationToFile(const PIString & path); +PIP_EXPORT void dumpApplication(); +PIP_EXPORT bool dumpApplicationToFile(const PIString & path); #endif // PIOBJECT_H diff --git a/lib/main/core/pipropertystorage.h b/lib/main/core/pipropertystorage.h index 56c09a51..a4a8ad15 100644 --- a/lib/main/core/pipropertystorage.h +++ b/lib/main/core/pipropertystorage.h @@ -32,14 +32,14 @@ * contains unique name and you can identify property by name with propertyValueByName(), propertyByName(). * You can add property using addProperty(const Property&), addProperty(const PIString&, const PIVariant&, const PIString&, int). */ -class PIPropertyStorage { +class PIP_EXPORT PIPropertyStorage { public: PIPropertyStorage() {} /** * @brief PIPropertyStorage element. */ - struct Property { + struct PIP_EXPORT Property { Property(const PIString & n = PIString(), const PIString & c = PIString(), const PIVariant & v = PIVariant(), int f = 0): name(n), comment(c), value(v), flags(f) {} diff --git a/lib/main/core/pivariant.h b/lib/main/core/pivariant.h index d40fa561..f5da7ce1 100644 --- a/lib/main/core/pivariant.h +++ b/lib/main/core/pivariant.h @@ -39,7 +39,7 @@ template -class PIP_EXPORT __PIVariantFunctions__ { +class __PIVariantFunctions__ { public: static PIString typeNameHelper() {return PIStringAscii("");} @@ -59,7 +59,7 @@ struct PIP_EXPORT __PIVariantInfo__ { }; template -struct PIP_EXPORT __PIVariantTypeInfo__ { +struct __PIVariantTypeInfo__ { typedef T PureType; typedef const T ConstPureType; typedef T * PointerType; @@ -102,7 +102,7 @@ REGISTER_VARIANT_TYPEINFO(ns::classname) #define REGISTER_VARIANT_CPP(classname) \ template \ -class PIP_EXPORT __##classname##_PIVariantInitializer__ { \ +class __##classname##_PIVariantInitializer__ { \ public: \ __##classname##_PIVariantInitializer__(const PIString & name) { \ if (__PIVariantInfoStorage__::get()->map->contains(name)) \ @@ -115,7 +115,7 @@ public: \ #define REGISTER_NS_VARIANT_CPP(ns, classname) \ template \ -class PIP_EXPORT __##ns##classname##_PIVariantInitializer__ { \ +class __##ns##classname##_PIVariantInitializer__ { \ public: \ __##ns##classname##_PIVariantInitializer__(const PIString & name) { \ if (__PIVariantInfoStorage__::get()->map->contains(name)) \ @@ -155,7 +155,7 @@ PIByteArray __PIVariantFunctions__::castHelper(PIB PIByteArray ret; ret << t; \ return ret;} \ template \ -class PIP_EXPORT __##classname_from##_##classname_to##_PIVariantCastInitializer__ { \ +class __##classname_from##_##classname_to##_PIVariantCastInitializer__ { \ public: \ __##classname_from##_##classname_to##_PIVariantCastInitializer__(const PIString & name, const PIString & cname) { \ __PIVariantInfo__ * vi(__PIVariantInfoStorage__::get()->map->value(name, 0)); \ @@ -206,7 +206,7 @@ class PIP_EXPORT PIVariant { public: //! Type of %PIVariant content - enum PIP_EXPORT Type { + enum Type { pivInvalid /** Invalid type , default type of empty contructor */ = 0 , pivBool /** bool */ , pivChar /** char */ , diff --git a/lib/main/crypt/piauth.h b/lib/main/crypt/piauth.h index 55559484..947d7e77 100644 --- a/lib/main/crypt/piauth.h +++ b/lib/main/crypt/piauth.h @@ -23,11 +23,12 @@ #ifndef PIAUTH_H #define PIAUTH_H +#include "pip_crypt_export.h" #include "piobject.h" #include "picrypt.h" -class PIP_EXPORT PIAuth : public PIObject +class PIP_CRYPT_EXPORT PIAuth : public PIObject { PIOBJECT(PIAuth) public: diff --git a/lib/main/crypt/picrypt.h b/lib/main/crypt/picrypt.h index e9eea9cd..67fe3a6b 100644 --- a/lib/main/crypt/picrypt.h +++ b/lib/main/crypt/picrypt.h @@ -23,9 +23,10 @@ #ifndef PICRYPT_H #define PICRYPT_H +#include "pip_crypt_export.h" #include "pistring.h" -class PIP_EXPORT PICrypt { +class PIP_CRYPT_EXPORT PICrypt { public: //! Construct and generate random key PICrypt(); diff --git a/lib/main/geo/pigeoposition.h b/lib/main/geo/pigeoposition.h index ef6ead1e..bb301198 100644 --- a/lib/main/geo/pigeoposition.h +++ b/lib/main/geo/pigeoposition.h @@ -30,8 +30,7 @@ class PIP_EXPORT PIGeoPosition : public PIMathVectorT3d { public: - enum CoordinateSystem - { + enum CoordinateSystem { Unknown=0, /// Unknown coordinate system Geodetic, /// Geodetic latitude, longitude, and height above ellipsoid Geocentric, /// Geocentric (regular spherical coordinates) diff --git a/lib/main/introspection/piintrospection_containers_p.h b/lib/main/introspection/piintrospection_containers_p.h index f9d24a71..7ace0e6d 100644 --- a/lib/main/introspection/piintrospection_containers_p.h +++ b/lib/main/introspection/piintrospection_containers_p.h @@ -44,7 +44,7 @@ public: PIVector getInfo() const; #pragma pack(push, 1) - struct _Type { + struct PIP_EXPORT _Type { _Type(); uint id; uint count; @@ -54,7 +54,7 @@ public: }; #pragma pack(pop) - struct TypeInfo: _Type { + struct PIP_EXPORT TypeInfo: _Type { PIString name; }; @@ -63,7 +63,7 @@ public: mutable PIMutex mutex; }; -PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::TypeInfo & v); -PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::TypeInfo & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PIIntrospectionContainers::TypeInfo & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PIIntrospectionContainers::TypeInfo & v); #endif // PIINTROSPECTION_CONTAINERS_P_H diff --git a/lib/main/introspection/piintrospection_server_p.h b/lib/main/introspection/piintrospection_server_p.h index d47b83da..549dd044 100644 --- a/lib/main/introspection/piintrospection_server_p.h +++ b/lib/main/introspection/piintrospection_server_p.h @@ -27,7 +27,7 @@ #include "pisystemmonitor.h" -class PIIntrospection { +class PIP_EXPORT PIIntrospection { public: enum InfoTypes { @@ -38,12 +38,12 @@ public: itThreads = 0x10, }; - struct RequiredInfo { + struct PIP_EXPORT RequiredInfo { RequiredInfo(); PIFlags types; }; - struct ProcessInfo { + struct PIP_EXPORT ProcessInfo { ProcessInfo(); PIString execCommand, hostname, user, OS_name, OS_version, architecture; @@ -53,14 +53,14 @@ public: PIStringList build_options; }; - struct ProcessStat { + struct PIP_EXPORT ProcessStat { ProcessStat() {} PISystemMonitor::ProcessStats proc; PIVector threads; }; - struct ObjectInfo { + struct PIP_EXPORT ObjectInfo { ObjectInfo(); PIString classname, name; @@ -91,13 +91,13 @@ public: }; -PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::RequiredInfo & v); -PIByteArray & operator >>(PIByteArray & b, PIIntrospection::RequiredInfo & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::RequiredInfo & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospection::RequiredInfo & v); -PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ProcessInfo & v); -PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ProcessInfo & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ProcessInfo & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ProcessInfo & v); -PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v); -PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIIntrospection::ObjectInfo & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospection::ObjectInfo & v); #endif // PIINTROSPECTION_SERVER_P_H diff --git a/lib/main/introspection/piintrospection_threads_p.h b/lib/main/introspection/piintrospection_threads_p.h index b9f12461..3318a4d2 100644 --- a/lib/main/introspection/piintrospection_threads_p.h +++ b/lib/main/introspection/piintrospection_threads_p.h @@ -35,7 +35,7 @@ public: sWaiting, }; - struct ThreadInfo { + struct PIP_EXPORT ThreadInfo { ThreadInfo(); PIString classname, name; int id, delay; @@ -57,7 +57,7 @@ public: }; -PIByteArray & operator <<(PIByteArray & b, const PIIntrospectionThreads::ThreadInfo & v); -PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & b, const PIIntrospectionThreads::ThreadInfo & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & b, PIIntrospectionThreads::ThreadInfo & v); #endif // PIINTROSPECTION_THREADS_P_H diff --git a/lib/main/io_devices/pibinarylog.h b/lib/main/io_devices/pibinarylog.h index c41401f0..6703dcf0 100644 --- a/lib/main/io_devices/pibinarylog.h +++ b/lib/main/io_devices/pibinarylog.h @@ -56,7 +56,7 @@ public: }; //! \brief Struct contains information about all records with same ID - struct BinLogRecordInfo { + struct PIP_EXPORT BinLogRecordInfo { BinLogRecordInfo() { id = count = 0; minimum_size = maximum_size = 0; @@ -70,7 +70,7 @@ public: }; //! \brief Struct contains full information about Binary Log file and about all Records using map of \a BinLogRecordInfo - struct BinLogInfo { + struct PIP_EXPORT BinLogInfo { PIString path; int records_count; llong log_size; @@ -80,7 +80,7 @@ public: }; //! \brief Struct contains position, ID and timestamp of record in file - struct BinLogIndex { + struct PIP_EXPORT BinLogIndex { int id; llong pos; PISystemTime timestamp; @@ -293,7 +293,7 @@ protected: DeviceInfoFlags deviceInfoFlags() const {return PIIODevice::Reliable;} private: - struct BinLogRecord { + struct PIP_EXPORT BinLogRecord { int id; int size; PISystemTime timestamp; diff --git a/lib/main/io_devices/piconfig.h b/lib/main/io_devices/piconfig.h index cb3ddb6e..c6027ffc 100644 --- a/lib/main/io_devices/piconfig.h +++ b/lib/main/io_devices/piconfig.h @@ -505,8 +505,8 @@ private: #ifdef PIP_STD_IOSTREAM -std::ostream & operator <<(std::ostream & s, const PIConfig::Branch & v); -std::ostream & operator <<(std::ostream & s, const PIConfig::Entry & v); +PIP_EXPORT std::ostream & operator <<(std::ostream & s, const PIConfig::Branch & v); +PIP_EXPORT std::ostream & operator <<(std::ostream & s, const PIConfig::Entry & v); #endif inline PICout operator <<(PICout s, const PIConfig::Branch & v) {s.setControl(0, true); v.piCoutt(s, ""); s.restoreControl(); return s;} diff --git a/lib/main/io_devices/piethernet.h b/lib/main/io_devices/piethernet.h index 574f9fab..bb9f988e 100644 --- a/lib/main/io_devices/piethernet.h +++ b/lib/main/io_devices/piethernet.h @@ -43,7 +43,7 @@ public: explicit PIEthernet(); //! \brief Type of %PIEthernet - enum PIP_EXPORT Type { + enum Type { UDP /** UDP - User Datagram Protocol */ , TCP_Client /** TCP client - allow connection to TCP server */ , TCP_Server /** TCP server - receive connections from TCP clients */ , @@ -51,7 +51,7 @@ public: }; //! \brief Parameters of %PIEthernet - enum PIP_EXPORT Parameters { + enum Parameters { ReuseAddress /** Rebind address if there is already binded. Enabled by default */ = 0x1, Broadcast /** Broadcast send. Disabled by default */ = 0x2, SeparateSockets /** If this parameter is set, %PIEthernet will initialize two different sockets, @@ -63,7 +63,7 @@ public: //! \brief IPv4 network address, IP and port - class Address { + class PIP_EXPORT Address { friend class PIEthernet; friend inline PIByteArray & operator <<(PIByteArray & s, const PIEthernet::Address & v); friend inline PIByteArray & operator >>(PIByteArray & s, PIEthernet::Address & v); @@ -322,7 +322,7 @@ public: //! Flags of network interface - enum PIP_EXPORT InterfaceFlag { + enum InterfaceFlag { ifActive /** Is active */ = 0x1, ifRunning /** Is running */ = 0x2, ifBroadcast /** Support broadcast */ = 0x4, @@ -485,7 +485,7 @@ protected: void applyTimeout(int fd, int opt, double ms); void applyOptInt(int level, int opt, int val); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) int sock, sock_s; bool connected_, connecting_, listen_threaded, server_bounded; mutable Address addr_r, addr_s, addr_lr; diff --git a/lib/main/io_devices/pifile.h b/lib/main/io_devices/pifile.h index e8af7626..1f94625b 100644 --- a/lib/main/io_devices/pifile.h +++ b/lib/main/io_devices/pifile.h @@ -38,7 +38,7 @@ public: struct PIP_EXPORT FileInfo { FileInfo() {size = 0; id_group = id_user = 0;} - enum PIP_EXPORT Flag { + enum Flag { File = 0x01, Dir = 0x02, Dot = 0x04, @@ -292,7 +292,7 @@ protected: private: PIString strType(const PIIODevice::DeviceMode type); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) int ret, prec_, fdi; PIString prec_str; diff --git a/lib/main/io_devices/pigpio.h b/lib/main/io_devices/pigpio.h index cd2b91e7..ed566206 100644 --- a/lib/main/io_devices/pigpio.h +++ b/lib/main/io_devices/pigpio.h @@ -26,7 +26,7 @@ #include "pithread.h" -class PIGPIO: public PIThread +class PIP_EXPORT PIGPIO: public PIThread { PIOBJECT_SUBCLASS(PIGPIO, PIThread) public: @@ -85,7 +85,7 @@ public: //! \} private: - struct GPIOData { + struct PIP_EXPORT GPIOData { GPIOData() {dir = PIGPIO::In; num = fd = -1;} PIString name; int dir; diff --git a/lib/main/io_devices/pipeer.h b/lib/main/io_devices/pipeer.h index 155d6055..41862623 100644 --- a/lib/main/io_devices/pipeer.h +++ b/lib/main/io_devices/pipeer.h @@ -36,7 +36,7 @@ public: explicit PIPeer(const PIString & name = PIString()); virtual ~PIPeer(); - class PeerInfo { + class PIP_EXPORT PeerInfo { friend class PIPeer; friend PIByteArray & operator <<(PIByteArray & s, const PIPeer::PeerInfo & v); friend PIByteArray & operator >>(PIByteArray & s, PIPeer::PeerInfo & v); @@ -44,7 +44,7 @@ public: PeerInfo() {dist = sync = cnt = 0; trace = -1; was_update = false; _data = 0;} ~PeerInfo() {} - struct PeerAddress { + struct PIP_EXPORT PeerAddress { PeerAddress(const PIEthernet::Address & a = PIEthernet::Address(), const PIEthernet::Address & m = PIEthernet::Address("255.255.255.0")); bool isAvailable() const {return ping > 0;} PIEthernet::Address address; diff --git a/lib/main/io_devices/piserial.h b/lib/main/io_devices/piserial.h index 8ef9e9d7..4b8cae4e 100644 --- a/lib/main/io_devices/piserial.h +++ b/lib/main/io_devices/piserial.h @@ -72,7 +72,7 @@ public: }; //! \brief Information about serial device - struct DeviceInfo { + struct PIP_EXPORT DeviceInfo { DeviceInfo(); //! \brief String representation of USB ID in format \"xxxx:xxxx\" @@ -246,7 +246,7 @@ protected: bool openDevice(); bool closeDevice(); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) int fd, vtime; bool sending; PITimeMeasurer tm_; diff --git a/lib/main/io_devices/pisharedmemory.h b/lib/main/io_devices/pisharedmemory.h index f00046e8..36bd8c3f 100644 --- a/lib/main/io_devices/pisharedmemory.h +++ b/lib/main/io_devices/pisharedmemory.h @@ -86,7 +86,7 @@ private: void initPrivate(); int dsize; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) }; diff --git a/lib/main/io_devices/pispi.h b/lib/main/io_devices/pispi.h index f6705f81..7c30a59f 100644 --- a/lib/main/io_devices/pispi.h +++ b/lib/main/io_devices/pispi.h @@ -77,7 +77,7 @@ private: uchar spi_bits; PIByteArray tx_buf, rx_buf; PIByteArray recv_buf; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) }; #endif // PISPI_H diff --git a/lib/main/io_devices/piusb.h b/lib/main/io_devices/piusb.h index ce729734..2b17d382 100644 --- a/lib/main/io_devices/piusb.h +++ b/lib/main/io_devices/piusb.h @@ -34,7 +34,7 @@ public: explicit PIUSB(ushort vid = 0, ushort pid = 0); ~PIUSB() {closeDevice();} - struct Endpoint { + struct PIP_EXPORT Endpoint { Endpoint(uchar a = 0, uchar at = 0, ushort mps = 0) {address = a; attributes = at; max_packet_size = mps; parse();} enum Direction {Write = 0, Read = 1}; @@ -54,7 +54,7 @@ public: UsageType usage_type; }; - struct Interface { + struct PIP_EXPORT Interface { Interface() {index = value_to_select = class_code = subclass_code = protocol_code = 0;} uchar index; uchar value_to_select; @@ -64,7 +64,7 @@ public: PIVector endpoints; }; - struct Configuration { + struct PIP_EXPORT Configuration { Configuration() {index = value_to_select = attributes = max_power = 0; self_powered = remote_wakeup = false;} uchar index; uchar value_to_select; @@ -75,7 +75,7 @@ public: PIVector interfaces; }; - struct Descriptor { + struct PIP_EXPORT Descriptor { Descriptor() {usb_spec_number = 0; device_class = device_subclass = device_protocol = max_packet_size = 0; id_vendor = id_product = id_device_release = 0; index_manufacturer = index_product = index_serial = 0;} ushort usb_spec_number; uchar device_class; @@ -148,6 +148,6 @@ protected: }; -PICout operator <<(PICout s, const PIUSB::Endpoint & v); +PIP_EXPORT PICout operator <<(PICout s, const PIUSB::Endpoint & v); #endif // PIUSB_H diff --git a/lib/main/io_utils/pibasetransfer.h b/lib/main/io_utils/pibasetransfer.h index a11909da..d5f54ac2 100644 --- a/lib/main/io_utils/pibasetransfer.h +++ b/lib/main/io_utils/pibasetransfer.h @@ -102,7 +102,7 @@ protected: llong bytes_all, bytes_cur; private: - enum PIP_EXPORT PacketType {pt_Unknown, pt_Data, pt_ReplySuccess, pt_ReplyInvalid, pt_Break, pt_Start, pt_Pause}; + enum PacketType {pt_Unknown, pt_Data, pt_ReplySuccess, pt_ReplyInvalid, pt_Break, pt_Start, pt_Pause}; # pragma pack(push,1) struct PIP_EXPORT StartRequest { diff --git a/lib/main/io_utils/pibroadcast.h b/lib/main/io_utils/pibroadcast.h index b099e43e..67008007 100644 --- a/lib/main/io_utils/pibroadcast.h +++ b/lib/main/io_utils/pibroadcast.h @@ -23,11 +23,12 @@ #ifndef PIBROADCAST_H #define PIBROADCAST_H +#include "pip_io_utils_export.h" #include "piethutilbase.h" #include "piethernet.h" -class PIBroadcast: public PIThread, public PIEthUtilBase { +class PIP_IO_UTILS_EXPORT PIBroadcast: public PIThread, public PIEthUtilBase { PIOBJECT_SUBCLASS(PIBroadcast, PIThread) public: diff --git a/lib/main/io_utils/piconnection.h b/lib/main/io_utils/piconnection.h index 5af11b52..f6be10bd 100644 --- a/lib/main/io_utils/piconnection.h +++ b/lib/main/io_utils/piconnection.h @@ -404,7 +404,7 @@ private: void __DevicePool_threadReadDP(void * ddp); -extern PIConnection::DevicePool * __device_pool__; +extern PIP_EXPORT PIConnection::DevicePool * __device_pool__; class PIP_EXPORT __DevicePoolContainer__ { public: diff --git a/lib/main/io_utils/pidiagnostics.h b/lib/main/io_utils/pidiagnostics.h index 9815bb19..71da060a 100644 --- a/lib/main/io_utils/pidiagnostics.h +++ b/lib/main/io_utils/pidiagnostics.h @@ -49,7 +49,7 @@ public: }; //! Information about current diagnostics state - struct State { + struct PIP_EXPORT State { State(); float immediate_freq; float integral_freq; @@ -123,7 +123,7 @@ public: //! \} private: - struct Entry { + struct PIP_EXPORT Entry { Entry() {bytes_ok = bytes_fail = 0; cnt_ok = cnt_fail = 0; empty = true;} ullong bytes_ok; ullong bytes_fail; diff --git a/lib/main/io_utils/piethutilbase.h b/lib/main/io_utils/piethutilbase.h index 8542ef36..fc564004 100644 --- a/lib/main/io_utils/piethutilbase.h +++ b/lib/main/io_utils/piethutilbase.h @@ -23,9 +23,10 @@ #ifndef PIETHUTILBASE_H #define PIETHUTILBASE_H +#include "pip_io_utils_export.h" #include "pibytearray.h" -class PIEthUtilBase { +class PIP_IO_UTILS_EXPORT PIEthUtilBase { public: PIEthUtilBase(); ~PIEthUtilBase(); diff --git a/lib/main/io_utils/pifiletransfer.h b/lib/main/io_utils/pifiletransfer.h index 241b499c..b74b9eef 100644 --- a/lib/main/io_utils/pifiletransfer.h +++ b/lib/main/io_utils/pifiletransfer.h @@ -35,7 +35,7 @@ public: PIFileTransfer(); ~PIFileTransfer(); - enum PIP_EXPORT StepType {pft_None, pft_Description, pft_Data}; + enum StepType {pft_None, pft_Description, pft_Data}; struct PIP_EXPORT PFTFileInfo: public PIFile::FileInfo { PFTFileInfo(const PIFile::FileInfo &fi = PIFile::FileInfo()): PIFile::FileInfo(fi) {} diff --git a/lib/main/io_utils/pistreampacker.h b/lib/main/io_utils/pistreampacker.h index 361e647c..f9777ee4 100644 --- a/lib/main/io_utils/pistreampacker.h +++ b/lib/main/io_utils/pistreampacker.h @@ -23,20 +23,21 @@ #ifndef PISTREAMPACKER_H #define PISTREAMPACKER_H +#include "pip_io_utils_export.h" #include "piobject.h" #include "piethutilbase.h" class PIIODevice; -class PIP_EXPORT PIStreamPacker: public PIObject, public PIEthUtilBase { +class PIP_IO_UTILS_EXPORT PIStreamPacker: public PIObject, public PIEthUtilBase { PIOBJECT(PIStreamPacker) public: //! Contructs packer and try to assign \"dev\" PIStreamPacker(PIIODevice * dev = 0); //! Progress info - struct Progress { + struct PIP_IO_UTILS_EXPORT Progress { Progress(); //! Is send/receive in progress diff --git a/lib/main/lua/piluaprogram.h b/lib/main/lua/piluaprogram.h index a21b075a..3b2cf5da 100644 --- a/lib/main/lua/piluaprogram.h +++ b/lib/main/lua/piluaprogram.h @@ -23,9 +23,10 @@ #ifndef PILUAPROGRAM_H #define PILUAPROGRAM_H +#include "pip_lua_export.h" #include "pip_lua.h" -class PILuaProgram +class PIP_LUA_EXPORT PILuaProgram { public: //! Constructs an empty PILuaProgram, initialize Lua context @@ -44,7 +45,7 @@ public: luabridge::Namespace getGlobalNamespace(); private: - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_LUA_EXPORT) }; #endif // PILUAPROGRAM_H diff --git a/lib/main/math/picompress.h b/lib/main/math/picompress.h index 187b019e..799ab072 100644 --- a/lib/main/math/picompress.h +++ b/lib/main/math/picompress.h @@ -25,8 +25,8 @@ #include "pibytearray.h" -PIByteArray piCompress(const PIByteArray & ba, int level = 6); +PIP_EXPORT PIByteArray piCompress(const PIByteArray & ba, int level = 6); -PIByteArray piDecompress(const PIByteArray & zba); +PIP_EXPORT PIByteArray piDecompress(const PIByteArray & zba); #endif // PICOMPRESS_H diff --git a/lib/main/math/pievaluator.h b/lib/main/math/pievaluator.h index fa4095a2..94ff6250 100644 --- a/lib/main/math/pievaluator.h +++ b/lib/main/math/pievaluator.h @@ -30,12 +30,12 @@ typedef complexd (*FuncFunc)(void * , int, complexd * ); namespace PIEvaluatorTypes { - enum PIP_EXPORT eType {etNumber, etOperator, etVariable, etFunction}; - enum PIP_EXPORT Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower, + enum eType {etNumber, etOperator, etVariable, etFunction}; + enum Operation {oNone, oAdd, oSubtract, oMultiply, oDivide, oResidue, oPower, oEqual, oNotEqual, oGreater, oSmaller, oGreaterEqual, oSmallerEqual, oAnd, oOr, oFunction }; - enum PIP_EXPORT BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg, + enum BaseFunctions {bfUnknown, bfSin, bfCos, bfTg, bfCtg, bfArcsin, bfArccos, bfArctg, bfArcctg, bfExp, bfRandom, bfRandomn, bfSh, bfCh, bfTh, bfCth, diff --git a/lib/main/math/pifft.h b/lib/main/math/pifft.h index 06250e32..628f3979 100644 --- a/lib/main/math/pifft.h +++ b/lib/main/math/pifft.h @@ -23,6 +23,7 @@ #ifndef PIFFT_H #define PIFFT_H +#include "pip_fftw_export.h" #include "pimathcomplex.h" class PIP_EXPORT PIFFT_double @@ -123,7 +124,7 @@ typedef PIFFT_float PIFFTf; #ifndef CC_VC -#define _PIFFTW_H(type) class _PIFFTW_P_##type##_ { \ +#define _PIFFTW_H(type) class PIP_FFTW_EXPORT _PIFFTW_P_##type##_ { \ public: \ _PIFFTW_P_##type##_(); \ ~_PIFFTW_P_##type##_(); \ @@ -138,7 +139,7 @@ _PIFFTW_H(double) _PIFFTW_H(ldouble) template -class PIP_EXPORT PIFFTW +class PIFFTW { public: explicit PIFFTW() {p = 0; newP(p);} diff --git a/lib/main/math/pimathbase.h b/lib/main/math/pimathbase.h index 740514b7..d33482b7 100644 --- a/lib/main/math/pimathbase.h +++ b/lib/main/math/pimathbase.h @@ -103,21 +103,21 @@ inline float sqr(const float & v) {return v * v;} inline double sqr(const double & v) {return v * v;} inline double sinc(const double & v) {if (v == 0.) return 1.; double t = M_PI * v; return sin(t) / t;} -double piJ0(const double & v); -double piJ1(const double & v); -double piJn(int n, const double & v); -double piY0(const double & v); -double piY1(const double & v); -double piYn(int n, const double & v); +PIP_EXPORT double piJ0(const double & v); +PIP_EXPORT double piJ1(const double & v); +PIP_EXPORT double piJn(int n, const double & v); +PIP_EXPORT double piY0(const double & v); +PIP_EXPORT double piY1(const double & v); +PIP_EXPORT double piYn(int n, const double & v); inline double toDb(double val) {return 10. * log10(val);} inline double fromDb(double val) {return pow(10., val / 10.);} inline double toRad(double deg) {return deg * M_PI_180;} inline double toDeg(double rad) {return rad * M_180_PI;} // [-1 ; 1] -double randomd(); +PIP_EXPORT double randomd(); // [-1 ; 1] normal -double randomn(double dv = 0., double sv = 1.); +PIP_EXPORT double randomn(double dv = 0., double sv = 1.); inline PIVector abs(const PIVector & v) { diff --git a/lib/main/math/pimathsolver.h b/lib/main/math/pimathsolver.h index 23bbd249..5d030c20 100644 --- a/lib/main/math/pimathsolver.h +++ b/lib/main/math/pimathsolver.h @@ -27,7 +27,7 @@ /// Differential evaluations -struct TransferFunction { +struct PIP_EXPORT TransferFunction { PIVector vector_Bm, vector_An; }; diff --git a/lib/main/math/piquaternion.h b/lib/main/math/piquaternion.h index 475da1b6..e9b79e92 100644 --- a/lib/main/math/piquaternion.h +++ b/lib/main/math/piquaternion.h @@ -25,7 +25,7 @@ #include "pimathmatrix.h" -class PIQuaternion +class PIP_EXPORT PIQuaternion { friend PIQuaternion operator*(const PIQuaternion & q0, const PIQuaternion & q1); friend PIQuaternion operator*(const double & a, const PIQuaternion & q); @@ -57,8 +57,8 @@ protected: }; -PIQuaternion operator *(const double & a, const PIQuaternion & q); -PIQuaternion operator *(const PIQuaternion & q0, const PIQuaternion & q1); +PIP_EXPORT PIQuaternion operator *(const double & a, const PIQuaternion & q); +PIP_EXPORT PIQuaternion operator *(const PIQuaternion & q0, const PIQuaternion & q1); inline PIQuaternion operator +(const PIQuaternion & q0, const PIQuaternion & q1) {return PIQuaternion(q0.vector() + q1.vector(), q0.scalar() + q1.scalar());} inline PIQuaternion operator -(const PIQuaternion & q0, const PIQuaternion & q1) {return PIQuaternion(q0.vector() - q1.vector(), q0.scalar() - q1.scalar());} inline PIQuaternion operator -(const PIQuaternion & q0) {return PIQuaternion(-q0.vector(), -q0.scalar());} diff --git a/lib/main/math/pistatistic.h b/lib/main/math/pistatistic.h index f5f66f30..d4e70997 100644 --- a/lib/main/math/pistatistic.h +++ b/lib/main/math/pistatistic.h @@ -26,7 +26,7 @@ #include "pimathbase.h" template -class PIP_EXPORT PIStatistic { +class PIStatistic { public: PIStatistic() {mean = variance = skewness = kurtosis = T();} diff --git a/lib/main/opencl/piopencl.h b/lib/main/opencl/piopencl.h index ac00f160..51be9a6a 100644 --- a/lib/main/opencl/piopencl.h +++ b/lib/main/opencl/piopencl.h @@ -20,10 +20,11 @@ #ifndef PIOPENCL_H #define PIOPENCL_H +#include "pip_opencl_export.h" #include "pivariant.h" -class PIOpenCL { +class PIP_OPENCL_EXPORT PIOpenCL { public: struct KernelArg; @@ -69,7 +70,7 @@ public: Double, }; - struct KernelArg { + struct PIP_OPENCL_EXPORT KernelArg { KernelArg(); AddressQualifier address_qualifier; AccessQualifier access_qualifier; @@ -85,7 +86,7 @@ public: void init(void * _k, uint index); }; - struct Device { + struct PIP_OPENCL_EXPORT Device { Device() {id = platform_id = 0; max_compute_units = max_clock_frequency = 0; max_memory_size = 0;} bool isValid() const {return id != 0;} PIString displayText() const {return name.trimmed() + " (" + device_version.trimmed() + ")";} @@ -100,7 +101,7 @@ public: ullong max_memory_size; }; - struct Platform { + struct PIP_OPENCL_EXPORT Platform { Platform() {id = 0;} bool isValid() const {return id != 0;} PIString displayText() const {return name.trimmed() + " (" + version.trimmed() + ", " + profile.trimmed() + ")";} @@ -113,7 +114,7 @@ public: PIVector devices; }; - class Context { + class PIP_OPENCL_EXPORT Context { friend class Program; public: ~Context(); @@ -125,10 +126,10 @@ public: void zero(); void deletePrograms(); PIVector programs_; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_OPENCL_EXPORT) }; - class Program { + class PIP_OPENCL_EXPORT Program { friend class Context; friend class Kernel; public: @@ -143,10 +144,10 @@ public: Context * context_; PIString source_; PIVector kernels_; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_OPENCL_EXPORT) }; - class Kernel { + class PIP_OPENCL_EXPORT Kernel { friend class Program; public: const PIString & name() const {return name_;} @@ -165,7 +166,7 @@ public: Program * program_; PIString name_; PIVector args_; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_OPENCL_EXPORT) }; static void init(); @@ -177,7 +178,7 @@ public: private: static PIString prog_header; PIOpenCL() {;} - class Initializer { + class PIP_OPENCL_EXPORT Initializer { public: Initializer(); static Initializer * instance(); diff --git a/lib/main/piplatform.h b/lib/main/piplatform.h index 73eebc88..cb46423d 100644 --- a/lib/main/piplatform.h +++ b/lib/main/piplatform.h @@ -20,6 +20,8 @@ #ifndef PIPLATFORM_H #define PIPLATFORM_H +#include + #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) # define WINDOWS # define ARCH_BITS_64 @@ -90,11 +92,5 @@ # define typeof __typeof__ #endif -#if defined(DOXYGEN) || defined(CC_GCC) || defined(PICODE) -# undef PIP_EXPORT -# define PIP_EXPORT -# undef DEPRECATED -# define DEPRECATED -#endif #endif // PIPLATFORM_H diff --git a/lib/main/system/pilibrary.h b/lib/main/system/pilibrary.h index 653f7db6..581fa5d1 100644 --- a/lib/main/system/pilibrary.h +++ b/lib/main/system/pilibrary.h @@ -42,7 +42,7 @@ private: bool loadInternal(); void getLastError(); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) PIString libpath, liberror; }; diff --git a/lib/main/system/piprocess.h b/lib/main/system/piprocess.h index 74f48cc6..d7473432 100644 --- a/lib/main/system/piprocess.h +++ b/lib/main/system/piprocess.h @@ -93,7 +93,7 @@ private: void exec_(); void startProc(bool detached); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) PIStringList args, env; PIString wd; PIByteArray out; diff --git a/lib/main/system/pisysteminfo.h b/lib/main/system/pisysteminfo.h index db1e54d2..5de39d5f 100644 --- a/lib/main/system/pisysteminfo.h +++ b/lib/main/system/pisysteminfo.h @@ -26,7 +26,7 @@ class PIP_EXPORT PISystemInfo { public: PISystemInfo(); - struct MountInfo { + struct PIP_EXPORT MountInfo { MountInfo(); PIString mount_point; PIString device; diff --git a/lib/main/system/pisystemmonitor.h b/lib/main/system/pisystemmonitor.h index a860a19a..f3407f81 100644 --- a/lib/main/system/pisystemmonitor.h +++ b/lib/main/system/pisystemmonitor.h @@ -32,7 +32,7 @@ public: ~PISystemMonitor(); #pragma pack(push, 1) - struct ProcessStatsFixed { + struct PIP_EXPORT ProcessStatsFixed { ProcessStatsFixed(); int ID; int parent_ID; @@ -52,7 +52,7 @@ public: float cpu_load_user; }; - struct ThreadStatsFixed { + struct PIP_EXPORT ThreadStatsFixed { ThreadStatsFixed(); llong id; PISystemTime work_time; @@ -63,7 +63,7 @@ public: }; #pragma pack(pop) - struct ProcessStats: ProcessStatsFixed { + struct PIP_EXPORT ProcessStats: ProcessStatsFixed { void makeStrings(); PIString exec_name; PIString state; @@ -74,7 +74,7 @@ public: PIString data_memsize_readable; }; - struct ThreadStats: ThreadStatsFixed { + struct PIP_EXPORT ThreadStats: ThreadStatsFixed { PIString name; PIDateTime created; }; @@ -107,10 +107,10 @@ private: mutable PIMutex stat_mutex; int pID_, page_size, cpu_count, cycle; #ifndef FREERTOS - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) #endif - class Pool { + class PIP_EXPORT Pool { friend class PISystemMonitor; public: static Pool * instance(); @@ -136,9 +136,9 @@ inline PICout operator <<(PICout s, const PISystemMonitor::ThreadStats & v) { return s; } -PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ProcessStats & v); -PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ProcessStats & v); -PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ThreadStats & v); -PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ThreadStats & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ProcessStats & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ProcessStats & v); +PIP_EXPORT PIByteArray & operator <<(PIByteArray & s, const PISystemMonitor::ThreadStats & v); +PIP_EXPORT PIByteArray & operator >>(PIByteArray & s, PISystemMonitor::ThreadStats & v); #endif // PISYSTEMMONITOR_H diff --git a/lib/main/system/pisystemtests.h b/lib/main/system/pisystemtests.h index 7aaafc85..094c85c1 100644 --- a/lib/main/system/pisystemtests.h +++ b/lib/main/system/pisystemtests.h @@ -23,16 +23,16 @@ #include "pibase.h" namespace PISystemTests { - PIP_EXPORT extern long time_resolution_ns; - PIP_EXPORT extern long time_elapsed_ns; - PIP_EXPORT extern long usleep_offset_us; + extern PIP_EXPORT long time_resolution_ns; + extern PIP_EXPORT long time_elapsed_ns; + extern PIP_EXPORT long usleep_offset_us; - class PISystemTestReader { + class PIP_EXPORT PISystemTestReader { public: PISystemTestReader(); }; - extern PISystemTestReader pisystestreader; + extern PIP_EXPORT PISystemTestReader pisystestreader; } #endif // PISYSTEMTESTS_H diff --git a/lib/main/thread/piconditionvar.h b/lib/main/thread/piconditionvar.h index 923e2ba7..0e988e32 100644 --- a/lib/main/thread/piconditionvar.h +++ b/lib/main/thread/piconditionvar.h @@ -111,7 +111,7 @@ public: virtual bool waitFor(PIMutex& lk, int timeoutMs, const std::function& condition); private: - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) }; diff --git a/lib/main/thread/pigrabberbase.h b/lib/main/thread/pigrabberbase.h index 3ba007fe..07a5c35d 100644 --- a/lib/main/thread/pigrabberbase.h +++ b/lib/main/thread/pigrabberbase.h @@ -28,7 +28,7 @@ template -class PIP_EXPORT PIGrabberBase: public PIThread +class PIGrabberBase: public PIThread { PIOBJECT_SUBCLASS(PIGrabberBase, PIThread) public: diff --git a/lib/main/thread/pimutex.h b/lib/main/thread/pimutex.h index b71b1600..a551625d 100644 --- a/lib/main/thread/pimutex.h +++ b/lib/main/thread/pimutex.h @@ -59,7 +59,7 @@ private: void init(); void destroy(); - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) }; diff --git a/lib/main/thread/pithread.h b/lib/main/thread/pithread.h index 2e08aa68..b6aa3c95 100644 --- a/lib/main/thread/pithread.h +++ b/lib/main/thread/pithread.h @@ -243,7 +243,7 @@ protected: PITimeMeasurer tmf_, tms_, tmr_; PIThread::Priority priority_; ThreadFunc ret_func; - PRIVATE_DECLARATION + PRIVATE_DECLARATION(PIP_EXPORT) private: bool _startThread(void * func); diff --git a/lib/main/thread/pithreadpoolexecutor.h b/lib/main/thread/pithreadpoolexecutor.h index d8655843..1d3bf75f 100644 --- a/lib/main/thread/pithreadpoolexecutor.h +++ b/lib/main/thread/pithreadpoolexecutor.h @@ -24,7 +24,7 @@ #include -class PIThreadPoolExecutor { +class PIP_EXPORT PIThreadPoolExecutor { public: explicit PIThreadPoolExecutor(size_t corePoolSize = -1, PIBlockingDequeue > * taskQueue_ = 0); diff --git a/main.cpp b/main.cpp index f0613273..5a9484ff 100644 --- a/main.cpp +++ b/main.cpp @@ -49,7 +49,7 @@ int main() { piCout << s.replaceAll(' ', '1');*/ piDebug = false; double min = -1, max = -1, mean = 0; - for (int i = 0; i < 50; ++i) { + for (int i = 0; i < 1; ++i) { PICodeParser cp; PITimeMeasurer tm; cp.parseFile("SH_plugin_base.h"); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index bcb399c3..7f52c1a6 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,9 +1,10 @@ include(DownloadGTest) macro(pip_test NAME LIBS) - gather_src("${NAME}" CPP_${NAME}_TEST _T_H _T_PH) + file(GLOB _CPPS "${NAME}/*.cpp") + file(GLOB _HDRS "${NAME}/*.h") set(_target pip_${NAME}_test) - add_executable(${_target} ${CPP_${NAME}_TEST}) + add_executable(${_target} ${_CPPS} ${_HDRS}) target_link_libraries(${_target} pip ${LIBS} gtest_main gmock_main) add_test(NAME ${_target} COMMAND tests) add_custom_target(${_target}_perform ALL COMMAND ${_target}) diff --git a/lib/main/auxiliary/piterminal/CMakeLists.txt b/utils/piterminal/CMakeLists.txt similarity index 74% rename from lib/main/auxiliary/piterminal/CMakeLists.txt rename to utils/piterminal/CMakeLists.txt index 81f2d998..89e51920 100644 --- a/lib/main/auxiliary/piterminal/CMakeLists.txt +++ b/utils/piterminal/CMakeLists.txt @@ -2,4 +2,6 @@ add_executable(piterminal "main.cpp") target_link_libraries(piterminal pip pip_console) if (DEFINED LIB) install(TARGETS piterminal DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) -endif () +else() + install(TARGETS piterminal DESTINATION bin) +endif() diff --git a/lib/main/auxiliary/piterminal/main.cpp b/utils/piterminal/main.cpp similarity index 100% rename from lib/main/auxiliary/piterminal/main.cpp rename to utils/piterminal/main.cpp index 8e077933..d78f1a8f 100644 --- a/lib/main/auxiliary/piterminal/main.cpp +++ b/utils/piterminal/main.cpp @@ -25,9 +25,9 @@ int main (int argc, char * argv[]) { #else # include "piscreentypes.h" # include "pisharedmemory.h" -# include "../../lib/console/piterminal.cpp" # include "pifile.h" # include +# include "../../lib/console/piterminal.cpp" PIVector > cells;