Skip to content

Commit

Permalink
Merge pull request #75 from RobotLocomotion/cmake
Browse files Browse the repository at this point in the history
Implement CMake build system
  • Loading branch information
ashuang authored Jun 30, 2016
2 parents b7b8cf2 + 9c5787f commit 723bc1e
Show file tree
Hide file tree
Showing 36 changed files with 2,971 additions and 181 deletions.
128 changes: 0 additions & 128 deletions .gitignore

This file was deleted.

87 changes: 87 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.1)

project(lcm)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if(CMAKE_VERSION VERSION_LESS 3.7)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/3.7")
endif()

find_package(GLib2 REQUIRED COMPONENTS gthread)

# Configuration and utility functions
include(lcm-cmake/config.cmake)
include(lcm-cmake/functions.cmake)
include(lcm-cmake/version.cmake)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
if (WIN32)
add_definitions(-DWIN32 -D_CRT_SECURE_NO_WARNINGS)
include_directories(${lcm_SOURCE_DIR}/WinSpecific/include)
include_directories(${lcm_SOURCE_DIR}/WinSpecific/getopt)
include_directories(${lcm_SOURCE_DIR})
add_subdirectory(WinSpecific)
set(lcm-winport lcm-winport)
get_filename_component(LCM_LCMGEN_PATH ${GLIB2_GLIB_RUNTIME} DIRECTORY)
set(LCM_USE_GLIB_RUNTIME "set(LCM_LCMGEN_PATH \"${LCM_LCMGEN_PATH}\")")
else()
set(lcm-winport)
endif()

# Core modules
add_subdirectory(lcm)
add_subdirectory(lcmgen)
add_subdirectory(lcm-logger)

option(LCM_ENABLE_EXAMPLES "Build test and example programs" ON)
if(LCM_ENABLE_EXAMPLES)
add_subdirectory(liblcm-test)
endif()

# Documentation (Main, C/C++, .NET)
add_subdirectory(docs)

# Java
lcm_option(
LCM_ENABLE_JAVA
"Build Java bindings and utilities"
JAVA_FOUND Java 1.6)
if(LCM_ENABLE_JAVA)
add_subdirectory(lcm-java)
add_custom_target(lcm-spy DEPENDS lcm-spy-alias)
add_custom_target(lcm-logplayer-gui DEPENDS lcm-logplayer-gui-alias)
endif()

# Python
lcm_option(
LCM_ENABLE_PYTHON
"Build Python bindings and utilities"
PYTHONLIBS_FOUND PythonLibs)
if(LCM_ENABLE_PYTHON)
add_subdirectory(lcm-python)
endif()

# Lua
lcm_option(
LCM_ENABLE_LUA
"Build Lua bindings and utilities"
LUA_FOUND Lua)
if(LCM_ENABLE_LUA)
add_subdirectory(lcm-lua)
endif()

# .NET
# TODO

# Install rules
include(lcm-cmake/install.cmake)

option(LCM_INSTALL_M4MACROS "Install autotools support M4 macros" ON)
if(LCM_INSTALL_M4MACROS)
add_subdirectory(m4macros)
endif()

option(LCM_INSTALL_PKGCONFIG "Install pkg-config files" ON)
if(LCM_INSTALL_PKGCONFIG)
add_subdirectory(lcm-pkgconfig)
endif()
4 changes: 4 additions & 0 deletions WinSpecific/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_library(lcm-winport STATIC
getopt/getopt.c
getopt/getopt_long.c
)
6 changes: 6 additions & 0 deletions WinSpecific/getopt/getopt.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
#ifndef GETOPT_H
#define GETOPT_H

#ifdef __cplusplus
extern "C" {
#endif

int getopt(int argc, char * const argv[], const char *optstring);
extern char *optarg;
extern int optind, opterr, optopt;
#include "getopt_long.h"

#ifdef __cplusplus
}
#endif

#endif /* GETOPT_H */
Loading

0 comments on commit 723bc1e

Please sign in to comment.