Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create and install auto-gened make include file #229

Merged
merged 8 commits into from Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Expand Up @@ -11,4 +11,6 @@ visitlog.py
uberenv_libs
*.tar.gz
*.tar
_uberenv_test*
s_env.sh
_uberenv_test*

10 changes: 5 additions & 5 deletions scripts/test-using-with-examples.sh
Expand Up @@ -43,6 +43,7 @@
#
###############################################################################

# using with cmake example
cd ${ASCENT_DIR}/examples/ascent/using-with-cmake
mkdir build
cd build
Expand All @@ -51,9 +52,8 @@ cmake ${EXAMPLE_CFG} ../
make VERBOSE=1
./ascent_render_example

# using with make example (still needs work for static builds)
#- cd ${TRAVIS_BUILD_DIR}/src/examples/using-with-make
#- make
#- env LD_LIBRARY_PATH=${ASCENT_DIR}/lib/:${CONDUIT_DIR}/lib/ ./example
# test run example apps
# using with make example
cd ${TRAVIS_BUILD_DIR}/src/examples/using-with-make
make
env LD_LIBRARY_PATH=${ASCENT_DIR}/lib/:${CONDUIT_DIR}/lib/ ./example

6 changes: 6 additions & 0 deletions src/ascent/CMakeLists.txt
Expand Up @@ -76,6 +76,10 @@ set(ASCENT_USE_OPENMP ${OPENMP_FOUND})
configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/ascent_config.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/ascent_config.h")

configure_file ("${CMAKE_CURRENT_SOURCE_DIR}/ascent_config.mk.in"
"${CMAKE_CURRENT_BINARY_DIR}/ascent_config.mk")


set(ascent_sources
# ascent interface
ascent.cpp
Expand Down Expand Up @@ -275,6 +279,8 @@ endif()
# Extra Install Targets for ascent
########################################

install(FILES "${CMAKE_CURRENT_BINARY_DIR}/ascent_config.mk" DESTINATION share/ascent)

install(FILES ${ascent_headers} DESTINATION include/ascent)


160 changes: 160 additions & 0 deletions src/ascent/ascent_config.mk.in
@@ -0,0 +1,160 @@
###############################################################################
# Copyright (c) 2015-2018, Lawrence Livermore National Security, LLC.
#
# Produced at the Lawrence Livermore National Laboratory
#
# LLNL-CODE-716457
#
# All rights reserved.
#
# This file is part of Ascent.
#
# For details, see: http://ascent.readthedocs.io/.
#
# Please also read ascent/LICENSE
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the disclaimer below.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the disclaimer (as noted below) in the
# documentation and/or other materials provided with the distribution.
#
# * Neither the name of the LLNS/LLNL nor the names of its contributors may
# be used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL LAWRENCE LIVERMORE NATIONAL SECURITY,
# LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
###############################################################################

###############################################################################
# file: ascent_config.mk
###############################################################################
#
# A CMake-generated Make include file Defines the following Make variables:
#
######
# ASCENT_INCLUDE_FLAGS
# ASCENT_LIB_FLAGS
# ASCENT_MPI_LIB_FLAGS
######
#
# For us in another Makefile build system
############################################################################


ASCENT_DIR = @ASCENT_INSTALL_PREFIX@

ASCENT_CONDUIT_DIR = @CONDUIT_DIR@

ASCENT_VTKH_DIR = @VTKH_DIR@
ASCENT_VTKM_DIR = @VTKM_DIR@
ASCENT_VTKM_VERSION = @VTKm_VERSION@

ASCENT_MFEM_DIR = @MFEM_DIR@

# include vars from conduit_config.mk
include $(ASCENT_CONDUIT_DIR)/share/conduit/conduit_config.mk



#################
# Linking Flags
#################

##########
# Conduit
##########


# Note: Conduit's conduit_config.mk handles hdf5 and zlib

# For Conduit without MPI
ASCENT_CONDUIT_LIB_FLAGS = $(CONDUIT_LIB_FLAGS)

# For using Conduit build with MPI
ASCENT_CONDUIT_MPI_LIB_FLAGS = $(CONDUIT_MPI_LIB_FLAGS)

##########
# VTKH
##########
# If using VTKH without mpi
ASCENT_VTKH_LIB_FLAGS=-L $(ASCENT_VTKH_DIR)/lib \
-lvtkh_rendering \
-lvtkh_filters \
-lvtkh_core \
-lvtkh_lodepng \
-lvtkh_utils

# If using VTKH with mpi
ASCENT_VTKH_MPI_LIB_FLAGS=-L $(ASCENT_VTKH_DIR)/lib \
-lvtkh_rendering_mpi \
-lvtkh_filters_mpi \
-lvtkh_core_mpi \
-lvtkh_lodepng \
-lvtkh_utils_mpi

##########
#VTKM
##########
ASCENT_VTKM_LIB_FLAGS = -L $(ASCENT_VTKM_DIR)/lib \
-lvtkm_cont-$(ASCENT_VTKM_VERSION) \
-lvtkm_rendering-$(ASCENT_VTKM_VERSION)

##########
# MFEM
##########

# Include make vars from the mfem config.mk file

if($(ASCENT_MFEM_DIR))
include $(ASCENT_MFEM_DIR)/share/mfem/config.mk
endif

# MFEM isn't in the interface, so we don't need include flags
ASCENT_MFEM_LIB_FLAGS = $(if $(ASCENT_MFEM_DIR),-L $(ASCENT_MFEM_DIR)/lib -lmfem $(MFEM_EXT_LIBS))

#######################
# Ascent Include Flags
#######################
ASCENT_INCLUDE_FLAGS = $(CONDUIT_INCLUDE_FLAGS) \
-I $(ASCENT_DIR)/include/ascent


####################
# Ascent Lib Flags
####################
# if using Ascent without mpi
ASCENT_LIB_FLAGS = -L $(ASCENT_DIR)/lib \
-lascent \
-lflow \
-lrover \
$(ASCENT_VTKH_LIB_FLAGS) \
$(ASCENT_VTKM_LIB_FLAGS) \
$(ASCENT_CONDUIT_LIB_FLAGS) \
$(ASCENT_MFEM_LIB_FLAGS)

# if using Ascent with mpi
ASCENT_MPI_LIB_FLAGS = -L $(ASCENT_DIR)/lib \
-lascent_mpi \
-lflow \
-lrover_mpi \
$(ASCENT_VTKH_MPI_LIB_FLAGS) \
$(ASCENT_VTKM_LIB_FLAGS) \
$(ASCENT_CONDUIT_MPI_LIB_FLAGS) \
$(ASCENT_MFEM_LIB_FLAGS)
2 changes: 1 addition & 1 deletion src/docs/sphinx/QuickStart.rst
Expand Up @@ -81,7 +81,7 @@ CMake-based build system example (see: ``examples/ascent/using-with-cmake``):
Makefile-based build system example (see: ``examples/ascent/using-with-make``):

.. literalinclude:: ../../examples/using-with-make/Makefile
:lines: 46-55
:lines: 46-56
:dedent: 2


Expand Down
23 changes: 17 additions & 6 deletions src/examples/using-with-make/Makefile
Expand Up @@ -48,19 +48,30 @@
# based build system.
#
# To build:
# env ASCENT_DIR={ascent install path} \
# CONDUIT_DIR={conduit install path} \
# make
# env ASCENT_DIR={ascent install path} make
# ./ascent_render_example
#
# From within an ascent install:
# make
# ./example
#
# Which corresponds to:
#
# make ASCENT_DIR=../../../
# ./example
#
###############################################################################

ASCENT_DIR ?= ../../..

# See $(ASCENT_DIR)/share/ascent/ascent_config.mk for detailed linking info
include $(ASCENT_DIR)/share/ascent/ascent_config.mk

INC_FLAGS=-I$(ASCENT_DIR)/include/ascent -I$(CONDUIT_DIR)/include/conduit
LINK_FLAGS=-L$(ASCENT_DIR)/lib/ -lascent -L$(CONDUIT_DIR)/lib/ -lconduit -lconduit_relay -lconduit_blueprint

main:
$(CXX) $(INC_FLAGS) ascent_render_example.cpp $(LINK_FLAGS) -o ascent_render_example
$(CXX) $(ASCENT_INCLUDE_FLAGS) ascent_render_example.cpp $(ASCENT_LIB_FLAGS) -o ascent_render_example

# TODO: Add mpi render example