Changeset 5692


Ignore:
Timestamp:
11/16/09 11:35:15 (10 years ago)
Author:
curtis
Message:

Some fixes for compiling Bio-Formats C++ bindings on Windows:

  • Set default generator to Visual Studio 2008 Express.
  • Split out dependency checking into separate CMake module.
Location:
trunk/components/native/bf-cpp
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/native/bf-cpp/CMakeLists.txt

    r5682 r5692  
    4141project(bfcpp) 
    4242 
     43include(jace/Prerequisites.cmake) 
     44 
    4345add_subdirectory(jace) 
    4446 
  • trunk/components/native/bf-cpp/build.properties

    r5551 r5692  
    2020component.runtime-cp     = ${component.classpath} 
    2121 
    22 # override if Ant cannot find your Java runtime classes 
     22# Override if Ant cannot find your Java runtime classes. 
    2323#jre.runtime = ${java.home}/lib/rt.jar 
    2424 
     
    2727              ${artifact.dir}/bio-formats.jar:\ 
    2828              ${artifact.dir}/loci-common.jar 
     29 
     30# Override of you are running a different version of Visual Studio on Windows. 
     31# As of this writing, generators for Visual Studio include: 
     32#   Visual Studio 6 
     33#   Visual Studio 7 
     34#   Visual Studio 7 .NET 2003 
     35#   Visual Studio 8 2005 
     36#   Visual Studio 8 2005 Win64 
     37#   Visual Studio 9 2008 
     38#   Visual Studio 9 2008 Win64 
     39#   Visual Studio 10 
     40#   Visual Studio 10 Win64 
     41# Run "cmake" with no arguments to list your system's available generators. 
     42cmake.generator.windows = Visual Studio 9 2008 
     43 
     44# Override if you would like to use a different generator on Mac OS X or Linux. 
     45# Run "cmake" with no arguments to list your system's available generators. 
     46cmake.generator.other = Unix Makefiles 
  • trunk/components/native/bf-cpp/build.xml

    r5588 r5692  
    132132    description="generate build system for Bio-Formats C++ bindings"> 
    133133    <mkdir dir="${build.dir}"/> 
     134    <if> 
     135      <isset property="isWindows"/> 
     136      <then> 
     137        <property name="cmake.generator" value="${cmake.generator.windows}"/> 
     138      </then> 
     139      <else> 
     140        <property name="cmake.generator" value="${cmake.generator.other}"/> 
     141      </else> 
     142    </if> 
    134143    <exec executable="cmake" dir="${build.dir}" failonerror="true"> 
     144      <arg value="-G${cmake.generator}"/> 
    135145      <arg value="-DJACE_DIR=${jace.home}"/> 
    136146      <arg value=".."/> 
     
    147157      <then> 
    148158        <copy file="${build.dir}/jace-runtime.jar" 
    149           todir="${build.dir}/debug"/> 
     159          todir="${build.dir}/Debug"/> 
    150160        <copy file="${build.dir}/loci_tools.jar" 
    151           todir="${build.dir}/debug"/> 
     161          todir="${build.dir}/Debug"/> 
    152162        <copy file="${build.dir}/jace-runtime.jar" 
    153163          todir="${build.dir}/release"/> 
     
    172182In Visual Studio, press F7, or select 
    173183"Build solution" from the "Build" menu. 
     184 
     185After the build is complete, you will need to 
     186copy jace.dll from ${build.dir}\jace\Debug to ${build.dir}\Debug 
     187before the executables will run. 
    174188</echo> 
    175189      </then> 
  • trunk/components/native/bf-cpp/jace/CMakeLists.txt

    r5588 r5692  
    2323 
    2424if(WIN32) 
    25 cmake_minimum_required(VERSION 2.6.4) 
     25cmake_minimum_required(VERSION 2.8) 
    2626else(WIN32) 
    2727cmake_minimum_required(VERSION 2.6) 
     
    3030project(jace) 
    3131 
    32 ### search for prerequisite libraries ### 
    33  
    34 message(STATUS "") 
    35  
    36 #message("-- Java Runtime:") 
    37 #find_package(Java REQUIRED) 
    38 #message("java          : ${JAVA_RUNTIME}") 
    39 #message("javac         : ${JAVA_COMPILE}") 
    40 #message("jar           : ${JAVA_ARCHIVE}") 
    41 #message("") 
    42  
    43 message(STATUS "-- Java Native Interface:") 
    44 find_package(JNI REQUIRED) 
    45 message(STATUS "jawt lib      : ${JAVA_AWT_LIBRARY}") 
    46 message(STATUS "jvm lib       : ${JAVA_JVM_LIBRARY}") 
    47 message(STATUS "jni.h         : ${JAVA_INCLUDE_PATH}") 
    48 message(STATUS "jni_md.h      : ${JAVA_INCLUDE_PATH2}") 
    49 message(STATUS "jawt.h        : ${JAVA_AWT_INCLUDE_PATH}") 
    50 message(STATUS "") 
    51  
    52 # HACK - CMake on Windows refuses to find the thread library unless BOOST_ROOT 
    53 #        is set, even though it can locate the Boost directory tree. 
    54 #        So we first look for base Boost, then set BOOST_ROOT and look again 
    55 #        for Boost Thread specifically. 
    56  
    57 message(STATUS "-- Boost:") 
    58 set(Boost_USE_STATIC_LIBS OFF) 
    59 set(Boost_USE_MULTITHREADED ON) 
    60 set(Boost_ADDITIONAL_VERSIONS "1.37" "1.37.0" "1.37.1" "1.38" "1.38.0" "1.38.1" 
    61   "1.39" "1.39.0" "1.39.1" "1.40" "1.40.0" "1.40.1" "1.41" "1.41.0" "1.41.1" 
    62   "1.42" "1.42.0" "1.42.1" "1.43" "1.43.0" "1.43.1" "1.44" "1.44.0" "1.44.1") 
    63 #set(Boost_FIND_QUIETLY ON) 
    64 find_package(Boost) 
    65 if(IS_DIRECTORY "${Boost_INCLUDE_DIR}") 
    66   message(STATUS "boost headers : ${Boost_INCLUDE_DIR}") 
    67 else(IS_DIRECTORY "${Boost_INCLUDE_DIR}") 
    68   if(UNIX) 
    69     message(FATAL_ERROR "Cannot build without Boost Thread library. Please install libboost-thread-dev package or visit www.boost.org.") 
    70   else(UNIX) 
    71     message(FATAL_ERROR "Cannot build without Boost Thread library. Please install Boost from www.boost.org.") 
    72   endif(UNIX) 
    73 endif(IS_DIRECTORY "${Boost_INCLUDE_DIR}") 
    74 #set(Boost_FIND_QUIETLY OFF) 
    75 if(WIN32) 
    76   set(BOOST_ROOT ${Boost_INCLUDE_DIR}) 
    77 endif(WIN32) 
    78 find_package(Boost COMPONENTS thread REQUIRED) 
    79  
    80 # HACK - Make linking to Boost work on Windows systems. 
    81 string(REGEX REPLACE "/[^/]*$" "" 
    82   Boost_STRIPPED_LIB_DIR "${Boost_THREAD_LIBRARY_DEBUG}") 
    83  
    84 if(EXISTS "${Boost_THREAD_LIBRARY_DEBUG}") 
    85   message(STATUS "boost lib dir : ${Boost_STRIPPED_LIB_DIR}") 
    86   message(STATUS "thread lib    : ${Boost_THREAD_LIBRARY_DEBUG}") 
    87 else(EXISTS "${Boost_THREAD_LIBRARY_DEBUG}") 
    88   message(FATAL_ERROR "Cannot build without Boost Thread library. Please install libboost-thread-dev package or visit www.boost.org.") 
    89 endif(EXISTS "${Boost_THREAD_LIBRARY_DEBUG}") 
    90 message(STATUS "") 
     32include(Prerequisites.cmake) 
    9133 
    9234### build Jace C++ library ### 
     
    10345  "${JAVA_INCLUDE_PATH}" "${JAVA_INCLUDE_PATH2}" 
    10446  "${Boost_INCLUDE_DIR}") 
    105  
    106 # HACK - Make linking to Boost work on Windows systems. 
    107 if(WIN32) 
    108   link_directories(${Boost_STRIPPED_LIB_DIR}) 
    109 endif(WIN32) 
    11047 
    11148file(GLOB_RECURSE JACE_SRC "${JACE_DIR}/source/c++/source/*.cpp") 
Note: See TracChangeset for help on using the changeset viewer.