This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/swig/android/CMakeLists.txt
Vítor Santos Costa d0418167a1 droid
2018-12-07 16:22:17 +00:00

69 lines
2.9 KiB
CMake

# This is a CMake file for SWIG and Android
set(JAVA_SWIG_OUTDIR ${CMAKE_SOURCE_DIR}/../yaplib/src/generated/java/pt/up/yap/lib)
set(SWIG_CXX_DIR ${CMAKE_BINARY_DIR}/src/generated/jni)
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/java/pt/up/yap/lib)
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/assets/Yap/pl)
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/assets/so)
FILE(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/src/generated/jni)
set(YAP_ASSETS ${CMAKE_SOURCE_DIR}/../yaplib/src/generated/assets/Yap)
set(SWIG_SOURCES ${CMAKE_SOURCE_DIR}/packages/swig/yap.i)
SET_SOURCE_FILES_PROPERTIES(${SWIG_SOURCES} PROPERTIES CPLUSPLUS ON)
include_directories(
${CMAKE_SOURCE_DIR}/CXX
)
set(GMP_ROOT ${CMAKE_SOURCE_DIR}/../gmp/${ANDROID_ABI})
set(GMP_INCLUDE_DIRS ${GMP_ROOT})
set(GMP_LIBRARIES ${GMP_ROOT}/libgmp.so)
file(INSTALL ${pl_library} DESTINATION ${YAP_ASSETS})
file(INSTALL ${CMAKE_CURRENT_SOURCE_DIR}/android.yap DESTINATION ${YAP_ASSETS})
file(INSTALL ${pl_boot_library} DESTINATION ${YAP_ASSETS}/pl)
file(INSTALL ${pl_os_library} DESTINATION ${YAP_ASSETS}/os)
execute_process(COMMAND swig -c++ -java -package pt.up.yap.lib -O -outdir ${JAVA_SWIG_OUTDIR} -addextern -I${CMAKE_SOURCE_DIR}/CXX -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/H -I${CMAKE_SOURCE_DIR}/os -I${CMAKE_SOURCE_DIR}/OPTYap -I${CMAKE_BINARY_DIR} -I${GMP_INCLUDE_DIRS} -DX_API -o ${SWIG_CXX_DIR}/yapi_swig.cxx ${SWIG_SOURCES}
)
execute_process(COMMAND ${SWIG_EXECUTABLE} -c++ -java -package pt.up.yap.lib -O -outdir ${JAVA_SWIG_OUTDIR} -addextern -I${CMAKE_CURRENT_SOURCE_DIR} -o ${SWIG_CXX_DIR}/streamer_swig.cxx streamer.i
)
add_library(YAPJava OBJECT
${CMAKE_BINARY_DIR}/src/generated/jni/streamer_swig.cxx
${CMAKE_BINARY_DIR}/src/generated/jni/yapi_swig.cxx
streamer.cpp
)
set_target_properties(YAPJava PROPERTIES LINKER_LANGUAGE CXX)
# GMP_FOUND - true if GMP/MPIR was found
# GMP_INCLUDE_DIRS - include search path
# GMP_LIBRARIES - libraries to link with
#config.h needs this (TODO: change in code latter)
include_directories(.;${GMP_INCLUDE_DIRS};${CMAKE_SOURCE_DIR}/include;${CMAKE_SOURCE_DIR}/H;${CMAKE_SOURCE_DIR}/H/generated;${CMAKE_SOURCE_DIR}/os;${CMAKE_SOURCE_DIR}/OPTYap;${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR})
if (FALSE)
set(SWIG_ADD_MODULE YAPJava SHARED CPLUSPLUS ${SWIG_SOURCES})
# Define swig module with given name and specified language
set(SWIG_LINK_LIBRARIES YAPJava YAP++ libYAP)
#- Link libraries to swig module
add_library(YAPJavaTop SHARED
main.cpp main.h
)
target_link_libraries(YAPJavaTop ${SWIG_MODULE_${YAPJava}_REAL_NAME} YAP++ libYap android)
endif ()