Skip to content

Commit

Permalink
Use conan standard way to build unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Sep 13, 2024
1 parent 2ea3243 commit d04e241
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
install_system_dependencies: true

- name: Install dependencies and build unit test
run: conan build . -o enable_testing=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv
run: conan build . -o enable_testing=True -s build_type=Release --build=missing --update -g GitHubActionsRunEnv -g GitHubActionsBuildEnv -c tools.build:skip_test=false

- name: Run Unit Test
id: run-test
Expand Down
10 changes: 4 additions & 6 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@ class SavitarConan(ConanFile):

options = {
"shared": [True, False],
"fPIC": [True, False],
"enable_testing": [True, False]
"fPIC": [True, False]
}
default_options = {
"shared": True,
"fPIC": True,
"enable_testing": False
"fPIC": True
}

def set_version(self):
Expand Down Expand Up @@ -86,7 +84,7 @@ def validate(self):

def build_requirements(self):
self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/cura_11622") # FIXME: use stable after merge
if self.options.enable_testing:
if not self.conf.get("tools.build:skip_test", False, check_type=bool):
self.test_requires("gtest/1.14.0")

def config_options(self):
Expand All @@ -102,7 +100,7 @@ def generate(self):
if is_msvc(self):
tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self)
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW"
tc.variables["ENABLE_TESTING"] = self.options.enable_testing
tc.variables["ENABLE_TESTING"] = not self.conf.get("tools.build:skip_test", False, check_type=bool)
tc.generate()

tc = CMakeDeps(self)
Expand Down

0 comments on commit d04e241

Please sign in to comment.