@cpp.js/package-spatialite-multithread 2.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,35 @@
1
+ <!-- ***** BEGIN LICENSE BLOCK *****
2
+ - Version: MPL 1.1/GPL 2.0/LGPL 2.1
3
+ -
4
+ - The contents of this file are subject to the Mozilla Public License Version
5
+ - 1.1 (the "License"); you may not use this file except in compliance with
6
+ - the License. You may obtain a copy of the License at
7
+ - http://www.mozilla.org/MPL/
8
+ -
9
+ - Software distributed under the License is distributed on an "AS IS" basis,
10
+ - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11
+ - for the specific language governing rights and limitations under the
12
+ - License.
13
+ -
14
+ - The Original Code is __________________________________________.
15
+ -
16
+ - The Initial Developer of the Original Code is
17
+ - ____________________________________________.
18
+ - Portions created by the Initial Developer are Copyright (C) 2___
19
+ - the Initial Developer. All Rights Reserved.
20
+ -
21
+ - Contributor(s):
22
+ -
23
+ - Alternatively, the contents of this file may be used under the terms of
24
+ - either the GNU General Public License Version 2 or later (the "GPL"), or
25
+ - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
26
+ - in which case the provisions of the GPL or the LGPL are applicable instead
27
+ - of those above. If you wish to allow use of your version of this file only
28
+ - under the terms of either the GPL or the LGPL, and not to allow others to
29
+ - use your version of this file under the terms of the MPL, indicate your
30
+ - decision by deleting the provisions above and replace them with the notice
31
+ - and other provisions required by the LGPL or the GPL. If you do not delete
32
+ - the provisions above, a recipient may use your version of this file under
33
+ - the terms of any one of the MPL, the GPL or the LGPL.
34
+ -
35
+ - ***** END LICENSE BLOCK ***** -->
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # @cpp.js/package-spatialite
2
+ **Precompiled spatialite library built with cpp.js for seamless integration in JavaScript, WebAssembly and React Native projects.**
3
+
4
+ <a href="https://www.npmjs.com/package/@cpp.js/package-spatialite">
5
+ <img alt="NPM version" src="https://img.shields.io/npm/v/@cpp.js/package-spatialite?style=for-the-badge" />
6
+ </a>
7
+ <a href="https://www.gaia-gis.it/fossil/libspatialite/index">
8
+ <img src="https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Funpkg.com%2F%40cpp.js%2Fpackage-spatialite%2Fpackage.json&query=%24.nativeVersion&style=for-the-badge&label=SpatiaLite" />
9
+ </a>
10
+ <a href="https://website-archive.mozilla.org/www.mozilla.org/mpl/MPL/boilerplate-1.1/mpl-tri-license-html">
11
+ <img alt="License" src="https://img.shields.io/npm/l/%40cpp.js%2Fpackage-spatialite?style=for-the-badge" />
12
+ </a>
13
+
14
+ ## Integration
15
+ Start by installing these package with the following command:
16
+
17
+ ```sh
18
+ npm install @cpp.js/package-spatialite
19
+ ```
20
+
21
+ To enable the library, modify the cppjs.config.js file as shown below.
22
+ ```diff
23
+ +import spatialite from '@cpp.js/package-spatialite/cppjs.config.js';
24
+
25
+ export default {
26
+ dependencies: [
27
+ + spatialite
28
+ ]
29
+ paths: {
30
+ config: import.meta.url,
31
+ }
32
+ };
33
+ ```
34
+
35
+ ## Usage
36
+ Below are the steps to use the spatialite in your C++ or JavaScript code.
37
+
38
+ ### Usage in C++ Code
39
+ ```diff
40
+ +#include <spatialite.h>
41
+
42
+ std::string Native::sample() {
43
+ + return std::string(spatialite_version());
44
+ }
45
+ ```
46
+
47
+ ## License
48
+ This project includes the precompiled spatialite library, which is distributed under the [MPL tri-license](https://website-archive.mozilla.org/www.mozilla.org/mpl/MPL/boilerplate-1.1/mpl-tri-license-html).
49
+
50
+ Spatialite Homepage: [https://www.gaia-gis.it/fossil/libspatialite/index](https://www.gaia-gis.it/fossil/libspatialite/index)
package/cppjs.build.js ADDED
@@ -0,0 +1,50 @@
1
+ const platformBuild = {
2
+ 'Emscripten-x86_64': ['--enable-shared=no', '--host=x86_64-pc-linux-gnu'],
3
+ 'Android-arm64-v8a': ['--enable-static=no', '--host=aarch64-linux-android'],
4
+ 'Android-x86_64': ['--enable-static=no', '--host=x86_64-linux-android'],
5
+ 'iOS-iphoneos': ['--enable-shared=no', '--host=arm-apple-darwin'],
6
+ 'iOS-iphonesimulator': ['--enable-shared=no', '--host=x86_64-apple-darwin'],
7
+ };
8
+
9
+ const platformLibs = {
10
+ 'Emscripten-x86_64': ['-lsqlite3'],
11
+ 'Android-arm64-v8a': ['-lstdc++', '-lsqlite3', '-lm', '-ltiff', '-lgeos'],
12
+ 'Android-x86_64': ['-lstdc++', '-lsqlite3', '-lm', '-ltiff', '-lgeos'],
13
+ 'iOS-iphoneos': ['-lstdc++', '-lsqlite3', '-lm', '-ltiff', '-lgeos'],
14
+ 'iOS-iphonesimulator': ['-lstdc++', '-lsqlite3', '-lm', '-ltiff', '-lgeos'],
15
+ };
16
+
17
+ const platformSourceReplaceList = {
18
+ 'Android-arm64-v8a': [
19
+ {
20
+ regex: ' -lpthread',
21
+ replacement: '',
22
+ paths: ['configure', 'configure.ac', 'src/Makefile.in', 'src/Makefile.am'],
23
+ },
24
+ ],
25
+ 'Android-x86_64': [
26
+ {
27
+ regex: ' -lpthread',
28
+ replacement: '',
29
+ paths: ['configure', 'configure.ac', 'src/Makefile.in', 'src/Makefile.am'],
30
+ },
31
+ ],
32
+ };
33
+
34
+ export default {
35
+ getURL: (version) => `https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-${version}.tar.gz`,
36
+ copyToSource: { 'config.sub': 'config.sub' },
37
+ sourceReplaceList: (platform) => [
38
+ ...(platformSourceReplaceList[platform] || []),
39
+ ],
40
+ buildType: 'configure', // cmake, configure
41
+ getBuildParams: (platform, depPaths) => [
42
+ ...(platformBuild[platform] || []),
43
+ '--enable-geosadvanced=yes', '--enable-geopackage=yes', '--enable-examples=no', '--enable-minizip=no',
44
+ '--enable-libxml2=no', '--enable-freexl=no', '--disable-rttopo', '--disable-gcp',
45
+ `--with-geosconfig=${depPaths.geos.bin}/geos-config`,
46
+ `SQLITE3_CFLAGS=-I${depPaths.sqlite3.header}`,
47
+ `SQLITE3_LIBS=-L${depPaths.sqlite3.libPath}`,
48
+ ],
49
+ getExtraLibs: (platform) => platformLibs[platform] || [],
50
+ };
@@ -0,0 +1,14 @@
1
+ import spatialiteWasmMultithread from '@cpp.js/package-spatialite-wasm-multithread/cppjs.config.js';
2
+ import spatialiteAndroidMultithread from '@cpp.js/package-spatialite-android-multithread/cppjs.config.js';
3
+ import spatialiteIosMultithread from '@cpp.js/package-spatialite-ios-multithread/cppjs.config.js';
4
+
5
+ export default {
6
+ dependencies: [
7
+ spatialiteWasmMultithread,
8
+ spatialiteAndroidMultithread,
9
+ spatialiteIosMultithread,
10
+ ],
11
+ paths: {
12
+ config: import.meta.url
13
+ }
14
+ };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@cpp.js/package-spatialite-multithread",
3
+ "version": "2.0.0-beta.1",
4
+ "nativeVersion": "5.1.0",
5
+ "description": "This package provides SpatiaLite, a spatial extension to SQLite, compiled with Cpp.js for seamless integration in JavaScript, WebAssembly and React Native environments. By using Cpp.js, this package enables high-performance spatial database operations both on the web (via WebAssembly) and native mobile environments (via machine code).",
6
+ "homepage": "https://github.com/bugra9/cpp.js/tree/main/packages/cppjs-package-spatialite#readme",
7
+ "repository": "https://github.com/bugra9/cpp.js.git",
8
+ "type": "module",
9
+ "license": "MPL tri-license",
10
+ "keywords": [
11
+ "spatialite",
12
+ "libspatialite",
13
+ "cpp.js-package",
14
+ "webassembly",
15
+ "react-native"
16
+ ],
17
+ "devDependencies": {
18
+ "cpp.js": "^2.0.0-beta.1",
19
+ "@cpp.js/package-spatialite-wasm-multithread": "^2.0.0-beta.1",
20
+ "@cpp.js/package-spatialite-android-multithread": "^2.0.0-beta.1",
21
+ "@cpp.js/package-spatialite-ios-multithread": "^2.0.0-beta.1"
22
+ }
23
+ }