2
0
mirror of https://github.com/team2059/Dent synced 2025-01-07 22:14:14 -05:00

Created cmake file (untested)

This commit is contained in:
Austen Adler 2015-04-10 08:36:20 -04:00
parent c2047f33b1
commit 28ab88876c
3 changed files with 32 additions and 34 deletions

3
.gitignore vendored
View File

@ -1,5 +1,4 @@
*.o
bin
wpilib
CMakeCache.txt
CMakeFiles
@ -7,3 +6,5 @@ cmake_install.cmake
vision
latex
html
Makefile
FRCUserProgram

30
CMakeLists.txt Normal file
View File

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 2.8.11)
project(dent)
# Compiler flags
set(CMAKE_CXX_COMPILER "/usr/bin/arm-frc-linux-gnueabi-g++")
set(CMAKE_EXE_LINKER_FLAGS -Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a)
add_compile_options(-std=c++11 -O0 -g3 -Wall -c -fmessage-length=0)
# Add sources and headers
file(GLOB_RECURSE DENT_SOURCES "Commands/*.cpp")
file(GLOB_RECURSE TMP "Subsystems/*.cpp")
set(DENT_SOURCES DentRobot.cpp OI.cpp ${DENT_SOURCES} ${TMP})
file(GLOB_RECURSE DENT_HEADERS "Commands/*.h")
file(GLOB_RECURSE DENT_HEADERS "Subsystems/*.h")
set(DENT_HEADERS DentRobot.h OI.h ${DENT_HEADERS} ${TMP})
message(STATUS DENT_SOURCES: ${DENT_SOURCES})
message(STATUS DENT_HEADERS: ${DENT_HEADERS})
set(DENT_INCLUDE_DIRS "")
foreach(_headerFile ${DENT_HEADERS})
get_filename_component(_dir ${_headerFile} PATH)
list(APPEND DENT_INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES DENT_INCLUDE_DIRS)
include_directories(/var/frc/wpilib/include)
# Build binary
include_directories(${DENT_INCLUDE_DIRS})
add_executable(FRCUserProgram ${DENT_SOURCES})
target_link_libraries(FRCUserProgram /var/frc/wpilib/lib/libwpi_2015.so)
# vim: ts=2:sw=2:et

View File

@ -1,33 +0,0 @@
REMOTEIP=10.20.59.2
CC=arm-frc-linux-gnueabi-g++
CFLAGS=-std=c++11 -O0 -g3 -Wall -c -fmessage-length=0
LDFLAGS=-Wl,-rpath,/opt/GenICam_v2_3/bin/Linux_armv7-a
rwildcard=$(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2) $(filter $(subst *,%,$2),$d))
SOURCES=$(call rwildcard,./,*.cpp)
OBJECTS=$(SOURCES:.cpp=.o)
WPILIB=/var/frc/wpilib
EXEC=bin/FRCUserProgram
CLEANSER=rm -f
READER=$(shell which pv||which cat)
all : $(OBJECTS)
if [ ! -d bin ];then mkdir bin; fi
$(CC) -L$(WPILIB)/lib $(LDFLAGS) -o $(EXEC) $(OBJECTS) -lwpi
%.o : %.cpp
$(CC) $(CFLAGS) -I$(WPILIB)/include $^ -o $@
clean:
$(CLEANSER) $(OBJECTS) bin/FRCUserProgram
deploy:
@$(READER) bin/FRCUserProgram | ssh admin@$(REMOTEIP) '(rm /home/lvuser/FRCUserProgram)</dev/null;cat>/home/lvuser/FRCUserProgram;chmod a+x /home/lvuser/FRCUserProgram'
run:
@$(READER) bin/FRCUserProgram | ssh admin@$(REMOTEIP) '(rm /home/lvuser/FRCUserProgram)</dev/null;cat > /home/lvuser/FRCUserProgram;chmod a+x /home/lvuser/FRCUserProgram && /usr/local/frc/bin/frcKillRobot.sh -r -t'
debug:
@$(READER) bin/FRCUserProgram | ssh admin@$(REMOTEIP) '(rm /home/lvuser/FRCUserProgram)</dev/null;cat > /home/lvuser/FRCUserProgram;chmod a+x /home/lvuser/FRCUserProgram;(/home/lvuser/run.sh||/home/admin/run.sh)'
putkey:
@test -d ~/.ssh||mkdir ~/.ssh;test -f ~/.ssh/id_rsa||ssh-keygen -t rsa -f ~/.ssh/id_rsa -b 4096 -q -N '';cat ~/.ssh/id_rsa.pub|ssh -v admin@$(REMOTEIP) 'cat >> /tmp/key;mkdir -p ~/.ssh;cat /tmp/key >> ~/.ssh/authorized_keys;rm /tmp/key'