Skip to content

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

Description

@AlecTaylor

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

Activity

  1. sebjameswml commented on Jan 15, 2014

    @sebjameswml
    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.

  2. AlecTaylor commented on Feb 3, 2014

    @AlecTaylor
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions