1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-18 00:10:04 +00:00

net/libarcus: needed for cura 5.7 update

- Upstream repository changed
- worked around changed build system
- protobuf fixes
This commit is contained in:
Matthieu Volat 2024-09-04 10:25:17 -04:00 committed by Diane Bruce
parent 2f2d616dc5
commit 7efae4b7a9
17 changed files with 712 additions and 36 deletions

View File

@ -1,6 +1,6 @@
PORTNAME= libArcus
PORTVERSION= 4.13.1
PORTREVISION= 4
PORTVERSION= 5.3.0
PORTREVISION= 0
PORTEPOCH= 1
CATEGORIES= net cad
DIST_SUBDIR= Ultimaker
@ -12,20 +12,30 @@ WWW= https://github.com/Ultimaker/libArcus
LICENSE= LGPL3
LICENSE_FILE= ${WRKSRC}/LICENSE
DEPRECATED= Fails to build with modern python
EXPIRATION_DATE= 2024-06-29
BUILD_DEPENDS= sip:devel/py-sip4
BUILD_DEPENDS= ${PYTHON_PKGNAMEPREFIX}sip>=0:devel/py-sip@${PY_FLAVOR}
LIB_DEPENDS= libprotobuf.so:devel/protobuf
USES= cmake compiler:c++17-lang python pyqt:5
USES= cmake compiler:c++17-lang python pyqt:6
USE_PYQT= pysip
USE_GITHUB= yes
GH_ACCOUNT= Ultimaker
GH_TUPLE= Ultimaker:pyArcus:${PORTVERSION}:pyArcus
USE_LDCONFIG= yes
#GH_TAGNAME= 3afb644
CMAKE_ARGS+= -DPYTHON_EXECUTABLE:STRING=${PYTHON_CMD} \
-DPYTHON_INCLUDEDIR:STRING=${PYTHON_INCLUDEDIR}
CMAKE_ARGS+= -DBUILD_EXAMPLES:BOOL=OFF \
-DPYTHON_EXECUTABLE:STRING=${PYTHON_CMD} \
-DPYTHON_INCLUDEDIR:STRING=${PYTHON_INCLUDEDIR}
post-extract:
@${MKDIR} ${WRKSRC}/cmake
@for f in COPYING-CMAKE-SCRIPTS FindSIP.cmake FindSIP.py SIPMacros.cmake; do \
${CP} ${FILESDIR}/$$f ${WRKSRC}/cmake; \
done
@for f in CMakeLists.txt CPackConfig.cmake ArcusConfig.cmake.in; do \
${CP} ${FILESDIR}/$$f ${WRKSRC}; \
done
@${MV} ${WRKSRC_pyArcus}/python ${WRKSRC}
@${MV} ${WRKSRC_pyArcus}/include/pyArcus ${WRKSRC}/include
@${MV} ${WRKSRC_pyArcus}/src/PythonMessage.cpp ${WRKSRC}/python
.include <bsd.port.mk>

View File

@ -1,3 +1,5 @@
TIMESTAMP = 1645698839
SHA256 (Ultimaker/Ultimaker-libArcus-4.13.1_GH0.tar.gz) = 51e865cb648750ad9ea315fa7632ee7016890273f911270f60d28c8a4bc50240
SIZE (Ultimaker/Ultimaker-libArcus-4.13.1_GH0.tar.gz) = 32077
TIMESTAMP = 1715499868
SHA256 (Ultimaker/Ultimaker-libArcus-5.3.0_GH0.tar.gz) = 3cf7411b573eda2de2aec9761bd6b539a5d5d67739761357f5f773d1490db0fb
SIZE (Ultimaker/Ultimaker-libArcus-5.3.0_GH0.tar.gz) = 26019
SHA256 (Ultimaker/Ultimaker-pyArcus-5.3.0_GH0.tar.gz) = 2eda2a93592480a295fa338118aaf28cdcf24b7c6980740a1df94810652fc368
SIZE (Ultimaker/Ultimaker-pyArcus-5.3.0_GH0.tar.gz) = 16436

View File

@ -0,0 +1,10 @@
@PACKAGE_INIT@
# We want to have access to protobuf_generate_cpp and other FindProtobuf features.
# However, if ProtobufConfig is used instead, there is a CMake option that controls
# this, which defaults to OFF. We need to force this option to ON instead.
set(protobuf_MODULE_COMPATIBLE ON CACHE "" INTERNAL FORCE)
find_package(Protobuf 3.0.0 REQUIRED)
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${SELF_DIR}/Arcus-targets.cmake)

View File

@ -0,0 +1,167 @@
project(arcus)
cmake_minimum_required(VERSION 3.8)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
include(GenerateExportHeader)
option(BUILD_PYTHON "Build " ON)
option(BUILD_EXAMPLES "Build the example programs" ON)
option(BUILD_STATIC "Build as a static library" OFF)
if(WIN32)
option(MSVC_STATIC_RUNTIME "Link the MSVC runtime statically" OFF)
endif()
# We want to have access to protobuf_generate_cpp and other FindProtobuf features.
# However, if ProtobufConfig is used instead, there is a CMake option that controls
# this, which defaults to OFF. We need to force this option to ON instead.
set(protobuf_MODULE_COMPATIBLE ON CACHE INTERNAL "" FORCE)
find_package(Protobuf 3.0.0 REQUIRED)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) #Required if a patch to libArcus needs to be made via templates.
if(BUILD_PYTHON)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# FIXME: Remove the code for CMake <3.12 once we have switched over completely.
# FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs.
if(${CMAKE_VERSION} VERSION_LESS 3.12)
# FIXME: Use FindPython3 to find Python, new in CMake 3.12.
# However currently on our CI server it finds the wrong Python version and then doesn't find the headers.
find_package(PythonInterp 3.4 REQUIRED)
find_package(PythonLibs 3.4 REQUIRED)
else()
# Use FindPython3 for CMake >=3.12
find_package(Python3 3.4 REQUIRED COMPONENTS Interpreter Development)
endif()
execute_process(COMMAND ${Python_EXECUTABLE} -c "import sysconfig; print(sysconfig.get_path('platlib'), end='')" OUTPUT_VARIABLE Python_SITEARCH)
find_package(SIP REQUIRED)
include(SIPMacros)
if(NOT DEFINED LIB_SUFFIX)
set(LIB_SUFFIX "")
endif()
include_directories(python/ include/pyArcus/ src/ ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS})
endif()
set(CMAKE_CXX_STANDARD 17)
if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
set(arcus_SRCS
src/Socket.cpp
src/SocketListener.cpp
src/MessageTypeStore.cpp
src/PlatformSocket.cpp
src/Error.cpp
)
set(arcus_HDRS
include/Arcus/Socket.h
include/Arcus/SocketListener.h
include/Arcus/Types.h
include/Arcus/MessageTypeStore.h
include/Arcus/Error.h
${CMAKE_CURRENT_BINARY_DIR}/src/ArcusExport.h
)
set(ARCUS_VERSION 1.1.0)
set(ARCUS_SOVERSION 3)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}")
if(BUILD_STATIC)
add_library(Arcus STATIC ${arcus_SRCS})
if(NOT WIN32 OR CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(Arcus PRIVATE pthread)
set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC)
endif()
else()
add_library(Arcus SHARED ${arcus_SRCS})
endif()
if(MSVC_STATIC_RUNTIME)
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif(${flag_var} MATCHES "/MD")
endforeach(flag_var)
endif()
if(BUILD_PYTHON)
set(SIP_EXTRA_FILES_DEPEND python/SocketListener.sip python/Types.sip python/PythonMessage.sip python/Error.sip)
set(SIP_EXTRA_SOURCE_FILES python/PythonMessage.cpp)
set(SIP_EXTRA_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/src)
set(SIP_EXTRA_OPTIONS -g -n PyQt6.sip) # -g means always release the GIL before calling C++ methods. -n PyQt6.sip is required to not get the PyCapsule error
generate_sip_python_module_code(pyArcus python/pyArcus.sip python/pyArcus.sip "${SIP_EXTRA_FILES_DEPEND}" pyArcus_cpp_files)
build_sip_python_module(pyArcus python/pyArcus.sip "${pyArcus_cpp_files};${SIP_EXTRA_SOURCE_FILES}" "" Arcus)
endif()
target_include_directories(Arcus PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
${PROTOBUF_INCLUDE_DIR}
)
target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES})
if(WIN32)
add_definitions(-D_WIN32_WINNT=0x0600) # Declare we require Vista or higher, this allows us to use IPv6 functions.
target_link_libraries(Arcus PUBLIC Ws2_32)
endif()
if(${CMAKE_BUILD_TYPE})
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo")
add_definitions(-DARCUS_DEBUG)
endif()
endif()
set_target_properties(Arcus PROPERTIES
FRAMEWORK FALSE
VERSION ${ARCUS_VERSION}
SOVERSION ${ARCUS_SOVERSION}
PUBLIC_HEADER "${arcus_HDRS}"
DEFINE_SYMBOL MAKE_ARCUS_LIB
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN 1
)
generate_export_header(Arcus
EXPORT_FILE_NAME src/ArcusExport.h
)
# This is required when building out-of-tree.
# The compiler won't find the generated header otherwise.
include_directories(${CMAKE_BINARY_DIR}/src include/)
if(BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
install(TARGETS Arcus
EXPORT Arcus-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Arcus
)
install(EXPORT Arcus-targets
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Arcus
)
configure_package_config_file(ArcusConfig.cmake.in ${CMAKE_BINARY_DIR}/ArcusConfig.cmake INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Arcus)
write_basic_package_version_file(${CMAKE_BINARY_DIR}/ArcusConfigVersion.cmake VERSION ${ARCUS_VERSION} COMPATIBILITY SameMajorVersion)
install(FILES
${CMAKE_BINARY_DIR}/ArcusConfig.cmake
${CMAKE_BINARY_DIR}/ArcusConfigVersion.cmake
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Arcus
)
include(CPackConfig.cmake)

View File

@ -0,0 +1,22 @@
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,24 @@
set(CPACK_PACKAGE_VENDOR "Ultimaker")
set(CPACK_PACKAGE_CONTACT "Ruben Dulek <r.dulek@ultimaker.com>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "libArcus Communication library")
if(NOT DEFINED CPACK_PACKAGE_VERSION)
set(CPACK_PACKAGE_VERSION "15.05.91")
endif()
set(CPACK_GENERATOR "DEB")
if(NOT DEFINED CPACK_DEBIAN_PACKAGE_ARCHITECTURE)
execute_process(COMMAND dpkg --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
set(CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
set(DEB_DEPENDS
"python3 (>= 3.4.0)"
"libgcc1 (>= 4.9.0)"
"libstdc++6 (>= 4.9.0)"
"libc6 (>= 2.19)"
"zlib1g (>= 1.2.0)"
"protobuf (>= 3.0.0)"
)
string(REPLACE ";" ", " DEB_DEPENDS "${DEB_DEPENDS}")
set(CPACK_DEBIAN_PACKAGE_DEPENDS ${DEB_DEPENDS})
include(CPack)

View File

@ -0,0 +1,64 @@
# Find SIP
# ~~~~~~~~
#
# SIP website: http://www.riverbankcomputing.co.uk/sip/index.php
#
# Find the installed version of SIP. FindSIP should be called after Python
# has been found.
#
# This file defines the following variables:
#
# SIP_VERSION - The version of SIP found expressed as a 6 digit hex number
# suitable for comparison as a string.
#
# SIP_VERSION_STR - The version of SIP found as a human readable string.
#
# SIP_BINARY_PATH - Path and filename of the SIP command line executable.
#
# SIP_INCLUDE_DIR - Directory holding the SIP C++ header file.
#
# SIP_DEFAULT_SIP_DIR - Default directory where .sip files should be installed
# into.
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF(SIP_VERSION)
# Already in cache, be silent
SET(SIP_FOUND TRUE)
ELSE(SIP_VERSION)
FIND_FILE(_find_sip_py FindSIP.py PATHS ${CMAKE_MODULE_PATH} NO_CMAKE_FIND_ROOT_PATH)
EXECUTE_PROCESS(COMMAND ${Python_EXECUTABLE} ${_find_sip_py} OUTPUT_VARIABLE sip_config)
IF(sip_config)
STRING(REGEX REPLACE "^sip_version:([^\n]+).*$" "\\1" SIP_VERSION ${sip_config})
STRING(REGEX REPLACE ".*\nsip_version_num:([^\n]+).*$" "\\1" SIP_VERSION_NUM ${sip_config})
STRING(REGEX REPLACE ".*\nsip_version_str:([^\n]+).*$" "\\1" SIP_VERSION_STR ${sip_config})
STRING(REGEX REPLACE ".*\ndefault_sip_dir:([^\n]+).*$" "\\1" SIP_DEFAULT_SIP_DIR ${sip_config})
IF(${SIP_VERSION_STR} VERSION_LESS 5)
STRING(REGEX REPLACE ".*\nsip_bin:([^\n]+).*$" "\\1" SIP_BINARY_PATH ${sip_config})
STRING(REGEX REPLACE ".*\nsip_inc_dir:([^\n]+).*$" "\\1" SIP_INCLUDE_DIR ${sip_config})
STRING(REGEX REPLACE ".*\nsip_module_dir:([^\n]+).*$" "\\1" SIP_MODULE_DIR ${sip_config})
ELSE(${SIP_VERSION_STR} VERSION_LESS 5)
FIND_PROGRAM(SIP_BUILD_EXECUTABLE sip-build)
ENDIF(${SIP_VERSION_STR} VERSION_LESS 5)
SET(SIP_FOUND TRUE)
ENDIF(sip_config)
IF(SIP_FOUND)
IF(NOT SIP_FIND_QUIETLY)
MESSAGE(STATUS "Found SIP version: ${SIP_VERSION_STR}")
ENDIF(NOT SIP_FIND_QUIETLY)
ELSE(SIP_FOUND)
IF(SIP_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find SIP")
ENDIF(SIP_FIND_REQUIRED)
ENDIF(SIP_FOUND)
ENDIF(SIP_VERSION)
ADD_DEFINITIONS(-DSIP_VERSION=0x${SIP_VERSION})

View File

@ -0,0 +1,60 @@
# -*- coding: utf-8 -*-
#
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Simon Edwards <simon@simonzone.com> nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY Simon Edwards <simon@simonzone.com> ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL Simon Edwards <simon@simonzone.com> BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# FindSIP.py
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
try:
import sipbuild
print("sip_version:%06.0x" % sipbuild.version.SIP_VERSION)
print("sip_version_num:%d" % sipbuild.version.SIP_VERSION)
print("sip_version_str:%s" % sipbuild.version.SIP_VERSION_STR)
import sysconfig
if "deb_system" in sysconfig.get_scheme_names():
python_modules_dir = sysconfig.get_path("purelib", "deb_system")
else:
python_modules_dir = sysconfig.get_path("purelib")
print("default_sip_dir:%s" % python_modules_dir)
except ImportError: # Code for SIP v4
import sipconfig
sipcfg = sipconfig.Configuration()
print("sip_version:%06.0x" % sipcfg.sip_version)
print("sip_version_num:%d" % sipcfg.sip_version)
print("sip_version_str:%s" % sipcfg.sip_version_str)
print("sip_bin:%s" % sipcfg.sip_bin)
print("default_sip_dir:%s" % sipcfg.default_sip_dir)
print("sip_inc_dir:%s" % sipcfg.sip_inc_dir)
# SIP 4.19.10+ has new sipcfg.sip_module_dir
if hasattr(sipcfg, "sip_module_dir"):
print("sip_module_dir:%s" % sipcfg.sip_module_dir)
else:
print("sip_module_dir:%s" % sipcfg.sip_mod_dir)

View File

@ -0,0 +1,231 @@
# Macros for SIP
# ~~~~~~~~~~~~~~
# Copyright (c) 2007, Simon Edwards <simon@simonzone.com>
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
# SIP website: http://www.riverbankcomputing.co.uk/sip/index.php
#
# This file defines the following macros:
#
# ADD_SIP_PYTHON_MODULE (MODULE_NAME MODULE_SIP [library1, libaray2, ...])
# Specifies a SIP file to be built into a Python module and installed.
# MODULE_NAME is the name of Python module including any path name. (e.g.
# os.sys, Foo.bar etc). MODULE_SIP the path and filename of the .sip file
# to process and compile. libraryN are libraries that the Python module,
# which is typically a shared library, should be linked to. The built
# module will also be install into Python's site-packages directory.
#
# The behavior of the ADD_SIP_PYTHON_MODULE macro can be controlled by a
# number of variables:
#
# SIP_INCLUDES - List of directories which SIP will scan through when looking
# for included .sip files. (Corresponds to the -I option for SIP.)
#
# SIP_TAGS - List of tags to define when running SIP. (Corresponds to the -t
# option for SIP.)
#
# SIP_CONCAT_PARTS - An integer which defines the number of parts the C++ code
# of each module should be split into. Defaults to 8. (Corresponds to the
# -j option for SIP.)
#
# SIP_DISABLE_FEATURES - List of feature names which should be disabled
# running SIP. (Corresponds to the -x option for SIP.)
#
# SIP_EXTRA_OPTIONS - Extra command line options which should be passed on to
# SIP.
# SIP_BUILD_EXTRA_OPTIONS - Extra command line options which should be passed on to
# sip-build.
SET(SIP_INCLUDES)
SET(SIP_TAGS)
SET(SIP_CONCAT_PARTS 16)
SET(SIP_DISABLE_FEATURES)
SET(SIP_EXTRA_OPTIONS)
SET(SIP_EXTRA_OBJECTS)
SET(SIP_BUILD_EXTRA_OPTIONS)
MACRO(GENERATE_SIP_PYTHON_MODULE_CODE MODULE_NAME MODULE_SIP SIP_FILES CPP_FILES)
STRING(REPLACE "." "/" _x ${MODULE_NAME})
GET_FILENAME_COMPONENT(_parent_module_path ${_x} PATH)
GET_FILENAME_COMPONENT(_child_module_name ${_x} NAME)
GET_FILENAME_COMPONENT(_module_path ${MODULE_SIP} PATH)
GET_FILENAME_COMPONENT(_abs_module_sip ${MODULE_SIP} ABSOLUTE)
# If this is not need anymore (using input configuration file for SIP files)
# SIP could be run in the source rather than in binary directory
#SET(_configured_module_sip ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/${_module_path}.sip)
SET(_configured_module_sip ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/${_child_module_name}.sip)
FOREACH (_sip_file ${SIP_FILES})
GET_FILENAME_COMPONENT(_sip_file_path ${_sip_file} PATH)
GET_FILENAME_COMPONENT(_sip_file_name_we ${_sip_file} NAME_WE)
#FILE(RELATIVE_PATH _sip_file_relpath ${BINDING_FILES_ROOT_DIR} "${_sip_file_path}/${_sip_file_name_we}")
SET(_sip_file_relpath "${_sip_file_path}/${_sip_file_name_we}")
SET(_out_sip_file "${CMAKE_CURRENT_BINARY_DIR}/${_sip_file_relpath}.sip")
CONFIGURE_FILE(${_sip_file} ${_out_sip_file})
ENDFOREACH (_sip_file)
SET(_message "-DMESSAGE=Generating CPP code for module ${MODULE_NAME}")
SET(_sip_output_files)
# Suppress warnings
IF(PEDANTIC)
IF(MSVC)
ADD_DEFINITIONS(
/wd4189 # local variable is initialized but not referenced
/wd4996 # deprecation warnings (bindings re-export deprecated methods)
/wd4701 # potentially uninitialized variable used (sip generated code)
/wd4702 # unreachable code (sip generated code)
/wd4703 # potentially uninitialized local pointer variable 'sipType' used
)
ELSE(MSVC)
# disable all warnings
ADD_DEFINITIONS( -w -Wno-deprecated-declarations )
IF(NOT APPLE)
ADD_DEFINITIONS( -fpermissive )
ENDIF(NOT APPLE)
ENDIF(MSVC)
ENDIF(PEDANTIC)
IF(MSVC)
ADD_DEFINITIONS( /bigobj )
ENDIF(MSVC)
IF (SIP_BUILD_EXECUTABLE)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}) # Output goes in this dir.
SET(_sip_output_files
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_array.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_bool.cpp
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_core.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_descriptors.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_enum.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_int_convertors.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_object_map.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_threads.c
${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip_voidptr.c)
FOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
IF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build/${_child_module_name}/sip${_child_module_name}part${CONCAT_NUM}.cpp )
ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
#SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --no-protected-is-public --pep484-pyi --no-make --concatenate=${SIP_CONCAT_PARTS} --qmake=${QMAKE_EXECUTABLE} --include-dir=${CMAKE_CURRENT_BINARY_DIR} --include-dir=${PYQT_SIP_DIR} --api-dir ${CMAKE_BINARY_DIR}/python ${SIP_BUILD_EXTRA_OPTIONS})
LIST(JOIN SIP_EXTRA_INCLUDE_DIRS "\",\"" _sip_extra_includes)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/pyproject.toml "\
[build-system]\n\
requires = [\"sip >=6, <7\"]\n\
build-backend = \"sipbuild.api\"
[tool.sip.metadata]\n\
name = \"${_child_module_name}\"\n\
[tool.sip.bindings.${_child_module_name}]\n\
concatenate = ${SIP_CONCAT_PARTS}\n\
include-dirs = [\"${_sip_extra_includes}\"]\n\
protected-is-public = false\n\
pep484-pyi = true\n\
[tool.sip.project]\n\
sip-files-dir = \"${CMAKE_CURRENT_SOURCE_DIR}/${_module_path}\"\n\
")
SET(SIPCMD ${SIP_BUILD_EXECUTABLE} --no-compile ${SIP_BUILD_EXTRA_OPTIONS})
ADD_CUSTOM_COMMAND(
OUTPUT ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${SIPCMD}
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
WORKING_DIRECTORY ${_module_path}
MAIN_DEPENDENCY ${_configured_module_sip}
DEPENDS ${SIP_EXTRA_FILES_DEPEND}
VERBATIM
)
ELSE (SIP_BUILD_EXECUTABLE)
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}) # Output goes in this dir.
SET(_sip_includes)
FOREACH (_inc ${SIP_INCLUDES})
GET_FILENAME_COMPONENT(_abs_inc ${_inc} ABSOLUTE)
LIST(APPEND _sip_includes -I ${_abs_inc})
ENDFOREACH (_inc )
SET(_sip_tags)
FOREACH (_tag ${SIP_TAGS})
LIST(APPEND _sip_tags -t ${_tag})
ENDFOREACH (_tag)
SET(_sip_x)
FOREACH (_x ${SIP_DISABLE_FEATURES})
LIST(APPEND _sip_x -x ${_x})
ENDFOREACH (_x ${SIP_DISABLE_FEATURES})
FOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
IF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
SET(_sip_output_files ${_sip_output_files} ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/sip${_child_module_name}part${CONCAT_NUM}.cpp )
ENDIF( ${CONCAT_NUM} LESS ${SIP_CONCAT_PARTS} )
ENDFOREACH(CONCAT_NUM RANGE 0 ${SIP_CONCAT_PARTS} )
SET(SIPCMD ${SIP_BINARY_PATH} ${_sip_tags} -w -e ${_sip_x} ${SIP_EXTRA_OPTIONS} -j ${SIP_CONCAT_PARTS} -c ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} -I ${CMAKE_CURRENT_BINARY_DIR}/${_module_path} ${_sip_includes} ${_configured_module_sip})
ADD_CUSTOM_COMMAND(
OUTPUT ${_sip_output_files}
COMMAND ${CMAKE_COMMAND} -E echo ${message}
COMMAND ${CMAKE_COMMAND} -E touch ${_sip_output_files}
COMMAND ${SIPCMD}
MAIN_DEPENDENCY ${_configured_module_sip}
DEPENDS ${SIP_EXTRA_FILES_DEPEND}
VERBATIM
)
ENDIF (SIP_BUILD_EXECUTABLE)
ADD_CUSTOM_TARGET(generate_sip_${MODULE_NAME}_cpp_files DEPENDS ${_sip_output_files})
SET(CPP_FILES ${_sip_output_files})
ENDMACRO(GENERATE_SIP_PYTHON_MODULE_CODE)
# Will compile and link the module
MACRO(BUILD_SIP_PYTHON_MODULE MODULE_NAME SIP_FILES EXTRA_OBJECTS)
SET(EXTRA_LINK_LIBRARIES ${ARGN})
# We give this target a long logical target name.
# (This is to avoid having the library name clash with any already
# install library names. If that happens then cmake dependency
# tracking get confused.)
STRING(REPLACE "." "_" _logical_name ${MODULE_NAME})
SET(_logical_name "python_module_${_logical_name}")
GET_FILENAME_COMPONENT(_module_path ${SIP_FILES} PATH)
ADD_LIBRARY(${_logical_name} MODULE ${_sip_output_files} ${EXTRA_OBJECTS})
SET_PROPERTY(TARGET ${_logical_name} PROPERTY AUTOMOC OFF)
TARGET_INCLUDE_DIRECTORIES(${_logical_name} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/${_module_path}/build ${SIP_EXTRA_INCLUDE_DIRS})
IF (${SIP_VERSION_STR} VERSION_LESS 5.0.0)
# require c++14 only -- sip breaks with newer versions due to reliance on throw(...) annotations removed in c++17
TARGET_COMPILE_FEATURES(${_logical_name} PRIVATE cxx_std_14)
ENDIF (${SIP_VERSION_STR} VERSION_LESS 5.0.0)
SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES CXX_VISIBILITY_PRESET default)
IF (NOT APPLE)
TARGET_LINK_LIBRARIES(${_logical_name} ${Python_LIBRARIES})
ENDIF (NOT APPLE)
TARGET_LINK_LIBRARIES(${_logical_name} ${EXTRA_LINK_LIBRARIES})
IF (APPLE)
SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
ENDIF (APPLE)
SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES PREFIX "" OUTPUT_NAME ${_child_module_name})
IF (WIN32)
SET_TARGET_PROPERTIES(${_logical_name} PROPERTIES SUFFIX ".pyd")
GET_TARGET_PROPERTY(_runtime_output ${_logical_name} RUNTIME_OUTPUT_DIRECTORY)
ADD_CUSTOM_COMMAND(TARGET ${_logical_name} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E echo "Copying extension ${_child_module_name}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "$<TARGET_FILE:${_logical_name}>" "${_runtime_output}/${_child_module_name}.pyd"
DEPENDS ${_logical_name}
)
ENDIF(WIN32)
INSTALL(TARGETS ${_logical_name} DESTINATION "${Python_SITEARCH}/${_parent_module_path}")
ENDMACRO(BUILD_SIP_PYTHON_MODULE MODULE_NAME SIP_FILES EXTRA_OBJECTS)

View File

@ -0,0 +1,19 @@
--- include/Arcus/Error.h.orig 2023-05-19 06:44:12 UTC
+++ include/Arcus/Error.h
@@ -5,6 +5,7 @@
#define ARCUS_ERROR_H
#include "Arcus/Types.h"
+#include "ArcusExport.h"
namespace Arcus
{
@@ -32,7 +33,7 @@ enum class ErrorCode
/**
* A class representing an error with an error code and an error message.
*/
-class Error
+class ARCUS_EXPORT Error
{
public:
/**

View File

@ -0,0 +1,27 @@
--- include/Arcus/MessageTypeStore.h.orig 2023-05-19 06:44:12 UTC
+++ include/Arcus/MessageTypeStore.h
@@ -8,12 +8,14 @@
#include "Arcus/Types.h"
+#include "ArcusExport.h"
+
namespace Arcus
{
/**
* A class to manage the different types of messages that are available.
*/
-class MessageTypeStore
+class ARCUS_EXPORT MessageTypeStore
{
public:
MessageTypeStore();
@@ -87,7 +89,7 @@ class MessageTypeStore (private)
void dumpMessageTypes();
private:
- class Private;
+ class ARCUS_NO_EXPORT Private;
const std::unique_ptr<Private> d;
};
} // namespace Arcus

View File

@ -0,0 +1,20 @@
--- include/Arcus/Socket.h.orig 2023-05-19 06:44:12 UTC
+++ include/Arcus/Socket.h
@@ -9,6 +9,8 @@
#include "Arcus/Error.h"
#include "Arcus/Types.h"
+#include "ArcusExport.h"
+
namespace Arcus
{
class SocketListener;
@@ -21,7 +23,7 @@ class SocketListener;
*
* Please see the README in libArcus for more details.
*/
-class Socket
+class ARCUS_EXPORT Socket
{
public:
Socket();

View File

@ -0,0 +1,20 @@
--- include/Arcus/SocketListener.h.orig 2023-05-19 06:44:12 UTC
+++ include/Arcus/SocketListener.h
@@ -6,6 +6,8 @@
#include "Arcus/Types.h"
+#include "ArcusExport.h"
+
namespace Arcus
{
class Socket;
@@ -24,7 +26,7 @@ class Error;
* signal from a subclass of this class, to make sure the actual event
* is handled on the main thread.
*/
-class SocketListener
+class ARCUS_EXPORT SocketListener
{
public:
SocketListener() : _socket(nullptr)

View File

@ -1,11 +0,0 @@
--- examples/CMakeLists.txt.orig 2021-11-26 15:37:16 UTC
+++ examples/CMakeLists.txt
@@ -12,7 +12,7 @@ add_executable(example ${example_SRCS} ${example_PB_SR
target_link_libraries(example Arcus)
if(NOT WIN32 OR CMAKE_COMPILER_IS_GNUCXX)
target_link_libraries(example pthread)
- set_target_properties(example PROPERTIES COMPILE_FLAGS "-std=c++11")
+ set_target_properties(example PROPERTIES COMPILE_FLAGS "-std=c++17")
endif()
add_custom_command(

View File

@ -0,0 +1,22 @@
--- src/MessageTypeStore.cpp.orig 2024-08-19 14:31:10.714537000 +0200
+++ src/MessageTypeStore.cpp 2024-08-19 15:30:50.769879000 +0200
@@ -39,7 +39,7 @@
{
}
- void AddError(const std::string& filename, int line, int column, const std::string& message) override
+ void AddError(const std::string& filename, int line, int column, const std::string& message)
{
_stream << "[" << filename << " (" << line << "," << column << ")] " << message << std::endl;
_error_count++;
@@ -53,6 +53,10 @@
int getErrorCount()
{
return _error_count;
+ }
+
+ void RecordError(absl::string_view filename, int line, int column, absl::string_view message)
+ {
}
private:

View File

@ -1,11 +0,0 @@
--- src/Socket_p.h.orig 2022-04-14 03:31:38 UTC
+++ src/Socket_p.h
@@ -548,7 +548,7 @@ namespace Arcus
google::protobuf::io::ArrayInputStream array(wire_message->data, wire_message->size);
google::protobuf::io::CodedInputStream stream(&array);
- stream.SetTotalBytesLimit(message_size_maximum, message_size_warning);
+ stream.SetTotalBytesLimit(message_size_maximum);
if(!message->ParseFromCodedStream(&stream))
{
error(ErrorCode::ParseFailedError, "Failed to parse message:" + std::string(wire_message->data));

View File

@ -11,4 +11,4 @@ lib/cmake/Arcus/ArcusConfigVersion.cmake
lib/libArcus.so
lib/libArcus.so.1.1.0
lib/libArcus.so.3
%%PYTHON_SITELIBDIR%%/Arcus.so
%%PYTHON_SITELIBDIR%%/pyArcus.so