Change build system, make work for npm registry
In Flowee the main repo I removed the Qt dependency for the stuff we use and in this repo I stopped linking to the externally built flowee libraries. This introduces an import.sh which copies the flowee sources we use in this plugin to sure there being minimumal external dependencies.
This commit is contained in:
@@ -2,3 +2,4 @@ build
|
|||||||
node_modules
|
node_modules
|
||||||
package-lock.json
|
package-lock.json
|
||||||
*.txt.user
|
*.txt.user
|
||||||
|
external
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
build
|
||||||
|
node_modules
|
||||||
|
package-lock.json
|
||||||
|
*.txt.user
|
||||||
|
import.sh
|
||||||
+52
-11
@@ -26,21 +26,17 @@ set(CLIENT_VERSION_REVISION 1)
|
|||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/external/cmake)
|
||||||
|
|
||||||
message(STATUS "-=-_-=- Building FloweeJS ${CLIENT_VERSION_MAJOR}-${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_REVISION}")
|
message(STATUS "-=-_-=- Building FloweeJS ${CLIENT_VERSION_MAJOR}-${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_REVISION}")
|
||||||
|
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
message ("Using OpenSSL ${OPENSSL_VERSION}")
|
message ("Using OpenSSL ${OPENSSL_VERSION}")
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
|
||||||
|
|
||||||
find_package(Boost 1.56.0
|
find_package(Boost 1.56.0
|
||||||
REQUIRED
|
REQUIRED
|
||||||
filesystem iostreams program_options system thread
|
filesystem iostreams program_options system thread
|
||||||
)
|
)
|
||||||
find_package(Flowee REQUIRED)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Include N-API wrappers
|
# Include N-API wrappers
|
||||||
execute_process(COMMAND node -p "require('node-addon-api').include"
|
execute_process(COMMAND node -p "require('node-addon-api').include"
|
||||||
@@ -50,9 +46,56 @@ execute_process(COMMAND node -p "require('node-addon-api').include"
|
|||||||
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
string(REPLACE "\n" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
||||||
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
string(REPLACE "\"" "" NODE_ADDON_API_DIR ${NODE_ADDON_API_DIR})
|
||||||
|
|
||||||
include_directories(${NODE_ADDON_API_DIR}
|
|
||||||
${CMAKE_JS_INC}
|
# create config file
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
find_path (HAVE_BYTESWAP_H byteswap.h)
|
||||||
|
check_symbol_exists(bswap_16 "byteswap.h" HAVE_DECL_BSWAP_16)
|
||||||
|
check_symbol_exists(bswap_32 "byteswap.h" HAVE_DECL_BSWAP_32)
|
||||||
|
check_symbol_exists(bswap_64 "byteswap.h" HAVE_DECL_BSWAP_64)
|
||||||
|
find_path (HAVE_ENDIAN_H endian.h)
|
||||||
|
find_path (HAVE_SYS_ENDIAN_H sys/endian.h)
|
||||||
|
check_symbol_exists(le16toh "endian.h" HAVE_DECL_LE16TOH)
|
||||||
|
check_symbol_exists(be16toh "endian.h" HAVE_DECL_BE16TOH)
|
||||||
|
check_symbol_exists(be32toh "endian.h" HAVE_DECL_BE32TOH)
|
||||||
|
check_symbol_exists(be64toh "endian.h" HAVE_DECL_BE64TOH)
|
||||||
|
check_symbol_exists(htobe16 "endian.h" HAVE_DECL_HTOBE16)
|
||||||
|
check_symbol_exists(htobe32 "endian.h" HAVE_DECL_HTOBE32)
|
||||||
|
check_symbol_exists(htobe64 "endian.h" HAVE_DECL_HTOBE64)
|
||||||
|
check_symbol_exists(htole16 "endian.h" HAVE_DECL_HTOLE16)
|
||||||
|
check_symbol_exists(htole32 "endian.h" HAVE_DECL_HTOLE32)
|
||||||
|
check_symbol_exists(htole64 "endian.h" HAVE_DECL_HTOLE64)
|
||||||
|
check_symbol_exists(le16toh "endian.h" HAVE_DECL_LE16TOH)
|
||||||
|
check_symbol_exists(le32toh "endian.h" HAVE_DECL_LE32TOH)
|
||||||
|
check_symbol_exists(le64toh "endian.h" HAVE_DECL_LE64TOH)
|
||||||
|
|
||||||
|
set (WORDS_BIGENDIAN ${CMAKE_WORDS_BIGENDIAN})
|
||||||
|
include (TestBigEndian)
|
||||||
|
test_big_endian(CMAKE_WORDS_BIGENDIAN)
|
||||||
|
|
||||||
|
configure_file (
|
||||||
|
"${CMAKE_SOURCE_DIR}/external/flowee-config.h.in"
|
||||||
|
${CMAKE_BINARY_DIR}/config/flowee-config.h
|
||||||
|
@ONLY
|
||||||
)
|
)
|
||||||
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
|
include_directories(${NODE_ADDON_API_DIR}
|
||||||
|
external
|
||||||
|
external/utils
|
||||||
|
external/crypto
|
||||||
|
external/interfaces
|
||||||
|
${CMAKE_JS_INC}
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# include the flowee source files.
|
||||||
|
add_subdirectory (external)
|
||||||
|
add_subdirectory (external/crypto)
|
||||||
|
|
||||||
|
# finally, build our plugin
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||||
|
|
||||||
|
|
||||||
add_library(flowee SHARED
|
add_library(flowee SHARED
|
||||||
ContextData.cpp
|
ContextData.cpp
|
||||||
@@ -61,11 +104,9 @@ add_library(flowee SHARED
|
|||||||
)
|
)
|
||||||
set_target_properties(flowee PROPERTIES PREFIX "" SUFFIX ".node")
|
set_target_properties(flowee PROPERTIES PREFIX "" SUFFIX ".node")
|
||||||
target_link_libraries(flowee
|
target_link_libraries(flowee
|
||||||
flowee_utils
|
flowee_lib
|
||||||
flowee_apputils
|
flowee_crypto
|
||||||
flowee_networkmanager
|
|
||||||
${Boost_LIBRARIES}
|
${Boost_LIBRARIES}
|
||||||
Qt5::Core
|
|
||||||
${CMAKE_JS_LIB}
|
${CMAKE_JS_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
+5
-7
@@ -99,11 +99,9 @@ void contextData_hubConnectedCallback(Napi::Env env, Napi::Function jsCallback,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// likewise for the indexer
|
// likewise for the indexer
|
||||||
void contextData_IndexerConnectedCallback(Napi::Env env, Napi::Function jsCallback, Blockchain::Services *services)
|
void contextData_IndexerConnectedCallback(Napi::Env env, Napi::Function jsCallback, void *data)
|
||||||
{
|
{
|
||||||
assert(services);
|
jsCallback.Call({ });
|
||||||
jsCallback.Call({ /*Napi::String::New(env, services )*/});
|
|
||||||
delete services;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Napi::Value contextData_connectIndexer(const Napi::CallbackInfo &info)
|
Napi::Value contextData_connectIndexer(const Napi::CallbackInfo &info)
|
||||||
@@ -176,11 +174,11 @@ void ContextData::initializeHubConnection(NetworkConnection /*connection*/, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextData::initializeIndexerConnection(NetworkConnection /*connection*/, Blockchain::Services services)
|
void ContextData::initializeIndexerConnection(NetworkConnection /*connection*/)
|
||||||
{
|
{
|
||||||
if (m_onIndexerConnect.Acquire() == napi_ok) {
|
if (m_onIndexerConnect.Acquire() == napi_ok) {
|
||||||
Blockchain::Services *s = new Blockchain::Services(services);
|
void *data = nullptr;
|
||||||
m_onIndexerConnect.NonBlockingCall(s, contextData_IndexerConnectedCallback);
|
m_onIndexerConnect.NonBlockingCall(data, contextData_IndexerConnectedCallback);
|
||||||
m_onIndexerConnect.Release();
|
m_onIndexerConnect.Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ public:
|
|||||||
void connectIndexer(napi_env env, const std::string &hostname, int port);
|
void connectIndexer(napi_env env, const std::string &hostname, int port);
|
||||||
|
|
||||||
void initializeHubConnection(NetworkConnection connection, const std::string &hubVersion);
|
void initializeHubConnection(NetworkConnection connection, const std::string &hubVersion);
|
||||||
void initializeIndexerConnection(NetworkConnection connection, Blockchain::Services services);
|
void initializeIndexerConnection(NetworkConnection connection);
|
||||||
|
|
||||||
static Napi::Value setOnConnectedHub(const Napi::CallbackInfo &info);
|
static Napi::Value setOnConnectedHub(const Napi::CallbackInfo &info);
|
||||||
static Napi::Value setOnConnectIndexer(const Napi::CallbackInfo &info);
|
static Napi::Value setOnConnectIndexer(const Napi::CallbackInfo &info);
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
cd `dirname $0`
|
||||||
|
|
||||||
|
if test -z "$SOURCES_HUB" -o ! -d "$SOURCES_HUB" -o ! -d "$SOURCES_HUB/hub"; then
|
||||||
|
echo -e "ERROR: Please export SOURCES_HUB to the absolute path of thehub repo\n"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
sources="
|
||||||
|
config/flowee-config.h.in
|
||||||
|
interfaces/NetworkEnums.h
|
||||||
|
interfaces/APIProtocol.h
|
||||||
|
apputils/Blockchain.cpp
|
||||||
|
apputils/Blockchain.h
|
||||||
|
apputils/Blockchain_p.h
|
||||||
|
networkmanager/NetworkConnection.cpp
|
||||||
|
networkmanager/NetworkConnection.h
|
||||||
|
networkmanager/NetworkEndPoint.h
|
||||||
|
networkmanager/NetworkException.cpp
|
||||||
|
networkmanager/NetworkException.h
|
||||||
|
networkmanager/NetworkManager.cpp
|
||||||
|
networkmanager/NetworkManager.h
|
||||||
|
networkmanager/NetworkManager_p.h
|
||||||
|
networkmanager/NetworkQueueFullError.cpp
|
||||||
|
networkmanager/NetworkQueueFullError.h
|
||||||
|
networkmanager/NetworkServiceBase.cpp
|
||||||
|
networkmanager/NetworkServiceBase.h
|
||||||
|
networkmanager/NetworkService.cpp
|
||||||
|
networkmanager/NetworkService.h
|
||||||
|
utils/utilstrencodings.h
|
||||||
|
utils/utilstrencodings.cpp
|
||||||
|
utils/chainparamsbase.h
|
||||||
|
utils/chainparamsbase.cpp
|
||||||
|
utils/WorkerThreads.h
|
||||||
|
utils/WorkerThreads.cpp
|
||||||
|
utils/uint256.h
|
||||||
|
utils/uint256.cpp
|
||||||
|
utils/tinyformat.h
|
||||||
|
utils/Logger.cpp
|
||||||
|
utils/Logger.h
|
||||||
|
utils/utiltime.h
|
||||||
|
utils/utiltime.cpp
|
||||||
|
utils/LogChannels.cpp
|
||||||
|
utils/LogChannels_p.h
|
||||||
|
utils/Message.cpp
|
||||||
|
utils/Message.h
|
||||||
|
utils/hash.h
|
||||||
|
utils/hash.cpp
|
||||||
|
utils/prevector.h
|
||||||
|
utils/serialize.h
|
||||||
|
utils/version.h
|
||||||
|
utils/WaitUntilFinishedHelper.h
|
||||||
|
utils/WaitUntilFinishedHelper.cpp
|
||||||
|
utils/amount.cpp
|
||||||
|
utils/amount.h
|
||||||
|
|
||||||
|
interfaces/
|
||||||
|
interfaces/boost_compat.h
|
||||||
|
streaming/
|
||||||
|
utils/streaming/ConstBuffer.h
|
||||||
|
utils/streaming/ConstBuffer.cpp
|
||||||
|
utils/streaming/MessageBuilder.h
|
||||||
|
utils/streaming/MessageBuilder_p.h
|
||||||
|
utils/streaming/MessageBuilder.cpp
|
||||||
|
utils/streaming/MessageParser.h
|
||||||
|
utils/streaming/MessageParser.cpp
|
||||||
|
utils/streaming/BufferPool.h
|
||||||
|
utils/streaming/BufferPool.cpp
|
||||||
|
utils/streaming/streams.h
|
||||||
|
primitives/
|
||||||
|
utils/primitives/FastTransaction.h
|
||||||
|
utils/primitives/FastTransaction.cpp
|
||||||
|
utils/primitives/TxIterator_p.h
|
||||||
|
utils/primitives/FastBlock.h
|
||||||
|
utils/primitives/FastBlock.cpp
|
||||||
|
utils/primitives/script.h
|
||||||
|
utils/primitives/script.cpp
|
||||||
|
utils/primitives/transaction.h
|
||||||
|
utils/primitives/transaction.cpp
|
||||||
|
utils/primitives/pubkey_utils.cpp
|
||||||
|
utils/primitives/pubkey_utils.h
|
||||||
|
utils/primitives/block.cpp
|
||||||
|
utils/primitives/block.h "
|
||||||
|
|
||||||
|
rm -rf external
|
||||||
|
mkdir external
|
||||||
|
cat > external/CMakeLists.txt << END
|
||||||
|
cmake_minimum_required (VERSION 3.13)
|
||||||
|
project (flowee_lib)
|
||||||
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
add_library(flowee_lib STATIC
|
||||||
|
END
|
||||||
|
dir=""
|
||||||
|
for i in $sources
|
||||||
|
do
|
||||||
|
if test ! -f $SOURCES_HUB/libs/$i; then
|
||||||
|
dir=$i
|
||||||
|
mkdir -p external/$dir
|
||||||
|
else
|
||||||
|
cp $SOURCES_HUB/libs/$i external/$dir
|
||||||
|
a=`basename $i`
|
||||||
|
echo " $dir$a" >> external/CMakeLists.txt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo ")" >> external/CMakeLists.txt
|
||||||
|
|
||||||
|
cp -r $SOURCES_HUB/libs/crypto external/
|
||||||
Reference in New Issue
Block a user