diff --git a/Lib.cmake b/Lib.cmake index a8087fcf..7965d4e6 100644 --- a/Lib.cmake +++ b/Lib.cmake @@ -69,8 +69,20 @@ FUNCTION (cmake_js_add_node_addon PROJECT_NAME) # message("Found nan: ${NODE_NAN_DIR}") # target_include_directories(${PROJECT_NAME} PRIVATE ${NODE_NAN_DIR}) # endif() - + # TODO nan and headers + + # include headers + set (NODE_HEADERS_DIR "") # TODO + target_include_directories(${PROJECT_NAME} PRIVATE + # some runtimes provide tidy headers + "${NODE_HEADERS_DIR}/include/node" + # some runtimes provide a lot more stuff + "${NODE_HEADERS_DIR}/src" + "${NODE_HEADERS_DIR}/deps/v8/include" + "${NODE_HEADERS_DIR}/deps/uv/include" + ) + else() # Find node-addon-api execute_process(COMMAND ${NODE_PATH} -p "require('node-api-headers').include_dir" diff --git a/rewrite/old/buildSystem.js b/rewrite/old/buildSystem.js index 1e0e61cc..eaf19156 100644 --- a/rewrite/old/buildSystem.js +++ b/rewrite/old/buildSystem.js @@ -7,24 +7,12 @@ const npmConfig = require('./npmConfig') const path = require('path') const Toolset = require('./toolset') -function isNodeApi(log, projectRoot) { - try { - const projectPkgJson = require(path.join(projectRoot, 'package.json')) - // Make sure the property exists - return !!projectPkgJson?.binary?.napi_versions - } catch (e) { - log.silly('CFG', "'package.json' not found.") - return false - } -} - class BuildSystem { constructor(options) { this.options = options || {} this.options.directory = path.resolve(this.options.directory || process.cwd()) this.options.out = path.resolve(this.options.out || path.join(this.options.directory, 'build')) this.log = new CMLog(this.options) - this.options.isNodeApi = isNodeApi(this.log, this.options.directory) const npmOptions = npmConfig(this.log) if (npmOptions && typeof npmOptions === 'object' && Object.keys(npmOptions).length) { diff --git a/rewrite/old/cMake.js b/rewrite/old/cMake.js index 5d6851e9..c289d1b3 100644 --- a/rewrite/old/cMake.js +++ b/rewrite/old/cMake.js @@ -120,14 +120,6 @@ class CMake { D.push({ CMAKE_LIBRARY_OUTPUT_DIRECTORY: this.buildDir }) } - // In some configurations MD builds will crash upon attempting to free memory. - // This tries to encourage MT builds which are larger but less likely to have this crash. - D.push({ CMAKE_MSVC_RUNTIME_LIBRARY: 'MultiThreaded$<$:Debug>' }) - - // Includes: - const includesString = await this.getCmakeJsIncludeString() - D.push({ CMAKE_JS_INC: includesString }) - // Runtime: D.push({ NODE_RUNTIME: this.targetOptions.runtime }) D.push({ NODE_RUNTIMEVERSION: this.targetOptions.runtimeVersion }) @@ -206,30 +198,6 @@ class CMake { } return libs.join(';') } - async getCmakeJsIncludeString() { - let incPaths = [] - if (!this.options.isNodeApi) { - // Include and lib: - if (this.dist.headerOnly) { - incPaths = [path.join(this.dist.internalPath, '/include/node')] - } else { - const nodeH = path.join(this.dist.internalPath, '/src') - const v8H = path.join(this.dist.internalPath, '/deps/v8/include') - const uvH = path.join(this.dist.internalPath, '/deps/uv/include') - incPaths = [nodeH, v8H, uvH] - } - - // NAN - const nanH = await locateNAN(this.projectRoot) - if (nanH) { - incPaths.push(nanH) - } - } else { - - } - - return incPaths.join(';') - } async configure() { this.verifyIfAvailable() diff --git a/rewrite/old/runtimePaths.js b/rewrite/old/runtimePaths.js index c9680da8..35fb2a17 100644 --- a/rewrite/old/runtimePaths.js +++ b/rewrite/old/runtimePaths.js @@ -13,10 +13,10 @@ const runtimePaths = { winLibs: [ { dir: targetOptions.isX64 ? 'x64' : '', - name: targetOptions.runtime + '.lib', + name: 'node.lib', }, ], - tarPath: targetOptions.runtime + '-v' + targetOptions.runtimeVersion + '.tar.gz', + tarPath: 'node-v' + targetOptions.runtimeVersion + '.tar.gz', headerOnly: false, } } else { @@ -25,10 +25,10 @@ const runtimePaths = { winLibs: [ { dir: targetOptions.isX64 ? 'win-x64' : 'win-x86', - name: targetOptions.runtime + '.lib', + name: 'node.lib', }, ], - tarPath: targetOptions.runtime + '-v' + targetOptions.runtimeVersion + '-headers.tar.gz', + tarPath: 'node-v' + targetOptions.runtimeVersion + '-headers.tar.gz', headerOnly: true, } } @@ -40,7 +40,7 @@ const runtimePaths = { winLibs: [ { dir: targetOptions.isX64 ? 'x64' : '', - name: targetOptions.runtime + '.lib', + name: 'nw.lib', }, { dir: targetOptions.isX64 ? 'x64' : '', @@ -56,7 +56,7 @@ const runtimePaths = { winLibs: [ { dir: targetOptions.isX64 ? 'x64' : '', - name: targetOptions.runtime + '.lib', + name: 'nw.lib', }, ], tarPath: 'nw-headers-v' + targetOptions.runtimeVersion + '.tar.gz',