Skip to content

Commit

Permalink
Updated cpp library
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt307082 committed Dec 28, 2023
1 parent cf9f5ae commit 34cf474
Show file tree
Hide file tree
Showing 600 changed files with 16,055 additions and 25,472 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ clean: colorflow.o libnsbmp.o
rm libnsbmp.o
rm colorflow.o

build: binding.gyp libbmp.a libcolorflow.a
build: binding.gyp
npm run build

test: colorflow.test.js
Expand Down
10 changes: 5 additions & 5 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"targets": [
{
"target_name": "colorflow",
"cflags!": [ "-fno-exceptions" ],
"cflags_cc!": [ "-fno-exceptions" ],
"sources": [
"cflags!": [ "-fno-exceptions", "-Wwrite-strings", "-Wunused-variable"],
"cflags_cc!": [ "-fno-exceptions", "-Wwrite-strings", "-Wunused-variable" ],
"sources": [
"native/libnsbmp.cpp",
"native/libcolorflow.cpp",
"native/colorflow.cpp"
],
"include_dirs": [
"/native/include"
],
"libraries": [
"../libcolorflow.a",
"../libbmp.a",
"-lpng",
"-ljpeg"
]
Expand Down
4 changes: 2 additions & 2 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,8 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
endif

quiet_cmd_regen_makefile = ACTION Regenerating $@
cmd_regen_makefile = cd $(srcdir); /home/matteobeghelli/Documents/colorflow/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/matteobeghelli/.cache/node-gyp/18.18.2" "-Dnode_gyp_dir=/home/matteobeghelli/Documents/colorflow/node_modules/node-gyp" "-Dnode_lib_file=/home/matteobeghelli/.cache/node-gyp/18.18.2/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/matteobeghelli/Documents/colorflow" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/matteobeghelli/Documents/colorflow/build/config.gypi -I/home/matteobeghelli/Documents/colorflow/node_modules/node-gyp/addon.gypi -I/home/matteobeghelli/.cache/node-gyp/18.18.2/include/node/common.gypi "--toplevel-dir=." binding.gyp
Makefile: $(srcdir)/../../.cache/node-gyp/18.18.2/include/node/common.gypi $(srcdir)/node_modules/node-gyp/addon.gypi $(srcdir)/binding.gyp $(srcdir)/build/config.gypi
cmd_regen_makefile = cd $(srcdir); /home/matteobeghelli/Documents/colorflow/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/root/.cache/node-gyp/18.19.0" "-Dnode_gyp_dir=/home/matteobeghelli/Documents/colorflow/node_modules/node-gyp" "-Dnode_lib_file=/root/.cache/node-gyp/18.19.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/matteobeghelli/Documents/colorflow" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/matteobeghelli/Documents/colorflow/build/config.gypi -I/home/matteobeghelli/Documents/colorflow/node_modules/node-gyp/addon.gypi -I/root/.cache/node-gyp/18.19.0/include/node/common.gypi "--toplevel-dir=." binding.gyp
Makefile: $(srcdir)/../../../../root/.cache/node-gyp/18.19.0/include/node/common.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/node_modules/node-gyp/addon.gypi
$(call do_cmd,regen_makefile)

# "all" is a concatenation of the "all" targets from all the included
Expand Down
2 changes: 1 addition & 1 deletion build/Release/.deps/Release/obj.target/colorflow.node.d
Original file line number Diff line number Diff line change
@@ -1 +1 @@
cmd_Release/obj.target/colorflow.node := g++ -o Release/obj.target/colorflow.node -shared -pthread -rdynamic -m64 -Wl,-soname=colorflow.node -Wl,--start-group Release/obj.target/colorflow/native/colorflow.o -Wl,--end-group /usr/local/lib/libcolorflow.a /usr/local/lib/libbmp.a -lpng -ljpeg
cmd_Release/obj.target/colorflow.node := g++ -o Release/obj.target/colorflow.node -shared -pthread -rdynamic -m64 -Wl,-soname=colorflow.node -Wl,--start-group Release/obj.target/colorflow/native/libnsbmp.o Release/obj.target/colorflow/native/libcolorflow.o Release/obj.target/colorflow/native/colorflow.o -Wl,--end-group -lpng -ljpeg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmd_Release/obj.target/colorflow/native/colorflow.o := g++ -o Release/obj.target/colorflow/native/colorflow.o ../native/colorflow.cpp '-DNODE_GYP_MODULE_NAME=colorflow' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/matteobeghelli/.cache/node-gyp/18.18.2/include/node -I/home/matteobeghelli/.cache/node-gyp/18.18.2/src -I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/openssl/config -I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/openssl/openssl/include -I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/uv/include -I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/zlib -I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/v8/include -I/native/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/colorflow/native/colorflow.o.d.raw -c
cmd_Release/obj.target/colorflow/native/colorflow.o := g++ -o Release/obj.target/colorflow/native/colorflow.o ../native/colorflow.cpp '-DNODE_GYP_MODULE_NAME=colorflow' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/18.19.0/include/node -I/root/.cache/node-gyp/18.19.0/src -I/root/.cache/node-gyp/18.19.0/deps/openssl/config -I/root/.cache/node-gyp/18.19.0/deps/openssl/openssl/include -I/root/.cache/node-gyp/18.19.0/deps/uv/include -I/root/.cache/node-gyp/18.19.0/deps/zlib -I/root/.cache/node-gyp/18.19.0/deps/v8/include -I/native/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/colorflow/native/colorflow.o.d.raw -c
Release/obj.target/colorflow/native/colorflow.o: ../native/colorflow.cpp \
../native/include/colorflow.h
../native/colorflow.cpp:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmd_Release/obj.target/colorflow/native/libcolorflow.o := g++ -o Release/obj.target/colorflow/native/libcolorflow.o ../native/libcolorflow.cpp '-DNODE_GYP_MODULE_NAME=colorflow' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/18.19.0/include/node -I/root/.cache/node-gyp/18.19.0/src -I/root/.cache/node-gyp/18.19.0/deps/openssl/config -I/root/.cache/node-gyp/18.19.0/deps/openssl/openssl/include -I/root/.cache/node-gyp/18.19.0/deps/uv/include -I/root/.cache/node-gyp/18.19.0/deps/zlib -I/root/.cache/node-gyp/18.19.0/deps/v8/include -I/native/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/colorflow/native/libcolorflow.o.d.raw -c
Release/obj.target/colorflow/native/libcolorflow.o: \
../native/libcolorflow.cpp ../native/include/png.h \
../native/include/jpeglib.h ../native/include/libnsbmp.h \
../native/include/colorflow.h
../native/libcolorflow.cpp:
../native/include/png.h:
../native/include/jpeglib.h:
../native/include/libnsbmp.h:
../native/include/colorflow.h:
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmd_Release/obj.target/colorflow/native/libnsbmp.o := g++ -o Release/obj.target/colorflow/native/libnsbmp.o ../native/libnsbmp.cpp '-DNODE_GYP_MODULE_NAME=colorflow' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/root/.cache/node-gyp/18.19.0/include/node -I/root/.cache/node-gyp/18.19.0/src -I/root/.cache/node-gyp/18.19.0/deps/openssl/config -I/root/.cache/node-gyp/18.19.0/deps/openssl/openssl/include -I/root/.cache/node-gyp/18.19.0/deps/uv/include -I/root/.cache/node-gyp/18.19.0/deps/zlib -I/root/.cache/node-gyp/18.19.0/deps/v8/include -I/native/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -std=gnu++17 -MMD -MF ./Release/.deps/Release/obj.target/colorflow/native/libnsbmp.o.d.raw -c
Release/obj.target/colorflow/native/libnsbmp.o: ../native/libnsbmp.cpp \
../native/include/libnsbmp.h
../native/libnsbmp.cpp:
../native/include/libnsbmp.h:
Binary file modified build/Release/colorflow.node
Binary file not shown.
Binary file modified build/Release/obj.target/colorflow.node
Binary file not shown.
Binary file modified build/Release/obj.target/colorflow/native/colorflow.o
Binary file not shown.
Binary file not shown.
Binary file not shown.
32 changes: 16 additions & 16 deletions build/colorflow.target.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ CFLAGS_CC_Debug := \
-std=gnu++17

INCS_Debug := \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/include/node \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/src \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/openssl/config \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/openssl/openssl/include \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/uv/include \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/zlib \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/v8/include \
-I/root/.cache/node-gyp/18.19.0/include/node \
-I/root/.cache/node-gyp/18.19.0/src \
-I/root/.cache/node-gyp/18.19.0/deps/openssl/config \
-I/root/.cache/node-gyp/18.19.0/deps/openssl/openssl/include \
-I/root/.cache/node-gyp/18.19.0/deps/uv/include \
-I/root/.cache/node-gyp/18.19.0/deps/zlib \
-I/root/.cache/node-gyp/18.19.0/deps/v8/include \
-I/native/include

DEFS_Release := \
Expand Down Expand Up @@ -84,16 +84,18 @@ CFLAGS_CC_Release := \
-std=gnu++17

INCS_Release := \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/include/node \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/src \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/openssl/config \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/openssl/openssl/include \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/uv/include \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/zlib \
-I/home/matteobeghelli/.cache/node-gyp/18.18.2/deps/v8/include \
-I/root/.cache/node-gyp/18.19.0/include/node \
-I/root/.cache/node-gyp/18.19.0/src \
-I/root/.cache/node-gyp/18.19.0/deps/openssl/config \
-I/root/.cache/node-gyp/18.19.0/deps/openssl/openssl/include \
-I/root/.cache/node-gyp/18.19.0/deps/uv/include \
-I/root/.cache/node-gyp/18.19.0/deps/zlib \
-I/root/.cache/node-gyp/18.19.0/deps/v8/include \
-I/native/include

OBJS := \
$(obj).target/$(TARGET)/native/libnsbmp.o \
$(obj).target/$(TARGET)/native/libcolorflow.o \
$(obj).target/$(TARGET)/native/colorflow.o

# Add to the list of files we specially track dependencies for.
Expand Down Expand Up @@ -131,8 +133,6 @@ LDFLAGS_Release := \
-m64

LIBS := \
/usr/local/lib/libcolorflow.a \
/usr/local/lib/libbmp.a \
-lpng \
-ljpeg

Expand Down
37 changes: 19 additions & 18 deletions build/config.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@
"lib/internal/blob.js",
"lib/internal/blocklist.js",
"lib/internal/bootstrap/browser.js",
"lib/internal/bootstrap/loaders.js",
"lib/internal/bootstrap/node.js",
"lib/internal/bootstrap/realm.js",
"lib/internal/bootstrap/switches/does_not_own_process_state.js",
"lib/internal/bootstrap/switches/does_own_process_state.js",
"lib/internal/bootstrap/switches/is_main_thread.js",
Expand Down Expand Up @@ -179,23 +179,26 @@
"lib/internal/main/watch_mode.js",
"lib/internal/main/worker_thread.js",
"lib/internal/mime.js",
"lib/internal/modules/cjs/helpers.js",
"lib/internal/modules/cjs/loader.js",
"lib/internal/modules/esm/assert.js",
"lib/internal/modules/esm/create_dynamic_module.js",
"lib/internal/modules/esm/fetch_module.js",
"lib/internal/modules/esm/formats.js",
"lib/internal/modules/esm/get_format.js",
"lib/internal/modules/esm/handle_process_exit.js",
"lib/internal/modules/esm/hooks.js",
"lib/internal/modules/esm/initialize_import_meta.js",
"lib/internal/modules/esm/load.js",
"lib/internal/modules/esm/loader.js",
"lib/internal/modules/esm/module_job.js",
"lib/internal/modules/esm/module_map.js",
"lib/internal/modules/esm/package_config.js",
"lib/internal/modules/esm/resolve.js",
"lib/internal/modules/esm/shared_constants.js",
"lib/internal/modules/esm/translators.js",
"lib/internal/modules/esm/utils.js",
"lib/internal/modules/esm/worker.js",
"lib/internal/modules/helpers.js",
"lib/internal/modules/package_json_reader.js",
"lib/internal/modules/run_main.js",
"lib/internal/net.js",
Expand Down Expand Up @@ -267,8 +270,10 @@
"lib/internal/test/transfer.js",
"lib/internal/test_runner/coverage.js",
"lib/internal/test_runner/harness.js",
"lib/internal/test_runner/mock.js",
"lib/internal/test_runner/mock/mock.js",
"lib/internal/test_runner/mock/mock_timers.js",
"lib/internal/test_runner/reporter/dot.js",
"lib/internal/test_runner/reporter/junit.js",
"lib/internal/test_runner/reporter/spec.js",
"lib/internal/test_runner/reporter/tap.js",
"lib/internal/test_runner/reporter/v8-serializer.js",
Expand Down Expand Up @@ -400,22 +405,18 @@
"v8_trace_maps": 0,
"v8_use_siphash": 1,
"want_separate_host_toolset": 0,
"nodedir": "/home/matteobeghelli/.cache/node-gyp/18.18.2",
"nodedir": "/root/.cache/node-gyp/18.19.0",
"python": "/usr/bin/python3",
"standalone_static_library": 1,
"version_commit_hooks": "true",
"user_agent": "yarn/1.22.19 npm/? node/v18.18.2 linux x64",
"bin_links": "true",
"init_version": "1.0.0",
"init_license": "MIT",
"version_tag_prefix": "v",
"registry": "https://registry.yarnpkg.com",
"ignore_scripts": "",
"version_git_message": "v%s",
"version_git_tag": "true",
"version_git_sign": "",
"strict_ssl": "true",
"save_prefix": "^",
"ignore_optional": ""
"user_agent": "npm/10.2.3 node/v18.19.0 linux x64 workspaces/false",
"userconfig": "/root/.npmrc",
"local_prefix": "/home/matteobeghelli/Documents/colorflow",
"prefix": "/usr",
"npm_version": "10.2.3",
"cache": "/root/.npm",
"node_gyp": "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",
"globalconfig": "/usr/etc/npmrc",
"init_module": "/root/.npm-init.js",
"global_prefix": "/usr"
}
}
19 changes: 11 additions & 8 deletions colorflow.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,6 @@ test("Should throw an error because the image doesn't exists", () => {
expect( () => colorflow("noexist.png")).toThrow("No such file or directory");
});

test("Properly calculate background color for png format", () => {
expect(colorflow("images/red.png")).toBe("#FF0000");
expect(colorflow("images/green.png")).toBe("#00FF00");
expect(colorflow("images/blue.png")).toBe("#0000FF");
expect(colorflow("images/black.png")).toBe("#000000");
expect(colorflow("images/white.png")).toBe("#FFFFFF");
expect(colorflow("images/road.png")).toBe("#6B6A67");
});

test("Properly calculate background color for jpeg format", () => {
expect(colorflow("images/red.jpeg")).toBe("#FE0000");
Expand All @@ -22,6 +14,17 @@ test("Properly calculate background color for jpeg format", () => {
expect(colorflow("images/mountain.jpeg")).toBe("#366681");
});


test("Properly calculate background color for png format", () => {
expect(colorflow("images/red.png")).toBe("#FF0000");
expect(colorflow("images/green.png")).toBe("#00FF00");
expect(colorflow("images/blue.png")).toBe("#0000FF");
expect(colorflow("images/black.png")).toBe("#000000");
expect(colorflow("images/white.png")).toBe("#FFFFFF");
expect(colorflow("images/road.png")).toBe("#6B6A67");
});


test("Properly calculate background color for bmp format", () => {
expect(colorflow("images/red.bmp")).toBe("#FF0000");
expect(colorflow("images/green.bmp")).toBe("#00FF00");
Expand Down
Loading

0 comments on commit 34cf474

Please sign in to comment.