Windows 10 npm install fix
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
-
npm install fastcall --force
--force is needed, because otherwise all files will be deleted in case of failed build (it will currently fail)
- Fix your
node_modules/fastcall/src/CMakeLists.txtto 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
- Fix your
node_modules/fastcall/deps/ref-cmake/CMakeLists.txtto 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")
-
npm install nan(otherwise there was no nan.h IIRC) -
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
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.
I figured this only fails with missing npm init (and press Enter like 10 times)
In case you want to prevent this pitfall: https://github.com/cmake-js/fastcall/pull/42