Skip to content

Commit

Permalink
WIP: Add SimpleTpl to help test RPATH (#126)
Browse files Browse the repository at this point in the history
Need to add unit tests for this yet.
  • Loading branch information
bartlettroscoe committed Oct 27, 2016
1 parent ae532ca commit 42d1c48
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 0 deletions.
1 change: 1 addition & 0 deletions tribits/examples/TribitsExampleProject/TPLsList.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
TRIBITS_REPOSITORY_DEFINE_TPLS(
MPI "${${PROJECT_NAME}_TRIBITS_DIR}/core/std_tpls/FindTPLMPI.cmake" PT
HeaderOnlyTpl "cmake/tpls/" PT
SimpleTpl "cmake/tpls/" ST
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TRIBITS_TPL_FIND_INCLUDE_DIRS_AND_LIBRARIES( SimpleTpl
REQUIRED_HEADERS SimpleTpl.hpp
REQUIRED_LIBS_NAMES simpletpl
MUST_FIND_ALL_HEADERS
)
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_TPLS HeaderOnlyTpl
LIB_OPTIONAL_TPLS SimpleTpl
)
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#cmakedefine HAVE_SIMPLECXX___INT64

#cmakedefine HAVE_SIMPLECXX_DEBUG
#cmakedefine HAVE_SIMPLECXX_SIMPLETPL

@SIMPLECXX_DEPRECATED_DECLARATIONS@
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include "SimpleCxx_HelloWorld.hpp"
#include "HeaderOnlyTpl_stuff.hpp"

#ifdef HAVE_SIMPLECXX_SIMPLETPL
# include "SimpleTpl.hpp"
#endif

std::string SimpleCxx::deps()
{
Expand All @@ -24,10 +27,15 @@ void HelloWorld::printHelloWorld(std::ostream &out) const
out << "Release is enabled!\n";
#endif
out << "Sqr(3) = " << HeaderOnlyTpl::sqr(3) << "\n";

#ifdef HAVE_SIMPLECXX_SIMPLETPL
out << "Cube(3) = " << SimpleTpl::cube(3) << "\n";
#endif
#ifdef SIMPLECXX_SHOW_DEPRECATED_WARNINGS
(void)someOldFunc();
(void)someOldFunc2();
#endif

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ int main() {

TEST_FIND_SUBSTR_IN_STR("Sqr(3) = 9", oss.str());

#ifdef HAVE_SIMPLECXX_SIMPLETPL
TEST_FIND_SUBSTR_IN_STR("Cube(3) = 27", oss.str());
#endif

if (success) {
std::cout << "End Result: TEST PASSED\n";
}
Expand Down
15 changes: 15 additions & 0 deletions tribits/examples/tpls/SimpleTpl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)

ADD_LIBRARY(simpletpl SimpleTpl.hpp SimpleTpl.cpp)

INSTALL(
TARGETS simpletpl
RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib"
)

INSTALL(
FILES SimpleTpl.hpp
DESTINATION "${CMAKE_INSTALL_PREFIX}/include"
)
6 changes: 6 additions & 0 deletions tribits/examples/tpls/SimpleTpl/SimpleTpl.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "SimpleTpl.hpp"

double SimpleTpl::cube(const double &v)
{
return v*v*v;
}
11 changes: 11 additions & 0 deletions tribits/examples/tpls/SimpleTpl/SimpleTpl.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef SIMPLE_TPL_HPP
#define SIMPLE_TPL_HPP

namespace SimpleTpl {

/** \brief . */
double cube(const double &v);

} // namespace SimpleTpl

#endif // SIMPLE_TPL_HPP

0 comments on commit 42d1c48

Please sign in to comment.