Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tvm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cld
ml
tvm
Commits
b7fe6119
Commit
b7fe6119
authored
7 years ago
by
Hu Shiwen
Committed by
Tianqi Chen
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
use auto source_group (#146)
parent
b47a1248
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
CMakeLists.txt
+6
-14
6 additions, 14 deletions
CMakeLists.txt
cmake/Util.cmake
+14
-16
14 additions, 16 deletions
cmake/Util.cmake
with
20 additions
and
30 deletions
CMakeLists.txt
+
6
−
14
View file @
b7fe6119
...
...
@@ -45,20 +45,11 @@ else(MSVC)
set
(
CMAKE_CXX_FLAGS
${
CMAKE_C_FLAGS
}
)
endif
(
MSVC
)
tvm_source_group
(
"Include
\\
tvm"
GLOB
"include/tvm/*.h"
)
tvm_source_group
(
"Include
\\
tvm
\\
runtime"
GLOB
"include/tvm/runtime/*.h"
)
tvm_source_group
(
"Source
\\
lang"
GLOB
"src/lang/*.cc"
)
tvm_source_group
(
"Source
\\
api"
GLOB
"src/api/*.cc"
)
tvm_source_group
(
"Source
\\
arithmetic"
GLOB
"src/arithmetic/*.cc"
)
tvm_source_group
(
"Source
\\
schedule"
GLOB
"src/schedule/*.cc"
)
tvm_source_group
(
"Source
\\
codegen"
GLOB
"src/codegen/*.cc"
)
tvm_source_group
(
"Source
\\
codegen
\\
llvm"
GLOB
"src/codegen/llvm/*.cc"
)
tvm_source_group
(
"Source
\\
codegen
\\
stack_vm"
GLOB
"src/codegen/stack_vm/*.cc"
)
tvm_source_group
(
"Source
\\
pass"
GLOB
"src/pass/*.cc"
)
tvm_source_group
(
"Source
\\
op"
GLOB
"src/op/*.cc"
)
tvm_source_group
(
"Source
\\
runtime"
GLOB
"src/runtime/*.cc"
)
tvm_source_group
(
"Source
\\
runtime
\\
cuda"
GLOB
"src/runtime/cuda/*.cc"
)
tvm_source_group
(
"Source
\\
runtime
\\
opencl"
GLOB
"src/runtime/opencl/*.cc"
)
# add source group
FILE
(
GLOB_RECURSE GROUP_SOURCE
"src/*.cc"
"HalideIR/src/*.cpp"
)
FILE
(
GLOB_RECURSE GROUP_Include
"src/*.h"
"include/*.h"
"HalideIR/src/*.h"
)
assign_source_group
(
"Source"
${
GROUP_SOURCE
}
)
assign_source_group
(
"Include"
${
GROUP_Include
}
)
file
(
GLOB COMPILER_SRCS
src/api/*.cc
...
...
@@ -141,6 +132,7 @@ else()
set
(
CMAKE_SHARED_LIBRARY_PREFIX
""
)
endif
()
list
(
APPEND RUNTIME_SRCS
${
GROUP_Include
}
)
add_library
(
libtvm SHARED
${
COMPILER_SRCS
}
${
RUNTIME_SRCS
}
)
add_library
(
libtvm_runtime SHARED
${
RUNTIME_SRCS
}
)
target_link_libraries
(
libtvm
${
TVM_LINKER_LIBS
}
${
TVM_RUNTIME_LINKER_LIBS
}
)
...
...
This diff is collapsed.
Click to expand it.
cmake/Util.cmake
+
14
−
16
View file @
b7fe6119
# Usage:
# tvm_source_group(<group> GLOB[_RECURSE] <globbing_expression>)
function
(
tvm_source_group group
)
cmake_parse_arguments
(
TVM_SOURCE_GROUP
""
""
"GLOB;GLOB_RECURSE"
${
ARGN
}
)
if
(
TVM_SOURCE_GROUP_GLOB
)
file
(
GLOB srcs1
${
TVM_SOURCE_GROUP_GLOB
}
)
source_group
(
${
group
}
FILES
${
srcs1
}
)
endif
()
if
(
TVM_SOURCE_GROUP_GLOB_RECURSE
)
file
(
GLOB_RECURSE srcs2
${
TVM_SOURCE_GROUP_GLOB_RECURSE
}
)
source_group
(
${
group
}
FILES
${
srcs2
}
)
endif
()
endfunction
()
#######################################################
# An option that the user can select. Can accept condition to control when option is available for user.
# Usage:
...
...
@@ -52,4 +37,17 @@ function(tvm_option variable description value)
else
()
unset
(
${
variable
}
CACHE
)
endif
()
endfunction
()
\ No newline at end of file
endfunction
()
function
(
assign_source_group group
)
foreach
(
_source IN ITEMS
${
ARGN
}
)
if
(
IS_ABSOLUTE
"
${
_source
}
"
)
file
(
RELATIVE_PATH _source_rel
"
${
CMAKE_CURRENT_SOURCE_DIR
}
"
"
${
_source
}
"
)
else
()
set
(
_source_rel
"
${
_source
}
"
)
endif
()
get_filename_component
(
_source_path
"
${
_source_rel
}
"
PATH
)
string
(
REPLACE
"/"
"
\\
"
_source_path_msvc
"
${
_source_path
}
"
)
source_group
(
"
${
group
}
\\
${
_source_path_msvc
}
"
FILES
"
${
_source
}
"
)
endforeach
()
endfunction
(
assign_source_group
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment