make اسکریپت دیگر در make اصلی - هفت خط کد انجمن پرسش و پاسخ برنامه نویسی

make اسکریپت دیگر در make اصلی

+1 امتیاز
فرض کنیم ما به یک پروژه وابستگی داریم که cmake برای آن نوشته شده و به درستی کار می کنه حالا در کتابخانه اصلی قصد داریم اضافه ش کنیم یعنی در ابتدا make کنیم و در انتها به کتابخانه اصلی اضافه کنیم برای این راه حل پیشنهاد بدید
سوال شده اردیبهشت 16, 1399  بوسیله ی ابید (امتیاز 781)   19 90 106
ویرایش شده اردیبهشت 16, 1399 بوسیله ی ابید

1 پاسخ

+2 امتیاز
 
بهترین پاسخ

تنها نکته مهم استفاده از add_subdirectory هستش مایقی داستان همانند prebuilt هستش و تفاوتی نمی کنه به مثال زیر دقت کنید.

set( lib_src_DIR ../gmath )

# Sets lib_build_DIR to the path of the desired output directory.
set( lib_build_DIR ../gmath/outputs )
file(MAKE_DIRECTORY ${lib_build_DIR})

# Adds the CMakeLists.txt file located in the specified directory
# as a build dependency.
add_subdirectory( # Specifies the directory of the CMakeLists.txt file.
                  ${lib_src_DIR}

                  # Specifies the directory for the build outputs.
                  ${lib_build_DIR} )

# Adds the output of the additional CMake build as a prebuilt static
# library and names it lib_gmath.
add_library( lib_gmath STATIC IMPORTED )
set_target_properties( lib_gmath PROPERTIES IMPORTED_LOCATION
                       ${lib_build_DIR}/${ANDROID_ABI}/lib_gmath.a )
include_directories( ${lib_src_DIR}/include )

# Links the top-level CMake build output against lib_gmath.
target_link_libraries( native-lib ... lib_gmath )

 

پاسخ داده شده اردیبهشت 16, 1399 بوسیله ی farnoosh (امتیاز 8,362)   20 44 59
انتخاب شد خرداد 12, 1399 بوسیله ی ابید
...