From 875e857bc504ab4c2e83325b3d5d9be9fd263524 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 20:15:29 +0100 Subject: [PATCH 01/26] Use vcpkg to resolve all packages. Also did some more cleanup to the cmake setup. Removed all custom build and find scripts in favor of vcpkg. Cleaned up cmake presets. --- .gitignore | 6 +- CMakeLists.txt | 109 +++------------------ CMakePresets.json | 123 +++++++++++++++--------- clients/qt/CMakeLists.txt | 19 +--- cmake/Utils.cmake | 22 ----- cmake/modules/BuildODE.cmake | 34 ------- cmake/modules/BuildProtobuf.cmake | 87 ----------------- cmake/modules/EnvHelper.cmake | 31 ------ cmake/modules/FindODE.cmake | 62 ------------ cmake/modules/FindOrBuildProtobuf.cmake | 11 --- cmake/modules/FindVarTypes.cmake | 37 ------- ports/vartypes/portfile.cmake | 17 ++++ ports/vartypes/vcpkg.json | 17 ++++ vcpkg-configuration.json | 6 ++ vcpkg.json | 6 +- 15 files changed, 140 insertions(+), 447 deletions(-) delete mode 100644 cmake/Utils.cmake delete mode 100644 cmake/modules/BuildODE.cmake delete mode 100644 cmake/modules/BuildProtobuf.cmake delete mode 100644 cmake/modules/EnvHelper.cmake delete mode 100644 cmake/modules/FindODE.cmake delete mode 100644 cmake/modules/FindOrBuildProtobuf.cmake delete mode 100644 cmake/modules/FindVarTypes.cmake create mode 100644 ports/vartypes/portfile.cmake create mode 100644 ports/vartypes/vcpkg.json create mode 100644 vcpkg-configuration.json diff --git a/.gitignore b/.gitignore index 2f15451b..f9c87035 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,7 @@ .DS_STORE -build*/* -dist/* -bin*/* *.user *.swp Thumbs.db .idea/* *.iml -cmake-build-debug -cmake-build-release +out diff --git a/CMakeLists.txt b/CMakeLists.txt index f9ffc9e6..32b8ec48 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,4 @@ -cmake_minimum_required(VERSION 3.5) - +cmake_minimum_required(VERSION 3.25) ## Project branding, version and package mantainer project(grSim) @@ -7,13 +6,11 @@ set(VERSION "1.0.0a2") #set(VENDOR "Parsian") set(MAINTAINER "Mani Monajjemi ") - # some utils and helper vars string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_LOWER) -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) -include(${PROJECT_SOURCE_DIR}/cmake/Utils.cmake) -standard_config() -standard_paths(${PROJECT_SOURCE_DIR} bin lib) + +set(CMAKE_AUTOMOC YES) +set(CMAKE_INCLUDE_CURRENT_DIR YES) # policy regarding how to handle generated stuff, OLD behavior would ignore generated files # (which includes the generated protobuf cpp files) @@ -21,18 +18,6 @@ if (POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() -# policy regarding when to rebuild stuff when external projects downloaded with URL changes -if (POLICY CMP0135) - cmake_policy(SET CMP0135 NEW) -endif() - -include(GNUInstallDirs) - -set(app ${CMAKE_PROJECT_NAME}) -# create the target before the sources list is known so that we can call -# add_dependencies( external_proj) -add_executable(${app} "") - # definitions for knowing the OS from the code if(MSVC) add_definitions(-DHAVE_MSVC) @@ -51,14 +36,14 @@ if(UNIX) endif() # set explicitly the c++ standard to use -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) # add src dir to included directories include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(${PROJECT_SOURCE_DIR}/include/net) include_directories(${PROJECT_SOURCE_DIR}/include/physics) - ## Handling depenendcies # we will append all libs to this var @@ -66,90 +51,25 @@ set(libs) # OpenGL find_package(OpenGL REQUIRED) -include_directories(${OPENGL_INCLUDE_DIR}) -list(APPEND libs ${OPENGL_LIBRARIES}) +list(APPEND libs OpenGL::GL) #find_package(GLUT REQUIRED) #include_directories(${GLUT_INCLUDE_DIR}) # Qt -if(APPLE AND EXISTS /usr/local/opt/qt) - # Homebrew installs Qt5 (up to at least 5.9.1) in - # /usr/local/qt5, ensure it can be found by CMake since - # it is not in the default /usr/local prefix. - list(APPEND CMAKE_PREFIX_PATH "/usr/local/opt/qt") -endif() find_package(Qt5 COMPONENTS Core Widgets OpenGL Network REQUIRED) list(APPEND libs Qt5::Core Qt5::Widgets Qt5::OpenGL Qt5::Network) # ODE -if(BUILD_ODE) - include(BuildODE) - add_dependencies(${app} ode_external) -else() - if(WIN32) - find_package(ODE CONFIG) - set(ODE_LIB_NAME ODE::ODE) - else() - find_package(ODE) - set(ODE_LIB_NAME ode::ode) - endif() - - if(ODE_FOUND) - list(APPEND libs ${ODE_LIB_NAME}) - else() - # if ODE could not be found just build it - include(BuildODE) - add_dependencies(${app} ode_external) - endif() -endif() +find_package(ode CONFIG REQUIRED) +list(APPEND libs ODE::ODE) # VarTypes -find_package(VarTypes) - -if(NOT VARTYPES_FOUND) - include(ExternalProject) - - set(VARTYPES_CMAKE_ARGS "-DVARTYPES_BUILD_STATIC=ON;-DCMAKE_INSTALL_PREFIX=") - if(NOT "${CMAKE_TOOLCHAIN_FILE}" STREQUAL "") - set(VARTYPES_CMAKE_ARGS "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE};${VARTYPES_CMAKE_ARGS}") - endif() - - ExternalProject_Add(vartypes_external - GIT_REPOSITORY https://github.com/jpfeltracco/vartypes - GIT_TAG origin/jpfeltracco/build_static - CMAKE_ARGS "${VARTYPES_CMAKE_ARGS}" - STEP_TARGETS install - ) - set(VARTYPES_LIB_SUBPATH "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}vartypes${CMAKE_STATIC_LIBRARY_SUFFIX}") - - # the byproducts are available after the install step - ExternalProject_Add_Step(vartypes_external out - DEPENDEES install - BYPRODUCTS - "/${VARTYPES_LIB_SUBPATH}" - ) - - add_dependencies(${app} vartypes_external) - - ExternalProject_Get_Property(vartypes_external install_dir) - add_dependencies(${app} vartypes_external) - - set(VARTYPES_INCLUDE_DIRS "${install_dir}/include") - set(VARTYPES_LIBRARIES "${install_dir}/${VARTYPES_LIB_SUBPATH}") -endif() - -target_include_directories(${app} PRIVATE ${VARTYPES_INCLUDE_DIRS}) -list(APPEND libs ${VARTYPES_LIBRARIES}) +find_package(vartypes CONFIG REQUIRED) +list(APPEND libs vartypes::vartypes) # Protobuf -include(FindOrBuildProtobuf) - -if(TARGET protobuf_external) - add_dependencies(${app} protobuf_external) -endif() - -include_directories(${Protobuf_INCLUDE_DIRS}) -list(APPEND libs ${Protobuf_LIBRARIES}) +find_package(protobuf CONFIG REQUIRED) +list(APPEND libs protobuf::libprotobuf) set (Protobuf_IMPORT_DIRS ${Protobuf_INCLUDE_DIR}) protobuf_generate_cpp(PROTO_CPP PROTO_H @@ -240,7 +160,8 @@ set(srcs file(GLOB CONFIG_FILES "config/*.ini") set_source_files_properties(${CONFIG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "config") -target_sources(${app} PRIVATE ${srcs}) +set(app ${CMAKE_PROJECT_NAME}) +add_executable(${app} ${srcs}) install(TARGETS ${app} DESTINATION bin) target_link_libraries(${app} ${libs}) diff --git a/CMakePresets.json b/CMakePresets.json index de8ed6dd..c9e16c4b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,45 +1,80 @@ { - "version": 6, - "configurePresets": [ - { - "name": "windows-default", - "displayName": "Windows x64 Release", - "generator": "Ninja", - "binaryDir": "${sourceDir}/out/build/${presetName}", - "architecture": { - "value": "x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" - } - }, - { - "name": "ninja-multi-vcpkg", - "displayName": "Windows x64 Release vcpkg", - "generator": "Ninja Multi-Config", - "binaryDir": "${sourceDir}/out/build/${presetName}", - "architecture": { - "value": "x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_TOOLCHAIN_FILE": { - "type": "FILEPATH", - "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" - }, - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" - } - } - ], - "buildPresets": [ - { - "name": "ninja-multi-vcpkg", - "configurePreset": "ninja-multi-vcpkg", - "displayName": "Build ninja-multi-vcpkg", - "description": "Build ninja-multi-vcpkg Configurations" - } - ] -} + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "base", + "hidden": true, + "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "installDir": "${sourceDir}/out/install/${presetName}" + }, + { + "name": "windows-base", + "inherits": "base", + "hidden": true, + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Windows" + } + }, + { + "name": "windows-vs-22", + "description": "Target Windows (64-bit) for Visual Studio 2022", + "inherits": "windows-base", + "generator": "Visual Studio 17 2022", + "architecture": { + "value": "x64" + } + }, + { + "name": "windows-vs-22-clang", + "description": "Target Windows (64-bit) with the Visual Studio development environment using clang-cl toolset.", + "inherits": "windows-vs-22", + "toolset": "ClangCL" + }, + { + "name": "windows-ninja-base", + "inherits": "windows-base", + "hidden": true, + "generator": "Ninja", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_C_COMPILER": "cl.exe", + "CMAKE_CXX_COMPILER": "cl.exe" + } + }, + { + "name": "windows-debug", + "inherits": "windows-ninja-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "windows-release", + "inherits": "windows-ninja-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + } + ], + "buildPresets": [ + { + "name": "windows-debug", + "configurePreset": "windows-debug" + }, + { + "name": "windows-release", + "configurePreset": "windows-release" + } + ] +} \ No newline at end of file diff --git a/clients/qt/CMakeLists.txt b/clients/qt/CMakeLists.txt index a543a721..58c4a01a 100644 --- a/clients/qt/CMakeLists.txt +++ b/clients/qt/CMakeLists.txt @@ -1,7 +1,4 @@ -cmake_minimum_required(VERSION 2.8) - set(CMAKE_AUTOMOC ON) - set(CMAKE_INCLUDE_CURRENT_DIR ON) # policy regarding how to handle generated stuff, OLD behavior would ignore generated files @@ -10,24 +7,13 @@ if (POLICY CMP0071) cmake_policy(SET CMP0071 NEW) endif() -# policy regarding when to rebuild stuff when external projects downloaded with URL changes -if (POLICY CMP0135) - cmake_policy(SET CMP0135 NEW) -endif() - set(libs) find_package(Qt5 COMPONENTS Core Widgets Network REQUIRED) list(APPEND libs Qt5::Core Qt5::Widgets Qt5::Network) -# if find_package was already executed and we already included BuildProtobuf find_package fails, -# so we only want to do execute find_package if protobuf was not found yet -if(NOT Protobuf_FOUND) - include(FindOrBuildProtobuf) -endif() - -include_directories(${Protobuf_INCLUDE_DIRS}) -list(APPEND libs ${Protobuf_LIBRARIES}) +find_package(protobuf CONFIG REQUIRED) +list(APPEND libs protobuf::libprotobuf) protobuf_generate_cpp(PROTO_CPP PROTO_H ../../src/proto/grSim_Replacement.proto @@ -50,4 +36,3 @@ if(TARGET protobuf_external) endif() target_link_libraries(${app} ${libs}) - diff --git a/cmake/Utils.cmake b/cmake/Utils.cmake deleted file mode 100644 index 868bacd3..00000000 --- a/cmake/Utils.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# Some utilities -#TODO: comment/document - -macro(standard_paths ARG0 ARG1 ARG2) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ARG0}/${ARG1}) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${ARG0}/${ARG2}) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${ARG0}/${ARG2}) - foreach(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) - string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}) - endforeach() - set(CMAKE_DEBUG_POSTFIX d) - set(CMAKE_MINSIZEREL_POSTFIX min) -endmacro() - -macro(standard_config) - set(CMAKE_AUTOMOC YES) - set(CMAKE_INCLUDE_CURRENT_DIR YES) -endmacro() - diff --git a/cmake/modules/BuildODE.cmake b/cmake/modules/BuildODE.cmake deleted file mode 100644 index 41aa54f7..00000000 --- a/cmake/modules/BuildODE.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# build ODE, because some versions of it cause grSim to segfault somewhere -# could be because in some packages the double precision is turned off -include(ExternalProject) - -ExternalProject_Add(ode_external - GIT_REPOSITORY https://bitbucket.org/odedevs/ode.git - GIT_TAG 0.16.4 - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH= - -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} - -DCMAKE_MAKE_PROGRAM:PATH=${CMAKE_MAKE_PROGRAM} - # necessary, because it does not build the static libs if this is ON - -DBUILD_SHARED_LIBS=OFF - # if this is OFF grSim just dies instantly and INSTALL.md says it should be ON - -DODE_DOUBLE_PRECISION=ON - -DCMAKE_INSTALL_PREFIX= - STEP_TARGETS install -) - -set(ODE_LIB_SUBPATH "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}ode${CMAKE_STATIC_LIBRARY_SUFFIX}") - -# the byproducts are available after the install step -ExternalProject_Add_Step(ode_external out - DEPENDEES install - BYPRODUCTS - "/${ODE_LIB_SUBPATH}" -) - -ExternalProject_Get_Property(ode_external install_dir) -set(ODE_LIBRARY "${install_dir}/${ODE_LIB_SUBPATH}") -list(APPEND libs ${ODE_LIBRARY}) -target_include_directories(${app} PRIVATE "${install_dir}/include") diff --git a/cmake/modules/BuildProtobuf.cmake b/cmake/modules/BuildProtobuf.cmake deleted file mode 100644 index dcc584b3..00000000 --- a/cmake/modules/BuildProtobuf.cmake +++ /dev/null @@ -1,87 +0,0 @@ -# *************************************************************************** -# * Copyright 2017 Michael Eischer * -# * Robotics Erlangen e.V. * -# * http://www.robotics-erlangen.de/ * -# * info@robotics-erlangen.de * -# * * -# * 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 * -# * 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 . * -# *************************************************************************** - -include(ExternalProject) - -set(PROTOBUF_CMAKE_ARGS ) - -ExternalProject_Add(protobuf_external - # URL is the same as in the ER-Force framework, - # because ER-Force needs it and has an incentive to keep the link stable - URL http://www.robotics-erlangen.de/downloads/libraries/protobuf-cpp-3.6.1.tar.gz - URL_HASH SHA256=b3732e471a9bb7950f090fd0457ebd2536a9ba0891b7f3785919c654fe2a2529 - SOURCE_SUBDIR cmake - CMAKE_ARGS - -DCMAKE_INSTALL_PREFIX:PATH= - -DCMAKE_TOOLCHAIN_FILE:PATH=${CMAKE_TOOLCHAIN_FILE} - -DCMAKE_C_COMPILER:PATH=${CMAKE_C_COMPILER} - -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} - -DCMAKE_MAKE_PROGRAM:PATH=${CMAKE_MAKE_PROGRAM} - # the tests fail to build :-( - -Dprotobuf_BUILD_TESTS:BOOL=OFF - STEP_TARGETS install -) - -set(PROTOBUF_SUBPATH "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}protobuf${CMAKE_STATIC_LIBRARY_SUFFIX}") -set(LIBPROTOC_SUBPATH "${CMAKE_INSTALL_LIBDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}protoc${CMAKE_STATIC_LIBRARY_SUFFIX}") -set(PROTOC_SUBPATH "bin/protoc${CMAKE_EXECUTABLE_SUFFIX}") - -# the byproducts are available after the install step -ExternalProject_Add_Step(protobuf_external out - DEPENDEES install - BYPRODUCTS - "/${PROTOBUF_SUBPATH}" - "/${LIBPROTOC_SUBPATH}" - "/${PROTOC_SUBPATH}" -) - -ExternalProject_Get_Property(protobuf_external install_dir) -set_target_properties(protobuf_external PROPERTIES EXCLUDE_FROM_ALL true) - -# override all necessary variables originally set by find_package -# if FORCE is not set cmake does not allow us to override the variables, for some unknown reason -set(Protobuf_FOUND true CACHE BOOL "" FORCE) -set(Protobuf_VERSION "3.6.1" CACHE STRING "" FORCE) -set(Protobuf_INCLUDE_DIR "${install_dir}/include" CACHE PATH "" FORCE) -set(Protobuf_INCLUDE_DIRS "${Protobuf_INCLUDE_DIR}" CACHE PATH "" FORCE) -set(Protobuf_LIBRARY "${install_dir}/${PROTOBUF_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_LIBRARIES "${Protobuf_LIBRARY}" CACHE PATH "" FORCE) -set(Protobuf_LIBRARY_DEBUG "${install_dir}/${PROTOBUF_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_LIBRARY_RELEASE "${install_dir}/${PROTOBUF_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_LITE_LIBRARY_DEBUG "${install_dir}/${PROTOBUF_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_LITE_LIBRARY_RELEASE "${install_dir}/${PROTOBUF_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_PROTOC_EXECUTABLE "${install_dir}/${PROTOC_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_PROTOC_LIBRARY_DEBUG "${install_dir}/${LIBPROTOC_SUBPATH}" CACHE PATH "" FORCE) -set(Protobuf_PROTOC_LIBRARY_RELEASE "${install_dir}/${LIBPROTOC_SUBPATH}" CACHE PATH "" FORCE) -# this is a dependency for the protobuf_generate_cpp custom command -# if this is not set the generate command sometimes get executed before protoc is compiled -set(protobuf_generate_DEPENDENCIES protobuf_external CACHE STRING "" FORCE) - -# compatibility with cmake 3.10 -if(NOT TARGET protobuf::protoc) - # avoid error if target was already created for an older version - add_executable(protobuf::protoc IMPORTED) -endif() -# override the protobuf::protoc path used by the protobuf_generate_cpp macro -set_target_properties(protobuf::protoc PROPERTIES - IMPORTED_LOCATION "${Protobuf_PROTOC_EXECUTABLE}" -) - -message(STATUS "Building protobuf ${Protobuf_VERSION}") diff --git a/cmake/modules/EnvHelper.cmake b/cmake/modules/EnvHelper.cmake deleted file mode 100644 index f5339c5f..00000000 --- a/cmake/modules/EnvHelper.cmake +++ /dev/null @@ -1,31 +0,0 @@ -# *************************************************************************** -# * Copyright 2017 Michael Eischer * -# * Robotics Erlangen e.V. * -# * http://www.robotics-erlangen.de/ * -# * info@robotics-erlangen.de * -# * * -# * 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 * -# * 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 . * -# *************************************************************************** - -macro(sanitize_env) - # remove "." from path to avoid searching the build_dir/bin folder - set(ORIG_PATH $ENV{PATH}) - set(MOD_PATH $ENV{PATH}) - list(REMOVE_ITEM MOD_PATH .) - set(ENV{PATH} ${MOD_PATH}) -endmacro() - -macro(restore_env) - set(ENV{PATH} ${ORIG_PATH}) -endmacro() diff --git a/cmake/modules/FindODE.cmake b/cmake/modules/FindODE.cmake deleted file mode 100644 index e11f477c..00000000 --- a/cmake/modules/FindODE.cmake +++ /dev/null @@ -1,62 +0,0 @@ -find_package(PkgConfig QUIET) - -foreach(pc_lib ode-double ode) - pkg_check_modules(pc_ode QUIET "${pc_lib}") - if(pc_ode_FOUND) - if(pc_ode_VERSION VERSION_LESS "0.13") - if (pc_ode_CFLAGS MATCHES "-D(dSINGLE|dDOUBLE)") - set(pc_ode_precision "${CMAKE_MATCH_1}") - endif() - else() - pkg_get_variable(pc_ode_precision "${pc_lib}" precision) - endif() - - break() - endif() -endforeach() - -find_library(ODE_LIBRARIES - NAMES "${pc_ode_LIBRARIES}" - HINTS "${pc_ode_LIBRARY_DIRS}" -) - -find_path(ODE_INCLUDE_DIR - NAMES ode/ode.h - HINTS "${pc_ode_INCLUDEDIR}" -) - -set(ODE_VERSION "${pc_ode_VERSION}") -set(ODE_PRECISION "${pc_ode_precision}") - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(ODE - REQUIRED_VARS ODE_LIBRARIES ODE_INCLUDE_DIR ODE_PRECISION - VERSION_VAR ODE_VERSION -) - -mark_as_advanced(ODE_LIBRARIES ODE_INCLUDE_DIR ODE_PRECISION) - -if(ODE_LIBRARIES AND NOT TARGET ode::ode) - add_library(ode::ode UNKNOWN IMPORTED) - set_target_properties(ode::ode PROPERTIES - IMPORTED_LOCATION "${ODE_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${ODE_INCLUDE_DIR}") - - if(ODE_VERSION VERSION_LESS "0.13") - if(ODE_PRECISION STREQUAL "dSINGLE") - set_target_properties(ode::ode PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "dSINGLE") - elseif(ODE_PRECISION STREQUAL "dDOUBLE") - set_target_properties(ode::ode PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "dDOUBLE") - endif() - else() - if(ODE_PRECISION STREQUAL "dSINGLE") - set_target_properties(ode::ode PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "dIDESINGLE") - elseif(ODE_PRECISION STREQUAL "dDOUBLE") - set_target_properties(ode::ode PROPERTIES - INTERFACE_COMPILE_DEFINITIONS "dIDEDOUBLE") - endif() - endif() -endif() diff --git a/cmake/modules/FindOrBuildProtobuf.cmake b/cmake/modules/FindOrBuildProtobuf.cmake deleted file mode 100644 index 4db92e07..00000000 --- a/cmake/modules/FindOrBuildProtobuf.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# sanitize environment before find_package, because otherwise it also looks in the directory created for the ExternalProject -include(EnvHelper) -sanitize_env() -find_package(Protobuf 3.3.0) -restore_env() - -# protobuf versions >= 3.21 are incompatible with how the project is setup and cause weird errors -# so we build protobuf ourselves -if(NOT Protobuf_FOUND OR Protobuf_VERSION VERSION_GREATER_EQUAL 3.21) - include(BuildProtobuf) -endif() diff --git a/cmake/modules/FindVarTypes.cmake b/cmake/modules/FindVarTypes.cmake deleted file mode 100644 index 11a0b33d..00000000 --- a/cmake/modules/FindVarTypes.cmake +++ /dev/null @@ -1,37 +0,0 @@ -find_path( - VARTYPES_INCLUDE_DIRS - NAMES - vartypes/VarTypes.h - HINTS - $ENV{HOME}/include - /usr/local/include - /usr/include - $ENV{ProgramFiles}/vartypes/include -) - -find_library( - VARTYPES_LIBRARY - NAMES - vartypes - HINTS - $ENV{HOME}/lib - /usr/local/lib - /usr/lib - $ENV{ProgramFiles}/vartypes/lib -) - -set(VARTYPES_LIBRARIES ${VARTYPES_LIBRARY}) - -find_package_handle_standard_args( - VARTYPES - DEFAULT_MSG - VARTYPES_INCLUDE_DIRS - VARTYPES_LIBRARIES -) - -mark_as_advanced( - VARTYPES_INCLUDE_DIRS - VARTYPES_LIBRARIES - VARTYPES_LIBRARY -) - diff --git a/ports/vartypes/portfile.cmake b/ports/vartypes/portfile.cmake new file mode 100644 index 00000000..852e7491 --- /dev/null +++ b/ports/vartypes/portfile.cmake @@ -0,0 +1,17 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO lordhippo/vartypes + REF cdfdb8ab68c1ceab6f8a2350244777de3c945be9 + SHA512 2ffb2d2990d89783c1025e9fe40b10a30e473666ba79156c46fc379655a33941acd95ce6c0739144d549b05d2df3d9d13bc6b3801de32032942bf72699d92148 + HEAD_REF master +) + +vcpkg_cmake_configure( + SOURCE_PATH ${SOURCE_PATH} + OPTIONS + -DBUILD_EXAMPLE=OFF) + +vcpkg_cmake_install() +vcpkg_cmake_config_fixup(PACKAGE_NAME "vartypes") + +file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/vartypes" RENAME copyright) diff --git a/ports/vartypes/vcpkg.json b/ports/vartypes/vcpkg.json new file mode 100644 index 00000000..dca14658 --- /dev/null +++ b/ports/vartypes/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vartypes", + "version-string": "0.9.0", + "description": "A feature-rich, object-oriented framework for managing variables in C++ / Qt5.", + "dependencies": [ + "qt5-base", + "boost-serialization", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ] +} \ No newline at end of file diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 00000000..3b3d32a1 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg-configuration.schema.json", + "overlay-ports": [ + "./ports" + ] +} \ No newline at end of file diff --git a/vcpkg.json b/vcpkg.json index 89c2f3c8..01d464f2 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,9 +1,9 @@ { - "name": "grsim", - "version-string": "0.0.1", "dependencies": [ "qt5-base", "ode", - "protobuf" + "protobuf", + "opengl", + "vartypes" ] } From c8d45ed688b4d02180bf9d1c25abdaf38a223195 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 20:16:29 +0100 Subject: [PATCH 02/26] Revert "Disable broken Windows pipeline" This reverts commit d14caf2420029a431b8685d9fcc8cecd18d0249a. --- .github/workflows/build.yaml | 49 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3ec7f355..74ee3643 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,28 +37,27 @@ jobs: # 5.15.11 is for macos-12 and 5.15.12 is for macos-13 run: PATH=/usr/local/Cellar/qt@5/5.15.11/lib/cmake/Qt5:/usr/local/Cellar/qt@5/5.15.12/lib/cmake/Qt5:$PATH && make -# Windows build does not work currently, see https://github.com/RoboCup-SSL/grSim/issues/183 -# build-windows: -# runs-on: windows-latest -# steps: -# - uses: actions/checkout@v4 -# -# - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies -# uses: lukka/run-vcpkg@v11 -# with: -# vcpkgGitCommitId: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50 -# vcpkgDirectory: c:/vcpkg # folder must reside in c:\ otherwise qt wont install due to long path errors -# -# - name: Run CMake and run vcpkg to build packages -# uses: lukka/run-cmake@v10 -# with: -# # this preset is needed to actually install the vcpkg dependencies -# configurePreset: "ninja-multi-vcpkg" -# configPresetAdditionalArgs: "[-DVCPKG_TARGET_TRIPLET=x64-windows]" -# buildPreset: "ninja-multi-vcpkg" -# buildPresetAdditionalArgs: "['--config Release']" -# env: -# # [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one -# # for the hosting system will be automatically choosen (x64 is the default on all -# # platforms, e.g. `x64-osx`). -# VCPKG_DEFAULT_TRIPLET: "x64-windows" + build-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies + uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50 + vcpkgDirectory: c:/vcpkg # folder must reside in c:\ otherwise qt wont install due to long path errors + + - name: Run CMake and run vcpkg to build packages + uses: lukka/run-cmake@v10 + with: + # this preset is needed to actually install the vcpkg dependencies + configurePreset: "ninja-multi-vcpkg" + configPresetAdditionalArgs: "[-DVCPKG_TARGET_TRIPLET=x64-windows]" + buildPreset: "ninja-multi-vcpkg" + buildPresetAdditionalArgs: "['--config Release']" + env: + # [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one + # for the hosting system will be automatically choosen (x64 is the default on all + # platforms, e.g. `x64-osx`). + VCPKG_DEFAULT_TRIPLET: "x64-windows" From 9f542665e2e8f75c434a6e0521cb5a0abf0dfe0a Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 20:23:07 +0100 Subject: [PATCH 03/26] Fix the CI script. --- .github/workflows/build.yaml | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 74ee3643..444fb026 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -4,6 +4,8 @@ on: branches: - master pull_request: + workflow_dispatch: + jobs: build-linux: runs-on: ${{ matrix.os }} @@ -52,12 +54,5 @@ jobs: uses: lukka/run-cmake@v10 with: # this preset is needed to actually install the vcpkg dependencies - configurePreset: "ninja-multi-vcpkg" - configPresetAdditionalArgs: "[-DVCPKG_TARGET_TRIPLET=x64-windows]" - buildPreset: "ninja-multi-vcpkg" - buildPresetAdditionalArgs: "['--config Release']" - env: - # [OPTIONAL] Define the vcpkg's triplet you want to enforce, otherwise the default one - # for the hosting system will be automatically choosen (x64 is the default on all - # platforms, e.g. `x64-osx`). - VCPKG_DEFAULT_TRIPLET: "x64-windows" + configurePreset: "windows-release" + buildPreset: "windows-release" From 45fdcccce8642f8c9b75919cb316aa9c5fa807a8 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 20:31:11 +0100 Subject: [PATCH 04/26] Fixing linux and mac CI jobs. --- .github/workflows/build.yaml | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 444fb026..c3b36783 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,12 +16,14 @@ jobs: os: [ ubuntu-20.04, ubuntu-22.04 ] steps: - uses: actions/checkout@v4 - - name: "Update dependencies" - run: sudo apt-get update - - name: "Install dependencies" - run: sudo apt-get install -y build-essential cmake pkg-config qtbase5-dev libqt5opengl5-dev libgl1-mesa-dev libglu1-mesa-dev libprotobuf-dev protobuf-compiler libode-dev libboost-dev - - name: "Build" - run: make + - uses: lukka/get-cmake@latest + - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies + uses: lukka/run-vcpkg@v11 + - name: Run CMake and run vcpkg to build packages + uses: lukka/run-cmake@v10 + with: + configurePreset: "linux-debug" + buildPreset: "linux-debug" build-macos: runs-on: ${{ matrix.os }} @@ -32,27 +34,24 @@ jobs: os: [ macos-12, macos-13 ] steps: - uses: actions/checkout@v4 - - name: "Install dependencies" - run: brew tap robotology/formulae && brew install cmake pkg-config qt@5 - - name: "Build" - # for some reason qt5 is not correctly in the path and this will break whenever the location of it changes - # 5.15.11 is for macos-12 and 5.15.12 is for macos-13 - run: PATH=/usr/local/Cellar/qt@5/5.15.11/lib/cmake/Qt5:/usr/local/Cellar/qt@5/5.15.12/lib/cmake/Qt5:$PATH && make + - uses: lukka/get-cmake@latest + - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies + uses: lukka/run-vcpkg@v11 + - name: Run CMake and run vcpkg to build packages + uses: lukka/run-cmake@v10 + with: + configurePreset: "macos-debug" + buildPreset: "macos-debug" build-windows: runs-on: windows-latest steps: - uses: actions/checkout@v4 - + - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 - with: - vcpkgGitCommitId: 8eb57355a4ffb410a2e94c07b4dca2dffbee8e50 - vcpkgDirectory: c:/vcpkg # folder must reside in c:\ otherwise qt wont install due to long path errors - - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: - # this preset is needed to actually install the vcpkg dependencies configurePreset: "windows-release" buildPreset: "windows-release" From 2b5b0ab4f679d6940ffa3158a58b7278e6fca5c8 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 20:35:01 +0100 Subject: [PATCH 05/26] Add the vcpkg commit sha back. --- .github/workflows/build.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c3b36783..685d3c4b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,6 +19,8 @@ jobs: - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: 215a2535590f1f63788ac9bd2ed58ad15e6afdff - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: @@ -37,6 +39,8 @@ jobs: - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: 215a2535590f1f63788ac9bd2ed58ad15e6afdff - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: @@ -50,6 +54,8 @@ jobs: - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 + with: + vcpkgGitCommitId: 215a2535590f1f63788ac9bd2ed58ad15e6afdff - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: From b0a68357f1992d871cc716ae6474ed2950f0d7b6 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 20:45:39 +0100 Subject: [PATCH 06/26] Add mac and linux cmake presets. --- CMakePresets.json | 66 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/CMakePresets.json b/CMakePresets.json index c9e16c4b..5387db11 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -23,6 +23,56 @@ "rhs": "Windows" } }, + { + "name": "linux-base", + "inherits": "base", + "hidden": true, + "generator": "Ninja", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Linux" + } + }, + { + "name": "macos-base", + "inherits": "base", + "hidden": true, + "generator": "Ninja", + "condition": { + "type": "equals", + "lhs": "${hostSystemName}", + "rhs": "Darwin" + } + }, + { + "name": "macos-debug", + "inherits": "macos-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "macos-release", + "inherits": "macos-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, + { + "name": "linux-debug", + "inherits": "linux-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "linux-release", + "inherits": "linux-base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release" + } + }, { "name": "windows-vs-22", "description": "Target Windows (64-bit) for Visual Studio 2022", @@ -68,6 +118,22 @@ } ], "buildPresets": [ + { + "name": "linux-debug", + "configurePreset": "linux-debug" + }, + { + "name": "linux-release", + "configurePreset": "linux-release" + }, + { + "name": "macos-debug", + "configurePreset": "macos-debug" + }, + { + "name": "macos-release", + "configurePreset": "macos-release" + }, { "name": "windows-debug", "configurePreset": "windows-debug" From a1eb87aff125566dda304b07cf2dcbc43495ea5f Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 21:58:55 +0100 Subject: [PATCH 07/26] Install necessary mac and linux system packages. --- .github/workflows/build.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 685d3c4b..aba73d61 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,6 +16,10 @@ jobs: os: [ ubuntu-20.04, ubuntu-22.04 ] steps: - uses: actions/checkout@v4 + - name: Install system packages + uses: ConorMacBride/install-package@v1 + with: + apt: '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 @@ -36,6 +40,10 @@ jobs: os: [ macos-12, macos-13 ] steps: - uses: actions/checkout@v4 + - name: Install system packages + uses: ConorMacBride/install-package@v1 + with: + brew: pkg-config - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 From f6e3d24c38f63113528df65841b8f4157de37309 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 21:59:45 +0100 Subject: [PATCH 08/26] Fixed a syntax error in CI script. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index aba73d61..60783a53 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ jobs: - name: Install system packages uses: ConorMacBride/install-package@v1 with: - apt: '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev + apt: ^libxcb.*-dev libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 From 0ccd80ed8100c1df8dd5384186868483632af2a7 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 22:16:43 +0100 Subject: [PATCH 09/26] Install python 3.11 for meson to work. Also add latest ubuntu and mac to build targets. --- .github/workflows/build.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 60783a53..4eb84a95 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04 ] + os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-latest ] steps: - uses: actions/checkout@v4 - name: Install system packages @@ -37,13 +37,16 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-12, macos-13 ] + os: [ macos-12, macos-13, macos-latest ] steps: - uses: actions/checkout@v4 - name: Install system packages uses: ConorMacBride/install-package@v1 with: brew: pkg-config + - uses: actions/setup-python@v5 + with: + python-version: '3.11' - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 From 952a8836753f980ae2b08e461cb9e60a2901281c Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Mon, 4 Mar 2024 22:40:59 +0100 Subject: [PATCH 10/26] Use a vartype commit that fixes the pch issue. --- ports/vartypes/portfile.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ports/vartypes/portfile.cmake b/ports/vartypes/portfile.cmake index 852e7491..e101c578 100644 --- a/ports/vartypes/portfile.cmake +++ b/ports/vartypes/portfile.cmake @@ -1,8 +1,8 @@ vcpkg_from_github( OUT_SOURCE_PATH SOURCE_PATH REPO lordhippo/vartypes - REF cdfdb8ab68c1ceab6f8a2350244777de3c945be9 - SHA512 2ffb2d2990d89783c1025e9fe40b10a30e473666ba79156c46fc379655a33941acd95ce6c0739144d549b05d2df3d9d13bc6b3801de32032942bf72699d92148 + REF a55280872b4b39269acbd4c3faa6160e64f576d5 + SHA512 03696c06aff60020aa2b868b6b60c98dfc43347578194e914be1954907bd63615d1e259ffaad148f47204aa953762821d85231c37edc51f97fd48a753e8de905 HEAD_REF master ) From 608a0b10c0f27b829cab51890c451b7cf9924e9d Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 00:17:48 +0100 Subject: [PATCH 11/26] Fixed installation and packaging. --- CMakeLists.txt | 8 ++++---- CMakePresets.json | 8 +++++++- clients/qt/CMakeLists.txt | 6 ++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32b8ec48..78c86e6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,9 +162,9 @@ set_source_files_properties(${CONFIG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION set(app ${CMAKE_PROJECT_NAME}) add_executable(${app} ${srcs}) -install(TARGETS ${app} DESTINATION bin) target_link_libraries(${app} ${libs}) +install(TARGETS ${app} DESTINATION bin) if(APPLE AND CMAKE_MACOSX_BUNDLE) # use CMAKE_MACOSX_BUNDLE if you want to build a mac bundle set(MACOSX_BUNDLE_ICON_FILE "${PROJECT_SOURCE_DIR}/resources/icons/grsim.icns") @@ -181,7 +181,7 @@ if(APPLE AND CMAKE_MACOSX_BUNDLE) elseif(WIN32 AND CMAKE_WIN32_EXECUTABLE) # use CMAKE_WIN32_EXECUTABLE if you want to build a windows exe install(DIRECTORY config DESTINATION .) - install(DIRECTORY bin DESTINATION . + install(DIRECTORY ${CMAKE_BINARY_DIR}/bin/ DESTINATION bin FILES_MATCHING PATTERN "*.dll") set(CPACK_PACKAGE_EXECUTABLES ${app} ${app}) else() @@ -208,9 +208,9 @@ if(UNIX) endif() elseif(WIN32) set(ARCH "win32") - set(CPACK_GENERATOR ZIP NSIS) + set(CPACK_GENERATOR ZIP) endif() -set(CPACK_OUTPUT_FILE_PREFIX ${PROJECT_SOURCE_DIR}/dist) +set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_BINARY_DIR}/dist) set(CPACK_PACKAGE_CONTACT ${MAINTAINER}) if(VENDOR) set(CPACK_PACKAGE_VENDOR ${VENDOR}) diff --git a/CMakePresets.json b/CMakePresets.json index 5387db11..70e96c46 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -11,7 +11,10 @@ "hidden": true, "toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", "binaryDir": "${sourceDir}/out/build/${presetName}", - "installDir": "${sourceDir}/out/install/${presetName}" + "installDir": "${sourceDir}/out/install/${presetName}", + "cacheVariables": { + "CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/out/build/${presetName}/bin" + } }, { "name": "windows-base", @@ -21,6 +24,9 @@ "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" + }, + "cacheVariables": { + "CMAKE_WIN32_EXECUTABLE": "ON" } }, { diff --git a/clients/qt/CMakeLists.txt b/clients/qt/CMakeLists.txt index 58c4a01a..d7b68915 100644 --- a/clients/qt/CMakeLists.txt +++ b/clients/qt/CMakeLists.txt @@ -31,8 +31,6 @@ add_executable(${app} MACOSX_BUNDLE mainwindow.h ) -if(TARGET protobuf_external) - add_dependencies(${app} protobuf_external) -endif() - target_link_libraries(${app} ${libs}) + +install(TARGETS ${app} DESTINATION bin) From ccf5d8c5d157f555127cbf51dc6e4c84d0db8e69 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 00:21:54 +0100 Subject: [PATCH 12/26] Add windows auto-release. --- .github/workflows/build.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4eb84a95..01f40fdb 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,6 +1,8 @@ name: Build on: push: + tags: + - 'v*' branches: - master pull_request: @@ -72,3 +74,11 @@ jobs: with: configurePreset: "windows-release" buildPreset: "windows-release" + - name: Release + uses: softprops/action-gh-release@v0.1.15 + if: startsWith(github.ref, 'refs/tags/v') + with: + draft: true + files: "out/windows-release/dist/*.zip" + fail_on_unmatched_files: true + generate_release_notes: true From 819d4791010b081831de6e3589c1a7e083287086 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 00:31:29 +0100 Subject: [PATCH 13/26] Add the missing package step and preset. --- .github/workflows/build.yaml | 1 + CMakePresets.json | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 01f40fdb..14247ca7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -74,6 +74,7 @@ jobs: with: configurePreset: "windows-release" buildPreset: "windows-release" + packagePreset: "windows-release" - name: Release uses: softprops/action-gh-release@v0.1.15 if: startsWith(github.ref, 'refs/tags/v') diff --git a/CMakePresets.json b/CMakePresets.json index 70e96c46..15957a2b 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -148,5 +148,11 @@ "name": "windows-release", "configurePreset": "windows-release" } + ], + "packagePresets": [ + { + "name": "windows-release", + "configurePreset": "windows-release" + } ] } \ No newline at end of file From 37296254b89386e9bfde904e2e723ed68612d5e7 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 01:05:25 +0100 Subject: [PATCH 14/26] Remove the unnecessary CMP0071. This only affects how automoc handles generated files. We don't moc proto-generated files. --- CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78c86e6a..8618438b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,12 +12,6 @@ string(TOLOWER ${CMAKE_PROJECT_NAME} CMAKE_PROJECT_NAME_LOWER) set(CMAKE_AUTOMOC YES) set(CMAKE_INCLUDE_CURRENT_DIR YES) -# policy regarding how to handle generated stuff, OLD behavior would ignore generated files -# (which includes the generated protobuf cpp files) -if (POLICY CMP0071) - cmake_policy(SET CMP0071 NEW) -endif() - # definitions for knowing the OS from the code if(MSVC) add_definitions(-DHAVE_MSVC) From 6767d5ae27409085988e7df0f2320a2a0662781c Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 01:16:19 +0100 Subject: [PATCH 15/26] Remove older linux and mac CI targets. Also add a todo to update the install file. --- .github/workflows/build.yaml | 4 ++-- INSTALL.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 14247ca7..1596e162 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-20.04, ubuntu-22.04, ubuntu-latest ] + os: [ ubuntu-latest ] steps: - uses: actions/checkout@v4 - name: Install system packages @@ -39,7 +39,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ macos-12, macos-13, macos-latest ] + os: [ macos-latest ] steps: - uses: actions/checkout@v4 - name: Install system packages diff --git a/INSTALL.md b/INSTALL.md index e7ee47f5..3ec2a0f5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -46,6 +46,8 @@ The container can be run in two flavors: ## Building and installing from the source code +TODO: Replace all these with a simplified vcpkg build. + ### Installing Dependencies #### Arch Linux From 4c5624b8b5883b60ba6de93f2d1c599a8822992e Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 08:51:12 +0100 Subject: [PATCH 16/26] Fixed windows release path in CI. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1596e162..22605416 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -80,6 +80,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: draft: true - files: "out/windows-release/dist/*.zip" + files: "out/build/windows-release/dist/*.zip" fail_on_unmatched_files: true generate_release_notes: true From 5a0e39bceeec67bb46dc46c20d70a0fae851b48a Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 09:01:07 +0100 Subject: [PATCH 17/26] Package linux and mac builds. --- .github/workflows/build.yaml | 10 ++++++---- CMakePresets.json | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 22605416..e69999f8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -30,8 +30,9 @@ jobs: - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: - configurePreset: "linux-debug" - buildPreset: "linux-debug" + configurePreset: "linux-release" + buildPreset: "linux-release" + packagePreset: "linux-release" build-macos: runs-on: ${{ matrix.os }} @@ -57,8 +58,9 @@ jobs: - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: - configurePreset: "macos-debug" - buildPreset: "macos-debug" + configurePreset: "macos-release" + buildPreset: "macos-release" + packagePreset: "macos-release" build-windows: runs-on: windows-latest diff --git a/CMakePresets.json b/CMakePresets.json index 15957a2b..fb4d40dc 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -150,6 +150,14 @@ } ], "packagePresets": [ + { + "name": "linux-release", + "configurePreset": "linux-release" + }, + { + "name": "macos-release", + "configurePreset": "macos-release" + }, { "name": "windows-release", "configurePreset": "windows-release" From 4edf2aaa4938bb888faa1917424dbfbafd4f6ef1 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 09:08:19 +0100 Subject: [PATCH 18/26] Add release steps for mac and linux. --- .github/workflows/build.yaml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e69999f8..e5eb50e8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -10,12 +10,7 @@ on: jobs: build-linux: - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest ] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Install system packages @@ -33,14 +28,17 @@ jobs: configurePreset: "linux-release" buildPreset: "linux-release" packagePreset: "linux-release" + - name: Release + uses: softprops/action-gh-release@v0.1.15 + if: startsWith(github.ref, 'refs/tags/v') + with: + draft: true + files: "out/build/windows-release/dist/*" + fail_on_unmatched_files: true + generate_release_notes: true build-macos: - runs-on: ${{ matrix.os }} - continue-on-error: true - strategy: - fail-fast: false - matrix: - os: [ macos-latest ] + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Install system packages @@ -61,6 +59,14 @@ jobs: configurePreset: "macos-release" buildPreset: "macos-release" packagePreset: "macos-release" + - name: Release + uses: softprops/action-gh-release@v0.1.15 + if: startsWith(github.ref, 'refs/tags/v') + with: + draft: true + files: "out/build/windows-release/dist/*" + fail_on_unmatched_files: true + generate_release_notes: true build-windows: runs-on: windows-latest @@ -82,6 +88,6 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: draft: true - files: "out/build/windows-release/dist/*.zip" + files: "out/build/windows-release/dist/*" fail_on_unmatched_files: true generate_release_notes: true From 554eb9d11b14e81c628b120cd29cb4bb45164963 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Tue, 5 Mar 2024 09:14:05 +0100 Subject: [PATCH 19/26] Fixed mac and linux release paths. --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e5eb50e8..b3f64f94 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -33,7 +33,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: draft: true - files: "out/build/windows-release/dist/*" + files: "out/build/linux-release/dist/*" fail_on_unmatched_files: true generate_release_notes: true @@ -64,7 +64,7 @@ jobs: if: startsWith(github.ref, 'refs/tags/v') with: draft: true - files: "out/build/windows-release/dist/*" + files: "out/build/macos-release/dist/*" fail_on_unmatched_files: true generate_release_notes: true From cc42addedb851ecbea0089173fd51e93c8eadc4f Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Sat, 18 May 2024 12:43:46 +0200 Subject: [PATCH 20/26] Fix clion cmake presets issue. --- CMakePresets.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index fb4d40dc..6a062fce 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -85,7 +85,8 @@ "inherits": "windows-base", "generator": "Visual Studio 17 2022", "architecture": { - "value": "x64" + "value": "x64", + "strategy": "external" } }, { @@ -163,4 +164,4 @@ "configurePreset": "windows-release" } ] -} \ No newline at end of file +} From 6cfee3d32306075df3e8ae2af7ab47fcb356150a Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Sun, 19 May 2024 16:49:10 +0200 Subject: [PATCH 21/26] Update geometry proto and set more fields. --- src/proto/ssl_vision_geometry.proto | 59 +++++++++++++++++++---------- src/sslworld.cpp | 7 ++++ 2 files changed, 47 insertions(+), 19 deletions(-) diff --git a/src/proto/ssl_vision_geometry.proto b/src/proto/ssl_vision_geometry.proto index 440fd1e1..21f4e0c1 100644 --- a/src/proto/ssl_vision_geometry.proto +++ b/src/proto/ssl_vision_geometry.proto @@ -44,33 +44,54 @@ message SSL_FieldCircularArc { } message SSL_GeometryFieldSize { + // Field length (distance between goal lines) in mm required int32 field_length = 1; + // Field width (distance between touch lines) in mm required int32 field_width = 2; + // Goal width (distance between inner edges of goal posts) in mm required int32 goal_width = 3; + // Goal depth (distance from outer goal line edge to inner goal back) in mm required int32 goal_depth = 4; + // Boundary width (distance from touch/goal line centers to boundary walls) in mm required int32 boundary_width = 5; + // Generated line segments based on the other parameters repeated SSL_FieldLineSegment field_lines = 6; + // Generated circular arcs based on the other parameters repeated SSL_FieldCircularArc field_arcs = 7; + // Depth of the penalty/defense area (measured between line centers) in mm optional int32 penalty_area_depth = 8; + // Width of the penalty/defense area (measured between line centers) in mm optional int32 penalty_area_width = 9; + // Radius of the center circle (measured between line centers) in mm + optional int32 center_circle_radius = 10; + // Thickness/width of the lines on the field in mm + optional int32 line_thickness = 11; + // Distance between the goal center and the center of the penalty mark in mm + optional int32 goal_center_to_penalty_mark = 12; + // Goal height in mm + optional int32 goal_height = 13; + // Ball radius in mm (note that this is a float type to represent sub-mm precision) + optional float ball_radius = 14; + // Max allowed robot radius in mm (note that this is a float type to represent sub-mm precision) + optional float max_robot_radius = 15; } message SSL_GeometryCameraCalibration { - required uint32 camera_id = 1; - required float focal_length = 2; - required float principal_point_x = 3; - required float principal_point_y = 4; - required float distortion = 5; - required float q0 = 6; - required float q1 = 7; - required float q2 = 8; - required float q3 = 9; - required float tx = 10; - required float ty = 11; - required float tz = 12; - optional float derived_camera_world_tx = 13; - optional float derived_camera_world_ty = 14; - optional float derived_camera_world_tz = 15; + required uint32 camera_id = 1; + required float focal_length = 2; + required float principal_point_x = 3; + required float principal_point_y = 4; + required float distortion = 5; + required float q0 = 6; + required float q1 = 7; + required float q2 = 8; + required float q3 = 9; + required float tx = 10; + required float ty = 11; + required float tz = 12; + optional float derived_camera_world_tx = 13; + optional float derived_camera_world_ty = 14; + optional float derived_camera_world_tz = 15; optional uint32 pixel_image_width = 16; optional uint32 pixel_image_height = 17; } @@ -103,13 +124,13 @@ message SSL_BallModelChipFixedLoss { message SSL_GeometryModels { optional SSL_BallModelStraightTwoPhase straight_two_phase = 1; - optional SSL_BallModelChipFixedLoss chip_fixed_loss = 2; + optional SSL_BallModelChipFixedLoss chip_fixed_loss = 2; } message SSL_GeometryData { - required SSL_GeometryFieldSize field = 1; + required SSL_GeometryFieldSize field = 1; repeated SSL_GeometryCameraCalibration calib = 2; - optional SSL_GeometryModels models = 3; + optional SSL_GeometryModels models = 3; } enum SSL_FieldShapeType { @@ -127,4 +148,4 @@ enum SSL_FieldShapeType { LeftFieldRightPenaltyStretch = 11; RightFieldLeftPenaltyStretch = 12; RightFieldRightPenaltyStretch = 13; -} \ No newline at end of file +} diff --git a/src/sslworld.cpp b/src/sslworld.cpp index ab14858f..f0ba7ba8 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -1015,6 +1015,13 @@ SSL_WrapperPacket* SSLWorld::generatePacket(int cam_id) { field->set_goal_width(CONVUNIT(cfg->Goal_Width())); field->set_goal_depth(CONVUNIT(cfg->Goal_Depth())); + field->set_penalty_area_depth(CONVUNIT(cfg->Field_Penalty_Depth())); + field->set_penalty_area_width(CONVUNIT(cfg->Field_Penalty_Width())); + field->set_center_circle_radius(CONVUNIT(cfg->Field_Rad())); + field->set_line_thickness(CONVUNIT(cfg->Field_Line_Width())); + field->set_goal_center_to_penalty_mark(CONVUNIT(cfg->Field_Penalty_Point())); + field->set_ball_radius(CONVUNIT(cfg->BallRadius())); + // Field lines and arcs addFieldLinesArcs(field); From c1ef61d21cec22f1606f05af9bf712d46cc32e2f Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Sat, 13 Jul 2024 17:13:42 +0200 Subject: [PATCH 22/26] Add msaa and fix field line flickering. --- src/glwidget.cpp | 4 ++++ src/graphics.cpp | 45 +++++------------------------------------ src/physics/pground.cpp | 2 +- 3 files changed, 10 insertions(+), 41 deletions(-) diff --git a/src/glwidget.cpp b/src/glwidget.cpp index 46af025d..810bc871 100644 --- a/src/glwidget.cpp +++ b/src/glwidget.cpp @@ -30,6 +30,10 @@ Copyright (C) 2011, Parsian Robotic Center (eew.aut.ac.ir/~parsian/grsim) GLWidget::GLWidget(QWidget *parent, ConfigWidget* _cfg) : QGLWidget(parent) { + QGLFormat format{}; + format.setSamples(4); // 4x MSAA + setFormat(format); + frames = 0; state = CursorMode::STEADY; first_time = true; diff --git a/src/graphics.cpp b/src/graphics.cpp index da269c07..d1d7a1e3 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -446,13 +446,7 @@ void CGraphics::initScene(int width,int height,dReal rc,dReal gc,dReal bc,bool f _width = width; _height = height; - //glEnable(GL_POLYGON_SMOOTH); - //glEnable(GL_LINE_SMOOTH); - //glEnable(GL_POINT_SMOOTH); - //glHint(GL_POINT_SMOOTH_HINT,GL_NICEST); - //glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST); - //glHint(GL_LINE_SMOOTH_HINT,GL_NICEST); - //glEnable(GL_MULTISAMPLE); + glEnable(GL_MULTISAMPLE); // setup stuff glEnable (GL_LIGHTING); @@ -462,7 +456,7 @@ void CGraphics::initScene(int width,int height,dReal rc,dReal gc,dReal bc,bool f glDisable (GL_TEXTURE_GEN_T); glShadeModel (GL_FLAT); glEnable (GL_DEPTH_TEST); - glDepthFunc (GL_LESS); + glDepthFunc (GL_LEQUAL); glEnable (GL_CULL_FACE); glCullFace (GL_BACK); glFrontFace (GL_CCW); @@ -471,7 +465,7 @@ void CGraphics::initScene(int width,int height,dReal rc,dReal gc,dReal bc,bool f glViewport (0,0,width,height); glMatrixMode (GL_PROJECTION); glLoadIdentity(); - const dReal vnear = 0.1f; + const dReal vnear = 0.2f; const dReal vfar = m_renderDepth; const dReal k = 0.8f; // view scale, 1 = +/- 45 degrees frustum_vnear = vnear; @@ -546,35 +540,6 @@ void CGraphics::finalizeScene() //owner->swapBuffers(); } -void CGraphics::drawSky () -{ - if (graphicDisabled) return; - const dReal ssize = 1000.0f; - dReal offset = 0.0f; - - dReal x = ssize*sky_scale; - dReal z = view_xyz[2] + sky_height; - - glBegin (GL_QUADS); - glNormal3f (0,0,-1); - glTexCoord2f (-x+offset,-x+offset); - glVertex3f (-ssize+view_xyz[0],-ssize+view_xyz[1],z); - glTexCoord2f (-x+offset,x+offset); - glVertex3f (-ssize+view_xyz[0],ssize+view_xyz[1],z); - glTexCoord2f (x+offset,x+offset); - glVertex3f (ssize+view_xyz[0],ssize+view_xyz[1],z); - glTexCoord2f (x+offset,-x+offset); - glVertex3f (ssize+view_xyz[0],-ssize+view_xyz[1],z); - glEnd(); - - //if (offset > 1) offset -= 1;//never read - - glDepthFunc (GL_LESS); - glDepthRange (0,1); - - resetState(); -} - void CGraphics::resetState() { if (graphicDisabled) return; @@ -582,7 +547,7 @@ void CGraphics::resetState() glDisable (GL_TEXTURE_2D); glShadeModel (GL_FLAT); glEnable (GL_DEPTH_TEST); - glDepthFunc (GL_LESS); + glDepthFunc (GL_LEQUAL); glColor3f (1,1,1); setColor (1,1,1,1); } @@ -593,7 +558,7 @@ void CGraphics::drawGround() glDisable (GL_LIGHTING); glShadeModel (GL_FLAT); glEnable (GL_DEPTH_TEST); - glDepthFunc (GL_LESS); + glDepthFunc (GL_LEQUAL); const dReal gsize = 100.0f; const dReal offset = 0; diff --git a/src/physics/pground.cpp b/src/physics/pground.cpp index fd99ea5d..b4cd6d22 100644 --- a/src/physics/pground.cpp +++ b/src/physics/pground.cpp @@ -43,7 +43,7 @@ void PGround::draw() g->useTexture(tex); g->drawGround(); g->noTexture(); - g->drawSSLGround(rad,len,wid,pdep,pwid,ppoint,lwidth,0.0001); + g->drawSSLGround(rad,len,wid,pdep,pwid,ppoint,lwidth,0.001); } PGround::~PGround() From 244d2170c9c6e11611241d19c0e550c4afba68c5 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Wed, 7 May 2025 09:32:43 +0200 Subject: [PATCH 23/26] Use actual time instead of sim time for frame times. --- src/sslworld.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sslworld.cpp b/src/sslworld.cpp index f0ba7ba8..74f2c86c 100644 --- a/src/sslworld.cpp +++ b/src/sslworld.cpp @@ -440,7 +440,9 @@ void SSLWorld::step(dReal dt) { p->step(dt/ballCollisionTry); } - sim_time += last_dt; + const auto now = std::chrono::system_clock::now(); + sim_time = std::chrono::duration_cast>(now.time_since_epoch()).count(); + //sim_time += last_dt; int best_k=-1; dReal best_dist = 1e8; @@ -985,7 +987,11 @@ SSL_WrapperPacket* SSLWorld::generatePacket(int cam_id) { pPacket->mutable_detection()->set_camera_id(cam_id); pPacket->mutable_detection()->set_frame_number(frame_num); pPacket->mutable_detection()->set_t_capture(sim_time); - pPacket->mutable_detection()->set_t_sent(sim_time); + + const auto now = std::chrono::system_clock::now(); + const double t_sent = std::chrono::duration_cast>(now.time_since_epoch()).count(); + pPacket->mutable_detection()->set_t_sent(t_sent); + dReal dev_x = cfg->noiseDeviation_x(); dReal dev_y = cfg->noiseDeviation_y(); dReal dev_a = cfg->noiseDeviation_angle(); From 31214876fc38de9c31dd39203d190cd04e82c1f7 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Thu, 8 May 2025 00:36:34 +0200 Subject: [PATCH 24/26] Update vcpkg. --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b3f64f94..dab55f7f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 with: - vcpkgGitCommitId: 215a2535590f1f63788ac9bd2ed58ad15e6afdff + vcpkgGitCommitId: ce613c41372b23b1f51333815feb3edd87ef8a8b - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: @@ -52,7 +52,7 @@ jobs: - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 with: - vcpkgGitCommitId: 215a2535590f1f63788ac9bd2ed58ad15e6afdff + vcpkgGitCommitId: ce613c41372b23b1f51333815feb3edd87ef8a8b - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: @@ -76,7 +76,7 @@ jobs: - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 with: - vcpkgGitCommitId: 215a2535590f1f63788ac9bd2ed58ad15e6afdff + vcpkgGitCommitId: ce613c41372b23b1f51333815feb3edd87ef8a8b - name: Run CMake and run vcpkg to build packages uses: lukka/run-cmake@v10 with: From 51c454c6330dd6cdb0f1185441397b755fb4bf58 Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Thu, 8 May 2025 08:35:41 +0200 Subject: [PATCH 25/26] Install linux package tools needed for libxcrypt. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dab55f7f..c2e46fca 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: - name: Install system packages uses: ConorMacBride/install-package@v1 with: - apt: ^libxcb.*-dev libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev + apt: ^libxcb.*-dev libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf automake autoconf-archive libtool libltdl-dev - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11 From aaa3e17b3daa53cca35e19c0e50e840245e6b44d Mon Sep 17 00:00:00 2001 From: Ali Salehi Date: Thu, 8 May 2025 09:07:29 +0200 Subject: [PATCH 26/26] Add bison to ubuntu package list. --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c2e46fca..03258658 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,7 +16,7 @@ jobs: - name: Install system packages uses: ConorMacBride/install-package@v1 with: - apt: ^libxcb.*-dev libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf automake autoconf-archive libtool libltdl-dev + apt: ^libxcb.*-dev libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev autoconf automake autoconf-archive libtool libltdl-dev bison - uses: lukka/get-cmake@latest - name: Install dependencies # saves / restores cache to avoid rebuilding dependencies uses: lukka/run-vcpkg@v11