Skip to content

Commit

Permalink
Merge pull request #351 from fawkesrobotics/common/cmake
Browse files Browse the repository at this point in the history
switch to cmake as buildsys
  • Loading branch information
TarikViehmann committed Jun 3, 2023
2 parents 36c6e61 + 2795f21 commit acee75f
Show file tree
Hide file tree
Showing 882 changed files with 7,511 additions and 319 deletions.
12 changes: 11 additions & 1 deletion .buildkite/build
Expand Up @@ -28,4 +28,14 @@ source $SCRIPT_PATH/environment.sh
set -euo pipefail

# Build software
$MAKE -j$NPROC all gui BUILDSTATS=1
mkdir build; cd build
cmake ..
echo "-> Running 'make doxygen' to check for warnings"
$MAKE -j$NPROC doxygen
if [ -s doxywarnings.txt ]; then
cat doxywarnings.txt
exit 1
else
echo "No warnings, good job!"
fi
$MAKE -j$NPROC BUILDSTATS=1
4 changes: 2 additions & 2 deletions .buildkite/lint
Expand Up @@ -312,5 +312,5 @@ check_gitlint
echo "-> Running yamllint on configuration files"
check_yamllint

echo "-> Running 'make check'"
gmake check YAMLLINT=0 HIDE_FORMAT_PROGRESS=1
echo "-> Running licensecheck"
./etc/licscripts/check_license.bash
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Expand Up @@ -6,7 +6,7 @@ merged-pr-plugin: &merged-pr-plugin
mode: checkout

podman-plugin-base: &podman-plugin-base
image: quay.io/fawkesrobotics/fawkes-builder:f36
image: quay.io/fawkesrobotics/fawkes-builder:f37
always-pull: true
debug: true
privileged: true
Expand Down
1 change: 1 addition & 0 deletions .buildkite/test
Expand Up @@ -27,6 +27,7 @@ source $SCRIPT_PATH/environment.sh
# Error out on any error in the script, pipes etc.
set -euo pipefail

cd build
# Run tests
$MAKE -j$NPROC test
$MAKE integration-test
52 changes: 52 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,52 @@
# *****************************************************************************
# CMake Build System for Fawkes
# -------------------
# Copyright (C) 2023 by Tarik Viehmann and Daniel Swoboda
#
# *****************************************************************************
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# *****************************************************************************

if(NOT FAWKES_DIR)
cmake_minimum_required(VERSION 3.5)
project(fawkes)
set(_FAWKES_DEPENDENCIES_CHECKED
""
CACHE INTERNAL "")
# make local cmake modules available
set(FAWKES_CORE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${FAWKES_CORE_DIR}/cmake")
include(base)
endif()

add_subdirectory(src)
if(NOT FAWKES_DIR)
set_common_properties_of_targets(all_targets)
endif()
# add_subdirectory(src/libs) add_subdirectory(src/plugins)
# add_subdirectory(src/mainapp) add_subdirectory(src/tools)
# if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# add_compile_options(-Wall -Wextra -Wpedantic) endif()
#
# collect the files for subdir1 include(src/libs//CMakeLists.txt) foreach(FILE
# ${FILES}) set(subdir1Files ${subdir1Files} subdir1/${FILE}) endforeach()
#
# collect the files for subdir2 include(subdir2/CMakeLists.txt) foreach(FILE
# ${FILES}) set(subdir2Files ${subdir2Files} subdir2/${FILE}) endforeach()
#
# add the source files to the executable add_executable(fawkes)
#
# ${subdir1Files} ${subdir2Files
2 changes: 1 addition & 1 deletion cfg/conf.d/meta_plugins.yaml
Expand Up @@ -22,7 +22,7 @@ fawkes/meta_plugins:
- mongodb
- clips
- robot-memory
- clips_robot_memory
- clips-robot-memory
- pddl-robot-memory
- pddl-planner
- clips-pddl-parser
Expand Down
89 changes: 89 additions & 0 deletions cmake/base.cmake
@@ -0,0 +1,89 @@
# *****************************************************************************
# CMake Build System for Fawkes
# -------------------
# Copyright (C) 2023 by Tarik Viehmann and Daniel Swoboda
#
# *****************************************************************************
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# *****************************************************************************

include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)

# make local cmake modules available
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${FAWKES_CORE_DIR}/cmake")
set(CMAKE_BUILD_TYPE "Debug")

# TODO: .ts generation of rest-api plugins (see old Makefiles in rest-api dirs)
# This is not urgent, as the generated stuff is already in git this was handled
# through rest-api.mk add_custom_target(restapi-generate echo
# "generate-restapi") set(WEBVIEW_FRONTEND_SRCDIR
# ${PROJECT_SOURCE_DIR}/src/plugins/webview/frontend/src)

set(FAWKES_PLUGIN_DIR ${PROJECT_SOURCE_DIR}/plugins/)
set(FAWKES_LIB_DIR ${PROJECT_SOURCE_DIR}/lib)
set(FAWKES_RES_DIR ${FAWKES_CORE_DIR}/res)
set(FAWKES_LUA_LIB_DIR ${FAWKES_LIB_DIR}/lua)
set(FAWKES_INTERFACE_DIR ${FAWKES_LIB_DIR}/interfaces/)
set(FAWKES_LUA_INTERFACE_DIR ${FAWKES_LUA_LIB_DIR}/interfaces/)
set(FAWKES_EXECUTABLE_DIR ${PROJECT_SOURCE_DIR}/bin)
file(MAKE_DIRECTORY ${FAWKES_PLUGIN_DIR})
file(MAKE_DIRECTORY ${FAWKES_RES_DIR})
file(MAKE_DIRECTORY ${FAWKES_LIB_DIR})

file(MAKE_DIRECTORY ${FAWKES_LUA_LIB_DIR})
file(MAKE_DIRECTORY ${FAWKES_LUA_INTERFACE_DIR})
file(MAKE_DIRECTORY ${FAWKES_EXECUTABLE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${FAWKES_EXECUTABLE_DIR})
include_directories(${FAWKES_LIB_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${FAWKES_LIB_DIR})
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(
STATUS
"Setting build type to '${default_build_type}' as none was specified.")
set(CMAKE_BUILD_TYPE
"${default_build_type}"
CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
"MinSizeRel" "RelWithDebInfo")

endif()

set(CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE TRUE)
include(utils)
include(dependencies)
include(libcrypto)
include(libxmlpp)
include(laser)
include(ros)
include(lua)
include(yamlcpp)
include(eigen3)
include(pcl)
include(tf)
include(gui)
include(navgraph)
include(cgal_libs)
include(webview)
include(fvconf)
include(kdl_parser)
include(clipsmm)
include(protobuf)
include(robot_memory)
include(doxygen)
include(tests)
include(integration_test)
44 changes: 44 additions & 0 deletions cmake/cgal_libs.cmake
@@ -0,0 +1,44 @@
# *****************************************************************************
# CMake Build System for Fawkes
# -------------------
# Copyright (C) 2023 by Tarik Viehmann and Daniel Swoboda
#
# *****************************************************************************
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# *****************************************************************************

function(depend_on_cgal_libs target)
if(NOT CGAL IN_LIST _FAWKES_DEPENDENCIES_CHECKED)
find_package(CGAL)
remember_dependency(CGAL)
endif()

depend_on_pkgconfig_libs(${target} "gmp;mpfr")
depend_on_boost_libs(${target} "system;thread")
target_include_directories(${target} PUBLIC ${Boost_INCLUDE_DIR})
target_link_libraries(${target} ${CGAL_LDLAGS} ${GMP_LDFLAGS} ${MPFR_LDFLAGS}
-lm)
target_compile_options(
${target}
PUBLIC ${CGAL_LDLAGS}
${GMP_LDFLAGS}
${MPFR_LDFLAGS}
-DHAVE_CGAL
-Wno-depcrecated-register
-DCGAL_DISABLE_ROUNDING_MATH_CHECK
-frounding-math)
# TODO: clang flags: -Wno-unused-local-typedef
endfunction()
28 changes: 28 additions & 0 deletions cmake/clipsmm.cmake
@@ -0,0 +1,28 @@
# *****************************************************************************
# CMake Build System for Fawkes
# -------------------
# Copyright (C) 2023 by Tarik Viehmann and Daniel Swoboda
#
# *****************************************************************************
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# *****************************************************************************

function(depend_on_clipsmm target)
depend_on_pkgconfig_libs(${target} clipsmm-1.0)
target_compile_options(${target} PUBLIC -DHAVE_CLIPS ${CLIPSMM_CFLAGS})
target_link_libraries(${target} ${CLIPSMM_LDFLAGS})
target_compile_features(${target} PUBLIC cxx_std_14)
endfunction()
66 changes: 66 additions & 0 deletions cmake/dependencies.cmake
@@ -0,0 +1,66 @@
# *****************************************************************************
# CMake Build System for Fawkes
# -------------------
# Copyright (C) 2023 by Tarik Viehmann and Daniel Swoboda
#
# *****************************************************************************
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# *****************************************************************************

pkg_check_modules(yaml-cpp REQUIRED yaml-cpp>=0.5.3)
remember_dependency(yaml-cpp)

pkg_check_modules(libelf REQUIRED libelf)
remember_dependency(libelf)

find_package(Boost COMPONENTS system thread filesystem)
if(Boost_SYSTEM_FOUND AND Boost_THREAD_FOUND)
set(SICK_TIM55X_BOOST_DEPS_FOUND
1
CACHE BOOL "SICK_TIM55x boost dependencies")
add_library(sick_tim55x INTERFACE IMPORTED)
target_include_directories(sick_tim55x INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(sick_tim55x INTERFACE -lpthread ${Boost_LIBRARIES})
target_compile_definitions(sick_tim55x INTERFACE HAVE_SICK55X_BOOST)
# target_compile_definitions do not work with imported targets
endif()

find_path(URG_ROOT urg/UrgCtrl.h PATH_SUFFIXES include)
if(URG_ROOT)
add_library(liburg INTERFACE IMPORTED)
target_include_directories(liburg INTERFACE ${URG_ROOT})
target_link_directories(liburg INTERFACE ${URG_ROOT}/lib)
target_link_libraries(
liburg
INTERFACE urg
urg_connection
urg_monitor
urg_coordinate
urg_geometry
urg_system
urg_common
urg_connection_sdl)
set(URG_C_DEFINITION HAVE_URG)
endif()

find_path(FLITE_ROOT flite/flite.h PATH_SUFFIXES include)
if(FLITE_ROOT)
add_library(FLite INTERFACE IMPORTED)
target_include_directories(FLite INTERFACE ${FLITE_ROOT})
target_link_directories(FLite INTERFACE ${FLITE_ROOT}/lib)
target_link_libraries(FLite INTERFACE -lflite_cmu_us_kal -lflite_usenglish
-lflite_cmulex -lflite -lm)
endif()
8 changes: 8 additions & 0 deletions cmake/doxygen.cmake
@@ -0,0 +1,8 @@
find_package(Doxygen)
set(DOXYGEN_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/doc/api/)
set(DOXYGEN_WARN_LOGFILE doxywarnings.txt)
set(DOXYGEN_HAVE_DOT NO)
set(DOXYGEN_EXCLUDE_PATTERNS
"${FAWKES_CORE_DIR}/src/plugins/webview/frontend;**/*.pb.*;\
**/*Interface.*;**/*.py;**/attic/*;")
doxygen_add_docs(doxygen ${PROJECT_SOURCE_DIR} COMMENT "Generate man pages")
37 changes: 37 additions & 0 deletions cmake/eigen3.cmake
@@ -0,0 +1,37 @@
# *****************************************************************************
# CMake Build System for Fawkes
# -------------------
# Copyright (C) 2023 by Tarik Viehmann and Daniel Swoboda
#
# *****************************************************************************
#
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
#
# *****************************************************************************

set(EIGEN3_DEPS "eigen3")

function(depend_on_eigen3 target)
depend_on_pkgconfig_libs(${target} eigen3)
target_compile_options(
${target} PUBLIC -DHAVE_EIGEN3 -DEIGEN_USE_NEW_STDVECTOR
-DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET)
target_link_libraries(${target} tolua++)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(${target} PRIVATE -Wno-deprecated-register)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${target} PRIVATE -Wno-deprecated-declarations)
endif()
endfunction()

0 comments on commit acee75f

Please sign in to comment.