Skip to content

Commit

Permalink
fix(cmake): Embed NativeScript.framework in sample and test applications
Browse files Browse the repository at this point in the history
This is necessary in order to be able to run them successfully on device
  • Loading branch information
mbektchiev committed Jul 5, 2018
1 parent 9c2b7b5 commit 3117d2d
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
31 changes: 31 additions & 0 deletions cmake/CreateNativeScriptApp.cmake
Expand Up @@ -23,6 +23,37 @@ function(CreateNativeScriptApp _target _main _plist _resources)
if(NOT ${EMBED_STATIC_DEPENDENCIES})
target_link_libraries(${_target} ${WEBKIT_LIBRARIES} ffi)
endif()
else()
set_target_properties(${_target} PROPERTIES
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks"
)

# Create Frameworks directory in app bundle
add_custom_command(
TARGET
${_target}
POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory
${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/${_target}.app/Frameworks
)

# Copy the framework into the bundle
add_custom_command(
TARGET
${_target}
POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory
${NativeScriptFramework_BINARY_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/
${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/${_target}.app/Frameworks
)

# Codesign the framework in it's new spot
add_custom_command(
TARGET
${_target}
POST_BUILD COMMAND codesign --force --verbose
${CMAKE_CURRENT_BINARY_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/${_target}.app/Frameworks/NativeScript.framework
--sign \"$(EXPANDED_CODE_SIGN_IDENTITY)\"
)

endif()

set_target_properties(${_target} PROPERTIES
Expand Down
4 changes: 3 additions & 1 deletion src/NativeScript/CMakeLists.txt
@@ -1,5 +1,7 @@
project(NativeScriptFramework)

set(HEADER_FILES
Calling/FFICache.h
Calling/FFICache.h
Calling/FFICall.h
Calling/FFICallback.h
Calling/FFICallbackInlines.h
Expand Down

0 comments on commit 3117d2d

Please sign in to comment.