aboutsummaryrefslogtreecommitdiffstats
path: root/java_fat/CMakeLists.txt
blob: f29b6b09b3bf6018054308405ce83957206a5702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# java/CMakeLists.txt

#                    COMMAND ${CMAKE_COMMAND} 
#                            -DOS_AND_ARCH=${OS_AND_ARCH}
#                            -Dos_and_arch_slash=${os_and_arch_slash}
#                            -Dos_and_arch_dot=${os_and_arch_dot}
#                            -D_jarfile=${CMAKE_CURRENT_BINARY_DIR}/jaulib_jni-natives-${OS_AND_ARCH}.jar
#                            -D_workdir=${CMAKE_CURRENT_BINARY_DIR}
#                            -D_module=jni
#                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/MakeNativeJar.cmake

# set(direct_bt_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt.jar CACHE FILEPATH "direct_bt jar file" FORCE)
set(direct_bt_fat_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-fat.jar CACHE FILEPATH "direct_bt fat jar file" FORCE)
set(direct_bt_fat2_jar_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-fat2.jar CACHE FILEPATH "direct_bt fat2 jar file" FORCE)
set(direct_bt_java_src_file ${CMAKE_CURRENT_BINARY_DIR}/direct_bt-java-src.zip CACHE FILEPATH "direct_bt java source file" FORCE)

add_custom_command (OUTPUT ${direct_bt_fat_jar_file} ${direct_bt_fat2_jar_file} ${direct_bt_java_src_file}
                    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                    COMMAND ${CMAKE_COMMAND}
                            -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../src/direct_bt
                            -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH}
                            -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}direct_bt${CMAKE_SHARED_LIBRARY_SUFFIX}.${direct_bt_VERSION_STRING}
                            -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}direct_bt${CMAKE_SHARED_LIBRARY_SUFFIX}
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake
                    COMMAND ${CMAKE_COMMAND}
                            -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../java/jni/direct_bt
                            -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH}
                            -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}javadirect_bt${CMAKE_SHARED_LIBRARY_SUFFIX}.${direct_bt_VERSION_STRING}
                            -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}javadirect_bt${CMAKE_SHARED_LIBRARY_SUFFIX}
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake
                    COMMAND ${CMAKE_COMMAND}
                            -D _dstdir:PATH='${CMAKE_CURRENT_BINARY_DIR}/temp'
                            -D _archives:FILEPATH="${jaulib_fat_jar_file}"
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/ExtractArchiveList.cmake
                    COMMAND ${JAR}
                       --create --file ${direct_bt_fat2_jar_file}
                       --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest-fat2.txt
                       -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ natives
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/ natives

                    COMMAND ${CMAKE_COMMAND}
                            -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../src/tinyb
                            -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH}
                            -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}tinyb${CMAKE_SHARED_LIBRARY_SUFFIX}.${tinyb_VERSION_STRING}
                            -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}tinyb${CMAKE_SHARED_LIBRARY_SUFFIX}
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake
                    COMMAND ${CMAKE_COMMAND}
                            -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../java/jni/tinyb
                            -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH}
                            -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}javatinyb${CMAKE_SHARED_LIBRARY_SUFFIX}.${tinyb_VERSION_STRING}
                            -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}javatinyb${CMAKE_SHARED_LIBRARY_SUFFIX}
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake
                    COMMAND ${JAR}
                       --create --file ${direct_bt_fat_jar_file}
                       --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest-fat.txt
                       -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/temp/ natives
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java/${CMAKE_FILES_DIRECTORY}/direct_bt_jar.dir/ tinyb
                       -C ${CMAKE_CURRENT_BINARY_DIR}/ natives

                    COMMAND ${JAR}
                       --create --file ${direct_bt_java_src_file}
                       --no-manifest
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java jau
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java org
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java tinyb
                    DEPENDS jaulib_fat_jar direct_bt tinyb direct_bt_jar javadirect_bt javatinyb
                    COMMENT "producing direct_bt [fat] jar files and its java source zip"
                    VERBATIM
                   )

add_custom_target (direct_bt_fat_jar ALL 
                   DEPENDS ${direct_bt_fat_jar_file} ${direct_bt_fat2_jar_file} ${direct_bt_java_src_file}
                  )

add_dependencies(direct_bt_fat_jar jaulib_fat_jar direct_bt tinyb direct_bt_jar javadirect_bt javatinyb)

install (FILES ${direct_bt_fat_jar_file} ${direct_bt_fat2_jar_file} ${direct_bt_java_src_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java)