diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b5fe80b..13e61b8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,37 +9,37 @@ on: jobs: deploy_11_3: - uses: ./.github/workflows/ci.yml + uses: ./.github/workflows/package_and_upload.yml with: version: "11.3" secrets: inherit deploy_12_2: - uses: ./.github/workflows/ci.yml + uses: ./.github/workflows/package_and_upload.yml with: version: "12.2" secrets: inherit deploy_12_3: - uses: ./.github/workflows/ci.yml + uses: ./.github/workflows/package_and_upload.yml with: version: "12.3" secrets: inherit deploy_13_2: - uses: ./.github/workflows/ci.yml + uses: ./.github/workflows/package_and_upload.yml with: version: "13.2" secrets: inherit deploy_13_3: - uses: ./.github/workflows/ci.yml + uses: ./.github/workflows/package_and_upload.yml with: version: "13.3" secrets: inherit deploy_14_2: - uses: ./.github/workflows/ci.yml + uses: ./.github/workflows/package_and_upload.yml with: version: "14.2" secrets: inherit diff --git a/.github/workflows/ci.yml b/.github/workflows/package_and_upload.yml similarity index 75% rename from .github/workflows/ci.yml rename to .github/workflows/package_and_upload.yml index 1684bd9..416ffed 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/package_and_upload.yml @@ -1,4 +1,4 @@ -name: 🚀 deploy +name: 📦 Package & Upload on: workflow_call: @@ -12,9 +12,11 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-24.04, macos-15, windows-2022] + os: [ubuntu-latest, macos-latest, windows-latest] runs-on: ${{ matrix.os }} + env: + VERBOSE: 1 steps: - uses: actions/checkout@v2 with: @@ -41,23 +43,17 @@ jobs: run: conan create prebuilt --version=${{ inputs.version }} - name: 🏗️ Build Demos Conan Package - if: ${{ runner.os != 'Windows' }} - working-directory: prebuilt/demo - run: VERBOSE=1 conan build . -pr profile -s compiler.version="${{ inputs.version }}" - - - name: 🏗️ Build Demos Conan Package - if: ${{ runner.os == 'Windows' }} working-directory: prebuilt/demo run: conan build . -pr profile -s compiler.version="${{ inputs.version }}" - name: 📡 Sign into JFrog Artifactory - if: ${{ github.ref == 'refs/heads/main' && startsWith(matrix.os, 'ubuntu-') }} + if: ${{ startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu-') }} env: PASSWORD: ${{ secrets.JFROG_LIBHAL_TRUNK_ID_TOKEN }} JFROG_USER: ${{ secrets.JFROG_LIBHAL_TRUNK_ID_TOKEN_USER }} run: conan remote login -p $PASSWORD libhal-trunk $JFROG_USER - name: 🆙 Upload `prebuilt-picolibc` to `libhal-trunk` repo - if: ${{ github.ref == 'refs/heads/main' && startsWith(matrix.os, 'ubuntu-') }} + if: ${{ startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu-') }} run: | conan upload "prebuilt-picolibc/*" --only-recipe --confirm -r=libhal-trunk diff --git a/flag_test_pkg/conanfile.py b/flag_test_pkg/conanfile.py deleted file mode 100644 index 4986d95..0000000 --- a/flag_test_pkg/conanfile.py +++ /dev/null @@ -1,60 +0,0 @@ -from conan import ConanFile -from conan.errors import ConanInvalidConfiguration - -required_conan_version = ">=2.0.6" - - -class Picolibc(ConanFile): - name = "picolibc" - version = "0.0.1" - settings = "os", "arch", "compiler", "build_type" - package_type = "static-library" - short_paths = True - options = { - "crt0": [ - "semihost", - "hosted", - "minimal", - ] - } - default_options = { - "crt0": "semihost", - } - - @property - def _link_flags(self): - return ["--specs=/path/to/picolibc.specs", - f"--oslib={str(self.options.crt0)}"] - - def package_id(self): - self.info.clear() - - def validate(self): - if ( - self.settings.compiler == "gcc" and - self.settings.compiler.get_safe("libc") != "picolibc" - ): - raise ConanInvalidConfiguration( - "settings.compiler.libc must be set to picolibc to use this package!") - - def source(self): - pass - - def build(self): - pass - - def package(self): - pass - - def package_info(self): - self.cpp_info.set_property("cmake_target_name", "picolibc") - self.cpp_info.libs = [] - self.cpp_info.includedirs = [] - self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] - self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] - self.cpp_info.exelinkflags = self._link_flags - - self.output.info(f"link flags: {self._link_flags}") - self.output.info(f"crt0: {str(self.options.crt0)}") diff --git a/prebuilt/conanfile.py b/prebuilt/conanfile.py index e5af1b8..9ec5837 100644 --- a/prebuilt/conanfile.py +++ b/prebuilt/conanfile.py @@ -1,6 +1,6 @@ from conan import ConanFile -from conan.tools.files import get, copy -import os +from conan.tools.files import get +from pathlib import Path required_conan_version = ">=2.0.6" @@ -10,7 +10,6 @@ class PrebuiltPicolibc(ConanFile): settings = "os", "arch", "compiler", "build_type" package_type = "static-library" build_policy = "missing" - short_paths = True options = { "crt0": [ "semihost", @@ -25,19 +24,10 @@ class PrebuiltPicolibc(ConanFile): def package_id(self): self.info.clear() - def build(self): + def package(self): get(self, **self.conan_data["sources"][self.version], - destination=self.build_folder) - - def package(self): - destination = os.path.join(self.package_folder, "") - copy(self, pattern="arm-none-eabi/*", src=self.build_folder, - dst=destination, keep_path=True) - copy(self, pattern="bin/*", src=self.build_folder, - dst=destination, keep_path=True) - copy(self, pattern="lib/*", src=self.build_folder, - dst=destination, keep_path=True) + destination=self.package_folder) def package_info(self): self.cpp_info.set_property("cmake_target_name", "picolibc") @@ -49,7 +39,7 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] - short_to_long_version = { + SHORT_TO_LONG_VERSION = { "11.3": "11.3.1", "12.2": "12.2.1", "12.3": "12.3.1", @@ -57,14 +47,14 @@ def package_info(self): "13.3": "13.3.1", "14.2": "14.2.1", } - long_version = short_to_long_version[self.version] - specs_path = f"lib/gcc/arm-none-eabi/{long_version}/picolibcpp.specs" - prefix = os.path.join(self.package_folder, 'arm-none-eabi') - picolibcpp_specs = os.path.join(self.package_folder, specs_path) + LONG_VERSION = SHORT_TO_LONG_VERSION[self.version] + PREFIX = Path(self.package_folder) / 'arm-none-eabi' + PICOLIB_CPP_SPECS = Path(self.package_folder) / 'lib' / 'gcc' / \ + 'arm-none-eabi' / LONG_VERSION / 'picolibcpp.specs' self.cpp_info.exelinkflags = [ - f"-specs={picolibcpp_specs}", - f"--picolibc-prefix={prefix}", + f"-specs={PICOLIB_CPP_SPECS}", + f"--picolibc-prefix={PREFIX}", f"-oslib={str(self.options.crt0)}", ] diff --git a/prebuilt/demo/conanfile.py b/prebuilt/demo/conanfile.py index f6b0afa..b3e1314 100644 --- a/prebuilt/demo/conanfile.py +++ b/prebuilt/demo/conanfile.py @@ -8,8 +8,6 @@ class Demo(ConanFile): def build_requirements(self): self.tool_requires("cmake/3.27.1") - self.tool_requires( - f"arm-gnu-toolchain/{self.settings.compiler.version}") def requirements(self): self.requires(f"prebuilt-picolibc/{self.settings.compiler.version}") diff --git a/prebuilt/demo/main.cpp b/prebuilt/demo/main.cpp index 871b2eb..9e55aca 100644 --- a/prebuilt/demo/main.cpp +++ b/prebuilt/demo/main.cpp @@ -1,4 +1,6 @@ #include +#include +#include int main() diff --git a/prebuilt/demo/profile b/prebuilt/demo/profile index 09200c7..a45de9f 100644 --- a/prebuilt/demo/profile +++ b/prebuilt/demo/profile @@ -1,8 +1,11 @@ [settings] build_type=MinSizeRel compiler=gcc -compiler.cppstd=20 +compiler.cppstd=23 compiler.libcxx=libstdc++ -compiler.version=12.2 +compiler.version=14.2 arch=cortex-m4f os=baremetal + +[tool_requires] +arm-gnu-toolchain/14.2