Skip to content
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

Feature/add_k230_conan2_compile #1267

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmake/nncaseruntimeConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
include(${CMAKE_CURRENT_LIST_DIR}/nncaseruntimeTargets.cmake)

if(NOT TARGET gsl-lite)
find_package(gsl-lite REQUIRED)
endif()
set(nncaseruntime_INCLUDE_DIRS ${CMAKE_CURRENT_LIST_DIR}/../../../include)
set(nncaseruntime_LIBS ${CMAKE_CURRENT_LIST_DIR}/../../libNncase.Runtime.Native.a)
22 changes: 15 additions & 7 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ class nncaseConan(ConanFile):
"tests": [True, False],
"python": [True, False],
# "vulkan_runtime": [True, False],
"python_root": ["ANY"]
"python_root": ["ANY"],
"op_profile": [True, False],
"dump_mem": [True, False],

}
default_options = {
"shared": False,
Expand All @@ -37,18 +40,21 @@ class nncaseConan(ConanFile):
"tests": False,
"python": True,
# "vulkan_runtime": False,
"python_root": ""
"python_root": "",
"op_profile": False,
"dump_mem": False
}

@property
def _min_cppstd(self):
return 17

def layout(self):
cmake_layout(self)
cmake_layout(self, build_folder="build")

def requirements(self):
self.requires('gsl-lite/0.37.0')
self.requires('nlohmann_json/3.11.3')
if self.options.tests:
self.requires('gtest/1.10.0')
self.requires('ortki/0.0.4')
Expand All @@ -60,9 +66,9 @@ def requirements(self):
self.requires('nethost/8.0.8')
self.requires('fmt/7.1.3')

if not self.options.runtime or self.options.tests:
self.requires('nlohmann_json/3.11.3')
# if not self.options.runtime or self.options.tests:
# self.requires('nlohmann_json/3.11.3')

# if (not self.options.runtime) or self.options.vulkan_runtime:
# self.requires('vulkan-headers/1.2.182')
# self.requires('vulkan-loader/1.2.182')
Expand All @@ -83,12 +89,14 @@ def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, self._min_cppstd)


def generate(self):
tc = CMakeToolchain(self, generator="Ninja")
tc.variables['BUILDING_RUNTIME'] = self.options.runtime
# tc.variables['ENABLE_VULKAN_RUNTIME'] = self.options.vulkan_runtime
tc.variables['BUILD_PYTHON_BINDING'] = self.options.python
tc.variables['BUILD_TESTING'] = self.options.tests
tc.variables['ENABLE_OP_PROFILE'] = self.options.op_profile
tc.variables['ENABLE_DUMP_MEM'] = self.options.dump_mem
if self.options.get_safe("python_root", default="") != "":
tc.variables['Python3_ROOT_DIR'] = str(self.options.python_root).replace('\\', '/')
if self.options.runtime:
Expand Down
13 changes: 13 additions & 0 deletions toolchains/riscv64-k230-linux.profile.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[conf]
tools.cmake.cmaketoolchain:user_toolchain+={{ os.path.join(profile_dir, "k230.linux.toolchain.cmake") }}
tools.cmake.cmaketoolchain:generator=Ninja

[settings]
os=Linux
arch=riscv64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=12

13 changes: 13 additions & 0 deletions toolchains/riscv64-k230-rtos.profile.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[conf]
tools.cmake.cmaketoolchain:user_toolchain+={{ os.path.join(profile_dir, "k230.rtos.toolchain.cmake") }}
tools.cmake.cmaketoolchain:generator=Ninja

[settings]
os=Linux
arch=riscv64
build_type=Release
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=12

Loading