Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
875e857
Use vcpkg to resolve all packages.
lordhippo Mar 4, 2024
c8d45ed
Revert "Disable broken Windows pipeline"
lordhippo Mar 4, 2024
9f54266
Fix the CI script.
lordhippo Mar 4, 2024
45fdccc
Fixing linux and mac CI jobs.
lordhippo Mar 4, 2024
2b5b0ab
Add the vcpkg commit sha back.
lordhippo Mar 4, 2024
b0a6835
Add mac and linux cmake presets.
lordhippo Mar 4, 2024
a1eb87a
Install necessary mac and linux system packages.
lordhippo Mar 4, 2024
f6e3d24
Fixed a syntax error in CI script.
lordhippo Mar 4, 2024
0ccd80e
Install python 3.11 for meson to work.
lordhippo Mar 4, 2024
952a883
Use a vartype commit that fixes the pch issue.
lordhippo Mar 4, 2024
608a0b1
Fixed installation and packaging.
lordhippo Mar 4, 2024
ccf5d8c
Add windows auto-release.
lordhippo Mar 4, 2024
819d479
Add the missing package step and preset.
lordhippo Mar 4, 2024
3729625
Remove the unnecessary CMP0071.
lordhippo Mar 5, 2024
6767d5a
Remove older linux and mac CI targets.
lordhippo Mar 5, 2024
4c5624b
Fixed windows release path in CI.
lordhippo Mar 5, 2024
5a0e39b
Package linux and mac builds.
lordhippo Mar 5, 2024
4edf2aa
Add release steps for mac and linux.
lordhippo Mar 5, 2024
554eb9d
Fixed mac and linux release paths.
lordhippo Mar 5, 2024
cc42add
Fix clion cmake presets issue.
lordhippo May 18, 2024
6cfee3d
Update geometry proto and set more fields.
lordhippo May 19, 2024
c1ef61d
Add msaa and fix field line flickering.
lordhippo Jul 13, 2024
244d217
Use actual time instead of sim time for frame times.
lordhippo May 7, 2025
3121487
Update vcpkg.
lordhippo May 7, 2025
51c454c
Install linux package tools needed for libxcrypt.
lordhippo May 8, 2025
aaa3e17
Add bison to ubuntu package list.
lordhippo May 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 78 additions & 49 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,93 @@
name: Build
on:
push:
tags:
- 'v*'
branches:
- master
pull_request:
workflow_dispatch:

jobs:
build-linux:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04 ]
runs-on: ubuntu-latest
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
- 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 bison
- uses: lukka/get-cmake@latest
- name: Install dependencies # saves / restores cache to avoid rebuilding dependencies
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ce613c41372b23b1f51333815feb3edd87ef8a8b
- name: Run CMake and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: "linux-release"
buildPreset: "linux-release"
packagePreset: "linux-release"
- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: "out/build/linux-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-12, macos-13 ]
runs-on: macos-latest
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
- 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
with:
vcpkgGitCommitId: ce613c41372b23b1f51333815feb3edd87ef8a8b
- name: Run CMake and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: "macos-release"
buildPreset: "macos-release"
packagePreset: "macos-release"
- name: Release
uses: softprops/[email protected]
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: "out/build/macos-release/dist/*"
fail_on_unmatched_files: true
generate_release_notes: true

# 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
- uses: lukka/get-cmake@latest
- name: Install dependencies # saves / restores cache to avoid rebuilding dependencies
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: ce613c41372b23b1f51333815feb3edd87ef8a8b
- name: Run CMake and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: "windows-release"
buildPreset: "windows-release"
packagePreset: "windows-release"
- name: Release
uses: softprops/[email protected]
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
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
.DS_STORE
build*/*
dist/*
bin*/*
*.user
*.swp
Thumbs.db
.idea/*
*.iml
cmake-build-debug
cmake-build-release
out
121 changes: 18 additions & 103 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,37 +1,16 @@
cmake_minimum_required(VERSION 3.5)

cmake_minimum_required(VERSION 3.25)

## Project branding, version and package mantainer
project(grSim)
set(VERSION "1.0.0a2")
#set(VENDOR "Parsian")
set(MAINTAINER "Mani Monajjemi <[email protected]>")


# 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)

# 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()

# 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(<target> external_proj)
add_executable(${app} "")
set(CMAKE_AUTOMOC YES)
set(CMAKE_INCLUDE_CURRENT_DIR YES)

# definitions for knowing the OS from the code
if(MSVC)
Expand All @@ -51,105 +30,40 @@ 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
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=<INSTALL_DIR>")
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
"<INSTALL_DIR>/${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
Expand Down Expand Up @@ -240,10 +154,11 @@ set(srcs
file(GLOB CONFIG_FILES "config/*.ini")
set_source_files_properties(${CONFIG_FILES} PROPERTIES MACOSX_PACKAGE_LOCATION "config")

target_sources(${app} PRIVATE ${srcs})
install(TARGETS ${app} DESTINATION bin)
set(app ${CMAKE_PROJECT_NAME})
add_executable(${app} ${srcs})
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")
Expand All @@ -260,7 +175,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()
Expand All @@ -287,9 +202,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})
Expand Down
Loading
Loading