Browse Source

completed build

master
jojapoppa 2 years ago
parent
commit
6d56111ce7
10 changed files with 222 additions and 26 deletions
  1. +14
    -14
      CMakeLists.txt
  2. +3
    -0
      build_gcc.sh
  3. +9
    -7
      build_js.sh
  4. +87
    -0
      dist/fedoragold-crypto-wasm.js
  5. +104
    -0
      dist/fedoragold-crypto.js
  6. +0
    -0
      include/fedoragold-crypto.h
  7. +1
    -1
      src/fedoragold-crypto-js.cpp
  8. +2
    -2
      src/fedoragold-crypto-node.cpp
  9. +1
    -1
      src/fedoragold-crypto.cpp
  10. +1
    -1
      tests/cryptotest.cpp

+ 14
- 14
CMakeLists.txt View File

@@ -15,7 +15,7 @@ set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build, options are
set(CMAKE_CONFIGURATION_TYPES Debug RelWithDebInfo Release CACHE TYPE INTERNAL)
set(ARCH native CACHE STRING "CPU to build for: -march value or default")

project(turtlecoin-crypto)
project(fedoragold-crypto)

# Required for finding Threads on ARM
enable_language(C)
@@ -222,18 +222,18 @@ include_directories(external/ed25519)
add_library(crypto STATIC ${BASE_CRYPTO})

set(SOURCES
src/turtlecoin-crypto.cpp
src/fedoragold-crypto.cpp
)

add_library(turtlecoin-crypto-static STATIC ${SOURCES})
target_link_libraries(turtlecoin-crypto-static crypto argon2 ed25519)
add_library(fedoragold-crypto-static STATIC ${SOURCES})
target_link_libraries(fedoragold-crypto-static crypto argon2 ed25519)

if(NOT BUILD_JS AND NOT BUILD_WASM)
if(WIN32)
add_library(turtlecoin-crypto-shared SHARED ${SOURCES})
target_link_libraries(turtlecoin-crypto-shared crypto argon2 ed25519)
target_link_libraries(turtlecoin-crypto-static ws2_32 advapi32 crypt32 gdi32 user32)
target_link_libraries(turtlecoin-crypto-shared ws2_32 advapi32 crypt32 gdi32 user32)
add_library(fedoragold-crypto-shared SHARED ${SOURCES})
target_link_libraries(fedoragold-crypto-shared crypto argon2 ed25519)
target_link_libraries(fedoragold-crypto-static ws2_32 advapi32 crypt32 gdi32 user32)
target_link_libraries(fedoragold-crypto-shared ws2_32 advapi32 crypt32 gdi32 user32)
endif()

set(CRYPTOTEST_SOURCES
@@ -241,15 +241,15 @@ if(NOT BUILD_JS AND NOT BUILD_WASM)
)

add_executable(cryptotest ${CRYPTOTEST_SOURCES})
target_link_libraries(cryptotest turtlecoin-crypto-static)
target_link_libraries(cryptotest fedoragold-crypto-static)
set_property(TARGET cryptotest PROPERTY OUTPUT_NAME "cryptotest")
else()
set(JAVSCRIPT_SOURCES
src/turtlecoin-crypto-js.cpp
src/fedoragold-crypto-js.cpp
)

add_executable(turtlecoin-crypto ${JAVSCRIPT_SOURCES})
target_link_libraries(turtlecoin-crypto turtlecoin-crypto-static)
add_executable(fedoragold-crypto ${JAVSCRIPT_SOURCES})
target_link_libraries(fedoragold-crypto fedoragold-crypto-static)

# Override our release flags for emscripten compatibility
set(CMAKE_C_FLAGS_DEBUG "")
@@ -274,13 +274,13 @@ else()
set(CMAKE_EXECUTABLE_SUFFIX ".js")
set(JS_LINKFLAGS_STR "${JS_LINKFLAGS_STR} -s WASM=0 --js-opts 1")
message(STATUS "emcc flags: ${JS_LINKFLAGS_STR}")
set_target_properties(turtlecoin-crypto PROPERTIES LINK_FLAGS "${JS_LINKFLAGS_STR}")
set_target_properties(fedoragold-crypto PROPERTIES LINK_FLAGS "${JS_LINKFLAGS_STR}")
endif()

if(BUILD_WASM)
set(CMAKE_EXECUTABLE_SUFFIX "-wasm.js")
set(JS_LINKFLAGS_STR "${JS_LINKFLAGS_STR} -s WASM=1 -s BINARYEN_METHOD='native-wasm'")
message(STATUS "emcc flags: ${JS_LINKFLAGS_STR}")
set_target_properties(turtlecoin-crypto PROPERTIES LINK_FLAGS "${JS_LINKFLAGS_STR} -s WASM=1 -s BINARYEN_METHOD='native-wasm'")
set_target_properties(fedoragold-crypto PROPERTIES LINK_FLAGS "${JS_LINKFLAGS_STR} -s WASM=1 -s BINARYEN_METHOD='native-wasm'")
endif()
endif()

+ 3
- 0
build_gcc.sh View File

@@ -0,0 +1,3 @@
cd build
cmake ..
make -j

+ 9
- 7
build_js.sh View File

@@ -2,6 +2,8 @@

# Set up emscripten

source ~/emsdk/emsdk_env.sh

if [[ -z "${EMSDK}" ]]; then
echo "Installing emscripten..."
echo ""
@@ -10,17 +12,17 @@ if [[ -z "${EMSDK}" ]]; then
git submodule update
fi
cd emsdk && git pull
./emsdk install latest && ./emsdk activate latest
source ./emsdk_env.sh
~/emsdk install latest && ./emsdk activate latest
source ~/emsdk_env.sh
cd ..
fi

# This applies a patch to fastcomp to make sure that the
# environment is set correctly for react environments
patch -N --verbose emsdk/fastcomp/emscripten/src/shell.js scripts/emscripten.patch
patch -N --verbose ~/emsdk/fastcomp/emscripten/src/shell.js.orig scripts/emscripten.patch

mkdir -p jsbuild && cd jsbuild && rm -rf *
emconfigure cmake .. -DNO_AES=1 -DARCH=default -DBUILD_WASM=1 -DBUILD_JS=0
make && cp turtlecoin-crypto-wasm.js ../dist
emconfigure cmake .. -DNO_AES=1 -DARCH=default -DBUILD_WASM=0 -DBUILD_JS=1
make && cp turtlecoin-crypto.js ../dist
emcmake cmake .. -DNO_AES=1 -DARCH=default -DBUILD_WASM=1 -DBUILD_JS=0
make && cp fedoragold-crypto-wasm.js ../dist
emcmake cmake .. -DNO_AES=1 -DARCH=default -DBUILD_WASM=0 -DBUILD_JS=1
make && cp fedoragold-crypto.js ../dist

+ 87
- 0
dist/fedoragold-crypto-wasm.js
File diff suppressed because it is too large
View File


+ 104
- 0
dist/fedoragold-crypto.js
File diff suppressed because it is too large
View File


include/turtlecoin-crypto.h → include/fedoragold-crypto.h View File


src/turtlecoin-crypto-js.cpp → src/fedoragold-crypto-js.cpp View File

@@ -5,7 +5,7 @@
#include <emscripten/bind.h>
#include <stdio.h>
#include <stdlib.h>
#include <turtlecoin-crypto.h>
#include <fedoragold-crypto.h>

using namespace emscripten;


src/turtlecoin-crypto-node.cpp → src/fedoragold-crypto-node.cpp View File

@@ -3,7 +3,7 @@
// Please see the included LICENSE file for more information.

#include <nan.h>
#include <turtlecoin-crypto.h>
#include <fedoragold-crypto.h>
#include <v8.h>

/*
@@ -2246,4 +2246,4 @@ NAN_MODULE_INIT(InitModule)
Nan::GetFunction(Nan::New<v8::FunctionTemplate>(chukwa_slow_hash_v2)).ToLocalChecked());
}

NODE_MODULE(turtlecoincrypto, InitModule);
NODE_MODULE(fedoragoldcrypto, InitModule);

src/turtlecoin-crypto.cpp → src/fedoragold-crypto.cpp View File

@@ -4,7 +4,7 @@

#include <StringTools.h>
#include <string.h>
#include <turtlecoin-crypto.h>
#include <fedoragold-crypto.h>

#ifndef NO_CRYPTO_EXPORTS
#ifdef _WIN32

+ 1
- 1
tests/cryptotest.cpp View File

@@ -6,7 +6,7 @@
#include <chrono>
#include <cxxopts.hpp>
#include <iostream>
#include <turtlecoin-crypto.h>
#include <fedoragold-crypto.h>

#define PERFORMANCE_ITERATIONS 1000
#define PERFORMANCE_ITERATIONS_LONG_MULTIPLIER 10


Loading…
Cancel
Save