[4b13d4]: libavogadro / src / CMakeLists.txt Maximize Restore History

Download this file

CMakeLists.txt    172 lines (150 with data), 5.3 kB

  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
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
set(QT_USE_QTOPENGL true)
set(QT_USE_QTNETWORK true)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
)
include(${QT_USE_FILE})
# Ensure the Avogadro include directory is always first
get_directory_property(tmp_include_dirs INCLUDE_DIRECTORIES)
set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES
"${libavogadro_BINARY_DIR}/include;${tmp_include_dirs}")
include_directories(
${CMAKE_CURRENT_BINARY_DIR}
${EIGEN2_INCLUDE_DIR}
${OPENBABEL2_INCLUDE_DIR}
)
# I think this is necessary now in order to tell the linker where openbabel is
link_directories(${OPENBABEL2_LIBRARY_DIRS})
# Library translations
if(NOT WIN32 AND Linguist_FOUND)
file(GLOB_RECURSE libavogadro_PO "${Avogadro_SOURCE_DIR}/i18n/libavogadro*.po")
QT4_WRAP_PO(libavogadro_QM ${libavogadro_PO})
else()
# don't attempt to create QM files on windows -- copy them from a linux build!
file(GLOB_RECURSE libavogadro_QM "${Avogadro_SOURCE_DIR}/libavogadro/src/libavogadro*.qm")
endif()
file(GLOB libavogadro_SRCS "*.cpp")
# Only headers with exported symbols should actually be installed
set(libavogadro_HDRS
animation.h
atom.h
bond.h
camera.h
color3f.h
color.h
colorbutton.h
cube.h
elementtranslator.h
engine.h
extension.h
fragment.h
glhit.h
glwidget.h
global.h
idlist.h
plotaxis.h # dlonie: Are these necessary here?
plotobject.h
plotpoint.h
plotwidget.h
mesh.h
meshgenerator.h
molecule.h
moleculefile.h
navigate.h
neighborlist.h
painter.h
painterdevice.h
periodictableview.h
plugin.h
pluginmanager.h
primitive.h
primitivelist.h
protein.h
residue.h
tool.h
toolgroup.h
undosequence.h
zmatrix.h
)
set(libavogadro_SRCS ${libavogadro_SRCS} ${libavogadro_UIS})
# Also add in the qtiocompressor class
#set(libavogadro_SRCS ${libavogadro_SRCS} ../qtiocompressor/qtiocompressor.cpp)
# Statically link the core engines and tools so that users have a working
# system even if no plugins can be found.
set(bsdyengine_SRCS engines/bsdyengine.cpp)
qt4_wrap_ui(bsdyengine_UIS engines/bsdysettingswidget.ui)
set(libavogadro_SRCS ${libavogadro_SRCS} ${bsdyengine_SRCS} ${bsdyengine_UIS})
set(elementcolor_SRCS colors/elementcolor.cpp)
set(libavogadro_SRCS ${libavogadro_SRCS} ${elementcolor_SRCS})
set(AVO_LINK_LIBRARIES ${OPENBABEL2_LIBRARIES}
${QT_LIBRARIES}
${OPENGL_LIBRARIES}
)
if(GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIR})
link_directories(${GLEW_LIBRARY_DIR})
set(AVO_LINK_LIBRARIES ${AVO_LINK_LIBRARIES} ${GLEW_LIBRARY})
endif(GLEW_FOUND)
# If python dependencies aren't found, remove the Avogadro Python source files
if(NOT ENABLE_PYTHON OR NOT ALL_PYTHON_FOUND)
set(PYTHON_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/pythoninterpreter.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pythonscript.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pythonerror.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pythontool_p.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pythonengine_p.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pythonextension_p.cpp)
foreach(P_ITEM ${PYTHON_SRCS})
list(REMOVE_ITEM libavogadro_SRCS "${P_ITEM}")
endforeach(P_ITEM ${PYTHON_SRCS})
endif(NOT ENABLE_PYTHON OR NOT ALL_PYTHON_FOUND)
qt4_automoc(${libavogadro_SRCS})
# you have to add link_directories before you add the target
if(ENABLE_PYTHON AND ALL_PYTHON_FOUND)
include_directories(
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_PATH})
qt4_add_resources(pythontool_RC_SRCS pythontool.qrc)
# The Python headers, only installed if Python is enabled
set(python_HDRS
pythoninterpreter.h
pythonscript.h
pythonerror.h
)
message(STATUS "Setting new boost python libraries")
set(AVO_LINK_LIBRARIES ${AVO_LINK_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_LIBRARIES})
set(libavogadro_HDRS ${libavogadro_HDRS} ${python_HDRS})
endif(ENABLE_PYTHON AND ALL_PYTHON_FOUND)
# Set up the include directory and symlink/copy all headers to it.
# Note: Windows lacks symlinks and so the files must be copied.
make_directory("${libavogadro_BINARY_DIR}/include/avogadro")
if(UNIX)
set(header_cmd "create_symlink")
else(UNIX)
set(header_cmd "copy_if_different")
endif(UNIX)
foreach(headerFile ${libavogadro_HDRS})
set(from "${CMAKE_CURRENT_SOURCE_DIR}/${headerFile}")
set(to "${libavogadro_BINARY_DIR}/include/avogadro/${headerFile}")
execute_process(
COMMAND ${CMAKE_COMMAND} -E ${header_cmd} "${from}" "${to}")
endforeach(headerFile ${libavogadro_HDRS})
add_library(avogadro SHARED ${libavogadro_SRCS} ${libavogadro_QM} ${pythontool_RC_SRCS})
set_target_properties(avogadro
PROPERTIES VERSION ${Avogadro_VERSION_FULL} SOVERSION 1 )
target_link_libraries(avogadro ${AVO_LINK_LIBRARIES})
install(TARGETS avogadro DESTINATION ${LIB_INSTALL_DIR})
install(FILES ${libavogadro_HDRS}
DESTINATION "${INCLUDE_INSTALL_DIR}/avogadro")
install(FILES ${libavogadro_QM} DESTINATION ${I18N_INSTALL_DIR})
# Add the engiens, tools and extensions directories
add_subdirectory(engines)
add_subdirectory(tools)
add_subdirectory(extensions)
add_subdirectory(colors)
# Add the boost python module if the boost::python was found
if(ENABLE_PYTHON AND ALL_PYTHON_FOUND)
add_subdirectory(python)
endif(ENABLE_PYTHON AND ALL_PYTHON_FOUND)