Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Adding catkin build files and a new Makefile.

  • Loading branch information...
commit 7174d62e1b7fa3e4a9f36855a161280edc580f80 1 parent 73371a1
William Woodall authored October 23, 2012
79  CMakeLists.txt
... ...
@@ -1,21 +1,58 @@
1  
-cmake_minimum_required(VERSION 2.4.6)
2  
-
3  
-set(ROS_ROOT $ENV{ROS_ROOT})
4  
-
5  
-if(DEFINED ROS_ROOT)
6  
-  option(SERIAL_BUILD_WIHOUT_ROS "Build without ROS?" OFF)
7  
-else(DEFINED ROS_ROOT)
8  
-  option(SERIAL_BUILD_WIHOUT_ROS "Build without ROS?" ON)
9  
-endif(DEFINED ROS_ROOT)
10  
-
11  
-if(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS)
12  
-  # Build with ROS
13  
-  include(serial_ros.cmake)
14  
-  message("Building with ROS")
15  
-  build_serial()
16  
-else(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS)
17  
-  # Build normally
18  
-  include(serial.cmake)
19  
-  message("Building stand alone")
20  
-  build_serial()
21  
-endif(DEFINED ROS_ROOT AND NOT SERIAL_BUILD_WIHOUT_ROS)
  1
+cmake_minimum_required(VERSION 2.8.3)
  2
+project(serial)
  3
+
  4
+# Find catkin
  5
+find_package(catkin REQUIRED)
  6
+
  7
+if(UNIX AND NOT APPLE)
  8
+    # If Linux, add rt and pthread
  9
+    catkin_package(
  10
+        LIBRARIES ${PROJECT_NAME}
  11
+        INCLUDE_DIRS include
  12
+        DEPENDS rt pthread
  13
+    )
  14
+else ()
  15
+    # Otherwise normal call
  16
+    catkin_package(
  17
+        LIBRARIES ${PROJECT_NAME}
  18
+        INCLUDE_DIRS include
  19
+    )
  20
+endif ()
  21
+
  22
+## Sources
  23
+set(serial_SRCS
  24
+    src/serial.cc
  25
+    # include/serial/serial.h
  26
+    # include/serial/v8stdint.h
  27
+)
  28
+if (UNIX)
  29
+    # If unix
  30
+    list (APPEND serial_SRCS src/impl/unix.cc)
  31
+else()
  32
+    # If windows
  33
+    list (APPEND serial_SRCS src/impl/win.cc)
  34
+endif()
  35
+
  36
+## Add serial library
  37
+add_library(${PROJECT_NAME}
  38
+    ${serial_SRCS}
  39
+)
  40
+
  41
+## Uncomment for example
  42
+add_executable(serial_example examples/serial_example.cc)
  43
+add_dependencies(serial_example ${PROJECT_NAME})
  44
+target_link_libraries(serial_example ${PROJECT_NAME})
  45
+
  46
+## Include headers
  47
+include_directories(include)
  48
+
  49
+## Install executable
  50
+install(
  51
+    TARGETS ${PROJECT_NAME}
  52
+    ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  53
+    LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
  54
+)
  55
+
  56
+## Tests
  57
+catkin_add_gtest(${PROJECT_NAME}-test tests/serial_tests.cc)
  58
+target_link_libraries(${PROJECT_NAME}-test ${PROJECT_NAME})
40  Makefile
... ...
@@ -1,5 +1,39 @@
1  
-ifdef ROS_ROOT
2  
-include $(shell rospack find mk)/cmake.mk
  1
+all: serial
  2
+
  3
+CMAKE_FLAGS := -DCMAKE_INSTALL_PREFIX=/tmp/usr/local
  4
+
  5
+install:
  6
+	cd build && make install
  7
+
  8
+uninstall:
  9
+	cd build && make uninstall
  10
+
  11
+serial:
  12
+	@mkdir -p build
  13
+	cd build && cmake $(CMAKE_FLAGS) ..
  14
+ifneq ($(MAKE),)
  15
+	cd build && $(MAKE)
3 16
 else
4  
-include serial.makefile
  17
+	cd build && make
  18
+endif
  19
+
  20
+.PHONY: clean
  21
+clean:
  22
+	rm -rf build
  23
+
  24
+.PHONY: doc
  25
+doc:
  26
+	@doxygen doc/Doxyfile
  27
+ifeq ($(UNAME),Darwin)
  28
+	@open doc/html/index.html
  29
+endif
  30
+
  31
+.PHONY: test
  32
+test:
  33
+	@mkdir -p build
  34
+	cd build && cmake $(CMAKE_FLAGS) ..
  35
+ifneq ($(MAKE),)
  36
+	cd build && $(MAKE) run_tests
  37
+else
  38
+	cd build && make run_tests
5 39
 endif
23  package.xml
... ...
@@ -0,0 +1,23 @@
  1
+<?xml version="1.0"?>
  2
+<package>
  3
+  <name>serial</name>
  4
+  <version abi="1.1.0">1.1.0</version>
  5
+  <description>
  6
+    Serial is a cross-platform, simple to use library for using serial ports on computers.  This library provides a C++, object oriented interface for interacting with RS-232 like devices on Linux and Windows.
  7
+  </description>
  8
+
  9
+  <maintainer email="wwoodall@willowgarage.com">William Woodall</maintainer>
  10
+
  11
+  <license>BSD</license>
  12
+
  13
+  <url type="website">http://wjwwood.github.com/serial/</url>
  14
+  <url type="repository">https://github.com/wjwwood/serial</url>
  15
+  <url type="bugtracker">https://github.com/wjwwood/serial/issues</url>
  16
+
  17
+  <author email="wjwwood@gmail.com">William Woodall</author>
  18
+  <author email="ash.gti@gmail.com">John Harrison</author>
  19
+
  20
+  <build_depend>cmake</build_depend>
  21
+  <build_depend>catkin</build_depend>
  22
+
  23
+</package>

0 notes on commit 7174d62

Please sign in to comment.
Something went wrong with that request. Please try again.