11# PREAMBLE
2- cmake_minimum_required (VERSION 3.2 )
2+ cmake_minimum_required (VERSION 3.13 )
33project (MAST
44 VERSION 0.3
55 LANGUAGES C CXX)
@@ -14,24 +14,25 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1414include (GNUInstallDirs)
1515
1616# Build options with defaults.
17- option (ENABLE_GCMMA "Build with GCMMA interface" OFF )
18- option (ENABLE_DOT "Build with DOT interface" OFF )
19- option (ENABLE_SNOPT "Build with SNOPT interface" OFF )
20- option (ENABLE_NLOPT "Build with NLOPT interface" OFF )
21- option (ENABLE_CYTHON "Build with CYTHON interface" OFF )
22- option (BUILD_DOC "Build documentation" OFF )
23-
24- # Required dependency paths.
17+ option (ENABLE_GCMMA "Build with GCMMA interface" OFF )
18+ option (ENABLE_DOT "Build with DOT interface" OFF )
19+ option (ENABLE_SNOPT "Build with SNOPT interface" OFF )
20+ option (ENABLE_NLOPT "Build with NLOPT interface" OFF )
21+ option (ENABLE_NASTRANIO "Build with support for reading Nastran meshes" OFF )
22+ option (ENABLE_CYTHON "Build with support for Cython development" OFF )
23+ option (BUILD_DOC "Build documentation" OFF )
24+
25+ # Dependency paths (optional) - these paths help CMake find dependencies.
2526set (MAST_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR} )
2627set (libMesh_DIR "libMesh_DIR" CACHE PATH "Directory containing libMesh include/ and lib/" )
2728set (PETSc_DIR "PETSc_DIR" CACHE PATH "Directory containing PETSc include/ and lib/" )
2829set (PETSc_ARCH "PETSc_ARCH" CACHE STRING "Configuration/build of PETSc that should be used." )
2930set (SLEPc_DIR "SLEPc_DIR" CACHE PATH "Directory containing SLEPc include/ and lib/" )
3031set (SLEPc_ARCH "SLEPc_ARCH" CACHE STRING "Configuration/build of SLEPc that should be used." )
3132set (EIGEN3_ROOT "Eigen_DIR" CACHE PATH "Directory containing eigen header files" )
32- set (DOT_DIR "DOT_DIR" CACHE PATH "Directory containing DOT lib/" )
33- set (SNOPT_DIR "SNOpt_DIR" CACHE PATH "Directory containing SNOPT lib/" )
34- set (NLOPT_DIR "NLOpt_DIR" CACHE PATH "Directory containing NLOpt include/ and lib/" )
33+ set (DOT_DIR "DOT_DIR" CACHE PATH "Directory containing DOT lib/" )
34+ set (SNOPT_DIR "SNOpt_DIR" CACHE PATH "Directory containing SNOPT lib/" )
35+ set (NLOPT_DIR "NLOpt_DIR" CACHE PATH "Directory containing NLOpt include/ and lib/" )
3536
3637# EXTERNALLY PROVIDED CONTENT
3738# None. Use this if we pull something in during the build in the future.
@@ -83,12 +84,36 @@ else()
8384 set (MAST_ENABLE_NLOPT 0)
8485endif ()
8586
87+ if (ENABLE_NASTRANIO)
88+ find_package (Python3 REQUIRED)
89+
90+ # Make sure Python has pyNastran.
91+ execute_process (COMMAND ${Python3_EXECUTABLE} -c "import pyNastran"
92+ RESULT_VARIABLE PYNASTRAN_ERROR)
93+ if (PYNASTRAN_ERROR)
94+ message (FATAL_ERROR "Error finding pyNastran package for Python3_EXECUTABLE!" )
95+ else ()
96+ message (STATUS " pyNastran package found" )
97+ endif ()
98+
99+ # Make sure Python has NumPy.
100+ execute_process (COMMAND ${Python3_EXECUTABLE} -c "import numpy"
101+ RESULT_VARIABLE NUMPY_ERROR)
102+ if (NUMPY_ERROR)
103+ message (FATAL_ERROR "Error finding pyNastran package for Python3_EXECUTABLE!" )
104+ else ()
105+ message (STATUS " Numpy package found" )
106+ endif ()
107+ endif ()
108+
109+ # THIRD PARTY/CONTRIB
110+ # - This directory contains files developed by third parties and are included in the
111+ # MAST source for convenience.
112+ add_subdirectory (contrib)
113+
86114# MAIN TARGETS
87115add_subdirectory (src)
88116
89- # EXAMPLES
90- add_subdirectory (examples)
91-
92117# DOCUMENTATION
93118if (BUILD_DOC)
94119 add_subdirectory (doc )
@@ -98,3 +123,6 @@ endif()
98123enable_testing ()
99124add_subdirectory (tests)
100125
126+ # EXAMPLES
127+ add_subdirectory (examples)
128+
0 commit comments