Skip to content

Commit

Permalink
Conan - Better Conan File
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Jan 4, 2024
1 parent fd452b3 commit 3237b4d
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 41 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ jobs:
conan config install settings_user.yml
- name: "Install Conan"
run: |
mv conan/conanfile-linux.txt conanfile.txt
mv conan/conanfile.py conanfile.py
mv conan/conanprofile-linux.txt conanprofile.txt
conan install conanfile.txt --profile:host=conanprofile.txt --profile:build=conanprofile.txt -s compiler.cppstd=20 --build=missing
conan install conanfile.py --profile:host=conanprofile.txt --profile:build=conanprofile.txt -s compiler.cppstd=20 --build=missing
- name: "CMake Build"
working-directory: ${{github.workspace}}/build
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ jobs:
uses: turtlebrowser/get-conan@main
- name: "Install Conan"
run: |
move conan/conanfile-windows.txt conanfile.txt
move conan/conanfile.py conanfile.py
move conan/conanprofile-windows.txt conanprofile.txt
conan install conanfile.txt --profile:host=conanprofile.txt --profile:build=conanprofile.txt -s compiler.cppstd=20 --build=missing
conan install conanfile.py --profile:host=conanprofile.txt --profile:build=conanprofile.txt -s compiler.cppstd=20 --build=missing
- name: "CMake Build"
working-directory: ${{github.workspace}}/build
run: |
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ A C++20 compiler is also required to build libaura.
Visual Studio 2022 with C++ Desktop workload is required to be installed.

1. First, clone/download the repo.
1. From the `conan` folder within the repo, copy `conanfile-windows.txt` and `conanprofile-windows.txt` to the root directory of the repo.
1. From the `conan` folder within the repo, copy `conanfile.py` and `conanprofile-windows.txt` to the root directory of the repo.
1. Open a terminal and navigate to the repo's root directory.
1. Run `conan install conanfile-windows.txt --profile:host=conanprofile-windows.txt --profile:build=conanprofile-windows.txt -s compiler.cppstd=20 --build=missing`.
1. Run `conan install conanfile.py --profile:host=conanprofile-windows.txt --profile:build=conanprofile-windows.txt -s compiler.cppstd=20 --build=missing`.
1. Once that command finishes, cd into the `build` folder.
1. From the `build` folder, run `cmake .. -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake"`.
- To skip building libaura's test suite, add `-DBUILD_TESTING="Off"` to the end of the command.
Expand All @@ -37,11 +37,11 @@ Visual Studio 2022 with C++ Desktop workload is required to be installed.

### Linux
1. First, clone/download the repo.
1. From the `conan` folder within the repo, copy `conansettings.yml`, `conanfile-linux.txt`, and `conanprofile-linux.txt` to the root directory of the repo.
1. From the `conan` folder within the repo, copy `conansettings.yml`, `conanfile.py`, and `conanprofile-linux.txt` to the root directory of the repo.
1. Rename `conansettings.yml` to `settings_user.yml`.
1. Open a terminal and navigate to the repo's root directory.
1. Run `conan config install settings_user.yml`.
1. Run `conan install conanfile-linux.txt --profile:host=conanprofile-linux.txt --profile:build=conanprofile-linux.txt -s compiler.cppstd=20 --build=missing`.
1. Run `conan install conanfile.py --profile:host=conanprofile-linux.txt --profile:build=conanprofile-linux.txt -s compiler.cppstd=20 --build=missing`.
1. Once that command finished, cd into the `build` folder.
1. From the `build` folder, run `cmake .. -DCMAKE_TOOLCHAIN_FILE="Release/generators/conan_toolchain.cmake" -DCMAKE_BUILD_TYPE=Release`.
- To skip building libaura's test suite, add `-DBUILD_TESTING="Off"` to the end of the command.
Expand Down
18 changes: 0 additions & 18 deletions conan/conanfile-linux.txt

This file was deleted.

15 changes: 0 additions & 15 deletions conan/conanfile-windows.txt

This file was deleted.

31 changes: 31 additions & 0 deletions conan/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os

from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
from conan.tools.cmake import cmake_layout
from conan.tools.build import check_min_cppstd

class libauraRecipe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "CMakeToolchain", "CMakeDeps"

def validate(self):
check_min_cppstd(self, "20")
if self.settings.os != "Windows" and self.settings.os != "Linux":
raise ConanInvalidConfiguration("Only Windows and Linux are supported by libaura.")

def requirements(self):
self.requires("boost/1.83.0")
self.requires("gtest/1.14.0")
self.requires("jsoncpp/1.9.5")
self.requires("libcurl/8.4.0")
self.requires("libgettext/0.22")
self.requires("maddy/1.3.0")
self.requires("sqlcipher/4.5.1")
if self.settings.os == "Linux":
self.requires("glib/2.78.1")
self.requires("libsecret/0.20.5")
self.requires("libuuid/1.0.3")

def layout(self):
cmake_layout(self)

0 comments on commit 3237b4d

Please sign in to comment.