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

node.native CMakeLists.txt replacement for its Makefile? #34

Open
AlecTaylor opened this issue Jan 15, 2014 · 2 comments
Open

node.native CMakeLists.txt replacement for its Makefile? #34

AlecTaylor opened this issue Jan 15, 2014 · 2 comments

Comments

@AlecTaylor
Copy link

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

@sebjameswml
Copy link
Contributor

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.

@AlecTaylor
Copy link
Author

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

  1. Create a "CMakeLists.txt" in your node.native folder (containing this big code snippet)
  2. Create a separate build directory (mine is node_native-build and located a directory above)
  3. Run: cmake -g 'Unix Makefiles' ../node_native from node_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.

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

No branches or pull requests

2 participants