Skip to content

Windows 10 npm install fix #40

@kungfooman

Description

@kungfooman

Hi, thanks for this nice library. I just tried it, but the build process fails with some missing headers, so I had to fix two cmake files

  1. npm install fastcall --force

--force is needed, because otherwise all files will be deleted in case of failed build (it will currently fail)

  1. Fix your node_modules/fastcall/src/CMakeLists.txt to something like this:
# Copyright 2016 Gábor Mező ([email protected])
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

file(GLOB SRC *.h* *.c*)

add_library(${PROJECT_NAME} SHARED ${SRC})

target_include_directories(${PROJECT_NAME} PRIVATE
  "D:/BabylonCpp/node/node_modules/nan"
  "C:/Users/kung/.cmake-js/node-x64/v8.9.4/include/node")

target_link_libraries (${PROJECT_NAME}
  ${CMAKE_JS_LIB}
  ${DYNCALL_LIBRARIES}
  ${DYNCALLBACK_LIBRARIES}
  ${DYNLOAD_LIBRARIES}
  "C:/Users/kung/.cmake-js/node-x64/v8.9.4/win-x64/node.lib")

set_target_properties(
  ${PROJECT_NAME}
  PROPERTIES
  PREFIX "" 
  SUFFIX ".node")

The hardcoded paths of course need to be fixed, the apply to my current setup

  1. Fix your node_modules/fastcall/deps/ref-cmake/CMakeLists.txt to something like this:
# Copyright 2016 Gábor Mező ([email protected])
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

file(GLOB SRC ../ref/src/*.h* ../ref/src/*.c*)

add_library(ref SHARED ${SRC})


target_include_directories(ref PRIVATE
  "D:/BabylonCpp/node/node_modules/nan")

target_link_libraries (ref ${CMAKE_JS_LIB})

set_target_properties(
  ref
  PROPERTIES
  PREFIX "" 
  SUFFIX ".node")
  1. npm install nan (otherwise there was no nan.h IIRC)

  2. Now the cmake files are fixed and nan.h should be available, so we just need to trigger a compilation with:

D:\BabylonCpp\node\node_modules\fastcall>..\..\node_modules\.bin\cmake-js.cmd compile

After all that, require("fastcall") should work, I might make a video later of the process, just wanted to put the info out first lol

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions