source: trunk/components/bio-formats-jace/CMakeLists.txt @ 4822

Revision 4822, 2.7 KB checked in by curtis, 11 years ago (diff)

Better build system for Bio-Formats C++ bindings on Linux.

Line 
1#
2# CMakeLists.txt
3#
4
5# CMake build file for bfjace, the Bio-Formats C++ bindings.
6
7cmake_minimum_required(VERSION 2.6)
8
9project(bfjace)
10
11### determine configuration ###
12
13message("")
14
15#find_package(Java REQUIRED)
16#message("-- Java Runtime:")
17#message("java             : ${JAVA_RUNTIME}")
18#message("javac            : ${JAVA_COMPILE}")
19#message("jar              : ${JAVA_ARCHIVE}")
20#message("")
21
22find_package(JNI REQUIRED)
23message("-- Java Native Interface:")
24message("jawt lib         : ${JAVA_AWT_LIBRARY}")
25message("jvm lib          : ${JAVA_JVM_LIBRARY}")
26message("jni.h            : ${JAVA_INCLUDE_PATH}")
27message("jni_md.h         : ${JAVA_INCLUDE_PATH2}")
28message("jawt.h           : ${JAVA_AWT_INCLUDE_PATH}")
29message("")
30
31set(Boost_USE_STATIC_LIBS OFF)
32set(Boost_USE_MULTITHREAD ON)
33find_package(Boost COMPONENTS thread REQUIRED)
34message("-- Boost:")
35if(EXISTS ${Boost_LIBRARIES})
36message("boost/thread.hpp : ${Boost_INCLUDE_DIR}")
37message("boost libs       : ${Boost_LIBRARIES}")
38message("")
39else(EXISTS ${Boost_LIBRARIES})
40  message(FATAL_ERROR "Cannot build without Boost Thread library. Please install libboost-thread-dev package or visit www.boost.org.")
41endif(EXISTS ${Boost_LIBRARIES})
42
43if(IS_DIRECTORY ${JACE_DIR})
44else(IS_DIRECTORY ${JACE_DIR})
45  message(FATAL_ERROR "Cannot build without Jace. Please set JACE_DIR.")
46endif(IS_DIRECTORY ${JACE_DIR})
47
48include_directories(include ${JACE_DIR}/source/c++/include proxies/include
49  ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${Boost_INCLUDE_DIR})
50
51### build Jace C++ library ###
52
53message("-- Jace source files:")
54message("jace directory   : ${JACE_DIR}")
55file(GLOB_RECURSE JACE_SRC ${JACE_DIR}/source/c++/source/*.cpp)
56#message("jace source      : ${JACE_SRC}")
57message("")
58
59add_library(jace SHARED ${JACE_SRC})
60
61set_target_properties(jace PROPERTIES
62  COMPILE_FLAGS "-pthread -Wall -fpermissive"
63  LINK_FLAGS "-pthread")
64
65### build Bio-Formats C++ bindings ###
66
67message("-- Bio-Formats C++ source files:")
68file(GLOB_RECURSE BFJACE_SRC proxies/source/*.cpp)
69#message("  bfjace source : ${BFJACE_SRC}")
70message("")
71
72add_library(bfjace SHARED ${BFJACE_SRC})
73
74set_target_properties(bfjace PROPERTIES
75  COMPILE_FLAGS "-pthread -Wall -fpermissive"
76  LINK_FLAGS "-pthread")
77
78target_link_libraries(bfjace jace)
79
80### build showinf example for testing bfjace ###
81
82add_executable(showinf source/showinf.cpp)
83
84target_link_libraries(showinf bfjace jace
85  ${JAVA_JVM_LIBRARY} ${Boost_LIBRARIES})
86
87### TEMP - build some examples for testing ###
88
89add_executable(example1 source/example1.cpp)
90
91target_link_libraries(example1 bfjace jace
92  ${JAVA_JVM_LIBRARY} ${Boost_LIBRARIES})
93
94add_executable(array_example source/array_example.cpp)
95
96target_link_libraries(array_example bfjace jace
97  ${JAVA_JVM_LIBRARY} ${Boost_LIBRARIES})
Note: See TracBrowser for help on using the repository browser.