Moved to cmake.js, updated packages

This commit is contained in:
Essem 2021-12-30 22:45:32 -06:00
parent 923349408e
commit c0dbb2f733
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
6 changed files with 2195 additions and 644 deletions

25
CMakeLists.txt Normal file
View file

@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.9)
cmake_policy(SET CMP0042 NEW)
project (image)
include_directories(${CMAKE_JS_INC})
file(GLOB SOURCE_FILES "natives/*.cc" "natives/*.h")
add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${CMAKE_JS_SRC})
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "" SUFFIX ".node")
target_link_libraries(${PROJECT_NAME} ${CMAKE_JS_LIB})
set(CMAKE_CXX_STANDARD 17)
add_definitions(-DNAPI_CPP_EXCEPTIONS)
add_definitions(-DNAPI_VERSION=3)
execute_process(COMMAND node -p "require('node-addon-api').include"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE 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})
target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_ADDON_API_DIR})
find_package(ImageMagick COMPONENTS Magick++)
add_definitions(-DMAGICKCORE_QUANTUM_DEPTH=16)
add_definitions(-DMAGICKCORE_HDRI_ENABLE=0)
include_directories(${ImageMagick_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${ImageMagick_LIBRARIES})

View file

@ -2,7 +2,7 @@
FROM node:alpine
RUN apk --no-cache upgrade
RUN apk add --no-cache git msttcorefonts-installer python3 alpine-sdk ffmpeg \
RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmpeg \
zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev \
libtool libwebp-dev libxml2-dev pango-dev freetype fontconfig \
vips vips-dev
@ -57,4 +57,4 @@ USER esmBot
EXPOSE 3762
ENTRYPOINT ["node", "api/index.js"]
ENTRYPOINT ["node", "api/index.js"]

View file

@ -2,7 +2,7 @@
FROM node:alpine
RUN apk --no-cache upgrade
RUN apk add --no-cache git msttcorefonts-installer python3 alpine-sdk ffmpeg \
RUN apk add --no-cache git cmake msttcorefonts-installer python3 alpine-sdk ffmpeg \
zlib-dev libpng-dev libjpeg-turbo-dev freetype-dev fontconfig-dev \
libtool libwebp-dev libxml2-dev pango-dev freetype fontconfig \
vips vips-dev

View file

@ -16,4 +16,4 @@
"defines": ["NAPI_CPP_EXCEPTIONS", "MAGICKCORE_HDRI_ENABLE=0", "MAGICKCORE_QUANTUM_DEPTH=16"]
}
]
}
}

2803
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,7 +9,7 @@
"node": ">=15"
},
"scripts": {
"build": "node-gyp configure build -j max",
"build": "cmake-js compile",
"docker:build": "docker build -t esmbot -f Dockerfile.bot .",
"docker:build-api": "docker build -t esmbot-api -f Dockerfile.api .",
"docker:run-bot": "docker run --rm --network=host esmbot",
@ -25,6 +25,7 @@
},
"dependencies": {
"@top-gg/sdk": "^3.1.1",
"cmake-js": "^6.3.0",
"cowsay2": "^2.0.4",
"dotenv": "^10.0.0",
"emoji-regex": "^10.0.0",