[rappture] Add new port (#13321)

This commit is contained in:
Vitalii Koshura 2020-09-05 05:14:17 +02:00 committed by GitHub
parent 147b06664b
commit 2e110d26c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 239 additions and 0 deletions

View File

@ -0,0 +1,110 @@
cmake_minimum_required(VERSION 3.11)
cmake_policy(VERSION 3.11)
project (rappture)
set(SRC_RAPPTURE_CORE
src/core/scew_extras.c
src/core/RpBindingsDict.cc
src/core/RpBuffer.cc
src/core/RpBufferCInterface.cc
src/core/RpDXWriter.cc
src/core/RpDXWriterFInterface.cc
src/core/RpEncode.cc
src/core/RpEntityRef.cc
src/core/RpFortranCommon.cc
src/core/RpLibrary.cc
src/core/RpLibraryCInterface.cc
src/core/RpLibraryFInterface.cc
src/core/RpOutcome.cc
src/core/RpOutcomeCInterface.cc
src/core/RpPtr.cc
src/core/RpResult.cc
src/core/RpUnits.cc
src/core/RpUnitsCInterface.cc
src/core/RpUnitsFInterface.cc
src/core/RpUnitsStd.cc
src/core/RpUtils.cc
src/core/RpUtilsCInterface.cc
src/core/RpUtilsFInterface.cc
src/core/b64/cdecode.c
src/core/b64/cencode.c
src/core/scew/attribute.c
src/core/scew/element.c
src/core/scew/error.c
src/core/scew/parser.c
src/core/scew/str.c
src/core/scew/tree.c
src/core/scew/writer.c
src/core/scew/xattribute.c
src/core/scew/xerror.c
src/core/scew/xhandler.c
src/core/scew/xparser.c
src/core/scew/xprint.c
)
set(HEADERS
src/core/rappture.h
src/core/RpBindingsDict.h
src/core/RpBuffer.h
src/core/RpBufferCHelper.h
src/core/RpBufferCInterface.h
src/core/RpDict.h
src/core/RpDXWriter.h
src/core/RpDXWriterFInterface.h
src/core/RpDXWriterFStubs.h
src/core/RpEncode.h
src/core/RpEntityRef.h
src/core/RpFortranCommon.h
src/core/RpLibrary.h
src/core/RpLibraryCInterface.h
src/core/RpLibraryFInterface.h
src/core/RpLibraryFStubs.h
src/core/RpOutcome.h
src/core/RpOutcomeCHelper.h
src/core/RpOutcomeCInterface.h
src/core/RpPtr.h
src/core/RpSimpleBuffer.h
src/core/RpUnits.h
src/core/RpUnitsCInterface.h
src/core/RpUnitsFInterface.h
src/core/RpUnitsFStubs.h
src/core/RpUnitsStd.h
src/core/RpUtils.h
src/core/RpUtilsCInterface.h
src/core/RpUtilsFInterface.h
src/core/RpUtilsFStubs.h
src/core/scew_extras.h
)
add_library(rappture ${SRC_RAPPTURE_CORE} ${HEADERS})
target_include_directories(rappture PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/core/>
$<INSTALL_INTERFACE:include>
)
find_package(expat CONFIG REQUIRED)
find_package(ZLIB REQUIRED)
target_compile_definitions(rappture PUBLIC
-D_CRT_SECURE_NO_WARNINGS
-DRAPPTURE_VERSION=1.9
-DSVN_VERSION=6713
-D_USE_MATH_DEFINES
)
target_link_libraries(rappture PRIVATE
expat::expat
ZLIB::ZLIB
)
install(TARGETS rappture EXPORT rappture-config
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
)
install(FILES ${HEADERS} DESTINATION include/rappture)
install(EXPORT rappture-config NAMESPACE unofficial::rappture:: DESTINATION share/rappture)

4
ports/rappture/CONTROL Normal file
View File

@ -0,0 +1,4 @@
Source: rappture
Version: 1.9
Description: Rappture is a toolkit supporting Rapid application infrastructure, making it quick and easy to develop powerful scientific applications.
Build-Depends: expat, zlib

View File

@ -0,0 +1,36 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_download_distfile(ARCHIVE
URLS "https://nanohub.org/app/site/downloads/rappture/rappture-src-20130903.tar.gz"
FILENAME "rappture-src-20130903.tar.gz"
SHA512 3b42569d056c5e80762eada3aff23d230d4ba8f6f0078de44d8571a713dde91e31e66fe3c37ceb66e934a1410b338fb481aeb5a29ef56b53da4ad2e8a2a2ae59
)
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES
"${CMAKE_CURRENT_LIST_DIR}/rappture.patch"
)
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
)
vcpkg_install_cmake()
vcpkg_fixup_cmake_targets()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
file(
INSTALL ${SOURCE_PATH}/license.terms
DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}
RENAME copyright
)

View File

@ -0,0 +1,89 @@
diff --git a/src/core/RpBuffer.cc b/src/core/RpBuffer.cc
index 6d439fe..ec45405 100644
--- a/src/core/RpBuffer.cc
+++ b/src/core/RpBuffer.cc
@@ -16,7 +16,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <unistd.h>
#include <fstream>
#include <zlib.h>
#include "b64/encode.h"
@@ -24,6 +23,11 @@
#include "RpBuffer.h"
#include "RpEncode.h"
+#if defined(_MSC_VER)
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
namespace Rappture {
/**
@@ -109,6 +113,9 @@ Buffer::operator+=(const Buffer& b)
Buffer::~Buffer()
{}
+#ifndef _WIN32
+# define _fileno fileno
+#endif
bool
Buffer::load (Outcome &status, const char *path)
@@ -123,7 +130,7 @@ Buffer::load (Outcome &status, const char *path)
}
struct stat stat;
- if (fstat(fileno(f), &stat) < 0) {
+ if (fstat(_fileno(f), &stat) < 0) {
status.addError("can't stat \"%s\": %s", path, strerror(errno));
return false;
}
diff --git a/src/core/RpDXWriter.cc b/src/core/RpDXWriter.cc
index e4748b3..8990c0f 100644
--- a/src/core/RpDXWriter.cc
+++ b/src/core/RpDXWriter.cc
@@ -18,6 +18,12 @@
#include <cfloat>
#include <RpDXWriter.h>
#include <assert.h>
+
+#if defined(_MSC_VER)
+#include <BaseTsd.h>
+typedef SSIZE_T ssize_t;
+#endif
+
using namespace Rappture;
DXWriter::DXWriter() :
diff --git a/src/core/RpLibrary.cc b/src/core/RpLibrary.cc
index 2b9a540..4da787b 100644
--- a/src/core/RpLibrary.cc
+++ b/src/core/RpLibrary.cc
@@ -11,7 +11,6 @@
* ======================================================================
*/
-#include "config.h"
#include "scew/scew.h"
#include "scew_extras.h"
#include "RpLibrary.h"
diff --git a/src/core/scew/scew.h b/src/core/scew/scew.h
index 9741ed5..e335c2d 100644
--- a/src/core/scew/scew.h
+++ b/src/core/scew/scew.h
@@ -61,12 +61,6 @@
# define SCEW_LIB_D
# endif /* _DEBUG */
-# if defined(SCEW_LIB_U) || defined(SCEW_LIB_S) || defined(SCEW_LIB_D)
-# pragma comment( lib, "scew_" SCEW_LIB_U SCEW_LIB_S SCEW_LIB_D ".lib" )
-# else
-# pragma comment( lib, "scew.lib" )
-# endif
-
#endif /* _WIN32 */
#endif /* SCEW_H_ALEIX0211250134 */