project_files/Android-build/CMakeLists.txt
changeset 6812 929b467c7277
parent 6807 f4816282ba01
child 7693 0bdb1dd83b63
equal deleted inserted replaced
6811:4248d57abc9e 6812:929b467c7277
    14 # You should have received a copy of the GNU General Public License
    14 # You should have received a copy of the GNU General Public License
    15 # along with this program; if not, write to the Free Software
    15 # along with this program; if not, write to the Free Software
    16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17 ###################################################################################
    17 ###################################################################################
    18 
    18 
    19 find_program(ANT ant)
    19 find_program(ANT ant DOC "Path to the java package creator: ant")
    20 if(NOT EXISTS ${ANT})
    20 if(NOT EXISTS ${ANT})
    21     MESSAGE(FATAL_ERROR "Couldn't detect the Ant build tool")
    21     MESSAGE(FATAL_ERROR "Couldn't detect the Ant build tool")
    22 endif()
    22 endif()
    23 
    23 
    24 if(NOT ANDROID_NDK)
    24 if(NOT ANDROID_NDK)
    31     MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK directory")
    31     MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK directory")
    32 endif()
    32 endif()
    33 
    33 
    34 if(NOT ANDROID_NDK_TOOLCHAINDIR)
    34 if(NOT ANDROID_NDK_TOOLCHAINDIR)
    35     set(toolchainbase "${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt")
    35     set(toolchainbase "${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.4.3/prebuilt")
    36     find_program(ANDROID_NDK_TOOLCHAINDIR arm-linux-androideabi-as
    36     find_path(ANDROID_NDK_TOOLCHAINDIR arm-linux-androideabi
    37                 "${toolchainbase}/linux-x86/bin"
    37                 "${toolchainbase}/linux-x86"
    38                 "${toolchainbase}/windows/bin")
    38                 "${toolchainbase}/windows")
    39     get_filename_component(ANDROID_NDK_TOOLCHAINDIR "${ANDROID_NDK_TOOLCHAINDIR}" PATH)
       
    40     get_filename_component(ANDROID_NDK_TOOLCHAINDIR "${ANDROID_NDK_TOOLCHAINDIR}" PATH)
       
    41 endif()
    39 endif()
    42 
    40 
    43 if(IS_DIRECTORY "${ANDROID_NDK_TOOLCHAINDIR}")
    41 if(IS_DIRECTORY "${ANDROID_NDK_TOOLCHAINDIR}")
    44     MESSAGE(STATUS "Detected the Android NDK toolchain at: " ${ANDROID_NDK_TOOLCHAINDIR}) 
    42     MESSAGE(STATUS "Detected the Android NDK toolchain at: ${ANDROID_NDK_TOOLCHAINDIR}") 
    45 else ()
    43 else ()
    46     MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK toolchain directory")
    44     MESSAGE(FATAL_ERROR "Couldn't detect the Android NDK toolchain directory: ${ANDROID_NDK_TOOLCHAINDIR}")
    47 endif()
    45 endif()
    48 
    46 
    49 if(NOT ANDROID_SDK)#Check if its defined at the cmdline
    47 if(NOT ANDROID_SDK)#Check if its defined at the cmdline
    50     find_program(ANDROID_SDK adb) #assume they've added platform-tools to their path
    48     find_program(ANDROID_SDK adb) #assume they've added platform-tools to their path
    51     get_filename_component(ANDROID_SDK "${ANDROID_SDK}" PATH)
    49     get_filename_component(ANDROID_SDK "${ANDROID_SDK}" PATH)
    60 endif()
    58 endif()
    61 
    59 
    62 if( NOT FPC_DIR)
    60 if( NOT FPC_DIR)
    63     find_program(FPC_DIR ppcrossarm)
    61     find_program(FPC_DIR ppcrossarm)
    64     get_filename_component(FPC_DIR "${FPC_DIR}" PATH)
    62     get_filename_component(FPC_DIR "${FPC_DIR}" PATH)
    65     set(FPC_DIR "${FPC_DIR}" CACHE PATH "Path to fpc dir used in the android port" FORCE)
    63     if(IS_DIRECTORY "${FPC_DIR}") 
       
    64     	set(FPC_DIR "${FPC_DIR}" CACHE PATH "Path to fpc dir used in the android port" FORCE)
       
    65     endif()
    66 endif()
    66 endif()
    67 
    67 
    68 if( IS_DIRECTORY "${FPC_DIR}")
    68 if( IS_DIRECTORY "${FPC_DIR}")
    69     MESSAGE(STATUS "Detected the FreePascal directory at: " "${FPC_DIR}") 
    69     MESSAGE(STATUS "Detected the FreePascal directory at: " "${FPC_DIR}") 
    70 else ()
    70 else ()
    79 
    79 
    80 MESSAGE(STATUS "Creating Makefile.android...")
    80 MESSAGE(STATUS "Creating Makefile.android...")
    81 
    81 
    82 configure_file(Templates/Makefile.android .)
    82 configure_file(Templates/Makefile.android .)
    83 
    83 
    84 find_program(ANDROID NAMES android android.bat PATHS "${ANDROID_SDK}/platform-tools" "${ANDROID_SDK}/tools")
    84 find_program(ANDROID_EXEC NAMES android android.bat PATHS "${ANDROID_SDK}/platform-tools" "${ANDROID_SDK}/tools")
    85 if(ANDROID)
    85 if(ANDROID_EXEC)
    86     exec_program(${ANDROID}
    86     exec_program(${ANDROID_EXEC}
    87                  ARGS "update project"
    87                  ARGS "update project"
    88                  "--path ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project"
    88                  "--path ${CMAKE_CURRENT_SOURCE_DIR}/SDL-android-project"
    89                  "--target android-${ANDROID_SDK_API_LVL}"
    89                  "--target android-${ANDROID_SDK_API_LVL}"
    90                  OUTPUT_VARIABLE androidoutput
    90                  OUTPUT_VARIABLE androidoutput
    91                 )
    91                 )