STYLE: use lowercase
This commit is contained in:
parent
0dd276a311
commit
8b2dd3a281
|
@ -20,8 +20,8 @@
|
||||||
# This script can be used as part of the build via ADD_CUSTOM_COMMAND, or used
|
# This script can be used as part of the build via ADD_CUSTOM_COMMAND, or used
|
||||||
# only during make install via INSTALL SCRIPT.
|
# only during make install via INSTALL SCRIPT.
|
||||||
#
|
#
|
||||||
IF(NOT DEFINED input_file)
|
if(NOT DEFINED input_file)
|
||||||
MESSAGE(FATAL_ERROR "
|
message(FATAL_ERROR "
|
||||||
${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable input_file is not defined.
|
${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): error: Variable input_file is not defined.
|
||||||
|
|
||||||
Use a command line like this to use this script:
|
Use a command line like this to use this script:
|
||||||
|
@ -39,87 +39,87 @@ bundle.
|
||||||
otool -L output.
|
otool -L output.
|
||||||
|
|
||||||
")
|
")
|
||||||
ENDIF(NOT DEFINED input_file)
|
endif(NOT DEFINED input_file)
|
||||||
message("ingest ${input_file}")
|
message("ingest ${input_file}")
|
||||||
SET(eol_char "E")
|
set(eol_char "E")
|
||||||
|
|
||||||
IF(APPLE)
|
if(APPLE)
|
||||||
SET(dep_tool "otool")
|
set(dep_tool "otool")
|
||||||
SET(dep_cmd_args "-L")
|
set(dep_cmd_args "-L")
|
||||||
SET(dep_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
|
set(dep_regex "^\t([^\t]+) \\(compatibility version ([0-9]+.[0-9]+.[0-9]+), current version ([0-9]+.[0-9]+.[0-9]+)\\)${eol_char}$")
|
||||||
ENDIF(APPLE)
|
endif(APPLE)
|
||||||
|
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("# Script \"${CMAKE_CURRENT_LIST_FILE}\" running...")
|
message("# Script \"${CMAKE_CURRENT_LIST_FILE}\" running...")
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("input_file: '${input_file}'")
|
message("input_file: '${input_file}'")
|
||||||
MESSAGE("extra_libs: '${extra_libs}'")
|
message("extra_libs: '${extra_libs}'")
|
||||||
MESSAGE("lib_path: '${lib_path}'")
|
message("lib_path: '${lib_path}'")
|
||||||
MESSAGE("")
|
message("")
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(input_file_full "${input_file}" ABSOLUTE)
|
get_filename_component(input_file_full "${input_file}" ABSOLUTE)
|
||||||
MESSAGE("input_file_full: '${input_file_full}'")
|
message("input_file_full: '${input_file_full}'")
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(bundle "${input_file_full}/../../.." ABSOLUTE)
|
get_filename_component(bundle "${input_file_full}/../../.." ABSOLUTE)
|
||||||
MESSAGE("bundle: '${bundle}'")
|
message("bundle: '${bundle}'")
|
||||||
|
|
||||||
|
|
||||||
FIND_PROGRAM(dep_cmd ${dep_tool})
|
find_program(dep_cmd ${dep_tool})
|
||||||
|
|
||||||
|
|
||||||
MACRO(APPEND_UNIQUE au_list_var au_value)
|
macro(append_unique au_list_var au_value)
|
||||||
SET(${au_list_var} ${${au_list_var}} "${au_value}")
|
set(${au_list_var} ${${au_list_var}} "${au_value}")
|
||||||
ENDMACRO(APPEND_UNIQUE)
|
endmacro(append_unique)
|
||||||
|
|
||||||
|
|
||||||
MACRO(GATHER_DEPENDENTS gd_target gd_dependents_var)
|
macro(gather_dependents gd_target gd_dependents_var)
|
||||||
EXECUTE_PROCESS(
|
execute_process(
|
||||||
COMMAND ${dep_cmd} ${dep_cmd_args} ${gd_target}
|
COMMAND ${dep_cmd} ${dep_cmd_args} ${gd_target}
|
||||||
OUTPUT_VARIABLE dep_tool_ov
|
OUTPUT_VARIABLE dep_tool_ov
|
||||||
)
|
)
|
||||||
|
|
||||||
STRING(REGEX REPLACE ";" "\\\\;" dep_candidates "${dep_tool_ov}")
|
string(REGEX REPLACE ";" "\\\\;" dep_candidates "${dep_tool_ov}")
|
||||||
STRING(REGEX REPLACE "\n" "${eol_char};" dep_candidates "${dep_candidates}")
|
string(REGEX REPLACE "\n" "${eol_char};" dep_candidates "${dep_candidates}")
|
||||||
|
|
||||||
SET(${gd_dependents_var} "")
|
set(${gd_dependents_var} "")
|
||||||
|
|
||||||
FOREACH(candidate ${dep_candidates})
|
foreach(candidate ${dep_candidates})
|
||||||
IF("${candidate}" MATCHES "${dep_regex}")
|
if("${candidate}" MATCHES "${dep_regex}")
|
||||||
STRING(REGEX REPLACE "${dep_regex}" "\\1" raw_item "${candidate}")
|
string(REGEX REPLACE "${dep_regex}" "\\1" raw_item "${candidate}")
|
||||||
STRING(REGEX REPLACE "${dep_regex}" "\\2" raw_compat_version "${candidate}")
|
string(REGEX REPLACE "${dep_regex}" "\\2" raw_compat_version "${candidate}")
|
||||||
STRING(REGEX REPLACE "${dep_regex}" "\\3" raw_current_version "${candidate}")
|
string(REGEX REPLACE "${dep_regex}" "\\3" raw_current_version "${candidate}")
|
||||||
|
|
||||||
SET(item "${raw_item}")
|
set(item "${raw_item}")
|
||||||
|
|
||||||
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" compat_major_version "${raw_compat_version}")
|
||||||
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" compat_minor_version "${raw_compat_version}")
|
||||||
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" compat_patch_version "${raw_compat_version}")
|
||||||
|
|
||||||
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\1" current_major_version "${raw_current_version}")
|
||||||
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\2" current_minor_version "${raw_current_version}")
|
||||||
STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
|
string(REGEX REPLACE "^([0-9]+)\\.([0-9]+)\\.([0-9]+)$" "\\3" current_patch_version "${raw_current_version}")
|
||||||
|
|
||||||
#MESSAGE("${raw_item} - compat ${raw_compat_version} - current ${raw_current_version}")
|
#message("${raw_item} - compat ${raw_compat_version} - current ${raw_current_version}")
|
||||||
APPEND_UNIQUE("${gd_dependents_var}" "${item}")
|
append_unique("${gd_dependents_var}" "${item}")
|
||||||
ELSE("${candidate}" MATCHES "${dep_regex}")
|
else("${candidate}" MATCHES "${dep_regex}")
|
||||||
IF("${candidate}" STREQUAL "${gd_target}:${eol_char}")
|
if("${candidate}" STREQUAL "${gd_target}:${eol_char}")
|
||||||
#MESSAGE("info: ignoring target name...")
|
#message("info: ignoring target name...")
|
||||||
ELSE("${candidate}" STREQUAL "${gd_target}:${eol_char}")
|
else("${candidate}" STREQUAL "${gd_target}:${eol_char}")
|
||||||
MESSAGE("error: candidate='${candidate}'")
|
message("error: candidate='${candidate}'")
|
||||||
ENDIF("${candidate}" STREQUAL "${gd_target}:${eol_char}")
|
endif("${candidate}" STREQUAL "${gd_target}:${eol_char}")
|
||||||
ENDIF("${candidate}" MATCHES "${dep_regex}")
|
endif("${candidate}" MATCHES "${dep_regex}")
|
||||||
ENDFOREACH(candidate)
|
endforeach(candidate)
|
||||||
ENDMACRO(GATHER_DEPENDENTS)
|
endmacro(gather_dependents)
|
||||||
|
|
||||||
|
|
||||||
MESSAGE("Gathering dependent libraries for '${input_file_full}'...")
|
message("Gathering dependent libraries for '${input_file_full}'...")
|
||||||
GATHER_DEPENDENTS("${input_file_full}" deps)
|
gather_dependents("${input_file_full}" deps)
|
||||||
MESSAGE("")
|
message("")
|
||||||
|
|
||||||
|
|
||||||
# Order lexicographically:
|
# Order lexicographically:
|
||||||
#
|
#
|
||||||
LIST(SORT deps)
|
list(SORT deps)
|
||||||
|
|
||||||
|
|
||||||
# Split into separate lists, "system" "embedded" and "nonsystem" libraries.
|
# Split into separate lists, "system" "embedded" and "nonsystem" libraries.
|
||||||
|
@ -128,98 +128,98 @@ LIST(SORT deps)
|
||||||
# be in the bundle and fixed-up already. Only non-system, non-embedded libs
|
# be in the bundle and fixed-up already. Only non-system, non-embedded libs
|
||||||
# need copying and fixing up...
|
# need copying and fixing up...
|
||||||
#
|
#
|
||||||
SET(system_deps "")
|
set(system_deps "")
|
||||||
SET(embedded_deps "")
|
set(embedded_deps "")
|
||||||
SET(nonsystem_deps "")
|
set(nonsystem_deps "")
|
||||||
|
|
||||||
FOREACH(d ${deps})
|
foreach(d ${deps})
|
||||||
SET(d_is_embedded_lib 0)
|
set(d_is_embedded_lib 0)
|
||||||
SET(d_is_system_lib 0)
|
set(d_is_system_lib 0)
|
||||||
|
|
||||||
IF("${d}" MATCHES "^(/System/Library|/usr/lib)")
|
if("${d}" MATCHES "^(/System/Library|/usr/lib)")
|
||||||
SET(d_is_system_lib 1)
|
set(d_is_system_lib 1)
|
||||||
ELSE("${d}" MATCHES "^(/System/Library|/usr/lib)")
|
else("${d}" MATCHES "^(/System/Library|/usr/lib)")
|
||||||
IF("${d}" MATCHES "^@executable_path")
|
if("${d}" MATCHES "^@executable_path")
|
||||||
SET(d_is_embedded_lib 1)
|
set(d_is_embedded_lib 1)
|
||||||
ENDIF("${d}" MATCHES "^@executable_path")
|
endif("${d}" MATCHES "^@executable_path")
|
||||||
ENDIF("${d}" MATCHES "^(/System/Library|/usr/lib)")
|
endif("${d}" MATCHES "^(/System/Library|/usr/lib)")
|
||||||
|
|
||||||
IF(d_is_system_lib)
|
if(d_is_system_lib)
|
||||||
SET(system_deps ${system_deps} "${d}")
|
set(system_deps ${system_deps} "${d}")
|
||||||
ELSE(d_is_system_lib)
|
else(d_is_system_lib)
|
||||||
IF(d_is_embedded_lib)
|
if(d_is_embedded_lib)
|
||||||
SET(embedded_deps ${embedded_deps} "${d}")
|
set(embedded_deps ${embedded_deps} "${d}")
|
||||||
ELSE(d_is_embedded_lib)
|
else(d_is_embedded_lib)
|
||||||
# if the non system lib is not found then try to look for it
|
# if the non system lib is not found then try to look for it
|
||||||
# in the standard framework search path for OSX
|
# in the standard framework search path for OSX
|
||||||
IF(NOT EXISTS "${d}")
|
if(NOT EXISTS "${d}")
|
||||||
SET(FRAMEWORK_SEARCH "/Library/Frameworks"
|
set(FRAMEWORK_SEARCH "/Library/Frameworks"
|
||||||
"/System/Library/Frameworks" )
|
"/System/Library/Frameworks" )
|
||||||
SET(__FOUND )
|
set(__FOUND )
|
||||||
FOREACH(f ${FRAMEWORK_SEARCH})
|
foreach(f ${FRAMEWORK_SEARCH})
|
||||||
SET(newd "${f}/${d}")
|
set(newd "${f}/${d}")
|
||||||
IF(EXISTS "${newd}" AND NOT __FOUND)
|
if(EXISTS "${newd}" AND NOT __FOUND)
|
||||||
SET(d "${newd}")
|
set(d "${newd}")
|
||||||
SET(__FOUND TRUE)
|
set(__FOUND TRUE)
|
||||||
ENDIF(EXISTS "${newd}" AND NOT __FOUND)
|
endif(EXISTS "${newd}" AND NOT __FOUND)
|
||||||
ENDFOREACH(f)
|
endforeach(f)
|
||||||
ENDIF(NOT EXISTS "${d}")
|
endif(NOT EXISTS "${d}")
|
||||||
SET(nonsystem_deps ${nonsystem_deps} "${d}")
|
set(nonsystem_deps ${nonsystem_deps} "${d}")
|
||||||
ENDIF(d_is_embedded_lib)
|
endif(d_is_embedded_lib)
|
||||||
ENDIF(d_is_system_lib)
|
endif(d_is_system_lib)
|
||||||
ENDFOREACH(d)
|
endforeach(d)
|
||||||
|
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("system_deps:")
|
message("system_deps:")
|
||||||
FOREACH(d ${system_deps})
|
foreach(d ${system_deps})
|
||||||
MESSAGE("${d}")
|
message("${d}")
|
||||||
ENDFOREACH(d ${system_deps})
|
endforeach(d ${system_deps})
|
||||||
|
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("embedded_deps:")
|
message("embedded_deps:")
|
||||||
FOREACH(d ${embedded_deps})
|
foreach(d ${embedded_deps})
|
||||||
MESSAGE("${d}")
|
message("${d}")
|
||||||
ENDFOREACH(d ${embedded_deps})
|
endforeach(d ${embedded_deps})
|
||||||
|
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("nonsystem_deps:")
|
message("nonsystem_deps:")
|
||||||
FOREACH(d ${nonsystem_deps})
|
foreach(d ${nonsystem_deps})
|
||||||
MESSAGE("${d}")
|
message("${d}")
|
||||||
ENDFOREACH(d ${nonsystem_deps})
|
endforeach(d ${nonsystem_deps})
|
||||||
|
|
||||||
MESSAGE("")
|
message("")
|
||||||
|
|
||||||
|
|
||||||
MACRO(COPY_LIBRARY_INTO_BUNDLE clib_bundle clib_libsrc clib_dstlibs clib_fixups)
|
macro(copy_library_into_bundle clib_bundle clib_libsrc clib_dstlibs clib_fixups)
|
||||||
#
|
#
|
||||||
# If the source library is a framework, copy just the shared lib bit of the framework
|
# If the source library is a framework, copy just the shared lib bit of the framework
|
||||||
# into the bundle under "${clib_bundle}/Contents/Frameworks" - if it is just a dylib
|
# into the bundle under "${clib_bundle}/Contents/Frameworks" - if it is just a dylib
|
||||||
# copy it into the same directory with the main bundle executable under
|
# copy it into the same directory with the main bundle executable under
|
||||||
# "${clib_bundle}/Contents/MacOS"
|
# "${clib_bundle}/Contents/MacOS"
|
||||||
#
|
#
|
||||||
IF("${clib_libsrc}" MATCHES ".framework/.*/.*/.*")
|
if("${clib_libsrc}" MATCHES ".framework/.*/.*/.*")
|
||||||
GET_FILENAME_COMPONENT(fw_src "${clib_libsrc}" ABSOLUTE)
|
get_filename_component(fw_src "${clib_libsrc}" ABSOLUTE)
|
||||||
GET_FILENAME_COMPONENT(fw_srcdir "${clib_libsrc}/../../.." ABSOLUTE)
|
get_filename_component(fw_srcdir "${clib_libsrc}/../../.." ABSOLUTE)
|
||||||
GET_FILENAME_COMPONENT(fwdirname "${fw_srcdir}" NAME)
|
get_filename_component(fwdirname "${fw_srcdir}" NAME)
|
||||||
STRING(REGEX REPLACE "^(.*)\\.framework$" "\\1" fwname "${fwdirname}")
|
string(REGEX REPLACE "^(.*)\\.framework$" "\\1" fwname "${fwdirname}")
|
||||||
STRING(REGEX REPLACE "^.*/${fwname}\\.framework/(.*)$" "\\1" fwlibname "${clib_libsrc}")
|
string(REGEX REPLACE "^.*/${fwname}\\.framework/(.*)$" "\\1" fwlibname "${clib_libsrc}")
|
||||||
SET(fw_dstdir "${clib_bundle}/Contents/Frameworks/${fwdirname}")
|
set(fw_dstdir "${clib_bundle}/Contents/Frameworks/${fwdirname}")
|
||||||
|
|
||||||
# MESSAGE("")
|
# message("")
|
||||||
# MESSAGE("fwdirname: '${fwdirname}'")
|
# message("fwdirname: '${fwdirname}'")
|
||||||
# MESSAGE("fwname: '${fwname}'")
|
# message("fwname: '${fwname}'")
|
||||||
# MESSAGE("fwlibname: '${fwlibname}'")
|
# message("fwlibname: '${fwlibname}'")
|
||||||
# MESSAGE("fw_src: '${fw_src}'")
|
# message("fw_src: '${fw_src}'")
|
||||||
# MESSAGE("fw_srcdir: '${fw_srcdir}'")
|
# message("fw_srcdir: '${fw_srcdir}'")
|
||||||
# MESSAGE("fw_dstdir: '${fw_dstdir}'")
|
# message("fw_dstdir: '${fw_dstdir}'")
|
||||||
# MESSAGE("new_name: '@executable_path/../Frameworks/${fwdirname}/${fwlibname}'")
|
# message("new_name: '@executable_path/../Frameworks/${fwdirname}/${fwlibname}'")
|
||||||
# MESSAGE("")
|
# message("")
|
||||||
|
|
||||||
MESSAGE("Copying ${fw_srcdir} into bundle...")
|
message("Copying ${fw_srcdir} into bundle...")
|
||||||
|
|
||||||
# This command copies the *entire* framework recursively:
|
# This command copies the *entire* framework recursively:
|
||||||
#
|
#
|
||||||
# EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_directory
|
# execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
# "${fw_srcdir}" "${fw_dstdir}"
|
# "${fw_srcdir}" "${fw_dstdir}"
|
||||||
# )
|
# )
|
||||||
|
|
||||||
|
@ -227,104 +227,104 @@ MACRO(COPY_LIBRARY_INTO_BUNDLE clib_bundle clib_libsrc clib_dstlibs clib_fixups)
|
||||||
# (This technique will not work for frameworks that have necessary
|
# (This technique will not work for frameworks that have necessary
|
||||||
# resource or auxiliary files...)
|
# resource or auxiliary files...)
|
||||||
#
|
#
|
||||||
MESSAGE("Copy: ${CMAKE_COMMAND} -E copy \"${fw_src}\" \"${fw_dstdir}/${fwlibname}\"")
|
message("Copy: ${CMAKE_COMMAND} -E copy \"${fw_src}\" \"${fw_dstdir}/${fwlibname}\"")
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
"${fw_src}" "${fw_dstdir}/${fwlibname}"
|
"${fw_src}" "${fw_dstdir}/${fwlibname}"
|
||||||
)
|
)
|
||||||
|
|
||||||
EXECUTE_PROCESS(COMMAND install_name_tool
|
execute_process(COMMAND install_name_tool
|
||||||
-id "@executable_path/../Frameworks/${fwdirname}/${fwlibname}"
|
-id "@executable_path/../Frameworks/${fwdirname}/${fwlibname}"
|
||||||
"${clib_bundle}/Contents/Frameworks/${fwdirname}/${fwlibname}"
|
"${clib_bundle}/Contents/Frameworks/${fwdirname}/${fwlibname}"
|
||||||
)
|
)
|
||||||
SET(${clib_dstlibs} ${${clib_dstlibs}}
|
set(${clib_dstlibs} ${${clib_dstlibs}}
|
||||||
"${clib_bundle}/Contents/Frameworks/${fwdirname}/${fwlibname}"
|
"${clib_bundle}/Contents/Frameworks/${fwdirname}/${fwlibname}"
|
||||||
)
|
)
|
||||||
SET(${clib_fixups} ${${clib_fixups}}
|
set(${clib_fixups} ${${clib_fixups}}
|
||||||
"-change"
|
"-change"
|
||||||
"${clib_libsrc}"
|
"${clib_libsrc}"
|
||||||
"@executable_path/../Frameworks/${fwdirname}/${fwlibname}"
|
"@executable_path/../Frameworks/${fwdirname}/${fwlibname}"
|
||||||
)
|
)
|
||||||
ELSE("${clib_libsrc}" MATCHES ".framework/.*/.*/.*")
|
else("${clib_libsrc}" MATCHES ".framework/.*/.*/.*")
|
||||||
IF("${clib_libsrc}" MATCHES "/")
|
if("${clib_libsrc}" MATCHES "/")
|
||||||
SET(clib_libsrcfull "${clib_libsrc}")
|
set(clib_libsrcfull "${clib_libsrc}")
|
||||||
ELSE("${clib_libsrc}" MATCHES "/")
|
else("${clib_libsrc}" MATCHES "/")
|
||||||
SET(clib_libsrcfull "${lib_path}/${clib_libsrc}")
|
set(clib_libsrcfull "${lib_path}/${clib_libsrc}")
|
||||||
IF(NOT EXISTS "${clib_libsrcfull}")
|
if(NOT EXISTS "${clib_libsrcfull}")
|
||||||
MESSAGE(FATAL_ERROR "error: '${clib_libsrcfull}' does not exist...")
|
message(FATAL_ERROR "error: '${clib_libsrcfull}' does not exist...")
|
||||||
ENDIF(NOT EXISTS "${clib_libsrcfull}")
|
endif(NOT EXISTS "${clib_libsrcfull}")
|
||||||
ENDIF("${clib_libsrc}" MATCHES "/")
|
endif("${clib_libsrc}" MATCHES "/")
|
||||||
|
|
||||||
GET_FILENAME_COMPONENT(dylib_src "${clib_libsrcfull}" ABSOLUTE)
|
get_filename_component(dylib_src "${clib_libsrcfull}" ABSOLUTE)
|
||||||
GET_FILENAME_COMPONENT(dylib_name "${dylib_src}" NAME)
|
get_filename_component(dylib_name "${dylib_src}" NAME)
|
||||||
SET(dylib_dst "${clib_bundle}/Contents/MacOS/${dylib_name}")
|
set(dylib_dst "${clib_bundle}/Contents/MacOS/${dylib_name}")
|
||||||
|
|
||||||
# MESSAGE("dylib_src: ${dylib_src}")
|
# message("dylib_src: ${dylib_src}")
|
||||||
# MESSAGE("dylib_dst: ${dylib_dst}")
|
# message("dylib_dst: ${dylib_dst}")
|
||||||
# MESSAGE("new_name: '@executable_path/${dylib_name}'")
|
# message("new_name: '@executable_path/${dylib_name}'")
|
||||||
|
|
||||||
MESSAGE("Copying ${dylib_src} into bundle...")
|
message("Copying ${dylib_src} into bundle...")
|
||||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy
|
execute_process(COMMAND ${CMAKE_COMMAND} -E copy
|
||||||
"${dylib_src}" "${dylib_dst}")
|
"${dylib_src}" "${dylib_dst}")
|
||||||
EXECUTE_PROCESS(COMMAND install_name_tool
|
execute_process(COMMAND install_name_tool
|
||||||
-id "@executable_path/${dylib_name}"
|
-id "@executable_path/${dylib_name}"
|
||||||
"${dylib_dst}"
|
"${dylib_dst}"
|
||||||
)
|
)
|
||||||
SET(${clib_dstlibs} ${${clib_dstlibs}}
|
set(${clib_dstlibs} ${${clib_dstlibs}}
|
||||||
"${dylib_dst}"
|
"${dylib_dst}"
|
||||||
)
|
)
|
||||||
SET(${clib_fixups} ${${clib_fixups}}
|
set(${clib_fixups} ${${clib_fixups}}
|
||||||
"-change"
|
"-change"
|
||||||
"${clib_libsrc}"
|
"${clib_libsrc}"
|
||||||
"@executable_path/${dylib_name}"
|
"@executable_path/${dylib_name}"
|
||||||
)
|
)
|
||||||
ENDIF("${clib_libsrc}" MATCHES ".framework/.*/.*/.*")
|
endif("${clib_libsrc}" MATCHES ".framework/.*/.*/.*")
|
||||||
ENDMACRO(COPY_LIBRARY_INTO_BUNDLE)
|
endmacro(copy_library_into_bundle)
|
||||||
|
|
||||||
|
|
||||||
# Copy dependent "nonsystem" libraries into the bundle:
|
# Copy dependent "nonsystem" libraries into the bundle:
|
||||||
#
|
#
|
||||||
MESSAGE("Copying dependent libraries into bundle...")
|
message("Copying dependent libraries into bundle...")
|
||||||
SET(srclibs ${nonsystem_deps} ${extra_libs})
|
set(srclibs ${nonsystem_deps} ${extra_libs})
|
||||||
SET(dstlibs "")
|
set(dstlibs "")
|
||||||
SET(fixups "")
|
set(fixups "")
|
||||||
FOREACH(d ${srclibs})
|
foreach(d ${srclibs})
|
||||||
COPY_LIBRARY_INTO_BUNDLE("${bundle}" "${d}" dstlibs fixups)
|
copy_library_into_bundle("${bundle}" "${d}" dstlibs fixups)
|
||||||
ENDFOREACH(d)
|
endforeach(d)
|
||||||
|
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("dstlibs='${dstlibs}'")
|
message("dstlibs='${dstlibs}'")
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("fixups='${fixups}'")
|
message("fixups='${fixups}'")
|
||||||
MESSAGE("")
|
message("")
|
||||||
|
|
||||||
|
|
||||||
# Fixup references to copied libraries in the main bundle executable and in the
|
# Fixup references to copied libraries in the main bundle executable and in the
|
||||||
# copied libraries themselves:
|
# copied libraries themselves:
|
||||||
#
|
#
|
||||||
IF(NOT "${fixups}" STREQUAL "")
|
if(NOT "${fixups}" STREQUAL "")
|
||||||
MESSAGE("Fixing up references...")
|
message("Fixing up references...")
|
||||||
FOREACH(d ${dstlibs} "${input_file_full}")
|
foreach(d ${dstlibs} "${input_file_full}")
|
||||||
MESSAGE("fixing up references in: '${d}'")
|
message("fixing up references in: '${d}'")
|
||||||
EXECUTE_PROCESS(COMMAND install_name_tool ${fixups} "${d}")
|
execute_process(COMMAND install_name_tool ${fixups} "${d}")
|
||||||
ENDFOREACH(d)
|
endforeach(d)
|
||||||
MESSAGE("")
|
message("")
|
||||||
ENDIF(NOT "${fixups}" STREQUAL "")
|
endif(NOT "${fixups}" STREQUAL "")
|
||||||
|
|
||||||
|
|
||||||
# List all references to eyeball them and make sure they look right:
|
# List all references to eyeball them and make sure they look right:
|
||||||
#
|
#
|
||||||
MESSAGE("Listing references...")
|
message("Listing references...")
|
||||||
FOREACH(d ${dstlibs} "${input_file_full}")
|
foreach(d ${dstlibs} "${input_file_full}")
|
||||||
EXECUTE_PROCESS(COMMAND otool -L "${d}")
|
execute_process(COMMAND otool -L "${d}")
|
||||||
MESSAGE("")
|
message("")
|
||||||
ENDFOREACH(d)
|
endforeach(d)
|
||||||
MESSAGE("")
|
message("")
|
||||||
|
|
||||||
|
|
||||||
# Output file:
|
# Output file:
|
||||||
#
|
#
|
||||||
GET_FILENAME_COMPONENT(script_name "${CMAKE_CURRENT_LIST_FILE}" NAME)
|
get_filename_component(script_name "${CMAKE_CURRENT_LIST_FILE}" NAME)
|
||||||
FILE(WRITE "${input_file_full}_${script_name}" "# Script \"${CMAKE_CURRENT_LIST_FILE}\" completed.\n")
|
file(WRITE "${input_file_full}_${script_name}" "# Script \"${CMAKE_CURRENT_LIST_FILE}\" completed.\n")
|
||||||
MESSAGE("")
|
message("")
|
||||||
MESSAGE("# Script \"${CMAKE_CURRENT_LIST_FILE}\" completed.")
|
message("# Script \"${CMAKE_CURRENT_LIST_FILE}\" completed.")
|
||||||
MESSAGE("")
|
message("")
|
||||||
|
|
Loading…
Reference in New Issue