node.native
node.native copied to clipboard
node.native CMakeLists.txt replacement for its Makefile?
libuv is a great abstraction layer replacement for libevent; with a major feature being interoperability. Is there a reason we are using vanilla Makefiles?
I.e.: can we migrate from our vanilla Makefile to CMakeLists?
Thanks for your consideration
Hi @AlecTaylor see Issue #25 - this is something which has been discussed. I'm sure a contribution of a CMakeList would be gratefully received. You'll see in the other issue that @divanvisagie has worked on a gyp file and @dennycd suggested cmake.
Been distracted at work; this is the first night I've had a chance to work on it since raising this issue:
How to use
- Create a "CMakeLists.txt" in your node.native folder (containing this big code snippet)
- Create a separate build directory (mine is
node_native-build
and located a directory above) - Run:
cmake -g 'Unix Makefiles' ../node_native
fromnode_native-build
CMakeLists.txt
project(node_native)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
cmake_minimum_required(VERSION 2.8)
aux_source_directory(. SRC_LIST)
add_executable(${PROJECT_NAME} ${SRC_LIST})
include_directories(../node_native ../node_native/libuv/include ../node_native/http-parser)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../node_native/libuv/libuv.a
COMMAND make
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../node_native/libuv)
add_custom_target(
libuv
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/../node_native/libuv/libuv.a)
add_dependencies(node_native libuv)
target_link_libraries(node_native ${CMAKE_CURRENT_SOURCE_DIR}/../node_native/libuv/libuv.a)
Error
I would send this through in a pull request, if not for these 376 errors of this style:
…undefined reference to `uv_tcp_bind'…
…undefined reference to `http_parser_init'…
See here for full output. Note that the same errors occur even without the code below # Attempting to link libraries
.