1
1
cmake_minimum_required (VERSION 3.15 )
2
2
3
+ include (${CMAKE_CURRENT_LIST_DIR} /cmake/Utils/GitVersion.cmake )
4
+
5
+ message (STATUS "MLC VERSION: ${MLC_VERSION_GIT} " )
6
+
3
7
project (
4
- mlc
5
- VERSION 0.1.1
8
+ MLC
9
+ VERSION ${MLC_VERSION_MAJOR} .${MLC_VERSION_MINOR}.${MLC_VERSION_PATCH}
6
10
DESCRIPTION "MLC-Python"
7
11
LANGUAGES C CXX
8
12
)
@@ -11,7 +15,7 @@ option(MLC_BUILD_TESTS "Build tests. This option will enable a test target `mlc_
11
15
option (MLC_BUILD_PY "Build Python bindings." OFF )
12
16
option (MLC_BUILD_REGISTRY
13
17
"Support for objects with non-static type indices. When turned on, \
14
- targets linked against `mlc ` will allow objects that comes with non-pre-defined type indices, \
18
+ targets linked against `MLC ` will allow objects that comes with non-pre-defined type indices, \
15
19
so that the object hierarchy could expand without limitation. \
16
20
This will require the downstream targets to link against target `mlc_registry` to be effective."
17
21
OFF
@@ -40,9 +44,7 @@ target_include_directories(mlc INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include")
40
44
if (MLC_BUILD_REGISTRY )
41
45
add_library (mlc_registry_objs OBJECT
42
46
"${CMAKE_CURRENT_SOURCE_DIR} /cpp/c_api.cc"
43
- "${CMAKE_CURRENT_SOURCE_DIR} /cpp/c_api_tests.cc"
44
47
"${CMAKE_CURRENT_SOURCE_DIR} /cpp/printer.cc"
45
- "${CMAKE_CURRENT_SOURCE_DIR} /cpp/json.cc"
46
48
"${CMAKE_CURRENT_SOURCE_DIR} /cpp/structure.cc"
47
49
"${CMAKE_CURRENT_SOURCE_DIR} /cpp/traceback.cc"
48
50
"${CMAKE_CURRENT_SOURCE_DIR} /cpp/traceback_win.cc"
@@ -57,6 +59,21 @@ if (MLC_BUILD_REGISTRY)
57
59
VISIBILITY_INLINES_HIDDEN ON
58
60
PREFIX "lib"
59
61
)
62
+
63
+ string (TIMESTAMP MLC_BUILD_TIME "%Y-%m-%dT%H:%M:%S" )
64
+ set_property (
65
+ SOURCE "${CMAKE_CURRENT_SOURCE_DIR} /cpp/c_api.cc"
66
+ APPEND
67
+ PROPERTY COMPILE_DEFINITIONS
68
+ MLC_VERSION_GIT= "${MLC_VERSION_GIT} "
69
+ MLC_VERSION_MAJOR= "${MLC_VERSION_MAJOR} "
70
+ MLC_VERSION_MINOR= "${MLC_VERSION_MINOR} "
71
+ MLC_VERSION_PATCH= "${MLC_VERSION_PATCH} "
72
+ MLC_VERSION_COMMIT_NUM= "${MLC_VERSION_COMMIT_NUM} "
73
+ MLC_VERSION_COMMIT_SHA= "${MLC_VERSION_COMMIT_SHA} "
74
+ MLC_BUILD_TIME= "${MLC_BUILD_TIME} "
75
+ )
76
+
60
77
add_cxx_warning (mlc_registry_objs )
61
78
target_link_libraries (mlc_registry_objs PRIVATE dlpack_header )
62
79
target_include_directories (mlc_registry_objs PRIVATE "${CMAKE_CURRENT_SOURCE_DIR} /include" )
0 commit comments