aboutsummaryrefslogtreecommitdiffstats
path: root/java_fat/CMakeLists.txt
blob: da11ddcbebd0ca6503774504e3028bf4869978b4 (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
# 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(jaulib_jar_file ${CMAKE_CURRENT_BINARY_DIR}/jaulib.jar CACHE FILEPATH "jaulib jar file" FORCE)
set(jaulib_fat_jar_file ${CMAKE_CURRENT_BINARY_DIR}/jaulib-fat.jar CACHE FILEPATH "jaulib fat jar file" FORCE)
set(jaulib_java_src_file ${CMAKE_CURRENT_BINARY_DIR}/jaulib-java-src.zip CACHE FILEPATH "jaulib java source file" FORCE)

add_custom_command (OUTPUT ${jaulib_jar_file} ${jaulib_fat_jar_file} ${jaulib_java_src_file}
                    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
                    COMMAND ${CMAKE_COMMAND}
                            -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../java_jni/jni
                            -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH}
                            -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}jaulib_jni_jni${CMAKE_SHARED_LIBRARY_SUFFIX}.${jaulib_VERSION_STRING}
                            -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}jaulib_jni_jni${CMAKE_SHARED_LIBRARY_SUFFIX}
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake
                    COMMAND ${CMAKE_COMMAND}
                            -D_srcdir=${CMAKE_CURRENT_BINARY_DIR}/../java_pkg/jni
                            -D_dstdir=${CMAKE_CURRENT_BINARY_DIR}/natives/${OS_AND_ARCH}
                            -D_srcbasename=${CMAKE_SHARED_LIBRARY_PREFIX}jaulib_pkg_jni${CMAKE_SHARED_LIBRARY_SUFFIX}.${jaulib_VERSION_STRING}
                            -D_dstbasename=${CMAKE_SHARED_LIBRARY_PREFIX}jaulib_pkg_jni${CMAKE_SHARED_LIBRARY_SUFFIX}
                            -P ${CMAKE_CURRENT_SOURCE_DIR}/../cmake/modules/FileCopyS2D.cmake
                    COMMAND ${JAR}
                       --create --file ${jaulib_jar_file}
                       --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_base/${CMAKE_FILES_DIRECTORY}/jaulib_base_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_base/${CMAKE_FILES_DIRECTORY}/jaulib_base_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_jni/${CMAKE_FILES_DIRECTORY}/jaulib_jni_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_jni/${CMAKE_FILES_DIRECTORY}/jaulib_jni_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_net/${CMAKE_FILES_DIRECTORY}/jaulib_net_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_pkg/${CMAKE_FILES_DIRECTORY}/jaulib_pkg_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_pkg/${CMAKE_FILES_DIRECTORY}/jaulib_pkg_jar.dir/ org
                    COMMAND ${JAR}
                       --create --file ${jaulib_fat_jar_file}
                       --manifest ${CMAKE_CURRENT_BINARY_DIR}/manifest.txt
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_base/${CMAKE_FILES_DIRECTORY}/jaulib_base_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_base/${CMAKE_FILES_DIRECTORY}/jaulib_base_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_jni/${CMAKE_FILES_DIRECTORY}/jaulib_jni_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_jni/${CMAKE_FILES_DIRECTORY}/jaulib_jni_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_net/${CMAKE_FILES_DIRECTORY}/jaulib_net_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_pkg/${CMAKE_FILES_DIRECTORY}/jaulib_pkg_jar.dir/ jau
                       -C ${CMAKE_CURRENT_BINARY_DIR}/../java_pkg/${CMAKE_FILES_DIRECTORY}/jaulib_pkg_jar.dir/ org
                       -C ${CMAKE_CURRENT_BINARY_DIR}/ natives
                    COMMAND ${JAR}
                       --create --file ${jaulib_java_src_file}
                       --no-manifest
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_base jau
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_base org
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_jni jau
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_jni org
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_net org
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_pkg jau
                       -C ${CMAKE_CURRENT_SOURCE_DIR}/../java_pkg org
                    DEPENDS jaulib_base_jar jaulib_jni_jar jaulib_net_jar jaulib_pkg_jar jaulib_jni_jni jaulib_pkg_jni
                    COMMENT "producing jaulib [fat] jar files and its java source zip"
                    VERBATIM
                   )

add_custom_target (jaulib_fat_jar ALL 
                   DEPENDS ${jaulib_jar_file} ${jaulib_fat_jar_file} ${jaulib_java_src_file}
                  )

add_dependencies(jaulib_fat_jar jaulib_base_jar jaulib_jni_jar jaulib_net_jar jaulib_pkg_jar jaulib_jni_jni jaulib_pkg_jni)

install (FILES ${jaulib_jar_file} ${jaulib_fat_jar_file} ${jaulib_java_src_file} DESTINATION ${CMAKE_INSTALL_LIBDIR}/../lib/java)