Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows 10 npm install fix #40

Open
kungfooman opened this issue Sep 17, 2018 · 2 comments
Open

Windows 10 npm install fix #40

kungfooman opened this issue Sep 17, 2018 · 2 comments

Comments

@kungfooman
Copy link

kungfooman commented Sep 17, 2018

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ő (gabor.mezo@outlook.com)
#
# 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ő (gabor.mezo@outlook.com)
#
# 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

@unbornchikken
Copy link
Member

Since I'm tight on schedule nowadays because of other projects, it would be really appreciated if you could make a PR from your improvements. Thanks.

@kungfooman
Copy link
Author

I figured this only fails with missing npm init (and press Enter like 10 times)

In case you want to prevent this pitfall: #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants