Skip to content

Commit

Permalink
Windows runtime files (#130)
Browse files Browse the repository at this point in the history
* Added Windows runtime redistributable files

* Added post build step to copy redistributable libs

* Refined npmignore regarding Windows build output

* Excluded dependencies and config folders from npm package

* Explicitly list 3rd party files for Windows build since it fails on wildcard
  • Loading branch information
s1hofmann authored Aug 15, 2022
1 parent 9f366a9 commit dcb1871
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
.idea
.vscode
.build
.github
3rdparty
build/CMakeFiles
build/cmake_install.cmake
build/CMakeCache.txt
build/Makefile
build/*.vcxproj*
build/*.sln
build/x64/
build/libnut.dir/
CMakeFiles
src
test
Expand Down
Binary file added 3rdparty/win32/api-ms-win-crt-heap-l1-1-0.dll
Binary file not shown.
Binary file added 3rdparty/win32/api-ms-win-crt-runtime-l1-1-0.dll
Binary file not shown.
Binary file added 3rdparty/win32/api-ms-win-crt-string-l1-1-0.dll
Binary file not shown.
Binary file added 3rdparty/win32/msvcp140.dll
Binary file not shown.
Binary file added 3rdparty/win32/vcruntime140.dll
Binary file not shown.
Binary file added 3rdparty/win32/vcruntime140_1.dll
Binary file not shown.
19 changes: 16 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.20)
set(CMAKE_CXX_STANDARD 17)

project(libnut)
Expand Down Expand Up @@ -26,8 +26,6 @@ elseif (WIN32)
message(STATUS "Windows build")
elseif (UNIX AND NOT APPLE)
message(STATUS "Linux build")
set(LIBS "${LIBS}" "-lpng")
set(LIBS "${LIBS}" "-lz")
set(LIBS "${LIBS}" "-lX11")
set(LIBS "${LIBS}" "-lXtst")
endif()
Expand All @@ -40,6 +38,21 @@ else()
set(CMAKE_CXX_FLAGS "/Wall /W4 /EHsc")
endif()

if (WIN32)
# Copy runtime distributable
add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_SOURCE_DIR}/3rdparty/win32/msvcp140.dll
${CMAKE_SOURCE_DIR}/3rdparty/win32/vcruntime140.dll
${CMAKE_SOURCE_DIR}/3rdparty/win32/vcruntime140_1.dll
${CMAKE_SOURCE_DIR}/3rdparty/win32/api-ms-win-crt-heap-l1-1-0.dll
${CMAKE_SOURCE_DIR}/3rdparty/win32/api-ms-win-crt-runtime-l1-1-0.dll
${CMAKE_SOURCE_DIR}/3rdparty/win32/api-ms-win-crt-string-l1-1-0.dll
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/
)
endif()

add_compile_definitions(NAPI_CPP_EXCEPTIONS)
add_compile_definitions(NAPI_VERSION=3)

Expand Down

0 comments on commit dcb1871

Please sign in to comment.