owlps/owlps-positioner/CMakeLists.txt

158 lines
4.7 KiB
CMake

# This file is part of the Owl Positioning System (OwlPS) project.
# It is subject to the copyright notice and license terms in the
# COPYRIGHT.t2t file found in the top-level directory of this
# distribution and at
# http://code.lm7.fr/p/owlps/source/tree/master/COPYRIGHT.t2t
# No part of the OwlPS Project, including this file, may be copied,
# modified, propagated, or distributed except according to the terms
# contained in the COPYRIGHT.t2t file; the COPYRIGHT.t2t file must be
# distributed along with this file, either separately or by replacing
# this notice by the COPYRIGHT.t2t file's contents.
# Make sure boost libraries are installed
find_package(Boost 1.42.0 COMPONENTS program_options)
if (NOT Boost_FOUND)
message(WARNING
"OwlPS Positioner dependency missing: Boost")
return()
endif()
include_directories(${Boost_INCLUDE_DIRS})
set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} m)
# On Linux and other GNU systems (e.g. GNU/kFreeBSD), we need -lrt for
# clock_gettime()
string(REGEX MATCH "^GNU" GNU_SYSTEM ${CMAKE_SYSTEM_NAME})
if ("${GNU_SYSTEM}" OR ${CMAKE_SYSTEM_NAME} STREQUAL Linux)
set(EXTRA_LIBS ${EXTRA_LIBS} rt)
endif()
# Enable C++11
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(OWLPS_POSITIONER_SRC_FILES
src/accesspoint.cc
src/accesspointsreadercsv.cc
src/area.cc
src/autocalibration.cc
src/building.cc
src/calibrationrequest.cc
src/cartographyalgorithm.cc
src/configuration.cc
src/csvfilereader.cc
src/csvstringreader.cc
src/direction.cc
src/fbcm.cc
src/frbhmbasic.cc
src/input.cc
src/inputcsv.cc
src/inputdatareader.cc
src/inputlogcsv.cc
src/inputmedium.cc
src/inputudpsocket.cc
src/interlinknetworks.cc
src/measurement.cc
src/minmax.cc
src/mobile.cc
src/mobilesreadercsv.cc
src/nss.cc
src/output.cc
src/outputcsv.cc
src/outputnetworksocket.cc
src/outputtcpsocketevaal.cc
src/outputterminal.cc
src/outputudpsocket.cc
src/owlps-positionerd.cc
src/point3d.cc
src/posexcept.cc
src/positioning.cc
src/posutil.cc
src/realposition.cc
src/referencepoint.cc
src/request.cc
src/result.cc
src/resultlist.cc
src/stock.cc
src/textfilereader.cc
src/textfilewriter.cc
src/timestamp.cc
src/topologyreadercsv.cc
src/trilaterationalgorithm.cc
src/userinterface.cc
src/waypoint.cc
src/wifidevice.cc
)
add_executable(owlps-positionerd
${OWLPS_POSITIONER_SRC_FILES})
target_link_libraries(owlps-positionerd
libowlps.so
${EXTRA_LIBS})
install(
TARGETS owlps-positionerd
DESTINATION bin)
add_executable(owlps-positionerd.semistatic EXCLUDE_FROM_ALL
${OWLPS_POSITIONER_SRC_FILES})
target_link_libraries(owlps-positionerd.semistatic
libowlps.a
${EXTRA_LIBS})
# Add the semistatic target to the global list of semistatic targets
list(APPEND OWLPS_SEMISTATIC_TARGETS owlps-positionerd.semistatic)
set(OWLPS_SEMISTATIC_TARGETS ${OWLPS_SEMISTATIC_TARGETS} PARENT_SCOPE)
add_executable(owlps-positionerd.static EXCLUDE_FROM_ALL
${OWLPS_POSITIONER_SRC_FILES})
set_target_properties(owlps-positionerd.static
PROPERTIES LINK_FLAGS -static)
target_link_libraries(owlps-positionerd.static
libowlps.a
${EXTRA_LIBS})
# Add the static target to the global list of static targets
list(APPEND OWLPS_STATIC_TARGETS owlps-positionerd.static)
set(OWLPS_STATIC_TARGETS ${OWLPS_STATIC_TARGETS} PARENT_SCOPE)
# Add compile flags for the above targets
set_target_properties(
owlps-positionerd
owlps-positionerd.semistatic
owlps-positionerd.static
PROPERTIES COMPILE_FLAGS ${EXE_FLAGS})
### Extra targets ###
# Indentation
set(INDENTER astyle --style=gnu --indent=spaces=2 --formatted --recursive)
add_custom_target(indent_positioner
${INDENTER} src/*.cc src/*.hh
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Reindenting source files"
VERBATIM)
# cppcheck
set(CODE_CHECKER cppcheck --quiet --enable=all)
add_custom_target(check_positioner
${CODE_CHECKER} src/*.hh src/*.cc
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Checking source code")
# Documentation
if (DOXYGEN_FOUND)
if (NOT DOXYGEN_DOT_FOUND)
message(WARNING
"Couldn't find Graphviz: you should install it if you want to generate diagrams in the OwlPS Positioner's HTML documentation")
endif()
set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doc")
set(DOXYGEN
DOXYGEN_OUTPUT_DIRECTORY=${DOXYGEN_OUTPUT_DIRECTORY} OWLPS_VERSION=${OWLPS_VERSION} "${DOXYGEN_EXECUTABLE}")
set(DOXYFILE Doxyfile)
add_custom_target(doc_positioner
${DOXYGEN} ${DOXYFILE}
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
COMMENT "Generating Doxygen documentation for OwlPS Positioner in \"${DOXYGEN_OUTPUT_DIRECTORY}\"")
else()
message(WARNING
"Couldn't find Doxygen: disabling OwlPS Positioner's documentation target")
endif()