Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support USE_FRAMEWORKS=static #333

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

support USE_FRAMEWORKS=static #333

wants to merge 10 commits into from

Conversation

baveku
Copy link

@baveku baveku commented Nov 14, 2024

Fix issue: #219 #218

Copy link

vercel bot commented Nov 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
nitro-docs ⬜️ Skipped (Inspect) Nov 27, 2024 1:01am

# Conflicts:
#	example/ios/NitroExample.xcodeproj/project.pbxproj
#	example/ios/Podfile.lock
Copy link
Owner

@mrousavy mrousavy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - thanks for your PR.

A few things;

  1. Watch indentation. This is not correct, I adjusted it.
  2. I'm not really sure if this should be in the autogenerated podspec extension. I would argue that this is something the user has to put in their podspec. Especially the FOLLY part which might change over time - Nitro does not have anything to do with Folly, this is something the user should configure in their Podspec imo.

@mrousavy
Copy link
Owner

In my opinion, this shouldn't go in the +autolinking.rb file.

This should go into NitroModules.podspec and the template's .podspec, but not in the autogenerated part. It's something that might change over time, and it's also an external factor (folly) - not really my fault that this breaks. I don't think going out of my way to fix a bug in another library is the right idea.

@baveku
Copy link
Author

baveku commented Nov 14, 2024

In my opinion, this shouldn't go in the +autolinking.rb file.

This should go into NitroModules.podspec and the template's .podspec, but not in the autogenerated part. It's something that might change over time, and it's also an external factor (folly) - not really my fault that this breaks. I don't think going out of my way to fix a bug in another library is the right idea.

That's right, I'll reference other libraries instead of editing autolink.

folly_config = get_folly_config()
folly_compiler_flags = folly_config[:compiler_flags]
folly_version = folly_config[:version]
boost_compiler_flags = '-Wno-documentation'

@baveku
Copy link
Author

baveku commented Nov 17, 2024

Hey @mrousavy,
First, I update umbera to support static, we don't need use HEADER_SEARCH_PATHS

// Include Swift defined types
#if __has_include("NitroImage-Swift.h")
// This header is generated by Xcode/Swift on every app build.
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroImage".
#include "NitroImage-Swift.h"
#elif __has_include(<NitroImage/NitroImage-Swift.h>)
#include <NitroImage/NitroImage-Swift.h>
#else
#error NitroImage's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroImage", and try building the app first.
#endif

Second, I don't find any ways to support build static so I will edit podspec to support GCC_PREPROCESSOR_DEFINITIONS

$gcc_shared_flags = "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
gcc_flags = ''
$use_frameworks = ENV['USE_FRAMEWORKS']
if $use_frameworks
	gcc_flags = $gcc_shared_flags
end
...

s.pod_target_xcconfig = {
		"GCC_PREPROCESSOR_DEFINITIONS" => gcc_flags}
}

Hope we can use this solution for USE_FRAMEWORKS=static

@baveku baveku requested a review from mrousavy November 19, 2024 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants