diff --git a/.github/workflows/windows-config/action.yml b/.github/workflows/windows-config/action.yml new file mode 100644 index 0000000000..23f16615e4 --- /dev/null +++ b/.github/workflows/windows-config/action.yml @@ -0,0 +1,51 @@ +name: windows-config +description: configure windows +inputs: + arch: + required: true + type: choice + options: + - x86 + - x64 + +runs: + using: "composite" + steps: + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: deps\vcpkg\cache\windows + key: windows-${{ inputs.arch }}-${{ hashFiles('.github\workflows\windows-config\action.yml', 'deps\vcpkg\manifest\vcpkg.json') }} + + - name: Setup msbuild + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ inputs.arch }} + + - name: Fix vcpkg + shell: cmd + run: vcpkg.exe integrate remove + + - name: Clone vcpkg + shell: cmd + run: | + git clone https://github.com/microsoft/vcpkg/ + + - name: Configure Gazebo + shell: cmd + run: | + set VCPKG_BINARY_SOURCES=clear;files,%CD%\deps\vcpkg\cache\windows,readwrite; + cmake . -G Ninja -B build ^ + -DCMAKE_BUILD_TYPE=Release ^ + -DCMAKE_TOOLCHAIN_FILE=vcpkg\scripts\buildsystems\vcpkg.cmake ^ + -DVCPKG_MANIFEST_DIR=deps\vcpkg\manifest ^ + -DVCPKG_OVERLAY_TRIPLETS=deps\vcpkg\triplets ^ + -DVCPKG_INSTALLED_DIR=%CD%\vcpkg\installed ^ + -DVCPKG_TARGET_TRIPLET=${{ inputs.arch }}-windows-release ^ + -DVCPKG_HOST_TRIPLET=${{ inputs.arch }}-windows-release ^ + -DVCPKG_INSTALL_OPTIONS=--clean-after-build ^ + -DUSE_EXTERNAL_TINYXML=ON ^ + -DUSE_EXTERNAL_TINYXML2=ON ^ + -DUSE_EXTERNAL_TINY_PROCESS_LIBRARY=ON ^ + -DGZ_PROTOBUF_USE_CMAKE_CONFIG=ON ^ + -DCMAKE_INSTALL_PREFIX=%CD%\vcpkg\installed\${{ inputs.arch }}-windows-release diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000000..2574370238 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,95 @@ +name: 🪟 Windows-vcpkg +on: + push: + branches: [ gazebo11 ] + pull_request: + branches: [ gazebo11 ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + config: + name: ${{ matrix.arch }}-config + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - arch: x64 + - arch: x86 + steps: + - uses: actions/checkout@v3 + + - name: Config Gazebo + uses: ./.github/workflows/windows-config/ + with: + arch: ${{ matrix.arch }} + + - name: Prepare logs on failure + if: failure() + shell: cmd + run: | + 7z a -t7z -r -mx=9 logs.7z ^ + vcpkg/buildtrees/*.log + + - name: Upload logs on failure + if: failure() + uses: actions/upload-artifact@v3 + with: + name: windows_logs_${{matrix.arch}}_${{github.event.pull_request.head.sha}} + path: logs.7z + + build: + name: ${{ matrix.arch }}-build + needs: config + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + include: + - arch: x64 + - arch: x86 + steps: + - uses: actions/checkout@v3 + + - name: Config Gazebo + uses: ./.github/workflows/windows-config/ + with: + arch: ${{ matrix.arch }} + + - name: Build Gazebo + shell: cmd + run: | + set /a proc=%NUMBER_OF_PROCESSORS% + echo proc=%proc% + cmake --build build --config Release -j %proc% + + - name: Install Gazebo + shell: cmd + run: | + cmake --install build --config Release + + - name: Tests suite compilation + shell: cmd + run: | + echo compile and run tests here + + - name: Prepare logs on failure + if: failure() + shell: cmd + run: | + 7z a -t7z -r -mx=9 logs.7z ^ + vcpkg/buildtrees/*.log ^ + build/.ninja_log ^ + build/build.ninja ^ + build/install_manifest.txt ^ + build/vcpkg-manifest-install.log + + - name: Upload logs on failure + if: failure() + uses: actions/upload-artifact@v3 + with: + name: windows_logs_${{matrix.arch}}_${{github.event.pull_request.head.sha}} + path: logs.7z diff --git a/.gitignore b/.gitignore index e5bb58bdc7..c8d0306268 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ build build_* build-* Ogre.log +deps/vcpkg/cache .DS_Store *.swp *.orig diff --git a/CMakeLists.txt b/CMakeLists.txt index 90780f5ca0..5c45dcce27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -193,7 +193,7 @@ set(GAZEBO_MODEL_DATABASE_URI http://models.gazebosim.org) set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR}) # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems when # we pass it to the compiler later. -string(REPLACE "\n" "" OGRE_RESOURCE_PATH ${OGRE_RESOURCE_PATH}) +string(REPLACE "\n" "" OGRE_RESOURCE_PATH "${OGRE_RESOURCE_PATH}") FILE(TO_CMAKE_PATH "${OGRE_RESOURCE_PATH}" OGRE_RESOURCE_PATH) diff --git a/cmake/SearchForStuff.cmake b/cmake/SearchForStuff.cmake index 948cf0a8a1..4f5859781d 100644 --- a/cmake/SearchForStuff.cmake +++ b/cmake/SearchForStuff.cmake @@ -167,6 +167,10 @@ if (PKG_CONFIG_FOUND) find_package(Simbody) if (Simbody_FOUND) message (STATUS "Looking for Simbody - found") + # When simbody is found but it static libs, we need to add it manually. + if ("${Simbody_LIBRARIES}" STREQUAL "" OR "${Simbody_LIBRARIES}" STREQUAL "Simbody_LIBRARIES-NOTFOUND") + set(Simbody_LIBRARIES ${Simbody_STATIC_LIBRARIES}) + endif() set (HAVE_SIMBODY TRUE) else() message (STATUS "Looking for Simbody - not found") @@ -587,9 +591,15 @@ if (PKG_CONFIG_FOUND) if (NOT BULLET_FOUND) pkg_check_modules(BULLET bullet2.82>=2.82) endif() - + if (NOT BULLET_FOUND) + find_package(BULLET CONFIG 2.82) + endif() if (BULLET_FOUND) set (HAVE_BULLET TRUE) + if (${BULLET_VERSION} STREQUAL "") + set (BULLET_VERSION ${BULLET_VERSION_STRING}) + endif() + message (STATUS "Bullet found: " ${BULLET_VERSION}) add_definitions( -DLIBBULLET_VERSION=${BULLET_VERSION} ) else() set (HAVE_BULLET FALSE) diff --git a/deps/vcpkg/cache/linux/.gitkeep b/deps/vcpkg/cache/linux/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/deps/vcpkg/cache/windows/.gitkeep b/deps/vcpkg/cache/windows/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/deps/vcpkg/manifest/vcpkg.json b/deps/vcpkg/manifest/vcpkg.json new file mode 100644 index 0000000000..bb3579ee8a --- /dev/null +++ b/deps/vcpkg/manifest/vcpkg.json @@ -0,0 +1,156 @@ +{ + "name": "gazebo", + "description": "Open source robotics simulator.", + "homepage": "http://gazebosim.org", + "license": "Apache-2.0", + "builtin-baseline": "19af97cba8ca48474e4ad15a24ed50271a9ecdac", + "dependencies": [ + "boost-asio", + "boost-date-time", + "boost-filesystem", + "boost-format", + "boost-interprocess", + "boost-iostreams", + "boost-program-options", + "boost-property-tree", + "boost-regex", + "boost-system", + "boost-thread", + "boost-uuid", + "ccd", + "freeimage", + { + "name": "hdf5", + "features": [ + "cpp" + ] + }, + "ignition-common3", + "ignition-fuel-tools4", + "ignition-math6", + "ignition-msgs5", + "ignition-transport8", + { + "name": "libtar", + "platform": "!windows" + }, + "ogre", + "opengl", + { + "name": "pkgconf", + "host": true + }, + "protobuf", + "qt5-base", + "qwt", + "sdformat9", + "tbb", + "tiny-process-library", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + } + ], + "default-features": [ + "bullet", + "dart", + "ffmpeg", + "gdal", + "graphviz", + "gts", + "libusb", + "openal", + "simbody" + ], + "features": { + "bullet": { + "description": "Use the bullet physics engine", + "dependencies": [ + "bullet3" + ] + }, + "dart": { + "description": "Use the dart physics engine", + "dependencies": [ + "dartsim" + ] + }, + "ffmpeg": { + "description": "Enable audio-video capabilities", + "dependencies": [ + { + "name": "ffmpeg", + "features": [ + "avcodec", + "avformat", + "swscale" + ] + } + ] + }, + "gdal": { + "description": "Enable digital elevation terrains support", + "dependencies": [ + "gdal" + ] + }, + "graphviz": { + "description": "Enable model editor's schematic view", + "dependencies": [ + "graphviz" + ] + }, + "gts": { + "description": "Enable CSG support", + "dependencies": [ + "gts" + ] + }, + "libusb": { + "description": "Enable USB peripheral support", + "dependencies": [ + "libusb" + ] + }, + "openal": { + "description": "Enable audio support", + "dependencies": [ + "openal-soft" + ] + }, + "plugins": { + "description": "Build gazebo plugins", + "supports": "!linux" + }, + "simbody": { + "description": "Use the simbody physics engine", + "dependencies": [ + "simbody" + ] + }, + "tools": { + "description": "Build gazebo tools", + "supports": "!(linux & static)" + } + }, + "overrides": [ + { + "name": "ogre", + "version": "1.12.9", + "port-version": 10 + }, + { + "name": "qwt", + "version": "6.1.5" + }, + { + "name": "graphviz", + "version": "2.49.1", + "port-version": 4 + } + ] +} diff --git a/deps/vcpkg/triplets/x86-windows-release.cmake b/deps/vcpkg/triplets/x86-windows-release.cmake new file mode 100644 index 0000000000..0a277bdb77 --- /dev/null +++ b/deps/vcpkg/triplets/x86-windows-release.cmake @@ -0,0 +1,4 @@ +set(VCPKG_TARGET_ARCHITECTURE x86) +set(VCPKG_CRT_LINKAGE dynamic) +set(VCPKG_LIBRARY_LINKAGE dynamic) +set(VCPKG_BUILD_TYPE release)