-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[symengine] conan v2 support #14872
Merged
conan-center-bot
merged 12 commits into
conan-io:master
from
cqc-alec:package/symengine-conan2
Jan 28, 2023
Merged
[symengine] conan v2 support #14872
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
a5111e2
[symengine] conan v2 support
cqc-alec 396d13a
Remove unused import.
cqc-alec 6f27876
Relax conan version requirement.
cqc-alec bc328ac
Restore old `test_package` directory renamed to `test_v1_package`.
cqc-alec 5d9602a
Remove files unwanted for packaging.
cqc-alec 6a0d809
Search for files recursively.
cqc-alec 04fc4fd
Restore line accidentally missed out.
cqc-alec cbbb24e
Specify C++11 in test package.
cqc-alec 3a2c756
Add "m" to system libs on Linux.
cqc-alec 33a6bdd
Use latest boost version.
cqc-alec 1dcc7fa
Format with black.
cqc-alec 1f66bc8
Set CMAKE_CXX_STANDARD using CMakeToolChain.
cqc-alec File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
from conans import ConanFile, CMake, tools | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "VirtualRunEnv" | ||
test_type = "explicit" | ||
|
||
def layout(self): | ||
cmake_layout(self) | ||
|
||
def requirements(self): | ||
self.requires(self.tested_reference_str) | ||
|
||
def generate(self): | ||
tc = CMakeToolchain(self) | ||
tc.variables["CMAKE_CXX_STANDARD"] = "11" | ||
tc.generate() | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.definitions["CMAKE_CXX_STANDARD"] = "11" | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) | ||
if can_run(self): | ||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(symengine REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE symengine::symengine) # FIXME: Replace `symengine::symengine` with `symengine` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It would need a new module in the recipe, but no problem skipping it for now. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake", "cmake_find_package_multi" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.definitions["CMAKE_CXX_STANDARD"] = "11" | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self): | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run(bin_path, run_environment=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <symengine/constants.h> | ||
#include <symengine/expression.h> | ||
#include <symengine/integer.h> | ||
#include <symengine/mul.h> | ||
|
||
#include <iostream> | ||
|
||
int main() { | ||
SymEngine::Expression pi_by_12 = | ||
SymEngine::div(SymEngine::pi, SymEngine::integer(12)); | ||
std::cout << pi_by_12 << std::endl; | ||
return 0; | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually we set it directly in the cmake file with
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
But no problem using here instead.