Skip to content

Commit

Permalink
Update to conan2 (#86)
Browse files Browse the repository at this point in the history
* Update to conan2

* Avoid building image library

* Fix build errors

* Update pipeline to build with conan2

Also make it simpler for now

* Temporarily disable tests

* Use correct glfw link target

* Avoid boost using deprecated functions on mac

* Disable metal texture as image library is disabled

* Update gtest to 1.15.0

* Simplify and move build script to own file

* Rename profiles to reflect pipeline's os variable

* Change build.sh permissions

* Simplify pipeline and add debug messages to build.sh

* Remove extra pagoda directory

* Change plugin test to use cmake generators

* Show ctest output on failure

* Dont run pgscript tests on windows

* Dont run tests on windows

---------

Co-authored-by: Diego Jesus <diego@fedora.tail2e39f.ts.net>
Co-authored-by: Diego <diego@localhost.localdomain>
Co-authored-by: Diego Jesus <diego.a.r.js@gmail.com>
  • Loading branch information
4 people authored Aug 27, 2024
1 parent 0b22d4a commit b5a85fd
Show file tree
Hide file tree
Showing 50 changed files with 439 additions and 473 deletions.
167 changes: 18 additions & 149 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,88 +10,36 @@ jobs:
matrix:
config:
- {
name: "Ubuntu-gcc",
name: "Linux",
os: ubuntu-latest,
set_path: "export PATH=$PATH:/home/runner/.local/bin",
conan_profile: './tools/profiles/ubuntu_gcc_Release_gh.txt',
cc: "gcc-9",
cxx: "g++-9"
compiler: "gcc",
build_script: "build.sh"
}
- {
name: "Ubuntu-clang",
os: ubuntu-latest,
set_path: "export PATH=$PATH:/home/runner/.local/bin",
conan_profile: './tools/profiles/ubuntu_clang_Release_gh.txt',
cc: "clang",
cxx: "clang++"
}
- {
name: "macOs-clang",
name: "macOS",
os: macos-latest,
set_path: "",
conan_profile: './tools/profiles/macos_clang_Release_gh.txt',
cc: "clang",
cxx: "clang++"
compiler: "clang",
build_script: "build.sh"
}
- {
name: "Windows-msvc",
os: windows-2019,
set_path: "",
conan_profile: './tools/profiles/win_msvc_Release_gh.txt',
cc: "",
cxx: ""
name: "Windows",
os: windows-latest,
compiler: "msvc",
build_script: "build.bat"
}
steps:
- name: Check out repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'pagoda'

- name: Download and Install Dependencies
run: |
pip3 install wheel setuptools numpy
pip3 install conan==1.58.0
- name: Download and Install Dependencies (Ubuntu)
if: ${{ contains(matrix.config.os, 'Ubuntu') }}
run: |
sudo apt-get install -y libgl1-mesa-dev libglu1-mesa-dev build-essential
- name: Configure and Build
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
CONAN_SYSREQUIRES_MODE: "enabled"
run: |
${{ matrix.config.set_path }}
pushd ${{ github.workspace }}/pagoda
git submodule update --init --recursive
popd
conan install -if ${{ github.workspace }}/build -pr ${{ github.workspace}}/pagoda/${{ matrix.config.conan_profile }} ${{ github.workspace }}/pagoda --build=missing
conan build -bf ${{ github.workspace }}/build ${{ github.workspace }}/pagoda
- name: Build
run: ${{ github.workspace }}/pagoda/${{ matrix.config.build_script}} ${{ github.workspace }} ${{ matrix.config.OS }} ${{ matrix.config.compiler }}

- name: Run tests
run: |
cd build
ctest -C Release
- name: Create package
run: |
${{ matrix.config.set_path }}
conan package -bf ${{ github.workspace }}/build -pf ${{ github.workspace }}/build/pagoda ${{ github.workspace }}/pagoda
- name: Pack Build Results
if: always()
shell: cmake -P {0}
run: |
execute_process(COMMAND ${CMAKE_COMMAND}
-E tar cJfv "build-results-${{ matrix.config.name }}.tar.xz" "./")
- name: Upload Build Results
if: always()
uses: actions/upload-artifact@v1
with:
path: ./build-results-${{ matrix.config.name }}.tar.xz
name: build-results-${{ matrix.config.name }}.tar.xz
ctest -C Release --output-on-failure
- name: Install
run: |
Expand All @@ -102,89 +50,10 @@ jobs:
shell: cmake -P {0}
run: |
execute_process(COMMAND ${CMAKE_COMMAND}
-E tar cJfv "${{ matrix.config.name }}.tar.xz" "${{ github.workspace }}/build/pagoda")
-E tar cJfv "pagoda-${{ github.ref_name }}-${{ matrix.config.name }}.tar.xz" "${{ github.workspace }}/build/pagoda")
- name: Upload
uses: actions/upload-artifact@v1
with:
path: ./${{ matrix.config.name }}.tar.xz
name: ${{ matrix.config.name }}.tar.xz

release:
if: contains(github.ref, 'tags/v')
runs-on: ubuntu-latest
needs: build

steps:
- name: Create Release
id: create_release
uses: actions/create-release@v1.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Store Release url
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > ./upload_url
- uses: actions/upload-artifact@v1
with:
path: ./upload_url
name: upload_url

publish:
if: contains(github.ref, 'tags/v')
runs-on: ${{ matrix.config.os }}
needs: release
strategy:
fail-fast: false
matrix:
config:
- {
name: "Ubuntu-gcc",
os: ubuntu-latest,
}
- {
name: "Ubuntu-clang",
os: ubuntu-latest,
}
- {
name: "macOs-clang",
os: ubuntu-latest,
}
- {
name: "Windows-msvc",
os: windows-latest,
}

steps:
- name: Download artifact
uses: actions/download-artifact@v1
with:
name: ${{ matrix.config.name }}.tar.xz
path: ./

- name: Download URL
uses: actions/download-artifact@v1
with:
name: upload_url
path: ./
- id: set_upload_url
run: |
upload_url=`cat ./upload_url`
echo ::set-output name=upload_url::$upload_url
- name: Upload to Release
id: upload_to_release
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: actions/upload-artifact@v4
with:
upload_url: ${{ steps.set_upload_url.outputs.upload_url }}
asset_path: ./${{ matrix.config.name }}.tar.xz
asset_name: ${{ matrix.config.name }}.tar.xz
asset_content_type: application/x-gtar
path: ./pagoda-${{ github.ref_name }}-${{ matrix.config.name }}.tar.xz
name: pagoda-${{ github.ref_name }}-${{ matrix.config.name }}.tar.xz
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0091 NEW)

set(version 0.1.0)

cmake_minimum_required(VERSION 3.30.0 FATAL_ERROR)
project("Pagoda" LANGUAGES CXX VERSION ${version})
cmake_minimum_required(VERSION 3.11.0 FATAL_ERROR)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_BINARY_DIR}")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")



include("Pagoda")
include("WGS84toCartesian")

Expand Down
47 changes: 47 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@echo off

set WORKSPACE=%1%
set OS=%2%
set COMPILER=%3%

set PY_VENV=%WORKSPACE%\buildenv
set PAGODA_ROOT=%WORKSPACE%\pagoda
set BUILD_ROOT=%WORKSPACE%\build

set CONAN_PROFILE_ROOT=%PAGODA_ROOT%\tools\profiles
set CONAN_PROFILE=%CONAN_PROFILE_ROOT%\%OS%_%COMPILER%_Release_gh.txt

echo "########################################"
echo "Running build.sh"
echo " workspace: %WORKSPACE%"
echo " os: %OS%"
echo " compiler: %COMPILER%"
echo " venv: %PY_VENV%"
echo " pagoda root: %PAGODA_ROOT%"
echo " profile root: %CONAN_PROFILE_ROOT%"
echo " profile: %CONAN_PROFILE%"
echo " build root: %BUILD_ROOT%"
echo "########################################"

REM ----------------------------------------
REM install dependencies
REM ----------------------------------------
pip3 install wheel setuptools numpy
pip3 install -r %WORKSPACE%/pagoda/requirements.txt

REM ----------------------------------------
REM install conan dependencies
REM ----------------------------------------
git -C %PAGODA_ROOT% submodule update --init --recursive
conan install ^
--profile:build=%CONAN_PROFILE% ^
--profile:host=%CONAN_PROFILE% ^
-of %BUILD_ROOT% ^
%PAGODA_ROOT% ^
--build=missing

REM ----------------------------------------
REM Build Pagoda
REM ----------------------------------------
cmake -S %PAGODA_ROOT% --preset conan-default
cmake --build %BUILD_ROOT% --config Release -j 24
49 changes: 49 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh

WORKSPACE=${1}
OS=${2}
COMPILER=${3}

PY_VENV=${WORKSPACE}/buildenv
PAGODA_ROOT=${WORKSPACE}/pagoda
BUILD_ROOT=${WORKSPACE}/build

CONAN_PROFILE_ROOT=${PAGODA_ROOT}/tools/profiles
CONAN_PROFILE=${CONAN_PROFILE_ROOT}/${OS}_${COMPILER}_Release_gh.txt

echo "########################################"
echo "Running build.sh"
echo " workspace: ${WORKSPACE}"
echo " os: ${OS}"
echo " compiler: ${COMPILER}"
echo " venv: ${PY_VENV}"
echo " pagoda root: ${PAGODA_ROOT}"
echo " profile root: ${CONAN_PROFILE_ROOT}"
echo " profile: ${CONAN_PROFILE}"
echo " build root: ${BUILD_ROOT}"
echo "########################################"

#----------------------------------------
# install dependencies
#----------------------------------------
python3 -m venv ${PY_VENV}
source ${PY_VENV}/bin/activate
pip3 install wheel setuptools numpy
pip3 install -r ${WORKSPACE}/pagoda/requirements.txt

#----------------------------------------
# install conan dependencies
#----------------------------------------
git -C ${PAGODA_ROOT} submodule update --init --recursive
conan install \
--profile:build=${CONAN_PROFILE} \
--profile:host=${CONAN_PROFILE} \
-of ${BUILD_ROOT} \
${PAGODA_ROOT} \
--build=missing

#----------------------------------------
# Build Pagoda
#----------------------------------------
cmake -S${PAGODA_ROOT} --preset conan-release
cmake --build ${BUILD_ROOT} -j 24
6 changes: 2 additions & 4 deletions cmake/Pagoda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ function (add_pagoda_build_unit)
# Shared libraries
$<$<BOOL:${PAGODA_SHARED_LIB}>:PAGODA_SHARED_LIB>
${PARSED_ARGS_COMPILE_DEFINITIONS}
# Prevent boost from using deprecated functions on Mac
$<$<PLATFORM_ID:Darwin>:BOOST_NO_CXX98_FUNCTION_BASE>
)

set_target_properties(${PARSED_ARGS_NAME}
Expand Down Expand Up @@ -401,10 +403,6 @@ function (add_unit_test unit_test_src)
get_filename_component(unit_test_base_name ${unit_test_src} NAME)
string(REPLACE ".test.cpp" "_test" test_name ${unit_test_base_name})
set(unit_test_libs GTest::gtest GTest::gtest_main)

add_pagoda_executable(
NAME ${test_name}
SOURCES ${unit_test_src}
DEPENDENCIES ${unit_test_libs}
)

Expand Down
23 changes: 16 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
from conans import tools, ConanFile, CMake
from conan import ConanFile
from conan.tools.files import save, load
from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps
from conan.tools.microsoft import unix_path, VCVars, is_msvc
from conan.errors import ConanInvalidConfiguration
from conan.errors import ConanException


import os

Expand All @@ -18,23 +24,26 @@ class Pagoda(ConanFile):
options = {
"shared" : [True, False],
}
default_options = (
"shared=False",
"imgui:shared=True"
default_options = {
"shared":False,
"imgui/*:shared":True
}
generators = (
"CMakeDeps",
"CMakeToolchain"
)
generators = "cmake_find_package"
exports_sources = "*"


def requirements(self):
self.requires("boost/1.73.0")
self.requires("gtest/1.10.0")
self.requires("gtest/1.15.0")
self.requires("libpng/1.6.37")
self.requires("nlohmann_json/3.9.1")
self.requires("openssl/1.1.1k", override=True)
self.requires("zlib/1.2.12", override=True)
self.requires("bzip2/1.0.8")
self.requires("entt/3.6.0")
self.requires("entt/3.13.2")
self.requires("libffi/3.4.4", override=True)
self.requires("fmt/8.1.1")
self.requires("magic_enum/0.9.5")
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
wheel
setuptools
numpy
conan==2.6.0
cmake==3.30.2
Loading

0 comments on commit b5a85fd

Please sign in to comment.