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
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
29 deletions
+20
-29
CMakeLists.txt
+6
-14
cmake/Util.cmake
+14
-15
No files found.
CMakeLists.txt
View file @
b7fe6119
...
@@ -45,20 +45,11 @@ else(MSVC)
...
@@ -45,20 +45,11 @@ else(MSVC)
set
(
CMAKE_CXX_FLAGS
${
CMAKE_C_FLAGS
}
)
set
(
CMAKE_CXX_FLAGS
${
CMAKE_C_FLAGS
}
)
endif
(
MSVC
)
endif
(
MSVC
)
tvm_source_group
(
"Include
\\
tvm"
GLOB
"include/tvm/*.h"
)
# add source group
tvm_source_group
(
"Include
\\
tvm
\\
runtime"
GLOB
"include/tvm/runtime/*.h"
)
FILE
(
GLOB_RECURSE GROUP_SOURCE
"src/*.cc"
"HalideIR/src/*.cpp"
)
tvm_source_group
(
"Source
\\
lang"
GLOB
"src/lang/*.cc"
)
FILE
(
GLOB_RECURSE GROUP_Include
"src/*.h"
"include/*.h"
"HalideIR/src/*.h"
)
tvm_source_group
(
"Source
\\
api"
GLOB
"src/api/*.cc"
)
assign_source_group
(
"Source"
${
GROUP_SOURCE
}
)
tvm_source_group
(
"Source
\\
arithmetic"
GLOB
"src/arithmetic/*.cc"
)
assign_source_group
(
"Include"
${
GROUP_Include
}
)
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"
)
file
(
GLOB COMPILER_SRCS
file
(
GLOB COMPILER_SRCS
src/api/*.cc
src/api/*.cc
...
@@ -141,6 +132,7 @@ else()
...
@@ -141,6 +132,7 @@ else()
set
(
CMAKE_SHARED_LIBRARY_PREFIX
""
)
set
(
CMAKE_SHARED_LIBRARY_PREFIX
""
)
endif
()
endif
()
list
(
APPEND RUNTIME_SRCS
${
GROUP_Include
}
)
add_library
(
libtvm SHARED
${
COMPILER_SRCS
}
${
RUNTIME_SRCS
}
)
add_library
(
libtvm SHARED
${
COMPILER_SRCS
}
${
RUNTIME_SRCS
}
)
add_library
(
libtvm_runtime SHARED
${
RUNTIME_SRCS
}
)
add_library
(
libtvm_runtime SHARED
${
RUNTIME_SRCS
}
)
target_link_libraries
(
libtvm
${
TVM_LINKER_LIBS
}
${
TVM_RUNTIME_LINKER_LIBS
}
)
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.
# An option that the user can select. Can accept condition to control when option is available for user.
# Usage:
# Usage:
...
@@ -53,3 +38,16 @@ function(tvm_option variable description value)
...
@@ -53,3 +38,16 @@ function(tvm_option variable description value)
unset
(
${
variable
}
CACHE
)
unset
(
${
variable
}
CACHE
)
endif
()
endif
()
endfunction
()
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