I create a swift framework with objectiveC code which are translated by j2objc.
I have add java files to compile source, and use the following setting:
GENERATED_FILES_DIR = "${SRCROOT}/Generated";
HEADER_SEARCH_PATHS = "${J2OBJC_HOME}/frameworks/JRE.framework/Headers" "${GENERATED_FILES_DIR}" "${J2OBJC_HOME}/include" $(inherited);
LIBRARY_SEARCH_PATHS = ${J2OBJC_HOME}/lib;
OTHER_LDFLAGS = -ljre_emul
CLANG_ENABLE_OBJC_ARC = NO
and I got error:
include "J2ObjC_header.h" >> Include of non-modular header inside framework module 'XXXXX'
Then i do the following:
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
The error still exist.
I link 'JRE.framework' and set the HEADER_SEARCH_PATHS
The error still exist.
How to fix it?
You also want to set
DEFINES_MODULE = NO;Besides that, you don't need the
"${J2OBJC_HOME}/include"inHEADER_SEARCH_PATHSand you can also removeLIBRARY_SEARCH_PATHS = ${J2OBJC_HOME}/lib; OTHER_LDFLAGS = -ljre_emul;since you are using the JRE framework now.If you are translating the
.javasources without the--no-package-directoriesflag and you want to preserve the directory structure, then you also want to do following:Copy Bundle ResourcesphasePublicsection of theHeadersphaseRun Scripphase to remove the.mfiles fromHeadersdirectory:find "$TARGET_BUILD_DIR/$PUBLIC_HEADERS_FOLDER_PATH" -name "*.m" -exec rm -f {} \;#include <your-framework-name/path/to/header/Header.h>