project_files/Android-build/CMakeLists.txt
branchhedgeroid
changeset 5381 8f95038f3f75
child 5408 1c2f0dfbe759
equal deleted inserted replaced
5379:4ed99dc92763 5381:8f95038f3f75
       
     1 set(ANDROID_NDK /home/richard/SoftDev/android/android-ndk-r5b)
       
     2 set(ANDROID_SDK /home/richard/SoftDev/android/android-sdk-linux_86)
       
     3 set(FPC_DIR /home/richard/SoftDev/fpc-2.4.4)
       
     4 set(ANDROID_SDK_API_LVL 8)
       
     5 set(ANDROID_NDK_API_LVL 5)
       
     6 
       
     7 configure_file(Templates/complete_build.sh .)
       
     8 configure_file(Templates/default.properties SDL-android-project/)
       
     9 configure_file(Templates/local.properties SDL-android-project/)
       
    10 configure_file(Templates/default.properties DataPackage/)
       
    11 configure_file(Templates/local.properties DataPackage/)
       
    12 configure_file(Templates/Makefile.android .)
       
    13 configure_file(Templates/pushToDevice.sh .)
       
    14 
       
    15 set(PREFERED_DIRS 
       
    16     Sounds
       
    17     Music
       
    18 )
       
    19 set(DIRS
       
    20     Fonts
       
    21     Forts
       
    22     Graphics
       
    23     Locale
       
    24     Maps
       
    25     misc
       
    26     Missions
       
    27     Names
       
    28     Scripts
       
    29     Themes
       
    30 )
       
    31 set(PREFERED_DIRS_PREFIX ../../../../Data)
       
    32 set(DIRS_PREFIX ../../../../../share/hedgewars/Data)
       
    33 
       
    34 if(CMAKE_HOST_WIN32) #Copy the asset files to the proper folder when using windows
       
    35     set(OPERATION copy_directory)
       
    36 else(CMAKE_HOST_WIN32)#If it isn't windows we can assume it's unix/darwin which supports symlinks
       
    37     set(OPERATION create_symlink)
       
    38 endif(CMAKE_HOST_WIN32)#We can make the above assumption because the android ndk/sdk only support Linux/Windows/Mac
       
    39 
       
    40 #Copy or symlink the smaller sized resources first
       
    41 foreach(DIR ${PREFERED_DIRS})
       
    42         EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}"
       
    43             -E 
       
    44             ${OPERATION}
       
    45             ${PREFERED_DIRS_PREFIX}/${DIR}
       
    46             DataPackage/assets/Data/${DIR} 
       
    47             WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       
    48         )
       
    49 endforeach(DIR)
       
    50 
       
    51 #Use the global resources second
       
    52 foreach(DIR ${DIRS})
       
    53          EXECUTE_PROCESS(COMMAND "${CMAKE_COMMAND}"
       
    54             -E 
       
    55             ${OPERATION} 
       
    56             ${DIRS_PREFIX}/${DIR}
       
    57             DataPackage/assets/Data/${DIR} 
       
    58             WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       
    59          )
       
    60 endforeach(DIR)