Browse files

Updating build system.

  • Loading branch information...
1 parent 4bb3f54 commit fbf736204356a16efed1530d5494f251d63cffa2 James Goppert committed Nov 7, 2011
View
64 CMakeLists.txt
@@ -9,9 +9,10 @@ set(APPLICATION_NAME ${PROJECT_NAME})
# set these for release
set(APPLICATION_VERSION_MAJOR "1")
set(APPLICATION_VERSION_MINOR "1")
-set(APPLICATION_VERSION_PATCH "0")
+set(APPLICATION_VERSION_PATCH "100")
set(ARKOSG_VERSION "0.1.6")
set(ARKCOMM_VERSION "0.1.3")
+set(MAVLINK_VERSION "0.9.0")
set(APPLICATION_VERSION "${APPLICATION_VERSION_MAJOR}.${APPLICATION_VERSION_MINOR}.${APPLICATION_VERSION_PATCH}")
set(LIBRARY_VERSION ${APPLICATION_VERSION})
@@ -37,6 +38,7 @@ include(DefineCMakeDefaults)
include(DefinePlatformDefaults)
include(DefineCompilerFlags)
include(DefineInstallationPaths)
+include(FindMAVLINK)
# cpack
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "arkTools scicoslab toolbox")
@@ -105,63 +107,35 @@ enable_language(CXX)
# add make dist target
add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)
-# find libraries with cmake modules
-find_package(SCICOSLAB REQUIRED)
-find_package(OpenSceneGraph 2.8.0 COMPONENTS osgGA osgDB osgUtil osgViewer)
-find_package(ARKOSG)
-find_package(ARKCOMM)
-find_package(Boost 1.42 REQUIRED COMPONENTS thread-mt system-mt)
-
-# find libraries with cmake modules
-find_package(SCICOSLAB)
-find_package(ARKOSG ${ARKOSG_VERSION})
-find_package(ARKCOMM ${ARKCOMM_VERSION})
-
-# external projects
-set(EP_BASE_DIR "${CMAKE_BINARY_DIR}/CMakeExternals")
-set_property(DIRECTORY PROPERTY EP_BASE ${EP_BASE_DIR})
-set(EP_INSTALL_ROOT ${EP_BASE_DIR}/InstallRoot${CMAKE_INSTALL_PREFIX})
-
# install/developer mode
if(DEV_MODE)
message(STATUS "configuring for in source build")
set(DATADIR ${PROJECT_SOURCE_DIR}/data)
- set(LIBDIR ${CMAKE_BINARY_DIR}/bin)
+ set(LIBDIR ${CMAKE_BINARY_DIR}/lib)
set(BINDIR ${CMAKE_BINARY_DIR}/bin)
- set(EP_DATA_ROOT ${EP_INSTALL_ROOT}/share)
+ set(EP_DATADIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/share)
else()
message(STATUS "configuring for install build")
set(DATADIR ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/data)
set(LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
set(BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
- set(EP_DATA_ROOT ${CMAKE_INSTALL_PREFIX}/share)
+ set(EP_DATADIR ${EP_INSTALL_PREFIX}/share)
endif()
-# static lib prefix
-if(WIN32)
- set(STATIC_LIB_PREFIX "")
-elseif(APPLE)
- set(STATIC_LIB_PREFIX "lib")
-elseif(UNIX)
- set(STATIC_LIB_PREFIX "lib")
-else()
- message(FATAL_ERROR "unknown operating system")
-endif()
+# external projects
+set(EP_BASE_DIR "${CMAKE_BINARY_DIR}/CMakeExternals")
+set_property(DIRECTORY PROPERTY EP_BASE ${EP_BASE_DIR})
+set(EP_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}-external)
-if( NOT MAVLINK_FOUND)
- ExternalProject_Add(mavlink
- GIT_REPOSITORY "git://github.com/pixhawk/mavlink.git"
- GIT_TAG ${MAVLINK_VERSION}
- CONFIGURE_COMMAND ""
- BUILD_COMMAND ""
- INSTALL_COMMAND ""
- INSTALL_DIR ${EP_INSTALL_ROOT}
- UPDATE_COMMAND ""
- BUILD_IN_SOURCE 1
- )
- set(MAVLINK_FOUND TRUE)
- set(MAVLINK_INCLUDE_DIRS ${EP_BASE_DIR}/Source/mavlink/include)
-endif()
+# find libraries with cmake modules
+find_package(SCICOSLAB)
+find_package(OpenSceneGraph 2.8.0 COMPONENTS osgGA osgDB osgUtil osgViewer)
+find_package(ARKOSG)
+find_package(ARKCOMM)
+find_package(Boost 1.42 COMPONENTS thread-mt system-mt)
+find_or_build_arkcomm(${ARKCOMM_VERSION} ${EP_BASE_DIR} ${EP_INSTALL_PREFIX} ${EP_DATADIR})
+find_or_build_arkosg(${ARKOSG_VERSION} ${EP_BASE_DIR} ${EP_INSTALL_PREFIX} ${EP_DATADIR})
+find_or_build_mavlink(${MAVLINK_VERSION} ${EP_BASE_DIR} ${EP_INSTALL_PREFIX} ${EP_DATADIR})
# install data files
install(DIRECTORY "${PROJECT_SOURCE_DIR}/aircraft" DESTINATION share/${PROJECT_NAME} PATTERN "*.git*" EXCLUDE)
View
167 COPYING.txt
@@ -1,167 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-
- This version of the GNU Lesser General Public License incorporates
-the terms and conditions of version 3 of the GNU General Public
-License, supplemented by the additional permissions listed below.
-
- 0. Additional Definitions.
-
- As used herein, "this License" refers to version 3 of the GNU Lesser
-General Public License, and the "GNU GPL" refers to version 3 of the GNU
-General Public License.
-
- "The Library" refers to a covered work governed by this License,
-other than an Application or a Combined Work as defined below.
-
- An "Application" is any work that makes use of an interface provided
-by the Library, but which is not otherwise based on the Library.
-Defining a subclass of a class defined by the Library is deemed a mode
-of using an interface provided by the Library.
-
- A "Combined Work" is a work produced by combining or linking an
-Application with the Library. The particular version of the Library
-with which the Combined Work was made is also called the "Linked
-Version".
-
- The "Minimal Corresponding Source" for a Combined Work means the
-Corresponding Source for the Combined Work, excluding any source code
-for portions of the Combined Work that, considered in isolation, are
-based on the Application, and not on the Linked Version.
-
- The "Corresponding Application Code" for a Combined Work means the
-object code and/or source code for the Application, including any data
-and utility programs needed for reproducing the Combined Work from the
-Application, but excluding the System Libraries of the Combined Work.
-
- 1. Exception to Section 3 of the GNU GPL.
-
- You may convey a covered work under sections 3 and 4 of this License
-without being bound by section 3 of the GNU GPL.
-
- 2. Conveying Modified Versions.
-
- If you modify a copy of the Library, and, in your modifications, a
-facility refers to a function or data to be supplied by an Application
-that uses the facility (other than as an argument passed when the
-facility is invoked), then you may convey a copy of the modified
-version:
-
- a) under this License, provided that you make a good faith effort to
- ensure that, in the event an Application does not supply the
- function or data, the facility still operates, and performs
- whatever part of its purpose remains meaningful, or
-
- b) under the GNU GPL, with none of the additional permissions of
- this License applicable to that copy.
-
- 3. Object Code Incorporating Material from Library Header Files.
-
- The object code form of an Application may incorporate material from
-a header file that is part of the Library. You may convey such object
-code under terms of your choice, provided that, if the incorporated
-material is not limited to numerical parameters, data structure
-layouts and accessors, or small macros, inline functions and templates
-(ten or fewer lines in length), you do both of the following:
-
- a) Give prominent notice with each copy of the object code that the
- Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the object code with a copy of the GNU GPL and this license
- document.
-
- 4. Combined Works.
-
- You may convey a Combined Work under terms of your choice that,
-taken together, effectively do not restrict modification of the
-portions of the Library contained in the Combined Work and reverse
-engineering for debugging such modifications, if you also do each of
-the following:
-
- a) Give prominent notice with each copy of the Combined Work that
- the Library is used in it and that the Library and its use are
- covered by this License.
-
- b) Accompany the Combined Work with a copy of the GNU GPL and this license
- document.
-
- c) For a Combined Work that displays copyright notices during
- execution, include the copyright notice for the Library among
- these notices, as well as a reference directing the user to the
- copies of the GNU GPL and this license document.
-
- d) Do one of the following:
-
- 0) Convey the Minimal Corresponding Source under the terms of this
- License, and the Corresponding Application Code in a form
- suitable for, and under terms that permit, the user to
- recombine or relink the Application with a modified version of
- the Linked Version to produce a modified Combined Work, in the
- manner specified by section 6 of the GNU GPL for conveying
- Corresponding Source.
-
- 1) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (a) uses at run time
- a copy of the Library already present on the user's computer
- system, and (b) will operate properly with a modified version
- of the Library that is interface-compatible with the Linked
- Version.
-
- e) Provide Installation Information, but only if you would otherwise
- be required to provide such information under section 6 of the
- GNU GPL, and only to the extent that such information is
- necessary to install and execute a modified version of the
- Combined Work produced by recombining or relinking the
- Application with a modified version of the Linked Version. (If
- you use option 4d0, the Installation Information must accompany
- the Minimal Corresponding Source and Corresponding Application
- Code. If you use option 4d1, you must provide the Installation
- Information in the manner specified by section 6 of the GNU GPL
- for conveying Corresponding Source.)
-
- 5. Combined Libraries.
-
- You may place library facilities that are a work based on the
-Library side by side in a single library together with other library
-facilities that are not Applications and are not covered by this
-License, and convey such a combined library under terms of your
-choice, if you do both of the following:
-
- a) Accompany the combined library with a copy of the same work based
- on the Library, uncombined with any other library facilities,
- conveyed under the terms of this License.
-
- b) Give prominent notice with the combined library that part of it
- is a work based on the Library, and explaining where to find the
- accompanying uncombined form of the same work.
-
- 6. Revised Versions of the GNU Lesser General Public License.
-
- The Free Software Foundation may publish revised and/or new versions
-of the GNU Lesser General Public License from time to time. Such new
-versions will be similar in spirit to the present version, but may
-differ in detail to address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Library as you received it specifies that a certain numbered version
-of the GNU Lesser General Public License "or any later version"
-applies to it, you have the option of following the terms and
-conditions either of that published version or of any later version
-published by the Free Software Foundation. If the Library as you
-received it does not specify a version number of the GNU Lesser
-General Public License, you may choose any version of the GNU Lesser
-General Public License ever published by the Free Software Foundation.
-
- If the Library as you received it specifies that a proxy can decide
-whether future versions of the GNU Lesser General Public License shall
-apply, that proxy's public statement of acceptance of any version is
-permanent authorization for you to choose that version for the
-Library.
-
-
View
27 cmake/arkcmake/FindARKCOMM.cmake
@@ -34,3 +34,30 @@ set(ARKCOMM_LIB_IMPORT ${ARKCOMM_LIBRARY_DIR}/arkcomm/arkcomm-targets.cmake)
set(ARKCOMM_PROCESS_INCLUDES ARKCOMM_INCLUDE_DIR)
set(ARKCOMM_PROCESS_LIBS ARKCOMM_LIBRARY ARKCOMM_LIBRARIES)
libfind_process(ARKCOMM)
+
+macro(find_or_build_arkcomm TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
+ find_package(ARKCOMM ${TAG})
+ if(NOT ARKCOMM_FOUND)
+ ExternalProject_Add(arkcomm
+ GIT_REPOSITORY "git://github.com/arktools/arkcomm.git"
+ GIT_TAG ${TAG}
+ UPDATE_COMMAND ""
+ INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
+ INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
+ )
+ set(ARKCOMM_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
+ # static lib prefix
+ if(WIN32)
+ set(STATIC_LIB_PREFIX "")
+ elseif(APPLE)
+ set(STATIC_LIB_PREFIX "lib")
+ elseif(UNIX)
+ set(STATIC_LIB_PREFIX "lib")
+ else()
+ message(FATAL_ERROR "unknown operating system")
+ endif()
+ set(ARKCOMM_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}arkcomm.a)
+ set(ARKCOMM_FOUND TRUE)
+ endif()
+endmacro()
View
44 cmake/arkcmake/FindARKMATH.cmake
@@ -12,27 +12,27 @@ MacroCommonPaths(ARKMATH)
# Include dir
find_path(ARKMATH_INCLUDE_DIR
- NAMES arkmath/storage_adaptors.hpp
- PATHS ${COMMON_INCLUDE_PATHS_ARKMATH}
+ NAMES arkmath/storage_adaptors.hpp
+ PATHS ${COMMON_INCLUDE_PATHS_ARKMATH}
)
# data dir
find_path(ARKMATH_DATA_DIR_SEARCH
- NAMES arkmath/data/WMM.COF
- PATHS ${COMMON_DATA_PATHS_ARKMATH}
+ NAMES arkmath/data/WMM.COF
+ PATHS ${COMMON_DATA_PATHS_ARKMATH}
)
set(ARKMATH_DATA_DIR ${ARKMATH_DATA_DIR_SEARCH}/arkmath/data)
# the library itself
find_library(ARKMATH_LIBRARY
- NAMES arkmath
- PATHS ${COMMON_LIBRARY_PATHS_ARKMATH}
+ NAMES arkmath
+ PATHS ${COMMON_LIBRARY_PATHS_ARKMATH}
)
# the import file
find_path(ARKMATH_LIBRARY_DIR
- NAMES arkmath/arkmath-targets.cmake
- PATHS ${COMMON_LIBRARY_PATHS_ARKMATH}
+ NAMES arkmath/arkmath-targets.cmake
+ PATHS ${COMMON_LIBRARY_PATHS_ARKMATH}
)
set(ARKMATH_LIB_IMPORT ${ARKMATH_LIBRARY_DIR}/arkmath/arkmath-targets.cmake)
@@ -41,3 +41,31 @@ set(ARKMATH_LIB_IMPORT ${ARKMATH_LIBRARY_DIR}/arkmath/arkmath-targets.cmake)
set(ARKMATH_PROCESS_INCLUDES ARKMATH_INCLUDE_DIR)
set(ARKMATH_PROCESS_LIBS ARKMATH_LIBRARY ARKMATH_LIBRARIES)
libfind_process(ARKMATH)
+
+macro(find_or_build_arkmath TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
+ find_package(ARKMATH ${TAG})
+ if(NOT ARKMATH_FOUND)
+ ExternalProject_Add(arkmath
+ GIT_REPOSITORY "git://github.com/arktools/arkmath.git"
+ GIT_TAG ${TAG}
+ UPDATE_COMMAND ""
+ INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
+ INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
+ )
+ set(ARKMATH_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
+ set(ARKMATH_DATA_DIR ${EP_DATADIR}/arkmath)
+ # static lib prefix
+ if(WIN32)
+ set(STATIC_LIB_PREFIX "")
+ elseif(APPLE)
+ set(STATIC_LIB_PREFIX "lib")
+ elseif(UNIX)
+ set(STATIC_LIB_PREFIX "lib")
+ else()
+ message(FATAL_ERROR "unknown operating system")
+ endif()
+ set(ARKMATH_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}arkmath.a)
+ set(ARKMATH_FOUND TRUE)
+ endif()
+endmacro()
View
28 cmake/arkcmake/FindARKOSG.cmake
@@ -41,3 +41,31 @@ set(ARKOSG_LIB_IMPORT ${ARKOSG_LIBRARY_DIR}/arkosg/arkosg-targets.cmake)
set(ARKOSG_PROCESS_INCLUDES ARKOSG_INCLUDE_DIR)
set(ARKOSG_PROCESS_LIBS ARKOSG_LIBRARY ARKOSG_LIBRARIES)
libfind_process(ARKOSG)
+
+macro(find_or_build_arkosg TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
+ find_package(ARKOSG ${TAG})
+ if(NOT ARKOSG_FOUND)
+ ExternalProject_Add(arkosg
+ GIT_REPOSITORY "git://github.com/arktools/arkosg.git"
+ GIT_TAG ${TAG}
+ UPDATE_COMMAND ""
+ INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
+ INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
+ )
+ set(ARKOSG_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include)
+ set(ARKOSG_DATA_DIR ${EP_DATADIR}/arkosg/data)
+ # static lib prefix
+ if(WIN32)
+ set(STATIC_LIB_PREFIX "")
+ elseif(APPLE)
+ set(STATIC_LIB_PREFIX "lib")
+ elseif(UNIX)
+ set(STATIC_LIB_PREFIX "lib")
+ else()
+ message(FATAL_ERROR "unknown operating system")
+ endif()
+ set(ARKOSG_LIBRARIES ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/lib/${STATIC_LIB_PREFIX}arkosg.a)
+ set(ARKOSG_FOUND TRUE)
+ endif()
+endmacro()
View
20 cmake/arkcmake/FindBOOSTNUMERICBINDINGS.cmake
@@ -11,11 +11,27 @@ MacroCommonPaths(BOOSTNUMERICBINDINGS)
# Include dir
find_path(BOOSTNUMERICBINDINGS_INCLUDE_DIR
- NAMES boost/numeric/bindings/lapack/lapack.h
- PATHS ${COMMON_INCLUDE_PATHS_BOOSTNUMERICBINDINGS}
+ NAMES boost/numeric/bindings/lapack/lapack.h
+ PATHS ${COMMON_INCLUDE_PATHS_BOOSTNUMERICBINDINGS}
)
# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(BOOSTNUMERICBINDINGS_PROCESS_INCLUDES BOOSTNUMERICBINDINGS_INCLUDE_DIR)
libfind_process(BOOSTNUMERICBINDINGS)
+
+macro(find_or_build_boostnumericbindings TAG EP_BASE_DIR EP_INSTALL_PREFIX)
+ find_package(BOOSTNUMERICBINDINGS)
+ if( NOT BOOSTNUMERICBINDINGS)
+ ExternalProject_Add(boost-numeric-bindings
+ GIT_REPOSITORY "http://git.tiker.net/trees/boost-numeric-bindings.git"
+ GIT_TAG ${BOOSTNUMERICBINDINGS_TAG}
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ BUILD_IN_SOURCE 1
+ )
+ set(BOOSTNUMERICBINDINGS_FOUND TRUE)
+ set(BOOSTNUMERICBINDINGS_INCLUDE_DIRS ${EP_BASE_DIR}/Source/boost-numeric-bindings)
+ endif()
+endmacro()
View
44 cmake/arkcmake/FindJSBSIM.cmake
@@ -12,21 +12,21 @@ MacroCommonPaths(JSBSIM)
# Include dir
find_path(JSBSIM_INCLUDE_DIR
- NAMES JSBSim/initialization/FGTrimmer.h
- PATHS ${COMMON_INCLUDE_PATHS_JSBSIM}
+ NAMES JSBSim/initialization/FGTrimmer.h
+ PATHS ${COMMON_INCLUDE_PATHS_JSBSIM}
)
# data dir
find_path(JSBSIM_DATA_DIR_SEARCH
- NAMES jsbsim/aircraft/aircraft_template.xml
- PATHS ${COMMON_DATA_PATHS_JSBSIM}
+ NAMES jsbsim/aircraft/aircraft_template.xml
+ PATHS ${COMMON_DATA_PATHS_JSBSIM}
)
set(JSBSIM_DATA_DIR ${JSBSIM_DATA_DIR_SEARCH}/jsbsim)
# Finally the library itself
find_library(JSBSIM_LIBRARY
- NAMES JSBSim
- PATHS ${COMMON_LIBRARY_PATHS_JSBSIM}
+ NAMES JSBSim
+ PATHS ${COMMON_LIBRARY_PATHS_JSBSIM}
)
# Set the include dir variables and the libraries and let libfind_process do the rest.
@@ -37,3 +37,35 @@ set(JSBSIM_INCLUDE_DIR ${JSBSIM_INCLUDE_DIR} ${JSBSIM_INCLUDE_DIR}/JSBSim)
set(JSBSIM_INCLUDES ${JSBSIM_INCLUDES} ${JSBSIM_INCLUDE_DIR}/JSBSim)
libfind_process(JSBSIM)
+
+macro(find_or_build_jsbsim TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
+ find_package(JSBSIM ${TAG})
+ if(NOT JSBSIM_FOUND)
+ ExternalProject_Add(jsbsim
+ GIT_REPOSITORY "git://github.com/jgoppert/jsbsim.git"
+ GIT_TAG ${TAG}
+ UPDATE_COMMAND ""
+ CONFIGURE_COMMAND ${EP_BASE_DIR}/Source/jsbsim/autogen.sh --enable-libraries --prefix=${EP_INSTALL_PREFIX}
+ BUILD_COMMAND make -j4
+ BUILD_IN_SOURCE 1
+ INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
+ INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
+ )
+ set(JSBSIM_INCLUDE_DIRS ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}/include/JSBSim)
+ set(JSBSIM_DATA_DIR ${EP_DATADIR}/jsbsim)
+ # static lib prefix
+ if(WIN32)
+ set(STATIC_LIB_PREFIX "")
+ elseif(APPLE)
+ set(STATIC_LIB_PREFIX "lib")
+ elseif(UNIX)
+ set(STATIC_LIB_PREFIX "lib")
+ else()
+ message(FATAL_ERROR "unknown operating system")
+ endif()
+
+ set(JSBSIM_LIBRARIES ${EP_LIBDIR}/${STATIC_LIB_PREFIX}JSBSim.a)
+ set(JSBSIM_FOUND TRUE)
+ endif()
+endmacro()
View
22 cmake/arkcmake/FindMAVLINK.cmake
@@ -11,11 +11,29 @@ MacroCommonPaths(MAVLINK)
# Include dir
find_path(MAVLINK_INCLUDE_DIR
- NAMES mavlink/mavlink_types.h
- PATHS ${COMMON_INCLUDE_PATHS_MAVLINK}
+ NAMES mavlink/mavlink_types.h
+ PATHS ${COMMON_INCLUDE_PATHS_MAVLINK}
)
# Set the include dir variables and the libraries and let libfind_process do the rest.
# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
set(MAVLINK_PROCESS_INCLUDES MAVLINK_INCLUDE_DIR)
libfind_process(MAVLINK)
+
+macro(find_or_build_mavlink TAG EP_BASE_DIR EP_INSTALL_PREFIX EP_DATADIR)
+ find_package(ARKCOMM ${TAG})
+ if( NOT MAVLINK_FOUND)
+ ExternalProject_Add(mavlink
+ GIT_REPOSITORY "git://github.com/pixhawk/mavlink.git"
+ GIT_TAG ${TAG}
+ UPDATE_COMMAND ""
+ INSTALL_DIR ${EP_BASE_DIR}/${EP_INSTALL_PREFIX}
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EP_INSTALL_PREFIX}
+ INSTALL_COMMAND make DESTDIR=${EP_BASE_DIR} install
+ )
+ set(MAVLINK_INCLUDE_DIRS ${EP_INCLUDEDIR})
+ set(MAVLINK_DATA_DIR "")
+ set(MAVLINK_LIBRARIES "")
+ set(MAVLINK_FOUND TRUE)
+ endif()
+endmacro()
View
131 cmake/arkcmake/autobuild.py
@@ -12,7 +12,7 @@
## check cmake success, etc.
## catch CMake Warning:
#Manually-specified variables were not used by the project:
- #BUILD_TYPE
+ #BUILD_TYPE
# (missing gprof flags)
import sys # for sys.argv[] and sys.platform
@@ -21,20 +21,20 @@
import shutil # for rmtree()
from optparse import OptionParser # for parsing options
try:
- from get_build_path import get_build_path
+ from get_build_path import get_build_path
except ImportError:
- print "Could not find 'get_build_path.py' "
- print "in '%s'" % os.path.dirname(os.path.abspath(__file__))
- print "This module is required."
- raise SystemExit
+ print "Could not find 'get_build_path.py' "
+ print "in '%s'" % os.path.dirname(os.path.abspath(__file__))
+ print "This module is required."
+ raise SystemExit
## Move to directory containing CMakeLists.txt and src/
build_path = get_build_path()
if build_path:
- os.chdir(build_path)
+ os.chdir(build_path)
else:
- print "The script was unable to find a build directory."
- raise SystemExit
+ print "The script was unable to find a build directory."
+ raise SystemExit
makeargs = "-j8"
cmakecall = ["cmake", ".."]
@@ -47,22 +47,31 @@
parser = OptionParser(usage=usage)
parser.set_defaults(verbose=False, makeargs="-j8")
parser.add_option("-v", "--verbose",
- action="store_true", dest="verbose",
- help="Verbose mode")
+ action="store_true", dest="verbose",
+ help="Verbose mode")
+parser.add_option("-c", "--cmake",
+ action="store", dest="cm",
+ help="Specify one or more arguments for CMake")
#parser.add_option("--makeargs",
# action="store", type="string", dest="makeargs",
# help="Argument to `make` [default '-j8']")
-#parser.add_option("--cmakeargs",
-# action="store", type="string", dest="cmakeargs",
-# help="Arguments to `cmake ..`")
(options, args) = parser.parse_args()
if options.verbose:
os.environ['VERBOSE'] = "1"
+### Split cmakeargs, reassemble, and insert into cmake call
+if options.cm:
+ cm_raw = options.cm
+ cm_list = cm_raw.split("-D")
+ if cm_list[0] == "":
+ cm_list.pop(0)
+ for cm in cm_list:
+ cm = cm.lstrip()
+ cmakearg = "-D" + cm
+ cmakecall.insert(1, cmakearg)
#if options.makeargs:
# makeargs = options.makeargs
-
def install_build(cmakecall, exitVal=True):
if not os.path.isdir(build_dir):
os.mkdir(build_dir)
@@ -71,29 +80,29 @@ def install_build(cmakecall, exitVal=True):
subprocess.check_call(["make", makeargs])
if exitVal == True:
raise SystemExit
-
+
def dev_build():
- cmakecall.insert(1, "-DDEV_MODE::bool=TRUE")
- install_build(cmakecall)
+ cmakecall.insert(1, "-DDEV_MODE::bool=TRUE")
+ install_build(cmakecall)
def grab_deps():
- if 'linux' in sys.platform:
- try:
- subprocess.check_call('sudo apt-get install cmake', shell=True)
- except:
- print "Error installing dependencies: ", sys.exc_info()[0]
- print "apt-get is available on Debian and Ubuntu"
- raise SystemExit
- elif 'darwin' in sys.platform:
- try:
- subprocess.check_call('sudo port install cmake', shell=True)
- except:
- print "Error installing dependencies: ", sys.exc_info()[0]
- print "Please install Macports (http://www.macports.org)"
- raise SystemExit
- else:
- print "Platform not recognized (did not match linux or darwin)"
- print "Script doesn't download dependencies for this platform"
+ if 'linux' in sys.platform:
+ try:
+ subprocess.check_call('sudo apt-get install cmake', shell=True)
+ except:
+ print "Error installing dependencies: ", sys.exc_info()[0]
+ print "apt-get is available on Debian and Ubuntu"
+ raise SystemExit
+ elif 'darwin' in sys.platform:
+ try:
+ subprocess.check_call('sudo port install cmake', shell=True)
+ except:
+ print "Error installing dependencies: ", sys.exc_info()[0]
+ print "Please install Macports (http://www.macports.org)"
+ raise SystemExit
+ else:
+ print "Platform not recognized (did not match linux or darwin)"
+ print "Script doesn't download dependencies for this platform"
raise SystemExit
def package_source():
@@ -116,41 +125,41 @@ def remake():
raise SystemExit
def clean():
- if 'posix' in os.name:
- print "Cleaning '%s' with rm -rf" % build_dir
- subprocess.check_call(["rm", "-rf", build_dir])
- else:
- print "Cleaning '%s' with shutil.rmtree()" % build_dir
- print "(may be very slow)"
- shutil.rmtree(build_dir, ignore_errors=True)
- print "Build cleaned"
+ if 'posix' in os.name:
+ print "Cleaning '%s' with rm -rf" % build_dir
+ subprocess.check_call(["rm", "-rf", build_dir])
+ else:
+ print "Cleaning '%s' with shutil.rmtree()" % build_dir
+ print "(may be very slow)"
+ shutil.rmtree(build_dir, ignore_errors=True)
+ print "Build cleaned"
# requires PROFILE definition in CMakeLists.txt:
# set(CMAKE_BUILD_TYPE PROFILE)
# set(CMAKE_CXX_FLAGS_PROFILE "-g -pg")
# set(CMAKE_C_FLAGS_PROFILE "-g -pg")
def profile():
- cmakecall.insert(1, "-DDEV_MODE::bool=TRUE")
- cmakecall.insert(2, "-DBUILD_TYPE=PROFILE")
- install_build(cmakecall)
-
+ cmakecall.insert(1, "-DDEV_MODE::bool=TRUE")
+ cmakecall.insert(2, "-DBUILD_TYPE=PROFILE")
+ install_build(cmakecall)
+
def menu():
- print "1. developer build: used for development."
- print "2. install build: used for building before final installation to the system."
- print "3. grab dependencies: installs all the required packages for debian based systems (ubuntu maverick/ debian squeeze,lenny) or darwin with macports."
- print "4. package source: creates a source package for distribution."
- print "5. package: creates binary packages for distribution."
- print "6. remake: calls make again after project has been configured as install or in source build."
- print "7. clean: removes the build directory."
- print "8. profile: compiles for gprof."
- print "9. end."
- opt = raw_input("Please choose an option: ")
- return opt
+ print "1. developer build: used for development."
+ print "2. install build: used for building before final installation to the system."
+ print "3. grab dependencies: installs all the required packages for debian based systems (ubuntu maverick/ debian squeeze,lenny) or darwin with macports."
+ print "4. package source: creates a source package for distribution."
+ print "5. package: creates binary packages for distribution."
+ print "6. remake: calls make again after project has been configured as install or in source build."
+ print "7. clean: removes the build directory."
+ print "8. profile: compiles for gprof."
+ print "9. end."
+ opt = raw_input("Please choose an option: ")
+ return opt
try:
loop_num = 0
# continues until a function raises system exit or ^C
- while (1):
+ while (1):
if len(args) == 1 and loop_num == 0:
opt = args[0]
loop_num += 1
@@ -191,6 +200,6 @@ def menu():
raise SystemExit
else:
print "Invalid option. Please try again: "
-
+
except KeyboardInterrupt:
- print "\n"
+ print "\n"
View
94 cmake/arkcmake/get_build_path.py
@@ -13,50 +13,50 @@
def get_build_path():
- build_dir=""
-
- ## Initialize search paths
- call_dir = os.getcwd()
- script_dir = os.path.dirname(os.path.abspath(__file__))
- script_mom = os.path.abspath(script_dir + os.sep + os.pardir)
- script_grandma = os.path.abspath(script_mom + os.sep + os.pardir)
- if script_mom == call_dir:
- script_mom = ""
- if script_grandma == call_dir:
- script_grandma = ""
-
- ## Define function to search for required components for build
- def find_build_dir(search_dir):
- BUILDFILE = "CMakeLists.txt"
- SRCDIR = "src"
- os.chdir(search_dir)
- if os.path.isfile(BUILDFILE) and os.path.isdir(SRCDIR):
- return search_dir
- return False
-
- ## Class to emulate if temp = x
- # (checking equality of x while assigning it to temp)
- # Borrowed from Alex Martelli
- class Holder(object):
- def set(self, value):
- self.value = value
- return value
- def get(self):
- return self.value
-
- temp = Holder()
-
- ## Search paths for build components
- if temp.set(find_build_dir(call_dir)):
- build_dir = temp.get()
- elif temp.set(find_build_dir(script_dir)):
- build_dir = temp.get()
- elif script_mom and temp.set(find_build_dir(script_mom)):
- build_dir = temp.get()
- elif script_grandma and temp.set(find_build_dir(script_grandma)):
- build_dir = temp.get()
- else:
- return 0
-
- print "I go now. Good luck, everybody!"
- return build_dir
+ build_dir=""
+
+ ## Initialize search paths
+ call_dir = os.getcwd()
+ script_dir = os.path.dirname(os.path.abspath(__file__))
+ script_mom = os.path.abspath(script_dir + os.sep + os.pardir)
+ script_grandma = os.path.abspath(script_mom + os.sep + os.pardir)
+ if script_mom == call_dir:
+ script_mom = ""
+ if script_grandma == call_dir:
+ script_grandma = ""
+
+ ## Define function to search for required components for build
+ def find_build_dir(search_dir):
+ BUILDFILE = "CMakeLists.txt"
+ #SRCDIR = "src"
+ os.chdir(search_dir)
+ if os.path.isfile(BUILDFILE):
+ return search_dir
+ return False
+
+ ## Class to emulate if temp = x
+ # (checking equality of x while assigning it to temp)
+ # Borrowed from Alex Martelli
+ class Holder(object):
+ def set(self, value):
+ self.value = value
+ return value
+ def get(self):
+ return self.value
+
+ temp = Holder()
+
+ ## Search paths for build components
+ if temp.set(find_build_dir(call_dir)):
+ build_dir = temp.get()
+ elif temp.set(find_build_dir(script_dir)):
+ build_dir = temp.get()
+ elif script_mom and temp.set(find_build_dir(script_mom)):
+ build_dir = temp.get()
+ elif script_grandma and temp.set(find_build_dir(script_grandma)):
+ build_dir = temp.get()
+ else:
+ return 0
+
+ #print "I go now. Good luck, everybody!"
+ return build_dir
View
78 cmake/email_status.py
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-# Author: Lenna X. Peterson (github.com/lennax)
-#
-# This script waits while a program runs, then emails exit status and runtime.
-# Requires 'send_gmail.py'
-# USAGE:
-# It is designed to prefix a normal argument:
-# $ rm -f => $ ./script.py rm -f
-# The script's options do not conflict with the called program's options:
-# $ rm -f => $ ./script.py -f you@gmail.com rm -f
-# But quoting is acceptable as well:
-# $ ./script.py "rm -rf"
-#
-# Then enter password and wait until you see "Running ..."
-
-import optparse # for parsing options
-import subprocess # for calling program
-import datetime # for timing program
-import getpass # for getting password
-try:
- import send_gmail # my module for sending
-except ImportError:
- print "Could not find 'send_gmail.py'"
- print "This module is required."
- raise SystemExit
-
-## Define defaults ##
-SENDER = "arktools.github@gmail.com"
-RECIPIENT = "arktools.github@gmail.com"
-
-## Option parsing ##
-usage = "usage: %prog [options] program_to_run [program options]"
-parser = optparse.OptionParser(usage=usage)
-parser.disable_interspersed_args()
-parser.set_defaults(sender=SENDER, recipient=RECIPIENT)
-descript = optparse.OptionGroup(parser, "Description", """This script waits while a program runs, then emails the exit status and runtime.""")
-parser.add_option_group(descript)
-parser.add_option("-f", "--from", dest="sender",
- help="""Email to send from (must be a gmail address/alias, must know password, default %s)""" % SENDER)
-parser.add_option("-t", "--to", dest="recipient",
- help="""Email to send to (default %s""" % RECIPIENT)
-(options, args) = parser.parse_args()
-if len(args) == 0:
- parser.print_usage()
- print "A program must be specified"
- raise SystemExit
-elif len(args) == 1 and " " in args[0]:
- script = args[0].split(" ")
-else:
- script = args
-if "@" not in options.sender:
- options.sender += "@gmail.com"
-if "@" not in options.recipient:
- options.recipient += "@gmail.com"
- print "Specified To: address did not include '@'"
- print "Trying %s@gmail.com" % options.recipient
-
-## Verify credentials BEFORE running (long) process
-pw = getpass.getpass("Enter password for '%s': " % options.sender)
-server = send_gmail.connect_gmail()
-send_gmail.authenticate(server, options.sender, pw, close=True)
-
-## Notify process exit status by email ##
-def status_email(script, sender, recipient):
- start = datetime.datetime.now()
- script_str = " ".join(script)
- print "Running '%s'..." % script_str
- status = subprocess.check_call(script)
- runtime = str(datetime.datetime.now() - start)
- message = "'%s' exited with status %s after %s" % (script_str, status, runtime)
- if status == 0:
- message = "Good news! " + message
- subject = "'%s' finished" % script_str
- print message
- print "Preparing to send mail"
- send_gmail.send_gmail(sender, pw, recipient, subject, message)
-
-status_email(script, options.sender, options.recipient)
View
55 cmake/send_gmail.py
@@ -1,55 +0,0 @@
-#!/usr/bin/python
-# Author: Lenna X. Peterson (github.com/lennax)
-
-import smtplib # for sending email
-from email.mime.text import MIMEText # for formatting message
-import getpass # for getting password
-
-## Connect to server ##
-def connect_gmail():
- server = smtplib.SMTP('smtp.gmail.com', 587)
- server.ehlo()
- server.starttls()
- server.ehlo()
- return server
-
-## Check login credentials ##
-def authenticate(server, sender, password, close=False):
- if password == "":
- password = getpass.getpass("Enter password for '%s': " % sender)
- if close:
- print "Checking authentication"
- not_auth = True
- while (not_auth):
- try:
- server.login(sender,password)
- except smtplib.SMTPAuthenticationError:
- print "Authentification failed, try again: "
- if sender != "arktools.github@gmail.com":
- sender = raw_input("Enter Gmail username: ")
- if "@" not in sender:
- sender += "@gmail.com"
- password = getpass.getpass("Enter password for '%s': " % sender)
- continue
- not_auth = False
- print "Logged in"
- if close:
- server.close()
- print "Closed connection"
-
-## Send via gmail ##
-# To call without specifying password, use ""
-def send_gmail(sender, password, recipient, subject, message):
- msg = MIMEText(message)
- if password == "":
- password = getpass.getpass("Enter password for '%s': " % sender)
- msg['Subject'] = subject
- msg['From'] = sender
- msg['To'] = recipient
- print "Connecting to server"
- server = connect_gmail()
- print "Logging in"
- authenticate(server, sender, password)
- server.sendmail(sender, [recipient], msg.as_string())
- server.close()
- print "Sent mail"
View
37 cmake/uninstall_mac.py
@@ -1,37 +0,0 @@
-#!/usr/bin/python
-
-import subprocess # for check_call()
-
-installed = [
- "/usr/local/include/JSBSim",
- "/usr/local/include/arkcomm",
- "/usr/local/include/arkmath",
- "/usr/local/include/arkosg",
- "/usr/local/include/arkscicos",
- "/usr/local/lib/arkcomm",
- "/usr/local/lib/arkmath",
- "/usr/local/lib/arkosg",
- "/usr/local/lib/libJSBSim.a",
- "/usr/local/lib/libJSBSim.la",
- "/usr/local/lib/libarkcomm.a",
- "/usr/local/lib/libarkmath.a",
- "/usr/local/lib/libarkosg.a",
- "/usr/local/lib/libarkscicos.0.0.0.so",
- "/usr/local/lib/libarkscicos.so",
- "/usr/local/lib/pkgconfig/arkcomm.pc",
- "/usr/local/lib/pkgconfig/arkmath.pc",
- "/usr/local/lib/pkgconfig/arkosg.pc",
- "/usr/local/lib/pkgconfig/arkscicos.pc",
- "/usr/local/lib/pkgconfig/jsbsim.pc",
- "/usr/local/share/arkmath",
- "/usr/local/share/arkosg",
- "/usr/local/share/jsbsim",
- "/Applications/ScicosLabGtk.app/Contents/Resources/scicoslab-gtk-4.4.1/contrib/arkscicos-toolbox",
-]
-
-print "Removing arkscicos..."
-for path in installed:
- subprocess.check_call(["sudo", "rm", "-rf", path])
- print "Removed '%s'" % path
-print "Finished removing arkscicos."
-exit(0)

0 comments on commit fbf7362

Please sign in to comment.