mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
reverting building opkg in maven/cmake (now uses ant)
This commit is contained in:
165
CMakeLists.txt
165
CMakeLists.txt
@@ -10,168 +10,3 @@ get_filename_component(NWT_API_INCLUDES networktables/cpp/include REALPATH)
|
||||
add_subdirectory(hal)
|
||||
add_subdirectory(networktables/cpp)
|
||||
add_subdirectory(wpilibc)
|
||||
|
||||
|
||||
|
||||
set(CPACK_PACKAGE_NAME "WPILib")
|
||||
set(CPACK_PACKAGE_VENDOR "Worcester Polytechnic Institute")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "WPILib, NetworkTables and HAL for RoboRIO target
|
||||
.
|
||||
This package contains the shared objects for WPILib, NetworkTables, and HAL for the 2015 target on the RoboRIO")
|
||||
if (NOT DEFINED CPACK_PACKAGE_VERSION)
|
||||
set(CPACK_PACKAGE_VERSION "2014.9999.DEV")
|
||||
endif (NOT DEFINED CPACK_PACKAGE_VERSION)
|
||||
SET(DEBIAN_ARCHITECTURE armv7a-vfp)
|
||||
SET(CPACK_PACKAGE_CONTACT "Brad Miller at WPI")
|
||||
|
||||
# Compute the md5sums file by doing a recursion of directory: `DIRECTORY`
|
||||
MACRO(COMPUTE_MD5SUMS DIRECTORY OUTPUT_FILE)
|
||||
|
||||
# Super ugly and barely readable but you need that in order to
|
||||
# work around a deficiency in EXECUTE_PROCESS which does not have dependencie scanning
|
||||
# TODO: look at this more
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/md5sum.cmake "
|
||||
|
||||
FILE(GLOB_RECURSE MD5SUM_INPUT_FILES ${DIRECTORY}/*)
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E md5sum \${MD5SUM_INPUT_FILES}
|
||||
WORKING_DIRECTORY ${DIRECTORY}
|
||||
OUTPUT_VARIABLE md5sum_VAR
|
||||
RESULT_VARIABLE md5sum_RES
|
||||
)
|
||||
STRING(REPLACE ${DIRECTORY}/
|
||||
\"\" md5sum_VAR_clean
|
||||
\${md5sum_VAR})
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/md5sums \${md5sum_VAR_clean})
|
||||
")
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${OUTPUT_FILE}
|
||||
COMMAND cmake
|
||||
ARGS -P ${CMAKE_BINARY_DIR}/md5sum.cmake
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
DEPENDS ${DIRECTORY} ${CMAKE_BINARY_DIR}/md5sum.cmake
|
||||
COMMENT "Generating md5sums"
|
||||
)
|
||||
|
||||
ENDMACRO(COMPUTE_MD5SUMS)
|
||||
|
||||
IF (NOT CMAKE_AR)
|
||||
MESSAGE(FATAL_ERROR "ar is required but could not be found. If it is in a non-standard location, use -DCMAKE_AR=path/to/ar")
|
||||
ELSE (NOT CMAKE_AR)
|
||||
IF (NOT DEFINED "CPACK_PACKAGE_NAME")
|
||||
MESSAGE(FATAL_ERROR "Package name was not set, please set the package name")
|
||||
ENDIF (NOT DEFINED "CPACK_PACKAGE_NAME")
|
||||
|
||||
# debian policy enforce lower case for package name
|
||||
STRING(TOLOWER ${CPACK_PACKAGE_NAME} DEBIAN_PACKAGE_NAME)
|
||||
IF(NOT DEBIAN_PACKAGE_DEPENDS)
|
||||
SET(DEBIAN_PACKAGE_DEPENDS "libc6 (>= 2.11.1-r7), libgcc1 (>= 4.4.1)")
|
||||
ENDIF(NOT DEBIAN_PACKAGE_DEPENDS)
|
||||
IF(NOT DEBIAN_PACKAGE_VERSION)
|
||||
SET(DEBIAN_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
ENDIF(NOT DEBIAN_PACKAGE_VERSION)
|
||||
IF(NOT DEBIAN_PACKAGE_SECTION)
|
||||
SET(DEBIAN_PACKAGE_SECTION devel)
|
||||
ENDIF(NOT DEBIAN_PACKAGE_SECTION)
|
||||
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/debian-binary
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E echo "2.0" > ${CMAKE_BINARY_DIR}/debian-binary
|
||||
COMMENT "Generating debian-binary"
|
||||
VERBATIM)
|
||||
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/control
|
||||
"Package: ${DEBIAN_PACKAGE_NAME}
|
||||
Version: ${CPACK_PACKAGE_VERSION}
|
||||
Section: ${DEBIAN_PACKAGE_SECTION}
|
||||
Priority: optional
|
||||
Architecture: ${DEBIAN_ARCHITECTURE}
|
||||
Depends: ${DEBIAN_PACKAGE_DEPENDS}
|
||||
Maintainer: ${CPACK_PACKAGE_CONTACT}
|
||||
Description: ${CPACK_PACKAGE_DESCRIPTION_SUMMARY}
|
||||
")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/postrm "#! /bin/sh
|
||||
ldconfig
|
||||
")
|
||||
FILE(WRITE ${CMAKE_BINARY_DIR}/postinst "#! /bin/sh
|
||||
ldconfig
|
||||
")
|
||||
# let's create a temp directory to call 'DESTDIR=... make install' into:
|
||||
# cleanup
|
||||
FILE(REMOVE ${CMAKE_BINARY_DIR}/debian_package)
|
||||
# make dir:
|
||||
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/debian_package)
|
||||
|
||||
# calling cmake -P cmake_install.cmake is the same as calling make install:
|
||||
ADD_CUSTOM_TARGET(deb_destdir_install
|
||||
COMMAND DESTDIR=${CMAKE_BINARY_DIR}/debian_package ${CMAKE_COMMAND} -DCOMPONENT=lib -P cmake_install.cmake
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/cmake_install.cmake WPILibAthena NetworkTables HALAthena
|
||||
COMMENT "Building debian_package directory with DESTDIR"
|
||||
)
|
||||
ADD_DEPENDENCIES(deb_destdir_install all)
|
||||
|
||||
|
||||
ADD_CUSTOM_TARGET(control_perms
|
||||
COMMAND chmod +x ${CMAKE_BINARY_DIR}/postinst ${CMAKE_BINARY_DIR}/postrm
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/postinst ${CMAKE_BINARY_DIR}/postrm
|
||||
COMMENT "Setting executable permissions"
|
||||
)
|
||||
|
||||
# create data.tar.gz from the make install stuff
|
||||
# all files starts with: ./usr
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/data.tar.gz
|
||||
COMMAND cmake -E tar
|
||||
ARGS cfz ${CMAKE_BINARY_DIR}/data.tar.gz .
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/debian_package
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/debian_package
|
||||
COMMENT "Generating data.tar.gz"
|
||||
)
|
||||
|
||||
|
||||
# get all the files to be installed:
|
||||
COMPUTE_MD5SUMS(
|
||||
${CMAKE_BINARY_DIR}/debian_package
|
||||
${CMAKE_BINARY_DIR}/md5sums
|
||||
)
|
||||
|
||||
# create a tarball (control.tar.gz) of control and md5sums
|
||||
# files need to be in relative path: ./md5sums ./control ...
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/control.tar.gz
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
COMMAND cmake -E tar
|
||||
ARGS cfz ${CMAKE_BINARY_DIR}/control.tar.gz control md5sums postinst postrm
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/control ${CMAKE_BINARY_DIR}/md5sums ${CMAKE_BINARY_DIR}/postinst ${CMAKE_BINARY_DIR}/postrm control_perms
|
||||
COMMENT "Generating control.tar.gz"
|
||||
)
|
||||
|
||||
|
||||
|
||||
# Warning order is important:
|
||||
# ar -r your-package-name.deb debian-binary control.tar.gz data.tar.gz
|
||||
# eg: cmake_2.4.5-1_i386.deb
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_BINARY_DIR}/${DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${DEBIAN_ARCHITECTURE}.deb
|
||||
COMMAND ${CMAKE_AR}
|
||||
ARGS -r ${CMAKE_BINARY_DIR}/${DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${DEBIAN_ARCHITECTURE}.deb
|
||||
${CMAKE_BINARY_DIR}/debian-binary
|
||||
${CMAKE_BINARY_DIR}/control.tar.gz ${CMAKE_BINARY_DIR}/data.tar.gz
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/debian-binary ${CMAKE_BINARY_DIR}/control.tar.gz ${CMAKE_BINARY_DIR}/data.tar.gz
|
||||
COMMENT "Generating deb package"
|
||||
)
|
||||
|
||||
# the final target:
|
||||
ADD_CUSTOM_TARGET(package
|
||||
DEPENDS ${CMAKE_BINARY_DIR}/${DEBIAN_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${DEBIAN_ARCHITECTURE}.deb
|
||||
)
|
||||
ADD_DEPENDENCIES(package deb_destdir_install)
|
||||
|
||||
|
||||
# BUG: debian_package is not removed during a 'make clean':
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES
|
||||
ADDITIONAL_MAKE_CLEAN_FILES "debian-binary;control;md5sums;debian_package;")
|
||||
ENDIF (NOT CMAKE_AR)
|
||||
|
||||
|
||||
@@ -24,35 +24,12 @@
|
||||
<configuration>
|
||||
<options>
|
||||
<option>-DCMAKE_TOOLCHAIN_FILE=../../../arm-toolchain.cmake</option>
|
||||
<option>-DCMAKE_INSTALL_PREFIX=/usr/local/frc/</option>
|
||||
<option>-DCPACK_PACKAGE_VERSION=${version-info}</option>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>cmake2</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<target>package</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>cmake3</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>generate</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<options>
|
||||
<option>-DCMAKE_INSTALL_PREFIX=target-root</option>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>cmake4</id>
|
||||
<id>cmake2</id>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
@@ -105,9 +82,7 @@
|
||||
<configuration>
|
||||
<target>
|
||||
<echo file="${project.build.directory}/cmake/target-root/so.properties">cpp-sos=${version-info}</echo>
|
||||
<move file="${project.build.directory}/cmake/wpilib_${version-info}_armv7a-vfp.deb" todir="${project.build.directory}/cmake/target-root" />
|
||||
<zip destfile="${project.build.directory}/cpp-root-1.0.0.jar" basedir="${project.build.directory}/cmake/target-root" />
|
||||
<move file="${project.build.directory}/cmake/target-root/wpilib_${version-info}_armv7a-vfp.deb" todir="${project.build.directory}/cmake/" />
|
||||
</target>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
Reference in New Issue
Block a user