Revision 20018

View differences:

trunk/libraries/libjni-mrsid/build.xml
1
	<project name="libjni-mrsid" default="main" basedir=".">
2
	<description>
3
		Compila la librería jmrsid
4
	</description>
5
		
6
	<property name="src-java" location="src/main/java" />
7
	<property name="src-test-java" location="src/test/java" />
8
	<property name="jar-dist" location="jar-dist" />
9
	<property name="build" location="bin/" />
10
	<property name="build-test" location="bin-test/" />
11
	<property name="cmake_build" location="BMCMake/" />
12
	<property name="sdk-dir" location="/home/miguel/mrsid/Geo_DSDK-6.0.7.1407" />
13
	<property environment="env"/>
14
	<condition property="jmrsid_version" value="0.0.5">
15
		<os family="unix"/>
16
	</condition>
17
	<condition property="jecw_version" value="005">
18
		<os family="windows"/>
19
	</condition>
20
	<property name="jmrsid-jar" location="jmrsid-0.0.5.jar" />
21
	<condition property="cmake_generator" value="'Unix Makefiles'">
22
		<os family="unix"/>
23
	</condition>
24
	<condition property="cmake_generator" value="'NMake Makefiles'">
25
		<os family="windows"/>
26
	</condition>		
27

  
28
	<target name="main" description="compile java code, make jars, prepare and compile natives" depends="clean,jar,prepare-natives,compile-natives">
29
	</target>
30

  
31
	<target name="jar" description="makes jar file">
32
		<mkdir dir="${build}" />
33
		<javac srcdir="${src-java}" destdir="${build}" />
34
		<mkdir dir="${jar-dist}" />
35
		<jar jarfile="${jmrsid-jar}" basedir="${build}" includes="es/gva/cit/jmrsid/**" />
36
		<move file="${jmrsid-jar}" todir="${jar-dist}" />
37
	</target>
38

  
39
	<target name="prepare-natives" description="prepares the natives to be compiled">
40
		<mkdir dir="${cmake_build}"/>
41
		<delete file="${cmake_build}/CMakeCache.txt"/>
42
		<exec dir="${cmake_build}" executable="cmake">
43
			<arg line=".." />
44
			<arg line="-G${cmake_generator}" />
45
			<arg line="-DMRSID_DIR=${sdk-dir}" />
46
			<arg line="-DCMAKE_BUILD_TYPE=Debug" />
47
			<arg line="-DJGDAL_VERSION=${jmrsid_version}" />
48
		</exec>
49
	</target>
50

  
51
	<target name="compile-natives" description="compiles natives">
52
		<exec dir="${cmake_build}" executable="make" os="Linux">
53
			<arg line="install" />
54
		</exec>
55
		<exec dir="${cmake_build}" executable="nmake" os="Windows 98,Windows 2000,Windows XP,Windows NT (Unknown)">
56
			<arg line="install" />
57
		</exec>
58
	</target>
59

  
60
		
61
	<target name="clean" description="clean distribution">
62
		<delete dir="jar-dist"/>
63
		<delete dir="lib-dist"/>
64
		<delete dir="BMCMake"/>
65
	</target>
66

  
67
</project>
trunk/libraries/libjni-mrsid/CMakeLists.txt
1
project(jmrsid)
2

  
3

  
4
# Looking for arch extension!
5
SET(LIB_POSTFIX "32")
6
IF(UNIX)
7
	IF(NOT APPLE)
8
		IF(CMAKE_SIZEOF_VOID_P MATCHES "8")
9
      		SET(LIB_POSTFIX "64")
10
  		ENDIF(CMAKE_SIZEOF_VOID_P MATCHES "8")
11
	ENDIF(NOT APPLE)
12
ELSE(UNIX)
13
	IF(CMAKE_SYSTEM_NAME MATCHES Windows)
14
		IF(CMAKE_CL_64)
15
      		SET(LIB_POSTFIX "64")
16
		ENDIF(CMAKE_CL_64)	
17
	ENDIF(CMAKE_SYSTEM_NAME MATCHES Windows)
18
ENDIF(UNIX)
19

  
20
SET(platform_dir)
21
IF(WIN32)
22
	IF(NOT CYGWIN)
23
		SET(platform_dir "w${LIB_POSTFIX}")
24
	ENDIF(NOT CYGWIN)
25
ENDIF(WIN32)
26
IF(UNIX)
27
	IF(APPLE)
28
		SET(platform_dir "mac")
29
	ELSE(APPLE)
30
		SET(platform_dir "linux")
31
	ENDIF(APPLE)
32
ENDIF(UNIX)
33

  
34
SET(GVSIG_BINARIES_PATH "${CMAKE_SOURCE_DIR}/../binaries/${platform_dir}/raster/mrsid")
35

  
36

  
37
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
38
FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/lib-dist)
39
#FILE(MAKE_DIRECTORY ${CMAKE_SOURCE_DIR}/bin-dist)
40

  
41
set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib-dist)
42
#set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/bin-dist)
43
#set(CMAKE_SKIP_RPATH TRUE)
44
IF(APPLE)
45
	SET(CMAKE_INSTALL_NAME_DIR @executable_path/../Resources/NativeLibs CACHE STRING "Executable Path for MacOS X" FORCE)
46
  	MARK_AS_ADVANCED(CMAKE_INSTALL_NAME_DIR)
47
ENDIF(APPLE)
48

  
49

  
50
SET(CMAKE_INSTALL_PREFIX ${GVSIG_BINARIES_PATH} CACHE STRING "Forcing install path" FORCE)
51
MARK_AS_ADVANCED(CMAKE_INSTALL_PREFIX)
52

  
53
# This is for an advanced option to give aggressive warnings
54
# under different compilers. If yours is not implemented, this option
55
# will not be made available.
56
IF(CMAKE_COMPILER_IS_GNUCXX)
57
    # To be complete, we might also do GNUCC flags,
58
    # but everything here is C++ code.
59
    # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG
60
    # returns too many hits.
61
    # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another
62
    # interesting C-specific flag.
63
    # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create
64
    # errors instead of warnings for certain issues, including superfluous
65
    # semicolons and commas, and the use of long long. -fpermissive seems
66
    # to be the workaround.
67
    SET(AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive")
68
ELSE(CMAKE_COMPILER_IS_GNUCXX)
69
    IF(MSVC)
70
        # FIXME: What are good aggressive warning flags for Visual Studio?
71
        # And do we need to further subcase this for different versions of VS?
72
        # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005
73
        SET(AGGRESSIVE_WARNING_FLAGS "/Wall /W4")
74

  
75

  
76
    ELSE(MSVC)
77
        # CMake lacks an elseif, so other non-gcc, non-VS compilers need
78
        # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should
79
        # remain unset.
80
    ENDIF(MSVC)
81
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
82

  
83
# This part is for the CMake menu option to toggle the warnings on/off.
84
# This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS.
85
IF(AGGRESSIVE_WARNING_FLAGS)
86
    OPTION(USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" OFF)
87
    MARK_AS_ADVANCED(USE_AGGRESSIVE_WARNINGS)
88

  
89
    IF(USE_AGGRESSIVE_WARNINGS)
90
        IF(NOT "${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
91
            SET(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL "Old CXX flags")
92
            SET(OLD_CMAKE_CXX_FLAGS_WAS_SET 1 CACHE INTERNAL "Old CXX flags was set")
93
            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AGGRESSIVE_WARNING_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
94
        ENDIF(NOT "${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
95
    ELSE(USE_AGGRESSIVE_WARNINGS)
96
        # FIXME: This will lose any changes made after OLD_CMAKE_CXX_FLAGS was
97
        # set. The better way would be to parse the string and remove each
98
        # option explicitly.
99
        IF("${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
100
            SET(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE)
101
            SET(OLD_CMAKE_CXX_FLAGS_WAS_SET 0 CACHE INTERNAL "Old CXX flags was set")
102
        ENDIF("${OLD_CMAKE_CXX_FLAGS_WAS_SET}")
103
    ENDIF(USE_AGGRESSIVE_WARNINGS)
104
ENDIF(AGGRESSIVE_WARNING_FLAGS)
105

  
106
# Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4
107
# and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support.
108
IF(APPLE)
109
    # These are just defaults/recommendations, but how we want to build
110
    # out of the box. But the user needs to be able to change these options.
111
    # So we must only set the values the first time CMake is run, or we
112
    # will overwrite any changes the user sets.
113
    # FORCE is used because the options are not reflected in the UI otherwise.
114
    # Seems like a good place to add version specific compiler flags too.
115
    IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
116
        # This is really fragile, but CMake doesn't provide the OS system
117
        # version information we need. (Darwin versions can be changed
118
        # independently of OS X versions.)
119
        # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically.
120
        IF(EXISTS /Developer/SDKs/10.5.sdk)
121
            SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX" FORCE)
122
            SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
123
        ELSE(EXISTS /Developer/SDKs/10.5.sdk)
124
            IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
125
                SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE)
126
                SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE)
127
            ELSE(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
128
                # No Universal Binary support
129
                # Should break down further to set the -mmacosx-version-min,
130
                # but the SDK detection is too unreliable here.
131
            ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk)
132
        ENDIF(EXISTS /Developer/SDKs/10.5.sdk)
133
    ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
134
ENDIF(APPLE)
135

  
136

  
137
SET(JMRSID_VERSION "0.0.5" CACHE STRING "JMRSID_VERSION")
138

  
139
find_package(JNI) 
140
find_package(MRSID) 
141

  
142
link_directories(${LIBRARY_OUTPUT_PATH})
143

  
144
add_subdirectory(src/main/native/jmrsid)
145

  
146
# This needs to be run very last so other parts of the scripts can take
147
# advantage of this.
148
IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
149
    SET(CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
150
ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE)
151

  
152

  
trunk/libraries/libjni-mrsid/.classpath
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<classpath>
3
	<classpathentry kind="src" path="src/main/java"/>
4
	<classpathentry kind="src" path="src/main/resources"/>
5
	<classpathentry kind="src" path="src/test/java"/>
6 3
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
7 4
	<classpathentry kind="lib" path="/home/miguel/eclipse/plugins/org.junit_3.8.2.v200706111738/junit.jar"/>
8 5
	<classpathentry kind="output" path="bin"/>

Also available in: Unified diff