浏览代码

[Demo Project] Add macOS framework templates, update Scons build script and ".gdextension" file.

bruvzg 3 年之前
父节点
当前提交
a263344653

+ 6 - 2
test/SConstruct

@@ -89,7 +89,7 @@ if env["target"] == "debug":
 
 
 # Check our platform specifics
 # Check our platform specifics
 if env["platform"] == "osx":
 if env["platform"] == "osx":
-    env["target_path"] += "osx/"
+    env["target_path"] += "{}.{}.framework/".format(env["target_name"], env["target"])
     cpp_library += ".osx"
     cpp_library += ".osx"
 
 
     if env["bits"] == "32":
     if env["bits"] == "32":
@@ -154,7 +154,11 @@ env.Append(LIBS=[cpp_library])
 env.Append(CPPPATH=["src/"])
 env.Append(CPPPATH=["src/"])
 sources = Glob("src/*.cpp")
 sources = Glob("src/*.cpp")
 
 
-target_name = "{}.{}.{}.{}".format(env["target_name"], env["platform"], env["target"], arch_suffix)
+if env["platform"] == "osx":
+    target_name = "{}.{}".format(env["target_name"], env["target"])
+else:
+    target_name = "{}.{}.{}.{}".format(env["target_name"], env["platform"], env["target"], arch_suffix)
+
 print(target_name)
 print(target_name)
 library = env.SharedLibrary(target=env["target_path"] + target_name, source=sources)
 library = env.SharedLibrary(target=env["target_path"] + target_name, source=sources)
 
 

+ 26 - 0
test/demo/bin/libgdexample.debug.framework/Resources/Info.plist

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleExecutable</key>
+	<string>libgdexample.debug</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.godotengine.libgdexample</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>libgdexample.debug</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0.0</string>
+	<key>CFBundleSupportedPlatforms</key>
+	<array>
+		<string>MacOSX</string>
+	</array>
+	<key>CFBundleVersion</key>
+	<string>1.0.0</string>
+	<key>LSMinimumSystemVersion</key>
+	<string>10.12</string>
+</dict>
+</plist>

+ 26 - 0
test/demo/bin/libgdexample.release.framework/Resources/Info.plist

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>CFBundleExecutable</key>
+	<string>libgdexample.release</string>
+	<key>CFBundleIdentifier</key>
+	<string>org.godotengine.libgdexample</string>
+	<key>CFBundleInfoDictionaryVersion</key>
+	<string>6.0</string>
+	<key>CFBundleName</key>
+	<string>libgdexample.release</string>
+	<key>CFBundlePackageType</key>
+	<string>FMWK</string>
+	<key>CFBundleShortVersionString</key>
+	<string>1.0.0</string>
+	<key>CFBundleSupportedPlatforms</key>
+	<array>
+		<string>MacOSX</string>
+	</array>
+	<key>CFBundleVersion</key>
+	<string>1.0.0</string>
+	<key>LSMinimumSystemVersion</key>
+	<string>10.12</string>
+</dict>
+</plist>

+ 2 - 0
test/demo/example.gdextension

@@ -8,3 +8,5 @@ linux.64.debug = "bin/libgdexample.linux.debug.64.so"
 linux.64.release = "bin/libgdexample.linux.release.64.so"
 linux.64.release = "bin/libgdexample.linux.release.64.so"
 windows.64.debug = "bin/libgdexample.windows.debug.64.dll"
 windows.64.debug = "bin/libgdexample.windows.debug.64.dll"
 windows.64.release = "bin/libgdexample.windows.release.64.dll"
 windows.64.release = "bin/libgdexample.windows.release.64.dll"
+macos.debug = "bin/libgdexample.debug.framework"
+macos.release = "bin/libgdexample.release.framework"

+ 2 - 0
test/demo/main.tscn

@@ -23,3 +23,5 @@ text = "Click me!"
 __meta__ = {
 __meta__ = {
 "_edit_use_anchors_": false
 "_edit_use_anchors_": false
 }
 }
+
+[connection signal="custom_signal" from="Example" to="." method="_on_Example_custom_signal"]