Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit f8ecc26

Browse files
committed
[[ ExternalsApiV5 ]] Tweaks to lcidlc and support to only generate obj-c related things if __OBJC__ is defined.
[[ ExternalsApiV5 ]] Got revtestexternal compiling on Linux.
1 parent 4df4184 commit f8ecc26

File tree

6 files changed

+42
-3
lines changed

6 files changed

+42
-3
lines changed

lcidlc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ SOURCES=\
99
CUSTOM_LIBS=core
1010
CUSTOM_STATIC_LIBS=stdc++
1111

12-
EncodedSupport.c: src/Support.mm
12+
EncodedSupport.c: Support.mm
1313
../prebuilt/bin/Revolution.lnx "./encode_source.rev" "$SRCROOT/src/Support.mm" "$SRCROOT/src/EncodedSupport.c" "g_support_template"
1414

15-
EncodedJavaSupport.c: src/Support.mm
15+
EncodedJavaSupport.c: Support.mm
1616
../prebuilt/bin/Revolution.lnx "./encode_source.rev" "$SRCROOT/src/Support.java" "$SRCROOT/src/EncodedJavaSupport.c" "g_java_support_template"
1717

1818
include $(dir $(lastword $(MAKEFILE_LIST)))/../rules/application.linux.makefile

lcidlc/src/InterfaceGenerate.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -620,8 +620,10 @@ static bool InterfaceGenerateHandlers(InterfaceRef self, CoderRef p_coder)
620620
CoderWriteLine(p_coder, "{");
621621
if (self -> use_objc_objects)
622622
{
623+
CoderWriteLine(p_coder, "#ifdef __OBJC__");
623624
CoderWriteLine(p_coder, "\tNSAutoreleasePool *t_pool;");
624625
CoderWriteLine(p_coder, "\tt_pool = [[NSAutoreleasePool alloc] init];");
626+
CoderWriteLine(p_coder, "#endif");
625627
CoderWriteLine(p_coder, "");
626628
}
627629

@@ -771,7 +773,11 @@ static bool InterfaceGenerateHandlers(InterfaceRef self, CoderRef p_coder)
771773
}
772774

773775
if (self -> use_objc_exceptions)
776+
{
777+
CoderWriteLine(p_coder, "#ifdef __OBJC__");
774778
CoderWriteLine(p_coder, "\tNS_DURING");
779+
CoderWriteLine(p_coder, "#endif");
780+
}
775781

776782
if (t_native_return_type != kNativeTypeNone)
777783
{
@@ -798,9 +804,11 @@ static bool InterfaceGenerateHandlers(InterfaceRef self, CoderRef p_coder)
798804

799805
if (self -> use_objc_exceptions)
800806
{
807+
CoderWriteLine(p_coder, "#ifdef __OBJC__");
801808
CoderWriteLine(p_coder, "\t\tNS_HANDLER");
802809
CoderWriteLine(p_coder, "\t\t\tsuccess = error__raise([[localException reason] cStringUsingEncoding: NSMacOSRomanStringEncoding]);");
803810
CoderWriteLine(p_coder, "\t\tNS_ENDHANDLER");
811+
CoderWriteLine(p_coder, "#endif");
804812
}
805813

806814
if (self -> use_cpp_exceptions)
@@ -908,7 +916,9 @@ static bool InterfaceGenerateHandlers(InterfaceRef self, CoderRef p_coder)
908916

909917
if (self -> use_objc_objects)
910918
{
919+
CoderWriteLine(p_coder, "#ifdef __OBJC__");
911920
CoderWriteLine(p_coder, "\t[t_pool release];");
921+
CoderWriteLine(p_coder, "#endif");
912922
CoderWriteLine(p_coder, "");
913923
}
914924

lcidlc/src/Support.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
#include <pthread.h>
1818
#include <stdarg.h>
1919
#include <stdio.h>
20+
#include <stdlib.h>
21+
#include <stdint.h>
22+
#include <string.h>
2023

2124
#ifdef __OBJC__
2225
#import <Foundation/Foundation.h>

revtestexternal/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
NAME=revtestexternal
2+
TYPE=library
3+
4+
SOURCES=\
5+
revtestexternal.cpp \
6+
revtestexternalidl.cpp
7+
8+
CUSTOM_DEFINES=
9+
10+
CUSTOM_INCLUDES=./src
11+
12+
CUSTOM_LIBS=
13+
14+
CUSTOM_STATIC_LIBS=stdc++
15+
16+
CUSTOM_DYNAMIC_LIBS=pthread
17+
18+
CUSTOM_CCFLAGS=
19+
20+
CUSTOM_LDFLAGS=
21+
22+
revtestexternalidl.cpp: revtestexternal.lcidl
23+
../_build/linux/$(MODE)/lcidlc revtestexternal.lcidl src/revtestexternalidl.cpp
24+
25+
include ../rules/library.linux.makefile

revtestexternal/src/revtestexternal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void *thread_begin(void *(*p_callback)(void *), void *p_context)
3636
pthread_t t_handle;
3737
if (pthread_create(&t_handle, NULL, p_callback, p_context) != 0)
3838
return NULL;
39-
return t_handle;
39+
return (void *)t_handle;
4040
}
4141

4242
void *thread_finish(void *p_thread)

rules/common.linux.makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ DEFINES=$(CUSTOM_DEFINES) $(TYPE_DEFINES) _LINUX TARGET_PLATFORM_POSIX
66

77
GLOBAL_INCLUDES=\
88
$(SOLUTION_DIR)/engine/include \
9+
$(SOLUTION_DIR)/lcidlc/include \
910
$(SOLUTION_DIR)/libcore/include \
1011
$(SOLUTION_DIR)/libexternal/include \
1112
$(SOLUTION_DIR)/thirdparty/headers/linux/include \

0 commit comments

Comments
 (0)