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

Less Dependencies? #52

Closed
Kulitorum opened this issue Nov 19, 2013 · 2 comments
Closed

Less Dependencies? #52

Kulitorum opened this issue Nov 19, 2013 · 2 comments

Comments

@Kulitorum
Copy link

Can this library have less dependencies?

I would love a cross-platform library thats just a bunch of c or c++ code that I can dump into my existing code and then have serial communication - just like that.

This library I wont even try because of all the dependencies - seems like a hazzle to ask users to install all that.

@wjwwood
Copy link
Owner

wjwwood commented Nov 19, 2013

The code has no dependencies.

The build system is pretty straight forward to install, but is not required to build the code, this CMake snippet would be sufficient to build the code for internal use of another project:

cmake_minimum_required(VERSION 2.8.3)
project(my_project)

include_directories(include)

set(serial_SRCS src/serial.cc include/serial/serial.h include/serial/v8stdint.h)
if(UNIX)
    list(APPEND serial_SRCS src/impl/unix.cc)
else()
    list(APPEND serial_SRCS src/impl/win.cc)
endif()

## Add serial library
add_library(serial ${serial_SRCS})
if(UNIX AND NOT APPLE)
    target_link_libraries(serial rt)
endif()

## Build your executable
add_executable(my_program src/my_program.cpp)
## Link your executable against the library
target_link_libraries(my_program serial)

If you know it will be Linux or OS X, then you can drop the if(UNIX AND NOT APPLE) logic. If you are using Windows, there is a simple Visual Studio solution distributed with the library:

https://github.com/wjwwood/serial/tree/master/visual_studio

If that answers your question, please close the issue.

@Kulitorum
Copy link
Author

Ok, I added the code to my existing project and look and behold it compiled. You listed a lot of dependencies on the main page, turns out they are only build dependencies.

Thanks :)

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