forked from polymec/polyglot-dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
69 lines (55 loc) · 2.51 KB
/
CMakeLists.txt
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
# Minimum CMake version.
cmake_minimum_required (VERSION 2.8.5)
# Build everything as static libs.
set (BUILD_SHARED_LIBS OFF)
# Project and version numbers.
project (polyglot)
set (POLYGLOT_MAJOR_VERSION 0)
set (POLYGLOT_MINOR_VERSION 7)
set (POLYGLOT_PATCH_VERSION 0)
set (POLYGLOT_VERSION "${POLYGLOT_MAJOR_VERSION}.${POLYGLOT_MINOR_VERSION}.${POLYGLOT_PATCH_VERSION}")
message("-- Building polyglot (v${POLYGLOT_VERSION})")
# Use our own CMake stuff.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Look for Polymec and use its CMake settings.
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${POLYMEC_PREFIX}/share/polymec/")
include(polymec)
if (NOT DEFINED POLYMEC_VERSION)
message(FATAL_ERROR "Could not find polymec library. Please use the polymec=/path/to/polymec option.")
endif()
message("-- Found polymec library in ${POLYMEC_PREFIX} (v${POLYMEC_VERSION})")
# Do we have polyamri?
if (EXISTS ${POLYMEC_PREFIX}/share/polymec/polyamri.cmake)
include(polyamri)
if (DEFINED POLYAMRI_VERSION)
message("-- Found polyamri library in ${POLYMEC_PREFIX} (v${POLYAMRI_VERSION})")
set(HAVE_POLYAMRI 1)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DPOLYGLOT_HAVE_POLYAMRI")
endif()
endif()
# Generate polyglot_version.h with the right version numbers.
add_custom_target(update_version_h ALL
python ${POLYMEC_PREFIX}/share/polymec/update_version_h.py polyglot ${POLYGLOT_VERSION} ${PROJECT_BINARY_DIR}/polyglot/polyglot_version.h)
# Build 3rd-party libraries.
add_subdirectory(3rdparty)
# Look for headers in the top directory.
include_directories(${PROJECT_SOURCE_DIR})
include_directories(${PROJECT_BINARY_DIR})
include_directories(${PROJECT_BINARY_DIR}/include)
# Look for libraries in these directories.
link_directories("${PROJECT_BINARY_DIR}/lib")
link_directories("${POLYMEC_PREFIX}/lib")
enable_testing()
# Library proper.
add_subdirectory(polyglot)
# We bundle a mesh generator/editor/importer/exporter.
add_subdirectory(polymesher)
# Generate a polyglot.cmake file that contains installation information.
set(CMAKE_INSTALL_PREFIX ${POLYMEC_PREFIX})
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Templates/polyglot.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/polyglot.cmake"
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/polyglot.cmake DESTINATION share/polymec)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/add_polyglot_executable.cmake DESTINATION share/polymec)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/add_polyglot_test.cmake DESTINATION share/polymec)