Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
b7fe6119
Commit
b7fe6119
authored
May 19, 2017
by
Hu Shiwen
Committed by
Tianqi Chen
May 18, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use auto source_group (#146)
parent
b47a1248
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
31 deletions
+21
-31
CMakeLists.txt
+6
-14
cmake/Util.cmake
+15
-17
No files found.
CMakeLists.txt
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
}
)
...
...
cmake/Util.cmake
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment