0% found this document useful (0 votes)
28 views

CMake Lists

This document is a CMake file that defines a project for building the termux-api library and scripts. It creates libraries and executables, configures installation locations and permissions, and installs the built files.

Uploaded by

Piloto XxX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views

CMake Lists

This document is a CMake file that defines a project for building the termux-api library and scripts. It creates libraries and executables, configures installation locations and permissions, and installs the built files.

Uploaded by

Piloto XxX
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

cmake_minimum_required(VERSION 3.0.

0)
project(termux-api)
include(GNUInstallDirs)

set(TERMUX_PREFIX ${CMAKE_INSTALL_PREFIX})

add_library(termux-api SHARED termux-api.c)

add_executable(termux-api-broadcast termux-api-broadcast.c)
target_link_libraries(termux-api-broadcast termux-api)

# TODO: get list through regex or similar


set(script_files
scripts/termux-api-start
scripts/termux-api-stop
scripts/termux-audio-info
scripts/termux-battery-status
scripts/termux-brightness
scripts/termux-call-log
scripts/termux-camera-info
scripts/termux-camera-photo
scripts/termux-clipboard-get
scripts/termux-clipboard-set
scripts/termux-contact-list
scripts/termux-dialog
scripts/termux-download
scripts/termux-fingerprint
scripts/termux-infrared-frequencies
scripts/termux-infrared-transmit
scripts/termux-job-scheduler
scripts/termux-keystore
scripts/termux-location
scripts/termux-media-player
scripts/termux-media-scan
scripts/termux-microphone-record
scripts/termux-nfc
scripts/termux-notification
scripts/termux-notification-list
scripts/termux-notification-remove
scripts/termux-sensor
scripts/termux-share
scripts/termux-sms-inbox
scripts/termux-sms-list
scripts/termux-sms-send
scripts/termux-speech-to-text
scripts/termux-storage-get
scripts/termux-telephony-call
scripts/termux-telephony-cellinfo
scripts/termux-telephony-deviceinfo
scripts/termux-toast
scripts/termux-torch
scripts/termux-tts-engines
scripts/termux-tts-speak
scripts/termux-usb
scripts/termux-vibrate
scripts/termux-volume
scripts/termux-wallpaper
scripts/termux-wifi-connectioninfo
scripts/termux-wifi-enable
scripts/termux-wifi-scaninfo
)

make_directory(scripts)
foreach(file ${script_files})
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${file}.in
${file} @ONLY
)
endforeach()

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/termux-callback.in
termux-callback @ONLY
)

install(
FILES ${CMAKE_BINARY_DIR}/termux-api-broadcast
DESTINATION ${CMAKE_INSTALL_PREFIX}/libexec
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

# Create a symlink for termux-api-broadcast->termux-api for backwards


# compatibility
INSTALL(CODE "execute_process( \
COMMAND ${CMAKE_COMMAND} -E create_symlink \
termux-api-broadcast \
${CMAKE_INSTALL_PREFIX}/libexec/termux-api \
)"
)

install(
FILES ${CMAKE_BINARY_DIR}/libtermux-api.so
TYPE LIB
)

install(
FILES ${CMAKE_CURRENT_SOURCE_DIR}/termux-api.h
TYPE INCLUDE
)

foreach(file ${script_files})
install(
FILES ${CMAKE_BINARY_DIR}/${file}
TYPE BIN
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
)
endforeach()

install(
FILES ${CMAKE_BINARY_DIR}/termux-callback
DESTINATION ${CMAKE_INSTALL_PREFIX}/libexec
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)

You might also like