|
1 ################################################################################### |
|
2 # Uncomment (remove the leading '#') and change the paths accordingly to your own |
|
3 # build environment, please do specify an absolute path (/home/richard/SoftDev |
|
4 # rather than ~/SoftDev). |
|
5 # You only need to change the three lines below, after that you can run 'cmake .' |
|
6 # from the hedgewars root directory |
|
7 # |
|
8 # optionally you can specify SDL_DIR this will move the required SDL libraries to |
|
9 # the correct place |
|
10 ################################################################################## |
|
11 |
1 set(ANDROID_NDK /home/richard/SoftDev/android/android-ndk-r5b) |
12 set(ANDROID_NDK /home/richard/SoftDev/android/android-ndk-r5b) |
2 set(ANDROID_SDK /home/richard/SoftDev/android/android-sdk-linux_86) |
13 set(ANDROID_SDK /home/richard/SoftDev/android/android-sdk-linux_86) |
3 set(FPC_DIR /home/richard/SoftDev/fpc-2.4.4) |
14 set(FPC_DIR /home/richard/SoftDev/fpc-2.4.4) |
|
15 set(SDL_DIR /home/richard/Downloads/android-project) |
|
16 |
|
17 if(ANDROID_NDK AND ANDROID_SDK AND FPC_DIR) |
|
18 |
4 set(ANDROID_SDK_API_LVL 8) |
19 set(ANDROID_SDK_API_LVL 8) |
5 set(ANDROID_NDK_API_LVL 5) |
20 set(ANDROID_NDK_API_LVL 5) |
|
21 |
|
22 MESSAGE("Creating android scripts and configuration files") |
6 |
23 |
7 configure_file(Templates/complete_build.sh .) |
24 configure_file(Templates/complete_build.sh .) |
8 configure_file(Templates/default.properties SDL-android-project/) |
25 configure_file(Templates/default.properties SDL-android-project/) |
9 configure_file(Templates/local.properties SDL-android-project/) |
26 configure_file(Templates/local.properties SDL-android-project/) |
10 configure_file(Templates/Makefile.android .) |
27 configure_file(Templates/Makefile.android .) |
11 configure_file(Templates/pushToDevice.sh .) |
28 configure_file(Templates/pushToDevice.sh .) |
12 |
29 |
13 set(PREFERED_DIRS |
30 if(SDL_DIR) |
14 Sounds |
|
15 Music |
|
16 ) |
|
17 set(DIRS |
|
18 Fonts |
|
19 Forts |
|
20 Graphics |
|
21 Locale |
|
22 Maps |
|
23 misc |
|
24 Missions |
|
25 Names |
|
26 Scripts |
|
27 Themes |
|
28 ) |
|
29 set(PREFERED_DIRS_PREFIX ../../../../Data) |
|
30 set(DIRS_PREFIX ../../../../../share/hedgewars/Data) |
|
31 |
31 |
32 if(CMAKE_HOST_WIN32) #Copy the asset files to the proper folder when using windows |
32 MESSAGE("Moving Android port of SDL to the proper directories") |
33 set(OPERATION copy_directory) |
|
34 else(CMAKE_HOST_WIN32)#If it isn't windows we can assume it's unix/darwin which supports symlinks |
|
35 set(OPERATION create_symlink) |
|
36 endif(CMAKE_HOST_WIN32)#We can make the above assumption because the android ndk/sdk only support Linux/Windows/Mac |
|
37 |
33 |
38 #Copy or symlink the smaller sized resources first |
34 set(DirsToCopy |
39 foreach(DIR ${PREFERED_DIRS}) |
35 SDL |
40 EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" |
36 SDL_image |
41 -E |
37 SDL_mixer |
42 ${OPERATION} |
38 SDL_ttf |
43 ${PREFERED_DIRS_PREFIX}/${DIR} |
39 jpeg |
44 DataPackage/assets/Data/${DIR} |
40 png |
45 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
41 mikmod |
46 ) |
42 tremor |
47 endforeach(DIR) |
43 freetype |
|
44 ) |
|
45 foreach(DIR ${DirsToCopy}) |
|
46 EXECUTE_PROCESS( |
|
47 COMMAND ${CMAKE_COMMAND} |
|
48 -E copy_directory |
|
49 ${SDL_DIR}/jni/${DIR} |
|
50 ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/${DIR} |
|
51 ) |
|
52 endforeach(DIR) |
|
53 exec_program(${HGCOMMAND} |
|
54 ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/core/android/SDL_android.cpp |
|
55 ) |
|
56 exec_program(${HGCOMMAND} |
|
57 ARGS revert ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project/jni/SDL/src/main/android/SDL_android_main.cpp |
|
58 ) |
|
59 else(SDL_DIR) |
|
60 MESSAGE("Android port of SDL not moved..") |
|
61 endif(SDL_DIR) |
48 |
62 |
49 #Use the global resources second |
63 else(ANDROID_AND AND ANDROID_SDK AND FPC_DIR) |
50 foreach(DIR ${DIRS}) |
64 MESSAGE("Android port files not created, edit top of ${CMAKE_CURRENT_SOURCE_DIR}/CMakeList.txt to created android specific files") |
51 EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}" |
65 endif(ANDROID_NDK AND ANDROID_SDK AND FPC_DIR) |
52 -E |
66 |
53 ${OPERATION} |
67 |
54 ${DIRS_PREFIX}/${DIR} |
|
55 DataPackage/assets/Data/${DIR} |
|
56 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
|
57 ) |
|
58 endforeach(DIR) |
|