...
 
Commits (3)
......@@ -25,6 +25,7 @@
# For example, creating a swift framework doesn't work with Ninja backend (only Xcode).
# Fortunately, creating a swift shared library works.
# As a result, I had to create my own script to create a framework from a shared library, called make-framework.sh.
# For xcode, create a swift framework directly.
# These two links are interesting:
# https://forums.swift.org/t/announcing-swift-support-in-cmake/24792
......@@ -47,19 +48,6 @@ add_custom_command(OUTPUT LinphoneWrapper.swift
linphone-doc
)
add_custom_command(OUTPUT linphonesw.framework
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/make-framework.sh" "linphonesw"
"-b" "${CMAKE_CURRENT_BINARY_DIR}"
"-v" "${PROJECT_VERSION}"
-o "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS linphonesw
)
add_custom_target(linphonesw-framework ALL
COMMAND echo "linphonesw.framework generated manually."
DEPENDS linphonesw.framework
)
add_library(linphonesw SHARED
${CMAKE_CURRENT_BINARY_DIR}/LinphoneWrapper.swift
)
......@@ -68,28 +56,39 @@ target_link_libraries(linphonesw
PRIVATE ${BCTOOLBOX_CORE_LIBRARIES} ${BELLESIP_LIBRARIES} linphone
)
if(CMAKE_GENERATOR STREQUAL Xcode)
set_target_properties(linphonesw PROPERTIES
FRAMEWORK TRUE
LINKER_LANGUAGE SWIFT
MACOSX_FRAMEWORK_IDENTIFIER org.linphone.linphonesw
MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/build/osx/Info.plist.in"
)
install(TARGETS linphonesw EXPORT ${EXPORT_TARGETS_NAME}Targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION Frameworks
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
else()
add_custom_command(OUTPUT linphonesw.framework
COMMAND "${CMAKE_CURRENT_SOURCE_DIR}/make-framework.sh" "linphonesw"
"-b" "${CMAKE_CURRENT_BINARY_DIR}"
"-v" "${PROJECT_VERSION}"
-o "${CMAKE_CURRENT_BINARY_DIR}"
DEPENDS linphonesw
)
add_custom_target(linphonesw-framework ALL
COMMAND echo "linphonesw.framework generated manually."
DEPENDS linphonesw.framework
)
#Add -target and -sdk options to switfc command line otherwise you'll get obscure errors.
target_compile_options(linphonesw PRIVATE -emit-objc-header -target ${CMAKE_OSX_ARCHITECTURES}-apple-ios10 -sdk ${CMAKE_OSX_SYSROOT})
#Add -target and -sdk options to switfc command line otherwise you'll get obscure errors.
target_compile_options(linphonesw PRIVATE -emit-objc-header -target ${CMAKE_OSX_ARCHITECTURES}-apple-ios10 -sdk ${CMAKE_OSX_SYSROOT})
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/linphonesw.framework DESTINATION Frameworks
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/linphonesw.framework DESTINATION Frameworks
USE_SOURCE_PERMISSIONS
)
#set_target_properties(linphonesw PROPERTIES
# FRAMEWORK TRUE
# LINKER_LANGUAGE SWIFT
# MACOSX_FRAMEWORK_IDENTIFIER org.linphone.linphonesw
# MACOSX_FRAMEWORK_INFO_PLIST "${CMAKE_SOURCE_DIR}/build/osx/Info.plist.in"
#)
#install(TARGETS linphonesw EXPORT ${EXPORT_TARGETS_NAME}Targets
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
# FRAMEWORK DESTINATION Frameworks
# PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
#)
)
endif()