diff --git a/CMakeLists.txt b/CMakeLists.txt index a2d47b2158..ff6b50406a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,27 +5,9 @@ include(CheckCXXCompilerFlag) include (FindPkgConfig) include(GNUInstallDirs) -#copied from GazeboUtils.cmake -macro (APPEND_TO_CACHED_STRING _string _cacheDesc) - FOREACH (newItem ${ARGN}) - SET (${_string} "${${_string}} ${newItem}" CACHE INTERNAL ${_cacheDesc} FORCE) - ENDFOREACH (newItem ${ARGN}) -endmacro (APPEND_TO_CACHED_STRING) - #check for depenedencies find_package(gazebo REQUIRED) find_package(Boost COMPONENTS system filesystem REQUIRED) -find_package(Protobuf REQUIRED) - -if (NOT PROTOBUF_FOUND) - MESSAGE ("Missing: Google Protobuf (libprotobuf-dev)") -endif() -if (NOT PROTOBUF_PROTOC_EXECUTABLE) - MESSAGE ( "Missing: Google Protobuf Compiler (protobuf-compiler)") -endif() -if (NOT PROTOBUF_PROTOC_LIBRARY) - MESSAGE ("Missing: Google Protobuf Compiler Library (libprotoc-dev)") -endif() #on windows we produce .dlls with no prefix if(WIN32) diff --git a/simulation/build.gradle b/simulation/build.gradle index 1698f19911..c0d1ff0765 100644 --- a/simulation/build.gradle +++ b/simulation/build.gradle @@ -5,7 +5,7 @@ publishing { publications { simulation(MavenPublication) { artifact zip - groupId 'simulation' + groupId 'edu.wpi.first.wpilib.simulation' artifactId 'simulation' version '1.0.0' } diff --git a/simulation/frcsim_installer.sh b/simulation/frcsim-installer.sh similarity index 94% rename from simulation/frcsim_installer.sh rename to simulation/frcsim-installer.sh index be3d4a5712..a2fdbabc3b 100755 --- a/simulation/frcsim_installer.sh +++ b/simulation/frcsim-installer.sh @@ -121,7 +121,7 @@ function install-eclipse { fi tar -xf /tmp/eclipse.tar.gz -C /opt - ln -s /opt/eclipse/eclipse /usr/bin/eclipse + ln -fs /opt/eclipse/eclipse /usr/bin/eclipse } function install-desktops { @@ -143,7 +143,7 @@ function install-toolchain { add-apt-repository ppa:openjdk-r/ppa -y add-apt-repository ppa:ubuntu-toolchain-r/test -y apt-get update - apt-get install libprotoc-dev libprotobuf-dev protobuf-compiler g++-4.9 openjdk-8-jdk -y + apt-get install cmake libprotoc-dev libprotobuf-dev protobuf-compiler g++-4.9 openjdk-8-jdk -y ln -fs /usr/bin/g++-4.9 /usr/bin/g++ } @@ -154,7 +154,9 @@ function install-models { install-fail fi - unzip /tmp/models.zip -d ~/wpilib/simulation + unzip /tmp/models.zip -d /tmp + mv /tmp/frcsim-gazebo-models/models ~/wpilib/simulation/models + mv /tmp/frcsim-gazebo-models/worlds ~/wpilib/simulation/worlds } function install-frcsim { @@ -196,6 +198,8 @@ function install-frcsim { install-desktops install-models + sudo chown -R $USER:$USER ~/wpilib + # Done echo "Installation Finished!!" } diff --git a/simulation/gz_msgs/CMakeLists.txt b/simulation/gz_msgs/CMakeLists.txt index 5ca638686e..5e79a8b971 100644 --- a/simulation/gz_msgs/CMakeLists.txt +++ b/simulation/gz_msgs/CMakeLists.txt @@ -1,6 +1,25 @@ -cmake_minimum_required(VERSION 2.8) +Cmake_minimum_required(VERSION 2.8) project(gz_msgs) +#copied from GazeboUtils.cmake +macro (APPEND_TO_CACHED_STRING _string _cacheDesc) + FOREACH (newItem ${ARGN}) + SET (${_string} "${${_string}} ${newItem}" CACHE INTERNAL ${_cacheDesc} FORCE) + ENDFOREACH (newItem ${ARGN}) +endmacro (APPEND_TO_CACHED_STRING) + +find_package(Protobuf REQUIRED) + +if (NOT PROTOBUF_FOUND) + MESSAGE ("Missing: Google Protobuf (libprotobuf-dev)") +endif() +if (NOT PROTOBUF_PROTOC_EXECUTABLE) + MESSAGE ( "Missing: Google Protobuf Compiler (protobuf-compiler)") +endif() +if (NOT PROTOBUF_PROTOC_LIBRARY) + MESSAGE ("Missing: Google Protobuf Compiler Library (libprotoc-dev)") +endif() + #list all proto files used get_filename_component(PROTO_DIR src/main/proto ABSOLUTE) set(msgs @@ -62,10 +81,9 @@ else() endif() target_link_libraries(${PROJECT_NAME} ${PROTOBUF_LIBRARIES}) -set_target_properties(${PROJECT_NAME} - PROPERTIES - INSTALL_RPATH "${ENV_HOME}/wpilib/simulation/lib" - LIBRARY_OUTPUT_DIRECTORY ${SIMULATION_INSTALL_DIR}/lib) +set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH "$ENV{HOME}/wpilib/simulation/lib") -file(COPY "${GZ_MSGS_INCLUDE_DIR}/simulation" - DESTINATION "${CMAKE_BINARY_DIR}/install/simulation/include") +install(TARGETS ${PROJECT_NAME} + DESTINATION "$ENV{HOME}/wpilib/simulation/lib") +install(DIRECTORY "${GZ_MSGS_INCLUDE_DIR}/simulation" + DESTINATION "$ENV{HOME}/wpilib/simulation/include") diff --git a/simulation/gz_msgs/README.md b/simulation/gz_msgs/README.md index 203457d1cc..74266c34e3 100644 --- a/simulation/gz_msgs/README.md +++ b/simulation/gz_msgs/README.md @@ -1,6 +1,19 @@ Building gz_msgs ================ -Currently uses cmake. -This is build as a part of the whole cmake project. -see top level building.md for detail +gz_msgs currently uses cmake, is built on the end-users computer. +This allows us to support various versions of protobuf (2.5 on Ubuntu 14.04, 2.6 on Ubuntu 15.10) + +To build, run the following commands in the ~/wpilib/simulation/gz_msgs directory. +If that directory doesn't exist, it means you haven't installed correctly. + +If you're a developer for wpilib, you will need to unzip the simulation.zip file you published into ~/releases. +If you are a student using FRCSim, you should have downloaded that zip when you installed frcsim. + + mkdir build + cd build + cmake .. + make + make install + +If you are installing FRCSim with the script, then this *should* have be done for you. diff --git a/wpilibc/simulation.gradle b/wpilibc/simulation.gradle index ec70276883..7da3216dc6 100644 --- a/wpilibc/simulation.gradle +++ b/wpilibc/simulation.gradle @@ -67,7 +67,7 @@ task allcsim(dependsOn: [wpilibcSim, gz_msgs, frc_gazebo_plugins]){ group = 'WPILib Simulation' } -task wpilibcSimCopy(type: Copy) { +task wpilibcSimCopy(type: Copy, dependsOn: allcsim) { description = 'copy headers and ntcore library to make simulation zip' group = 'WPILib Simulation' into "$simulationInstallDir"