Comparing version 1.0.0 to 1.0.1
@@ -14,4 +14,7 @@ cmake_minimum_required(VERSION 3.6) | ||
include(cmake/exe.cmake) | ||
include(cmake/test.cmake) | ||
if(CCPM_BUILD_TEST) | ||
include(cmake/test.cmake) | ||
endif() | ||
execute_process(COMMAND node index.js | ||
@@ -21,6 +24,2 @@ WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
execute_process(COMMAND node index.js lib | ||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
OUTPUT_VARIABLE LIB_LIST_oid | ||
) | ||
@@ -30,10 +29,25 @@ if(DEPS_LIST_oid) | ||
foreach(pkg ${DEPS_LIST_oid}) | ||
message("add_subdirectory: ${pkg} ${pkg}") | ||
add_subdirectory(${pkg} ${pkg}) | ||
string(REPLACE "," ";" DEP_PATHS ${pkg}) | ||
list(GET DEP_PATHS 0 ABSOLUTE_PATH) | ||
list(GET DEP_PATHS 1 RELATIVE_PATH) | ||
get_property(CCPM_SOURCE_LIST GLOBAL PROPERTY "CCPM_SOURCE_LIST") | ||
if(NOT CCPM_SOURCE_LIST) | ||
set_property(GLOBAL PROPERTY "CCPM_SOURCE_LIST" "${ABSOLUTE_PATH}") | ||
message("add_subdirectory: ${ABSOLUTE_PATH} ${RELATIVE_PATH}") | ||
add_subdirectory(${ABSOLUTE_PATH} ${RELATIVE_PATH}) | ||
else() | ||
list(FIND CCPM_SOURCE_LIST ${ABSOLUTE_PATH} FIND_INDEX) | ||
if(${FIND_INDEX} MATCHES "-1") | ||
set_property(GLOBAL PROPERTY "CCPM_SOURCE_LIST" "${CCPM_SOURCE_LIST};${ABSOLUTE_PATH}") | ||
message("add_subdirectory: ${ABSOLUTE_PATH} ${RELATIVE_PATH}") | ||
add_subdirectory(${ABSOLUTE_PATH} ${RELATIVE_PATH}) | ||
else() | ||
message("found ${ABSOLUTE_PATH}") | ||
endif() | ||
endif() | ||
endforeach() | ||
endif() | ||
if(LIB_LIST_oid) | ||
string(REPLACE "\n" ";" LIB_LIST_oid ${LIB_LIST_oid}) | ||
target_link_libraries(oid ${LIB_LIST_oid}) | ||
endif() | ||
if(CCPM_BUILD_TEST) | ||
target_link_libraries(${TEST_EXE_NAME} cmocha) | ||
endif() |
40
index.js
@@ -1,37 +0,3 @@ | ||
const path = require('path') | ||
const fs = require('fs') | ||
const pkg = require(path.join(__dirname, './package.json')) | ||
const paths = [] | ||
const libs = [] | ||
if (pkg.dependencies) { | ||
for (const key in pkg.dependencies) { | ||
const dir = findProjectRoot(require.resolve(key)) | ||
if (fs.existsSync(path.join(dir, 'CMakeLists.txt')) || fs.existsSync(path.join(dir, 'CMakelists.txt'))) { | ||
paths.push(path.relative(__dirname, dir).replace(/\\/g, '/')) | ||
libs.push(path.basename(key)) | ||
} | ||
} | ||
} | ||
if (process.argv.slice(2)[0] === 'lib') { | ||
libs.forEach(lib => console.log(lib)) | ||
} else { | ||
paths.forEach(p => console.log(p)) | ||
} | ||
function findProjectRoot (start) { | ||
let current = start ? path.resolve(start) : process.cwd() | ||
let previous = '' | ||
do { | ||
const target = path.join(current, 'package.json') | ||
if (fs.existsSync(target) && fs.statSync(target).isFile()) { | ||
return current | ||
} | ||
previous = current | ||
current = path.dirname(current) | ||
} while (current !== previous) | ||
return '' | ||
} | ||
const getDepPaths = require('@ccpm/dep-paths').getDepPaths | ||
const paths = getDepPaths(__dirname) | ||
paths.forEach(p => console.log(p)) |
{ | ||
"name": "@ccpm/oid", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "C implemention for MongoDB ObjectID", | ||
@@ -8,3 +8,5 @@ "main": "index.js", | ||
"license": "MIT", | ||
"keywords": ["objectid"], | ||
"keywords": [ | ||
"objectid" | ||
], | ||
"repository": { | ||
@@ -17,3 +19,9 @@ "type": "git", | ||
"access": "public" | ||
}, | ||
"devDependencies": { | ||
"@ccpm/cmocha": "^1.0.1" | ||
}, | ||
"dependencies": { | ||
"@ccpm/dep-paths": "^1.0.0" | ||
} | ||
} |
@@ -7,2 +7,13 @@ # oid-cpp | ||
## Setup | ||
``` bash | ||
$ npm install @ccpm/oid | ||
``` | ||
``` cmake | ||
add_subdirectory(...) | ||
target_link_libraries(<TARGET> oid) | ||
``` | ||
## C API | ||
@@ -9,0 +20,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
84
0
27460
1
1
15
3
1
+ Added@ccpm/dep-paths@^1.0.0
+ Added@ccpm/dep-paths@1.3.0(transitive)