Skip to content

Commit

Permalink
drake viewer builds with cmake (on mac, requires export CXX=/usr/bin/…
Browse files Browse the repository at this point in the history
…g++ instead of clang++ due to what appears to be an eigen-related issue)

git-svn-id: https://svn.csail.mit.edu/locomotion/robotlib/trunk@6545 c9849af7-e679-4ec6-a44e-fc146a885bd3
  • Loading branch information
russt committed Jul 11, 2013
1 parent ee9b831 commit 612a4bc
Show file tree
Hide file tree
Showing 30 changed files with 1,138 additions and 120 deletions.
4 changes: 2 additions & 2 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<folderInfo id="0.223161107." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.1490918522" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform binaryParser="org.eclipse.cdt.core.MachO64" id="org.eclipse.cdt.build.core.prefbase.toolchain.1490918522.582651722" name=""/>
<builder buildPath="${workspace_loc:/drake}/" command="make" enableAutoBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.188937989" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<builder arguments="VERBOSE=1 -j8" buildPath="${workspace_loc:/drake}/" command="make" enableAutoBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.188937989" incrementalBuildTarget="all" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.1300060025" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.1897653860" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.478355067" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
Expand Down Expand Up @@ -91,7 +91,7 @@
<folderInfo id="0.223161107.510608512." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.822542901" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform binaryParser="org.eclipse.cdt.core.MachO64" id="org.eclipse.cdt.build.core.prefbase.toolchain.822542901.625733607" name=""/>
<builder arguments="-j8" buildPath="${workspace_loc:/drake}/" command="make" enableAutoBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.693997493" incrementalBuildTarget="debug" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<builder arguments="BUILD_TYPE=Debug VERBOSE=1" buildPath="${workspace_loc:/drake}/" command="make" enableAutoBuild="false" id="org.eclipse.cdt.build.core.settings.default.builder.693997493" incrementalBuildTarget="" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" superClass="org.eclipse.cdt.build.core.settings.default.builder"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.libs.259768903" name="holder for library settings" superClass="org.eclipse.cdt.build.core.settings.holder.libs"/>
<tool id="org.eclipse.cdt.build.core.settings.holder.664075779" name="Assembly" superClass="org.eclipse.cdt.build.core.settings.holder">
<option id="org.eclipse.cdt.build.core.settings.holder.incpaths.845811980" name="Include Paths" superClass="org.eclipse.cdt.build.core.settings.holder.incpaths" valueType="includePath">
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,8 @@ bin
drake.jar
*.out
urdf_kin_test
pod-build
lcmtypes/c
lcmtypes/cpp
lcmtypes/java
lcmtypes/python
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 2.6.0)

set(POD_NAME drake)
include(cmake/pods.cmake)
include(cmake/lcmtypes.cmake)

lcmtypes_build()


#add_subdirectory(util)
#add_subdirectory(algorithms)
add_subdirectory(systems)

142 changes: 49 additions & 93 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,93 +1,49 @@

# Note: make will automatically delete intermediate files (google "make chains of implicit rules")

CC = gcc
CXX = g++
PKG_CONFIG_PATH := ${PKG_CONFIG_PATH}:$(shell pwd)/thirdParty

LCMFILES = $(shell find . -iname "*.lcm" | tr "\n" " " | sed "s|\./||g")
SUBDIRS:=$(shell grep -v "^\#" tobuild.txt)

LCM_CFILES = $(LCMFILES:%.lcm=%.c)
LCM_CFLAGS = $(shell pkg-config --cflags lcm)
LCM_LDFLAGS = $(shell pkg-config --libs lcm)
EIGEN_CFLAGS = $(shell pkg-config --cflags eigen3)

#CFILES = $(LCM_CFILES)
LCM_JAVAFILES = $(LCMFILES:%.lcm=%.java)
OTHER_JAVAFILES = util/MyLCMTypeDatabase.java util/MessageMonitor.java util/CoordinateFrameData.java util/LCMCoder.java util/Transform.java
JAVAFILES = $(LCM_JAVAFILES) $(OTHER_JAVAFILES)

OBJFILES = $(LCM_CFILES:%.c=%.o)
CLASSFILES = $(JAVAFILES:%.java=%.class)
EXTRACLASSFILES = util/MyLCMTypeDatabase*MyClassVisitor.class

MATLAB = $(shell which matlab)

all: matlab_config java c
@for subdir in $(SUBDIRS); do \
echo "\n-------------------------------------------"; \
echo "-- $$subdir"; \
echo "-------------------------------------------"; \
$(MAKE) -C $$subdir all || exit 2; \
done

debug: CXX += -g
debug: CC += -g
debug: matlab_config java c
@for subdir in $(SUBDIRS); do \
echo "\n-------------------------------------------"; \
echo "-- $$subdir"; \
echo "-------------------------------------------"; \
$(MAKE) -C $$subdir debug || exit 2; \
done

doxygen :
doxygen doc/Doxyfile

java : drake.jar

c : drake.a

matlab_config : util/drake_config.mat .matlabroot

util/drake_config.mat .matlabroot : configure.m
matlab -nosplash -nodesktop -r "configure;exit";
# todo: consider using configure(struct('autoconfig',true))

drake.jar : $(CLASSFILES)
cd ..; jar -cf drake/drake.jar $(CLASSFILES:%=drake/%) $(EXTRACLASSFILES:%=drake/%)

drake.a : $(OBJFILES)
ar rc $@ $^

.INTERMEDIATE : $(OBJFILES) $(CLASSFILES)
.PRECIOUS : $(LCMFILES) $(OTHER_JAVAFILES)

util/LCMCoder.class : util/LCMCoder.java util/CoordinateFrameData.class
javac $< -cp $(CLASSPATH):$(shell pwd)/../

%.class : %.java
javac $<

%.o : %.c
$(CC) -c -I include/ $< -o $@ $(LCM_CFLAGS) $(EIGEN_CFLAGS)

%.c : %.lcm
@if grep -i package $< ; then echo "\n *** ERROR: $< has a package specified. Don't do that. *** \n"; exit 1; fi
lcm-gen -c --c-cpath="$(shell echo $< | sed "s|/[A-Za-z0-9_]*\.lcm|/|")" --c-hpath="include/" $<

%.java : %.lcm
@if grep -i package $< ; then echo "\n *** ERROR: $< has a package specified. Don't do that. *** \n"; exit 1; fi
lcm-gen -j --jdefaultpkg="drake.$(shell echo $< | sed "s|/[A-Za-z0-9._]*\.lcm||g" | tr "/" ".")" --jpath=".." $<

clean :
-rm -f drake.jar drake.a $(LIBS) $(LCM_HFILES) $(LCM_CFILES) $(OBJFILES) $(LCM_JAVAFILES) $(CLASSFILES) $(EXTRACLASSFILES)
-rm -rf doc/DoxygenMatlab/html
@for subdir in $(SUBDIRS); do \
echo "\n-------------------------------------------"; \
echo "-- $$subdir"; \
echo "-------------------------------------------"; \
$(MAKE) -C $$subdir clean; \
done

# Default pod makefile distributed with pods version: 12.11.14

default_target: all

# Default to a less-verbose build. If you want all the gory compiler output,
# run "make VERBOSE=1"
$(VERBOSE).SILENT:

# Figure out where to build the software.
# Use BUILD_PREFIX if it was passed in.
# If not, search up to four parent directories for a 'build' directory.
# Otherwise, use ./build.
ifeq "$(BUILD_PREFIX)" ""
BUILD_PREFIX:=$(shell for pfx in ./ .. ../.. ../../.. ../../../..; do d=`pwd`/$$pfx/build;\
if [ -d $$d ]; then echo $$d; exit 0; fi; done; echo `pwd`/build)
endif
# create the build directory if needed, and normalize its path name
BUILD_PREFIX:=$(shell mkdir -p $(BUILD_PREFIX) && cd $(BUILD_PREFIX) && echo `pwd`)

# Default to a release build. If you want to enable debugging flags, run
# "make BUILD_TYPE=Debug"
ifeq "$(BUILD_TYPE)" ""
BUILD_TYPE="Release"
endif

all: pod-build/Makefile
$(MAKE) -C pod-build all install

pod-build/Makefile:
$(MAKE) configure

.PHONY: configure
configure:
@echo "\nBUILD_PREFIX: $(BUILD_PREFIX)\n\n"

# create the temporary build directory if needed
@mkdir -p pod-build

# run CMake to generate and configure the build scripts
@cd pod-build && cmake -DCMAKE_INSTALL_PREFIX=$(BUILD_PREFIX) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ..

clean:
-if [ -e pod-build/install_manifest.txt ]; then rm -f `cat pod-build/install_manifest.txt`; fi
-if [ -d pod-build ]; then $(MAKE) -C pod-build clean; rm -rf pod-build; fi

# other (custom) targets are passed through to the cmake-generated Makefile
%::
$(MAKE) -C pod-build $@
93 changes: 93 additions & 0 deletions Makefile.bk
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

# Note: make will automatically delete intermediate files (google "make chains of implicit rules")

CC = gcc
CXX = g++
PKG_CONFIG_PATH := ${PKG_CONFIG_PATH}:$(shell pwd)/thirdParty

LCMFILES = $(shell find . -iname "*.lcm" | tr "\n" " " | sed "s|\./||g")
SUBDIRS:=$(shell grep -v "^\#" tobuild.txt)

LCM_CFILES = $(LCMFILES:%.lcm=%.c)
LCM_CFLAGS = $(shell pkg-config --cflags lcm)
LCM_LDFLAGS = $(shell pkg-config --libs lcm)
EIGEN_CFLAGS = $(shell pkg-config --cflags eigen3)

#CFILES = $(LCM_CFILES)
LCM_JAVAFILES = $(LCMFILES:%.lcm=%.java)
OTHER_JAVAFILES = util/MyLCMTypeDatabase.java util/MessageMonitor.java util/CoordinateFrameData.java util/LCMCoder.java util/Transform.java
JAVAFILES = $(LCM_JAVAFILES) $(OTHER_JAVAFILES)

OBJFILES = $(LCM_CFILES:%.c=%.o)
CLASSFILES = $(JAVAFILES:%.java=%.class)
EXTRACLASSFILES = util/MyLCMTypeDatabase*MyClassVisitor.class

MATLAB = $(shell which matlab)

all: matlab_config java c
@for subdir in $(SUBDIRS); do \
echo "\n-------------------------------------------"; \
echo "-- $$subdir"; \
echo "-------------------------------------------"; \
$(MAKE) -C $$subdir all || exit 2; \
done

debug: CXX += -g
debug: CC += -g
debug: matlab_config java c
@for subdir in $(SUBDIRS); do \
echo "\n-------------------------------------------"; \
echo "-- $$subdir"; \
echo "-------------------------------------------"; \
$(MAKE) -C $$subdir debug || exit 2; \
done

doxygen :
doxygen doc/Doxyfile

java : drake.jar

c : drake.a

matlab_config : util/drake_config.mat .matlabroot

util/drake_config.mat .matlabroot : configure.m
matlab -nosplash -nodesktop -r "configure;exit";
# todo: consider using configure(struct('autoconfig',true))

drake.jar : $(CLASSFILES)
cd ..; jar -cf drake/drake.jar $(CLASSFILES:%=drake/%) $(EXTRACLASSFILES:%=drake/%)

drake.a : $(OBJFILES)
ar rc $@ $^

.INTERMEDIATE : $(OBJFILES) $(CLASSFILES)
.PRECIOUS : $(LCMFILES) $(OTHER_JAVAFILES)

util/LCMCoder.class : util/LCMCoder.java util/CoordinateFrameData.class
javac $< -cp $(CLASSPATH):$(shell pwd)/../

%.class : %.java
javac $<

%.o : %.c
$(CC) -c -I include/ $< -o $@ $(LCM_CFLAGS) $(EIGEN_CFLAGS)

%.c : %.lcm
@if grep -i package $< ; then echo "\n *** ERROR: $< has a package specified. Don't do that. *** \n"; exit 1; fi
lcm-gen -c --c-cpath="$(shell echo $< | sed "s|/[A-Za-z0-9_]*\.lcm|/|")" --c-hpath="include/" $<

%.java : %.lcm
@if grep -i package $< ; then echo "\n *** ERROR: $< has a package specified. Don't do that. *** \n"; exit 1; fi
lcm-gen -j --jdefaultpkg="drake.$(shell echo $< | sed "s|/[A-Za-z0-9._]*\.lcm||g" | tr "/" ".")" --jpath=".." $<

clean :
-rm -f drake.jar drake.a $(LIBS) $(LCM_HFILES) $(LCM_CFILES) $(OBJFILES) $(LCM_JAVAFILES) $(CLASSFILES) $(EXTRACLASSFILES)
-rm -rf doc/DoxygenMatlab/html
@for subdir in $(SUBDIRS); do \
echo "\n-------------------------------------------"; \
echo "-- $$subdir"; \
echo "-------------------------------------------"; \
$(MAKE) -C $$subdir clean; \
done

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


File renamed without changes.
Loading

0 comments on commit 612a4bc

Please sign in to comment.