Skip to content

Commit

Permalink
support 230 build
Browse files Browse the repository at this point in the history
  • Loading branch information
curioyang committed Nov 7, 2024
1 parent 1bc4c93 commit 8bddace
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 7 deletions.
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

0 comments on commit 8bddace

Please sign in to comment.