Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Build and Deploy

on:
pull_request:
push:
tags:
- 'v*'
Expand All @@ -20,6 +21,9 @@ jobs:
- os: macos-latest
platform: darwin
arch: arm64
- os: windows-latest
platform: win32
arch: x64

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -119,6 +123,7 @@ jobs:
publish:
name: Publish to npm
needs: build
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
8 changes: 6 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,21 @@
}],

["OS=='win'", {
"include_dirs": [
"C:/vcpkg/installed/x64-windows/include"
],
"libraries": [
"<(module_root_dir)/vendor/lib/networkit.lib",
"<(module_root_dir)/vendor/lib/networkit/networkit_state.lib",
"<(module_root_dir)/vendor/lib/tlx.lib",
"arrow.lib"
"C:/vcpkg/installed/x64-windows/lib/arrow.lib"
],
"msvs_settings": {
"VCCLCompilerTool": {
"ExceptionHandling": 1,
"RuntimeLibrary": 2, # 2 = /MD (MD_DynamicRelease), matching prebuilt networkit.lib
"AdditionalOptions": ["/std:c++20", "/openmp", "/W0"]
"RuntimeTypeInfo": "true",
"AdditionalOptions": ["/std:c++20", "/openmp", "/W0", "/MD", "/GR"]
}
}
}]
Expand Down
25 changes: 23 additions & 2 deletions scripts/build-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,28 @@ function useHomebrewLlvmIfAvailable(env) {
return env;
}

const args = ['node-gyp', 'rebuild', ...process.argv.slice(2)];
function nodeGypCommand() {
try {
return {
command: process.execPath,
args: [require.resolve('node-gyp/bin/node-gyp.js'), 'rebuild', ...process.argv.slice(2)],
};
} catch {
if (process.env.npm_execpath) {
return {
command: process.execPath,
args: [process.env.npm_execpath, 'exec', '--', 'node-gyp', 'rebuild', ...process.argv.slice(2)],
};
}

return {
command: process.platform === 'win32' ? 'npx.cmd' : 'npx',
args: ['node-gyp', 'rebuild', ...process.argv.slice(2)],
};
}
}

const { command, args } = nodeGypCommand();
const env = useHomebrewLlvmIfAvailable(process.env);

if (process.platform === 'darwin') {
Expand All @@ -43,7 +64,7 @@ if (process.platform === 'darwin') {
}
}

execFileSync('npm', ['exec', '--', ...args], {
execFileSync(command, args, {
cwd: root,
env,
stdio: 'inherit',
Expand Down
86 changes: 86 additions & 0 deletions vendor/include/networkit/GlobalState.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@

#ifndef NETWORKIT_GLOBAL_STATE_HPP_
#define NETWORKIT_GLOBAL_STATE_HPP_

#if defined(NETWORKIT_BUILDING_STATELIB)
#if defined(WIN32)
#define NETWORKIT_EXPORT __declspec(dllexport)
#else
#define NETWORKIT_EXPORT
#endif // WIN32
#else
#if defined(WIN32)
#define NETWORKIT_EXPORT __declspec(dllimport)
#else
#define NETWORKIT_EXPORT
#endif // WIN32
#endif // NETWORKIT_BUILDING_STATELIB

#include <atomic>
#include <csignal>
#include <cstdint>
#include <fstream>
#include <mutex>

#include <networkit/auxiliary/Log.hpp>
#include <networkit/auxiliary/SignalHandling.hpp>

namespace NetworKit {

namespace GlobalState {

// Global states used for auxiliary/Random

// The global seed generation functions as an epoch counter
// for each time, the seed was updated. At the same time it
// releases the changes made to the seed values to other
// threads which always access it by an aquire.
// seedValues and seedUseThreadId can hence be accesses
// relaxed.
// As long as globalSeedGeneration is zero, the getURNG()
// ignores these two variables.

NETWORKIT_EXPORT uint64_t getSeed();
NETWORKIT_EXPORT void setSeed(uint64_t seed);

NETWORKIT_EXPORT uint64_t getGlobalSeed();
NETWORKIT_EXPORT void incGlobalSeed();

NETWORKIT_EXPORT void setSeedUseThreadId(bool useThreadId);
NETWORKIT_EXPORT bool getSeedUseThreadId();

// Global states used for auxiliary/Log
NETWORKIT_EXPORT Aux::Log::LogLevel getLogLevel();
NETWORKIT_EXPORT void setLogLevel(Aux::Log::LogLevel p = Aux::Log::LogLevel::INFO);

NETWORKIT_EXPORT bool getPrintTime();
NETWORKIT_EXPORT void setPrintTime(bool b);

NETWORKIT_EXPORT bool getPrintLocation();
NETWORKIT_EXPORT void setPrintLocation(bool b);

NETWORKIT_EXPORT std::ofstream &getLogFile();
NETWORKIT_EXPORT void setLogfile(std::string_view filename);

NETWORKIT_EXPORT std::mutex &getLogFileMutex();

NETWORKIT_EXPORT bool getLogFileIsOpen();

// Global states used for auxiliary/SignalHandling
NETWORKIT_EXPORT bool getReceivedSIGINT();
NETWORKIT_EXPORT void setReceivedSIGINT(bool isReceivedSIGINT);

NETWORKIT_EXPORT bool getRootSet();
NETWORKIT_EXPORT void setRootSet(bool isRootSet);

NETWORKIT_EXPORT auto getPrevHandler() -> void (*)(int);
NETWORKIT_EXPORT void setPrevHandler(void (*handler)(int));

NETWORKIT_EXPORT Aux::SignalHandler *getRoot();
NETWORKIT_EXPORT void setRoot(Aux::SignalHandler *rootHandler);

} // namespace GlobalState

} // namespace NetworKit

#endif // NETWORKIT_GLOBAL_STATE_HPP_
41 changes: 41 additions & 0 deletions vendor/include/networkit/Globals.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Globals.hpp
*
* Created on: 06.02.2013
* Author: Christian Staudt (christian.staudt@kit.edu)
*/

#ifndef NETWORKIT_GLOBALS_HPP_
#define NETWORKIT_GLOBALS_HPP_

#include <cstdint>
#include <limits>
#include <utility>

namespace NetworKit {
using index = uint64_t; ///< more expressive name for an index into an array

/// Should be used in OpenMP parallel for-loops and is associated with unsigned semantics.
/// On MSVC it falls back to being signed, as MSVC does not support unsigned parallel fors.
#ifdef _MSC_VER
using omp_index = int64_t;
#else
using omp_index = index;
#endif // _MSC_VER

using coordinate = double;

using count = uint64_t; ///< more expressive name for an integer quantity
using node = index; ///< node indices are 0-based
using edgeweight = double; ///< edge weight type
using edgeid = index; ///< edge id

constexpr edgeweight defaultEdgeWeight = 1.0;
constexpr edgeweight nullWeight = 0.0;
constexpr index none = std::numeric_limits<index>::max(); ///< value for not existing nodes/edges

constexpr double PI = 3.141592653589793238462643383279502884197169399375105820974944592307816406286;

} // namespace NetworKit

#endif // NETWORKIT_GLOBALS_HPP_
27 changes: 27 additions & 0 deletions vendor/include/networkit/algebraic/AlgebraicGlobals.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* AlgebraicGlobals.h
*
* Created on: May 31, 2016
* Author: Michael Wegner (michael.wegner@student.kit.edu)
*/

#ifndef NETWORKIT_ALGEBRAIC_ALGEBRAIC_GLOBALS_HPP_
#define NETWORKIT_ALGEBRAIC_ALGEBRAIC_GLOBALS_HPP_

#include <networkit/Globals.hpp>

namespace NetworKit {

/** Represents a matrix entry s.t. matrix(row, column) = value */
struct Triplet {
index row;
index column;
double value;
};

/** Floating point epsilon to use in comparisons. */
constexpr double FLOAT_EPSILON = 1e-9;

} // namespace NetworKit

#endif // NETWORKIT_ALGEBRAIC_ALGEBRAIC_GLOBALS_HPP_
Loading
Loading