• Home
  • Raw
  • Download

Lines Matching refs:pkg_name

64 function(__download_pkg pkg_name pkg_url pkg_md5)
68 … set(pkg_url "http://${LOCAL_LIBS_SERVER}:8081/libs/${pkg_name}/${_URL_FILE_NAME}" ${pkg_url})
72 ${pkg_name}
76 FetchContent_GetProperties(${pkg_name})
77 message("download: ${${pkg_name}_SOURCE_DIR} , ${pkg_name} , ${pkg_url}")
78 if(NOT ${pkg_name}_POPULATED)
79 FetchContent_Populate(${pkg_name})
80 set(${pkg_name}_SOURCE_DIR ${${pkg_name}_SOURCE_DIR} PARENT_SCOPE)
85 function(__download_pkg_with_git pkg_name pkg_url pkg_git_commit pkg_md5)
88 set(pkg_url "http://${LOCAL_LIBS_SERVER}:8081/libs/${pkg_name}/${pkg_git_commit}")
90 ${pkg_name}
96 ${pkg_name}
100 FetchContent_GetProperties(${pkg_name})
101 message("download: ${${pkg_name}_SOURCE_DIR} , ${pkg_name} , ${pkg_url}")
102 if(NOT ${pkg_name}_POPULATED)
103 FetchContent_Populate(${pkg_name})
104 set(${pkg_name}_SOURCE_DIR ${${pkg_name}_SOURCE_DIR} PARENT_SCOPE)
110 function(__find_pkg_then_add_target pkg_name pkg_exe lib_path)
112 unset(${pkg_name}_LIBS)
114 message("_FIND:${${pkg_name}_BASE_DIR}")
117 find_program(${pkg_exe}_EXE ${pkg_exe} PATHS ${${pkg_name}_BASE_DIR}/bin NO_DEFAULT_PATH)
121 add_executable(${pkg_name}::${pkg_exe} IMPORTED GLOBAL)
122 set_target_properties(${pkg_name}::${pkg_exe} PROPERTIES
131 if(${pkg_name}_USE_STATIC_LIBS)
137 … find_library(${_LIB_NAME}_LIB ${_LIB_SEARCH_NAME} PATHS ${${pkg_name}_BASE_DIR}/${lib_path}
140 … find_library(${_LIB_NAME}_LIB ${_LIB_SEARCH_NAME} PATHS ${${pkg_name}_BASE_DIR}/${lib_path}
147 add_library(${pkg_name}::${_LIB_NAME} ${_LIB_TYPE} IMPORTED GLOBAL)
149 …set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_IMPLIB_RELEASE ${${_LIB_NAME}_…
151 … set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES IMPORTED_LOCATION ${${_LIB_NAME}_LIB})
154 if(EXISTS ${${pkg_name}_BASE_DIR}/include)
155 set_target_properties(${pkg_name}::${_LIB_NAME} PROPERTIES
156 INTERFACE_INCLUDE_DIRECTORIES "${${pkg_name}_BASE_DIR}/include")
159 list(APPEND ${pkg_name}_LIBS ${pkg_name}::${_LIB_NAME})
162 set(${pkg_name}_LIBPATH ${LIBPATH} CACHE STRING INTERNAL)
165 set(${pkg_name}_LIBS ${${pkg_name}_LIBS} PARENT_SCOPE)
186 file(TOUCH ${_MS_LIB_CACHE}/${pkg_name}_patch.md5)
187 file(READ ${_MS_LIB_CACHE}/${pkg_name}_patch.md5 ${pkg_name}_PATCHES_MD5)
189 message("patches md5:${${pkg_name}_PATCHES_MD5}")
191 set(${pkg_name}_PATCHES_NEW_MD5)
194 set(${pkg_name}_PATCHES_NEW_MD5 "${${pkg_name}_PATCHES_NEW_MD5},${_PF_MD5}")
197 if(NOT ${pkg_name}_PATCHES_MD5 STREQUAL ${pkg_name}_PATCHES_NEW_MD5)
198 set(${pkg_name}_PATCHES ${PKG_PATCHES})
199 file(REMOVE_RECURSE "${_MS_LIB_CACHE}/${pkg_name}-subbuild")
200 file(WRITE ${_MS_LIB_CACHE}/${pkg_name}_patch.md5 ${${pkg_name}_PATCHES_NEW_MD5})
201 message("patches changed : ${${pkg_name}_PATCHES_NEW_MD5}")
210 function(mindspore_add_pkg pkg_name)
227 set(__FIND_PKG_NAME ${pkg_name})
228 string(TOLOWER ${pkg_name} pkg_name)
229 message("pkg name:${__FIND_PKG_NAME},${pkg_name}")
231 set(${pkg_name}_PATCHES_HASH)
234 set(${pkg_name}_PATCHES_HASH "${${pkg_name}_PATCHES_HASH},${_PF_MD5}")
238 set(${pkg_name}_CONFIG_TXT
240 ${ARGN} - ${${pkg_name}_USE_STATIC_LIBS}- ${${pkg_name}_PATCHES_HASH}
241 ${${pkg_name}_CXXFLAGS}--${${pkg_name}_CFLAGS}--${${pkg_name}_LDFLAGS}")
242 string(REPLACE ";" "-" ${pkg_name}_CONFIG_TXT ${${pkg_name}_CONFIG_TXT})
243 string(MD5 ${pkg_name}_CONFIG_HASH ${${pkg_name}_CONFIG_TXT})
245 message("${pkg_name} config hash: ${${pkg_name}_CONFIG_HASH}")
247 set(${pkg_name}_BASE_DIR ${_MS_LIB_CACHE}/${pkg_name}_${${pkg_name}_CONFIG_HASH})
248 set(${pkg_name}_DIRPATH ${${pkg_name}_BASE_DIR} CACHE STRING INTERNAL)
250 if(EXISTS ${${pkg_name}_BASE_DIR}/options.txt AND PKG_HEAD_ONLY)
251 set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/${PKG_HEAD_ONLY} PARENT_SCOPE)
252 add_library(${pkg_name} INTERFACE)
253 target_include_directories(${pkg_name} INTERFACE ${${pkg_name}_INC})
255 __find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIB_PATH} ${PKG_LIBS})
260 set(${__FIND_PKG_NAME}_ROOT ${${pkg_name}_BASE_DIR})
261 set(${__FIND_PKG_NAME}_ROOT ${${pkg_name}_BASE_DIR} PARENT_SCOPE)
264 __find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIB_PATH} ${PKG_LIBS})
265 if(${pkg_name}_LIBS)
266 set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
267 message("Found libs: ${${pkg_name}_LIBS}")
273 set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
281 __download_pkg_with_git(${pkg_name} ${PKG_GIT_REPOSITORY} ${PKG_GIT_TAG} ${PKG_MD5})
283 __download_pkg(${pkg_name} ${PKG_URL} ${PKG_MD5})
288 file(GLOB ${pkg_name}_INSTALL_SUBMODULE ${_SUBMODULE_FILE}/*)
289 …file(COPY ${${pkg_name}_INSTALL_SUBMODULE} DESTINATION ${${pkg_name}_SOURCE_DIR}/3rdparty/${_SUBMO…
292 set(${pkg_name}_SOURCE_DIR ${PKG_DIR})
294 file(WRITE ${${pkg_name}_BASE_DIR}/options.txt ${${pkg_name}_CONFIG_TXT})
295 message("${pkg_name}_SOURCE_DIR : ${${pkg_name}_SOURCE_DIR}")
302 message("patching ${${pkg_name}_SOURCE_DIR} -p1 < ${_LF_PATCH_FILE}")
304 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}
311 file(GLOB ${pkg_name}_INSTALL_SOURCE ${${pkg_name}_SOURCE_DIR}/${_SOURCE_DIR}/*)
312 file(COPY ${${pkg_name}_INSTALL_SOURCE} DESTINATION ${${pkg_name}_BASE_DIR}/${_SOURCE_DIR}/)
314 …file(LOCK ${${pkg_name}_BASE_DIR} DIRECTORY GUARD FUNCTION RESULT_VARIABLE ${pkg_name}_LOCK_RET TI…
315 if(NOT ${pkg_name}_LOCK_RET EQUAL "0")
316 … message(FATAL_ERROR "error! when try lock ${${pkg_name}_BASE_DIR} : ${${pkg_name}_LOCK_RET}")
320 file(GLOB ${pkg_name}_cmake ${PKG_CUSTOM_CMAKE}/CMakeLists.txt)
321 file(COPY ${${pkg_name}_cmake} DESTINATION ${${pkg_name}_SOURCE_DIR})
324 if(${pkg_name}_SOURCE_DIR)
326 file(GLOB ${pkg_name}_SOURCE_SUBDIRS ${${pkg_name}_SOURCE_DIR}/*)
327 file(COPY ${${pkg_name}_SOURCE_SUBDIRS} DESTINATION ${${pkg_name}_BASE_DIR})
328 set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/${PKG_HEAD_ONLY} PARENT_SCOPE)
330 add_library(${pkg_name} INTERFACE)
331 target_include_directories(${pkg_name} INTERFACE ${${pkg_name}_INC})
335 __exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} ${${pkg_name}_CXXFLAGS} -j${THNUM}
336 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
339 file(GLOB ${pkg_name}_INSTALL_INCS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_INCS})
340 file(GLOB ${pkg_name}_INSTALL_LIBS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_LIBS})
341 file(COPY ${${pkg_name}_INSTALL_INCS} DESTINATION ${${pkg_name}_BASE_DIR}/include)
342 file(COPY ${${pkg_name}_INSTALL_LIBS} DESTINATION ${${pkg_name}_BASE_DIR}/lib)
346 file(MAKE_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
347 if(${pkg_name}_CFLAGS)
348 set(${pkg_name}_CMAKE_CFLAGS "-DCMAKE_C_FLAGS=${${pkg_name}_CFLAGS}")
350 if(${pkg_name}_CXXFLAGS)
351 set(${pkg_name}_CMAKE_CXXFLAGS "-DCMAKE_CXX_FLAGS=${${pkg_name}_CXXFLAGS}")
354 if(${pkg_name}_LDFLAGS)
355 if(${pkg_name}_USE_STATIC_LIBS)
356 … #set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_STATIC_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
358 … set(${pkg_name}_CMAKE_LDFLAGS "-DCMAKE_SHARED_LINKER_FLAGS=${${pkg_name}_LDFLAGS}")
363 … ${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
364 … -DCMAKE_INSTALL_PREFIX=${${pkg_name}_BASE_DIR} ${${pkg_name}_SOURCE_DIR}/${PKG_CMAKE_PATH}
365 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
367 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
370 … ${${pkg_name}_CMAKE_CFLAGS} ${${pkg_name}_CMAKE_CXXFLAGS} ${${pkg_name}_CMAKE_LDFLAGS}
371 … -DCMAKE_INSTALL_PREFIX=${${pkg_name}_BASE_DIR} ${${pkg_name}_SOURCE_DIR}/${PKG_CMAKE_PATH}
372 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
374 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR}/_build)
377 if(${pkg_name}_CFLAGS)
378 set(${pkg_name}_MAKE_CFLAGS "CFLAGS=${${pkg_name}_CFLAGS}")
380 if(${pkg_name}_CXXFLAGS)
381 set(${pkg_name}_MAKE_CXXFLAGS "CXXFLAGS=${${pkg_name}_CXXFLAGS}")
383 if(${pkg_name}_LDFLAGS)
384 set(${pkg_name}_MAKE_LDFLAGS "LDFLAGS=${${pkg_name}_LDFLAGS}")
389 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
394 … ${${pkg_name}_MAKE_CFLAGS} ${${pkg_name}_MAKE_CXXFLAGS} ${${pkg_name}_MAKE_LDFLAGS}
395 --prefix=${${pkg_name}_BASE_DIR}
396 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
398 set(${pkg_name}_BUILD_OPTION ${PKG_BUILD_OPTION})
400 set(${pkg_name}_BUILD_OPTION ${${pkg_name}_BUILD_OPTION}
401 … ${${pkg_name}_MAKE_CFLAGS} ${${pkg_name}_MAKE_CXXFLAGS} ${${pkg_name}_MAKE_LDFLAGS})
405 __exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} ${${pkg_name}_BUILD_OPTION}
406 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
408 __exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} ${${pkg_name}_BUILD_OPTION} -j${THNUM}
409 WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
413 file(GLOB ${pkg_name}_INSTALL_INCS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_INCS})
414 file(GLOB ${pkg_name}_INSTALL_LIBS ${${pkg_name}_SOURCE_DIR}/${PKG_INSTALL_LIBS})
415 file(COPY ${${pkg_name}_INSTALL_INCS} DESTINATION ${${pkg_name}_BASE_DIR}/include)
416 file(COPY ${${pkg_name}_INSTALL_LIBS} DESTINATION ${${pkg_name}_BASE_DIR}/lib)
418 … __exec_cmd(COMMAND ${CMAKE_MAKE_PROGRAM} install WORKING_DIRECTORY ${${pkg_name}_SOURCE_DIR})
424 __find_pkg_then_add_target(${pkg_name} ${PKG_EXE} ${PKG_LIB_PATH} ${PKG_LIBS})
425 set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)
426 if(NOT ${pkg_name}_LIBS)
427 message(FATAL_ERROR "Can not find pkg: ${pkg_name}")
432 set(${pkg_name}_INC ${${pkg_name}_BASE_DIR}/include PARENT_SCOPE)