Mercurial > dwindows
comparison mobile.txt @ 2671:0ed61ddb9957
Add a mobile platform text file with instructions on how to create projects.
iOS and Android currently can't be built using the command line system we
use on other platforms, so these instructions provide the means to get
Dynamic Windows running on mobile platfoms. There might be better ways to do
this, so considering the information a work in progress.
Also the Android C++ file had now incorrect requirement information.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Mon, 18 Oct 2021 12:44:57 +0000 |
parents | |
children | d2c3b17a4ddf |
comparison
equal
deleted
inserted
replaced
2670:e3a95940c18f | 2671:0ed61ddb9957 |
---|---|
1 How to create a Dynamic Windows project for iOS in Xcode and Android in Android Studio. | |
2 | |
3 | |
4 Xcode | |
5 | |
6 === Dynamic Windows Project Creation === | |
7 1. File → New → Project… | |
8 2. Select “iOS” then “App” then click “Next” | |
9 3. Fill in the following: | |
10 “Product Name” with “Dynamic Windows iOS” | |
11 “Team” select the appropriate team for this project. | |
12 “Organization Identifier” with “org.dbsoft” | |
13 “Interface” select “Storyboard” | |
14 “Language” select “Objective-C” | |
15 Uncheck “Include Tests” and click “Next” | |
16 4. Choose a location for the project, “Don’t add to any project or workspace” | |
17 5. Rename the “Dynamic Windows iOS” target to “dwtest” and remove the following files: | |
18 *.m, *.h, *.storyboard and Assets.xcassets | |
19 6. Select “dwtest” folder and File → Add Files to “Dynamic Windows iOS”… | |
20 Select “dwtest.c” from the file dialog with “Copy items if needed” unchecked. | |
21 “Add to targets” should have “dwtest” checked. | |
22 7. Highlight the project “Dynamic Windows iOS” in the top left then select the target “dwtest” | |
23 Edit “Bundle Identifier” to be “org.dbsoft.dwindows.dwtest” | |
24 8. Click the target dropdown and click “Add Target” | |
25 Select “Framework” and click “Next” | |
26 “Product name” with “dwindows” uncheck “Include Tests” | |
27 9. Delete the created “dwindows.h” and “Move to Trash” | |
28 10. Select “dwindows” folder and File → Add Files to “Dynamic Windows iOS”… | |
29 Add “dw.h” and “ios/dw.n” with “Copy items if needed” unchecked. | |
30 11. Repeat steps 8 through 10 with “dwcompat” adding the dwcompat.c and dwcompat.h files. | |
31 12. Highlight the project “Dynamic Windows iOS” in the top left then select the main project. | |
32 Click “Build Settings” for the entire project and find “Apple Clang – Preprocessing” | |
33 Double click “Preprocessor Macros” and add “__IOS__” to the list for release and debug. | |
34 13. Set “Objective-C Automatic Reference Counting” to “No” in “Language – Objective-C” | |
35 14. Edit the “Info.plist” in “dwtest” and remove all the settings below “Bundle version” | |
36 This is required because Dynamic Windows does not use storyboards. | |
37 If necessary edit the “dwtest” “Build Settings” and correct the path to “dwtest/Info.plist” | |
38 15. Highlight the project “Dynamic Windows iOS” in the top left then File → New → Group | |
39 Name the new group “Resources” | |
40 Copy “mac/file.png” “mac/folder.png” and “image/test.png” into “Resources” | |
41 | |
42 === Project Creation === | |
43 1. File → New → Project… | |
44 2. Select “iOS” then “App” then click “Next” | |
45 3. Fill in the following: | |
46 “Product Name” with your application name. | |
47 “Team” select the appropriate team for this project. | |
48 “Organization Identifier” with your identifier | |
49 “Interface” select “Storyboard” | |
50 “Language” select “Objective-C” | |
51 Uncheck “Include Tests” and click “Next” | |
52 4. Choose a location for the project, “Don’t add to any project or workspace” | |
53 5. Make sure you close the “Dynamic Windows iOS” main project before step 6. | |
54 6. Select the project in the top left and File → Add Files to “Project Name”… | |
55 Find the “Dynamic Windows iOS” project and add it to the application project. | |
56 7. Select the Project folder and File → Add Files to “Project Name”… | |
57 Add your source files with “Copy items if needed” unchecked. | |
58 8. Edit the “Info.plist” in the Project and remove all the settings below “Bundle version” | |
59 This is required because Dynamic Windows does not use storyboards. | |
60 9. Highlight the Project Name in the top left then File → New → Group | |
61 Name the new group “Resources” | |
62 10. Place any application resource images in the form “#.png” where # is the resource ID. | |
63 Any other application files placed here will be accessible via dw_app_dir() at runtime. | |
64 11. Open Assets.xcassets and drag the appropriate icons into the bottom sections. | |
65 12. Select the project in the top left and select the application target from the drop down list. | |
66 Under “General” find “Frameworks, Libraries and Embedded Content” | |
67 Add “dwindows.framework” from the “Dynamic Windows iOS” project. | |
68 If necessary add “dwcompat.framework” from the Dynamic Windows iOS” project. | |
69 13. Highlight the project name in the top left then select the main project. | |
70 Click “Info” and set the “iOS Deployment Target” to “13.0” | |
71 14. Click “Build Settings” for the entire project and find “Search Paths” and add the path to | |
72 dw.h in “Header Search Paths” for Release and Debug (Any Architecture | Any SDK) | |
73 15. Also under “Build Settings” find “Apple Clang – Preprocessing” | |
74 Double click “Preprocessor Macros” and add “__IOS__” to the list for release and debug. | |
75 | |
76 | |
77 Android Studio | |
78 | |
79 === Project Creation === | |
80 1. File → New → New Project | |
81 2. Select “Phone and Tablet” then “Native C++” and click “Next” | |
82 3. Fill in the following: | |
83 “Name” with your own application name | |
84 “Package name” with “org.dbsoft.dwindows” | |
85 “Save location” can be the default | |
86 “Language” select “Kotlin” | |
87 “Minimum SDK” select “API 23: Android 6.0 (Marshmallow)” | |
88 click “Next” | |
89 4. Select “Toolchain Default” and click “Finish” | |
90 | |
91 === Source File Installation === | |
92 5. Install “android/DWindows.kt” into “app/src/main/java/org/dbsoft/dwindows” | |
93 Remove “MainActivity.kt” from app/src/main/java/org/dbsoft/dwindows” | |
94 6. Install “dw.h” and “android/dw.cpp” into “app/src/main/cpp” | |
95 Remove “native-lib.cpp” from “app/src/main/cpp” | |
96 7. Optionally install “dwcompat.h” and “dwcompat.c” into “app/src/main/cpp” | |
97 8. Install your source files (or our example “dwtest.c”) into “app/src/main/cpp” | |
98 9. Right click “app” in your project and click New → Folder → Assets Folder | |
99 “Target Source Set” select “main” and click “Finish” | |
100 10. Place any application resource images in the form “#.png” where # is the resource ID. | |
101 Any other application files placed here will be accessible via dw_app_dir() at runtime. | |
102 | |
103 === Project Configuration === | |
104 11. Open “app/manifests/AndroidManifest.xml” and in the “activity” section | |
105 change “android:name” from “.MainActivity” to “.DWindows” | |
106 12. Recommend adding the following (but depends on the app usage): | |
107 android:configChanges="orientation|screenSize|screenLayout|keyboardHidden" | |
108 android:screenOrientation="fullSensor" | |
109 android:persistent="true" | |
110 android:usesCleartextTraffic="true" | |
111 13: Open “app/src/main/cpp/CMakeLists.txt” and in the add_library() section: | |
112 Remove “native-lib.cpp” and add “dw.cpp” optionally “dwcompat.c” and your applications C | |
113 or C++ source files that you had installed in step 8. | |
114 Also change “project()” to be your project name. | |
115 14. Open “build.gradle (Module)” in “Gradle Scripts” and change “applicationId” to your App ID. | |
116 | |
117 === Application Assets === | |
118 15. Remove all the files under “app/res/mipmap/ic_launcher” and app/res/mipmap/ic_launcher_round” | |
119 16. Right click “app” and click New → Image Asset | |
120 “Icon Type” select “Launcher Icons (Legacy Only)” | |
121 “Name” enter “ic_launcher” | |
122 “Asset Type” check “Image” | |
123 “Path” click the folder icon and select the largest launcher image you have. | |
124 “Shape” select “Square” | |
125 Click “Next” and then “Finish” | |
126 17. Right click “app” and click New → Image Asset | |
127 “Icon Type” select “Launcher Icons (Legacy Only)” | |
128 “Name” enter “ic_launcher_round” | |
129 “Asset Type” check “Image” | |
130 “Path” click the folder icon and select the largest launcher image you have. | |
131 “Shape” select “Circle” | |
132 Click “Next” and then “Finish” | |
133 | |
134 |