Skip to content

Commit

Permalink
Build refinements
Browse files Browse the repository at this point in the history
  • Loading branch information
jedbrown committed Dec 5, 2008
1 parent 3c1e5cf commit 387b863
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 30 deletions.
31 changes: 20 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ mark_as_advanced(MPI_COMPILER MPI_EXEC)
include_directories (${PETSC_INCLUDES} ${IMESH_INCLUDES} ${MPI_INCLUDE_PATH})
add_definitions (${PETSC_DEFINITIONS} ${MPI_COMPILE_FLAGS})

option (Dohp_USE_DEBUG "Compile with debugging support" ON)
option (Dohp_BUILD_TESTS "Build tests" ON)
option (Dohp_BUILD_SANDBOX "Build programs in sandbox" ON)
option (PEDANTIC_WARNINGS "Compile with pedantic warnings" ON)
option (BUILD_SHARED_LIBS "Build shared Dohp libraries" ON)
option (dUSE_DEBUG "Compile Dohp with extra debugging" ON)
option (Dohp_BUILD_TESTS "Build tests" ON)
option (Dohp_BUILD_SANDBOX "Build programs in sandbox" ON)
option (PEDANTIC_WARNINGS "Compile with pedantic warnings" ON)
option (BUILD_SHARED_LIBS "Build shared Dohp libraries" ON)

add_definitions (-std=c99)
if (Dohp_USE_DEBUG)
add_definitions (-DdUSE_DEBUG=1 -g3)
endif (Dohp_USE_DEBUG)
list (APPEND CMAKE_C_FLAGS -std=c99)

if (Dohp_BUILD_TESTS)
enable_testing ()
Expand All @@ -45,13 +42,25 @@ if (PEDANTIC_WARNINGS)
add_definitions (${PEDANTIC_FLAGS})
endif (PEDANTIC_WARNINGS)

configure_file (${Dohp_SOURCE_DIR}/dohpconfig.h.in
${Dohp_BINARY_DIR}/include/dohpconfig.h @ONLY)

add_custom_target (etags
etags `find include src sandbox -name *.[ch]`
WORKING_DIRECTORY ${Dohp_SOURCE_DIR})

include_directories (${Dohp_SOURCE_DIR}/include)
include_directories (${Dohp_SOURCE_DIR}/include ${Dohp_BINARY_DIR}/include)

set (Dohp_DEPENDENT_LIBRARIES ${IMESH_LIBRARIES} ${PETSC_LIBRARIES} ${MPI_LIBRARIES})
set (Dohp_LIBRARIES dohp ${Dohp_DEPENDENT_LIBRARIES})

set (ARCHIVE_OUTPUT_DIRECTORY ${Dohp_BINARY_DIR}/lib CACHE PATH "Output directory for Dohp archives")
set (LIBRARY_OUTPUT_DIRECTORY ${Dohp_BINARY_DIR}/lib CACHE PATH "Output directory for Dohp libraries")
set (RUNTIME_OUTPUT_DIRECTORY ${Dohp_BINARY_DIR}/bin CACHE PATH "Output directory for Dohp executables")
mark_as_advanced (ARCHIVE_OUTPUT_DIRECTORY LIBRARY_OUTPUT_DIRECTORY RUNTIME_OUTPUT_DIRECTORY)

set (Dohp_LIBRARIES dohp ${IMESH_LIBRARIES} ${PETSC_LIBRARIES} ${MPI_LIBRARIES})
set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

add_subdirectory (include)
add_subdirectory (src)
Expand Down
11 changes: 9 additions & 2 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
INSTALL_FILES (/include FILES
dohp.h dohpfs.h dohpgeom.h dohpjacobi.h dohpmesh.h dohpquotient.h dohptype.h)
install_files (/include FILES
dohpconfig.h
dohp.h
dohpfs.h
dohpgeom.h
dohpjacobi.h
dohpmesh.h
dohpquotient.h
dohptype.h)

# Do not include the headers in private, they're private.
4 changes: 2 additions & 2 deletions include/dohptype.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#ifndef _DOHPTYPE_H
#define _DOHPTYPE_H

#include "dohpconfig.h"
#include "petsc.h"
#include "iMesh.h"

Expand Down Expand Up @@ -130,8 +131,7 @@ static inline dScalar dColonSymScalar3(const dScalar a[6],const dScalar b[6])
#define dNAME_LEN 256
#define dSTR_LEN 256

/* defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) */
#if 1
#if defined(__GNUC__)
# define dUNUSED __attribute__((unused))
# define dLIKELY(x) __builtin_expect(!!(x),1)
# define dUNLIKELY(x) __builtin_expect(!!(x),0)
Expand Down
6 changes: 5 additions & 1 deletion sandbox/itaps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,9 @@ set (Dohp_SANDBOX_EXECS

foreach (EXE ${Dohp_SANDBOX_EXECS})
add_executable (${EXE} "${EXE}.c")
target_link_libraries (${EXE} ${Dohp_LIBRARIES})
#target_link_libraries (${EXE} ${Dohp_LIBRARIES})
target_link_libraries (${EXE} dohp)
endforeach (EXE)

install (TARGETS ${Dohp_SANDBOX_EXECS}
RUNTIME DESTINATION bin)
10 changes: 7 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,24 @@ list (APPEND Dohp_SRCS
jacobi/impls/tensor/efstopo.c)

# ADD_SUBDIRECTORY (fs)
LIST (APPEND Dohp_SRCS
list (APPEND Dohp_SRCS
fs/interface/fs.c
fs/interface/fsreg.c
fs/interface/q1.c
fs/impls/cont/cont.c)

# ADD_SUBDIRECTORY (fs/mesh)
LIST (APPEND Dohp_SRCS
list (APPEND Dohp_SRCS
fs/mesh/interface/mesh.c
fs/mesh/interface/meshreg.c
fs/mesh/impls/pack/pack.c
fs/mesh/impls/serial/serial.c)

ADD_LIBRARY (dohp ${Dohp_SRCS})
add_library (dohp ${Dohp_SRCS})
target_link_libraries (dohp ${Dohp_DEPENDENT_LIBRARIES})
install (TARGETS dohp
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)

if (Dohp_BUILD_TESTS)
add_subdirectory (fs/tests)
Expand Down
25 changes: 14 additions & 11 deletions src/fs/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
add_executable (ex1 ex1.c)
target_link_libraries(ex1 ${Dohp_LIBRARIES})
add_executable (ex2 ex2.c)
target_link_libraries(ex2 ${Dohp_LIBRARIES})
add_executable (ex3 ex3.c)
target_link_libraries(ex3 ${Dohp_LIBRARIES})
add_executable (ellip ellip.c)
target_link_libraries(ellip ${Dohp_LIBRARIES})
macro (dohp_link_executable name source)
add_executable (${name} ${source})
target_link_libraries (${name} dohp)
endmacro ()

add_test (fs-mf-projection ex1 -snes_mf -ksp_type minres -const_BDeg 6 -snes_monitor -ksp_converged_reason)
add_test (fs-mf-op-proj-0 ex1 -snes_mf_operator -ksp_type minres -pc_type jacobi -const_BDeg 10 -snes_monitor -ksp_converged_reason
dohp_link_executable (fs-ex1 ex1.c)
dohp_link_executable (ellip ellip.c)
# add_executable (ex2 ex2.c)
# target_link_libraries(ex2 ${Dohp_LIBRARIES})
# add_executable (ex3 ex3.c)
#target_link_libraries(ex3 ${Dohp_LIBRARIES})

add_test (fs-mf-projection fs-ex1 -snes_mf -ksp_type minres -const_BDeg 6 -snes_monitor -ksp_converged_reason)
add_test (fs-mf-op-proj-0 fs-ex1 -snes_mf_operator -ksp_type minres -pc_type jacobi -const_BDeg 10 -snes_monitor -ksp_converged_reason
-ksp_rtol 1e-10 -q1scale 0.5 -frequency 5,4,3 -require_ptwise 2e-6,3e-6,2.3e-5 -require_grad 7e-7,3e-6,2e-4)
add_test (fs-mf-op-proj-1 ex1 -const_BDeg 7 -snes_mf_operator -ksp_converged_reason -pc_type jacobi -ksp_type minres
add_test (fs-mf-op-proj-1 fs-ex1 -const_BDeg 7 -snes_mf_operator -ksp_converged_reason -pc_type jacobi -ksp_type minres
-ksp_rtol 1e-10 -snes_monitor -frequency 2,2,2 -require_ptwise 2e-6,2e-6,9e-6 -require_grad 3e-6,7e-6,1.1e-4)

0 comments on commit 387b863

Please sign in to comment.