cmake_minimum_required(VERSION 2.

8) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/config ${CMAKE_CURRENT_SOURCE_DIR}/config/share ${CMAKE_CURRENT_SOURCE_DIR}/config/share/utils ${CMAKE_CURRENT_SOURCE_DIR}/config/share/package_arch ${CMAKE_CURRENT_SOURCE_DIR}/config/share/config_tests ${CMAKE_MODULE_PATH} ) # Check for compilers after initializing MPI project("Dakota" C CXX Fortran) # Attempt to detect MPI if not specified option(DAKOTA_HAVE_MPI "Enable MPI in DAKOTA" OFF) include(DakotaHaveMPI) DakotaHaveMPI() # Now check lanauges after MPI compilers are processed enable_language(C) enable_language(CXX) enable_language(Fortran) include(FortranCInterface) include(CheckFunctionExists) include(CheckIncludeFile) include(FindCURL) option(BUILD_STATIC "build static libraries" OFF) option(BUILD_SCILAB_INTERFACE "build the Scilab interface" OFF) option(CUSTOM_SCILAB_PATH "path for a custom scilab install" OFF) if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE ) message(FATAL_ERROR "In-source builds are not allowed. Please create a directory and run cmake from there, passing the path to this source directory as the last argument. This process created the file `CMakeCache.txt' and the directory `CMakeFiles'. Please delete them.") endif() add_definitions("-DHAVE_CONFIG_H") # Add CMAKE_BUILD_TYPE for DISTRIBUTION to match historical tests / releases set(CMAKE_C_FLAGS_DISTRIBUTION "-O2") set(CMAKE_CXX_FLAGS_DISTRIBUTION "-O2") set(CMAKE_Fortran_FLAGS_DISTRIBUTION "-O2") option(BUILD_SHARED_LIBS "Build shared libraries?" ON) if(CMAKE_SYSTEM_NAME MATCHES Darwin) set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") endif() # first check for a system blas and lapack find_library(BLAS_LIBS blas) find_library(LAPACK_LIBS lapack) if(NOT BLAS_LIBS OR NOT LAPACK_LIBS) # if not a system blas and lapack, then look for a cmake built LAPACK

40 or newer if(HAVE_ACRO) # Acro requires the signals library in addition find_package(Boost 1.37 or newer. including some libraries # DAKOTA requires Boost 1. PGI may demand 1.path to include is: ${MPI_INCLUDE_PATH}") set(HAVE_MPI "ON") add_definitions(-DHAVE_MPI) include_directories(${MPI_INCLUDE_PATH}) # Some TPLs have manage the setting with USE_MPI rather than HAVE_MPI set(USE_MPI "ON") else() message(FATAL_ERROR "Cannot find MPI.# with find_package find_package(LAPACK REQUIRED NO_MODULE) set(BLAS_LIBS blas) set(LAPACK_LIBS lapack) endif() # hack to be fixed when CMake does it automatically if(${CMAKE_Fortran_COMPILER_ID} MATCHES "Intel") set(FIXED_FLAG "-fixed") elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "GNU") set(FIXED_FLAG "-ffixed-form") elseif(${CMAKE_Fortran_COMPILER_ID} MATCHES "PGI") set(FIXED_FLAG "-Mfixed") endif() if(CMAKE_SYSTEM_NAME MATCHES Darwin) set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS} -undefined dynamic_lookup") endif() find_package(Boost 1.40 REQUIRED) # check for a MPI-enabled build if(CMAKE_CXX_COMPILER MATCHES mpicxx) find_program(mpicxx mpicxx) if(${mpicxx} MATCHES "mpicxx-NOTFOUND") message(FATAL_ERROR "Cannot build parallel configuration without mpicxx") endif() message(" **** dakota build **** MPIHOME is: " $ENV{MPIHOME}) set(MPI_INCLUDE_PATH "$ENV{MPIHOME}/include" CACHE PATH "Always use $MPIHOME to find MessagePassing header files" FORCE ) find_package(MPI REQUIRED) if(MPI_FOUND) #message("MPI found . Please build a serial configuration instead") endif(MPI_FOUND) endif() # Mandate a system or user-provided Boost.37 REQUIRED COMPONENTS regex signals) else() find_package(Boost 1.37 REQUIRED COMPONENTS regex) endif() .

" OFF) option(HAVE_CONMIN "Build the CONMIN package." ON) option(HAVE_NL2SOL "Build the NL2SOL package." ON) option(HAVE_XDR "Build the XDR interface module.include(CTest) set( CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/config/share ${CMAKE_CURRENT_SOURCE_DIR}/config/share/utils ${CMAKE_CURRENT_SOURCE_DIR}/config/share/package_arch ${CMAKE_CURRENT_SOURCE_DIR}/config/share/config_tests ${CMAKE_MODULE_PATH} ) option(HAVE_PECOS "Build the Pecos package." ON) option(HAVE_FSUDACE "Build the FSUDACE package." ON) option(HAVE_HOPSPACK "Build the hopspack package." ON) option(HAVE_AMPL "Build the AMPL package." OFF) #if(USE_SYSTEM_TEUCHOS) # # WJB: suspect SYSTEM_TEUCHOS settings specify incorrect paths -." ON) option(USE_SYSTEM_TEUCHOS "If false.cmake) # ##set(Teuchos_INCLUDE_DIRS ${Trilinos_INCLUDE_DIRS} CACHE FILEPATH "include d ir for Teuchos" FORCE) # ##set(Teuchos_LIBRARY_DIRS ${Trilinos_LIBRARY_DIRS} CACHE FILEPATH "library d ir for Teuchos" FORCE) #else() # set(Teuchos_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/packages/teuchos/src # ${CMAKE_CURRENT_BINARY_DIR}/packages/teuchos/src) # set(Teuchos_LIBRARY_DIRS ${CMAKE_CURRENT_BINARY_DIR}/packages/teuchos/src) #endif() # Set the export name for install targets. parent packages likely want # to override this to the name of their target set(ExportTarget ${CMAKE_PROJECT_NAME}-targets CACHE STRING "Name for the export target for ${CMAKE_PROJECT_NAME}") # TODO: Have etphipp remove Trilinos-specific code and instead set in TriKota if (BUILD_IN_TRILINOS) set(ExportTarget Trilinos) ." ON) option(HAVE_NPSOL "Build the NPSOL package." ON) option(HAVE_DOT "Build the DOT package." ON) option(HAVE_NLPQL "Build the NLPQL package. if Scilab is detected.ASAP: option(HAVE_ACRO "Build the ACRO package.try to get # # a review from someone interested in this case being enabled # find_package(Trilinos REQUIRED) # ## Kitware version -. DAKOTA will use the included version of Teuchos." ON) option(HAVE_SURFPACK "Build the Surfpack package." OFF) option(HAVE_JEGA "Build the JEGA package." ON) option(HAVE_OPTPP "Build the OPTPP package." ON) option(HAVE_SCILAB "Build Scilab module." ON) option(HAVE_NCSUOPT "Build the NCSUOPT package." ON) option(HAVE_DDACE "Build the DDACE package.ToDo with Zack ." ON) # WJB .include(${Trilinos_DIR}/TrilinosConfig." ON) option(HAVE_TRACKING "Build the DAKOTA usage tracker module.cmake) # include(${Trilinos_DIR}/TeuchosConfig." ON) option(HAVE_PSUADE "Build the PSUADE package.

${SCILAB_ROOT}/lib/thirdparty") "${LINK_OPT} -Wl.-rpath. the path to Teuchos will already be set if (NOT BUILD_IN_TRILINOS) # first probe for system-installed Trilinos # this will respect Trilinos_DIR if already set find_package(Trilinos QUIET) if ( NOT Trilinos_DIR ) # if no one has configured a local src Teuchos.-rpath-link.${SCILAB_ROOT}/lib/thirdparty") if (EXISTS ${SCILAB_ROOT}/thirdparty/java/lib/amd64) set(LINK_OPT_ARCH "amd64") else (EXISTS ${SCILAB_ROOT}/thirdparty/java/lib/amd64) set(LINK_OPT_ARCH "i386") .${SCILAB_ROOT}/lib/scilab") "${LINK_OPT} -Wl.-rpath.-rpath-link.${SCILAB_ROOT}/lib/scilab") "${LINK_OPT} -Wl. do so # this will respect Teuchos_DIR if already set if( NOT Teuchos_DIR ) set( Teuchos_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/teuchos ) message( "Setting Teuchos_DIR to ${Teuchos_DIR}" ) add_subdirectory(packages/teuchos) else() message( "in ${CMAKE_CURRENT_BINARY_DIR} Teuchos_DIR already set to ${Teucho s_DIR}" ) endif() find_package( Teuchos NO_MODULE REQUIRED ) else() message( "Using system trilinos in ${Trilinos_DIR}" ) endif() endif() if(HAVE_CONMIN) if ( NOT CONMIN_DIR ) set( CONMIN_DIR ${CMAKE_CURRENT_BINARY_DIR}/packages/CONMIN ) message( "Setting CONMIN_DIR to ${CONMIN_DIR}" ) add_subdirectory(packages/CONMIN) else() message( "in ${CMAKE_CURRENT_BINARY_DIR} CONMIN_DIR already set to ${CONMIN_ DIR}" ) endif() find_package( CONMIN NO_MODULE REQUIRED ) endif(HAVE_CONMIN) if (BUILD_SCILAB_INTERFACE) find_package(Scilab) if (HAVE_SCILAB) ##set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ## ${CMAKE_SOURCE_DIR}) if ( SCILAB_ROOT ) add_definitions("-DDAKOTA_SCILAB") include_directories(${SCILAB_INCLUDE}) set(LINK_OPT set(LINK_OPT set(LINK_OPT set(LINK_OPT "-Wl.endif() # when building inside Trilinos.

disabling." ON) if (HAVE_X_GRAPHICS) find_package(X11) if (X11_FOUND) find_package(Motif) if (MOTIF_FOUND) include(FindThreads) if (Threads_FOUND) message(" All X_GRAPHICS dependencies have been found.${SCILAB_ROOT}/thirdparty/java/l ib/${LINK_OPT_ARCH}/") else ( SCILAB_ROOT ) message( "Scilab not found" ) endif ( SCILAB_ROOT ) endif (HAVE_SCILAB) endif (BUILD_SCILAB_INTERFACE) #Keep track of what libraries should be included in libdakota ## WJB .") set(HAVE_X_GRAPHICS OFF CACHE BOOL "X graphics OFF on MOST PLATFORMS" FORCE) endif(MOTIF_FOUND) else() message(WARNING "HAVE_X_GRAPHICS requested.${SCILAB_ROOT}/thirdparty/java/lib/${ LINK_OPT_ARCH}/server") set(LINK_OPT "${LINK_OPT} -Wl.-rpath-link.ToDo: determine whether this is needed at the top-level set(SUBLIBS dakota_src) # Manage option for graphics (default ON if possible) option(HAVE_X_GRAPHICS "Build the DAKOTA/Motif Graphics package.${SCILAB_ROOT}/thirdparty/java/l ib/${LINK_OPT_ARCH}") set(LINK_OPT "${LINK_OPT} -Wl.-rpath-link. disabling. but threads not found.endif (EXISTS ${SCILAB_ROOT}/thirdparty/java/lib/amd64) set(LINK_OPT "${LINK_OPT} -Wl. disabling.") else() message(WARNING "HAVE_X_GRAPHICS requested.") set(HAVE_X_GRAPHICS OFF CACHE BOOL "X graphics OFF on MOST PLATFORMS" FORCE) endif(X11_FOUND) endif(HAVE_X_GRAPHICS) add_subdirectory(packages) add_subdirectory(src) #add_subdirectory(examples) #add_subdirectory(test) # Package-specific configuration options include_directories(${Dakota_BINARY_DIR}) . 2D graphics will be ENABLED in dakota as requested.-rpath. but X11 not found.-rpath.") set(HAVE_X_GRAPHICS OFF CACHE BOOL "X graphics OFF on MOST PLATFORMS" FORCE) endif(Threads_FOUND) else() message(WARNING "HAVE_X_GRAPHICS requested. but Motif not found.${SCILAB_ROOT}/thirdparty/java/lib/${ LINK_OPT_ARCH}") set(LINK_OPT "${LINK_OPT} -Wl.

" OFF) if(ENABLE_DAKOTA_DOCS) if(UNIX) add_subdirectory(docs) else() message(FATAL_ERROR "DAKOTA documentation build only available on UNIX platf orms") endif() endif() .dox ) foreach(doc ${docs_files}) configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/docs/${doc} ${CMAKE_CURRENT_BINARY_DIR}/docs/${doc} COPYONLY) endforeach() #generate dakota.input.h.dox Ref_Method.dox Ref_Model.dox Ref_Responses.desc" COMMAND ${PERL_EXECUTABLE} generate_desc." OFF) if(ENABLE_SPEC_MAINT AND NOT UNIX) message(FATAL_ERROR "DAKOTA specification maintenance mode only available on U NIX platforms") endif() option(ENABLE_DAKOTA_DOCS "Enable DAKOTA documentation build.desc find_package(Perl REQUIRED) ADD_CUSTOM_COMMAND( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/dakota.dox Ref_Variables.input.configure_file("${Dakota_SOURCE_DIR}/config/dakota_config.h" @ONLY ) add_definitions("-DHAVE_CONFIG_H") file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs) set(docs_files WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} ) #clean up binary dir #file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/docs) option(ENABLE_DAKOTA_TESTS "Enable Dakota" "${Dakota_BINARY_DIR}/dakota_config.dox Ref_Strategy." ON) if(ENABLE_DAKOTA_TESTS) add_subdirectory(test) endif() option(ENABLE_SPEC_MAINT "Enable DAKOTA specification maintenance mode.