Skip to content

Commit

Permalink
Shortenling names to MixedLang and WithSubpackages
Browse files Browse the repository at this point in the history
This makes the substitutions:

  MixedLanguage => MixedLang
  PackageWithSubpackages => WithSubpackages
  SubpackageA => A
  SubpackageB => B
  SubpackageC => C

I also I changed the directory names:

  mixed_language => mixed_lang
  package_with_subpackages => with_subpackages
  package_with_subpackages/A => with_subpackages/a
  package_with_subpackages/B => with_subpackages/b
  package_with_subpackages/C => with_subpackages/c

The names of the subpackages are now shorter and easier to type and read.  The
directory names are shorter and are now all lower-case as is convention
adopted from Trilinos.

All of the tests have been updated too.
  • Loading branch information
Roscoe A. Bartlett committed Oct 6, 2014
1 parent 7bbcc8d commit bfa3094
Show file tree
Hide file tree
Showing 38 changed files with 480 additions and 485 deletions.
266 changes: 132 additions & 134 deletions doc/developers_guide/TribitsDevelopersGuide.html

Large diffs are not rendered by default.

Binary file modified doc/developers_guide/TribitsDevelopersGuide.pdf
Binary file not shown.
212 changes: 107 additions & 105 deletions doc/developers_guide/TribitsDevelopersGuide.rst

Large diffs are not rendered by default.

23 changes: 9 additions & 14 deletions doc/developers_guide/UtilsMacroFunctionDoc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -707,8 +707,8 @@ etc!
TIMER_GET_RAW_SECONDS()
+++++++++++++++++++++++

Return the raw time in seconds since epoch, i.e., since 1970-01-01 00:00:00
UTC.
Return the raw time in seconds (nano-second accuracy) since epoch, i.e.,
since 1970-01-01 00:00:00 UTC.

Usage::

Expand All @@ -719,11 +719,11 @@ This function is used along with `TIMER_GET_REL_SECONDS()`_, and
profiling purposes. See `TIMER_PRINT_REL_TIME()`_ for more details and an
example.

NOTE: This function runs an external process to run the ``date`` command.
Therefore, it only works on Unix/Linux and other systems that have a
standard ``date`` command. Since this runs an external process, this
function should only be used to time very course-grained operations
(i.e. that take longer than a second).
NOTE: This function runs an external process with ``EXECUTE_PROCESS()`` to
run the ``date`` command. Therefore, it only works on Unix/Linux and other
systems that have a standard ``date`` command. Since this uses
``EXECUTE_PROCESS()``, this function should only be used to time very
course-grained operations (i.e. that take longer than a second).

TIMER_GET_REL_SECONDS()
+++++++++++++++++++++++
Expand Down Expand Up @@ -751,9 +751,7 @@ Usage::

Differences the raw times ``<startSeconds>`` and ``<endSeconds>``
(i.e. gotten from `TIMER_GET_RAW_SECONDS()`_) and prints the time in
``<min>m<sec>s`` format. This can only resolve times a second or greater
apart. If the start and end times are less than a second then ``0m0s`` will
be printed.
``<min>m<sec>s`` format.

This is meant to be used with `TIMER_GET_RAW_SECONDS()`_ to time expensive
blocks of CMake code like::
Expand All @@ -769,10 +767,7 @@ blocks of CMake code like::

This will print something like::

REAL_EXPENSIVE() time: 0m5s

Again, don't try to time something that takes less than 1 second as it will
be recorded as ``0m0s``.
REAL_EXPENSIVE() time: 0m5.235s
UNITTEST_COMPARE_CONST()
++++++++++++++++++++++++
Expand Down
8 changes: 4 additions & 4 deletions doc/examples/TribitsExampleProject/PackagesList.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
TRIBITS_REPOSITORY_DEFINE_PACKAGES(
SimpleCxx packages/simple_cxx PT
MixedLanguage packages/mixed_language PT
PackageWithSubpackages packages/package_with_subpackages PT
WrapExternal packages/wrap_external ST
SimpleCxx packages/simple_cxx PT
MixedLang packages/mixed_lang PT
WithSubpackages packages/with_subpackages PT
WrapExternal packages/wrap_external ST
)

TRIBITS_DISABLE_PACKAGE_ON_PLATFORMS(WrapExternal Windows)
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ MACRO(TRIBITS_REPOSITORY_SETUP_EXTRA_OPTIONS)
IF (NOT ${PROJECT_NAME}_ENABLE_Fortran)
MESSAGE(
"\n***"
"\n*** Warning: Setting ${PROJECT_NAME}_ENABLE_MixedLanguage=OFF"
"\n*** Warning: Setting ${PROJECT_NAME}_ENABLE_MixedLang=OFF"
" because ${PROJECT_NAME}_ENABLE_Fortran=OFF!"
"\n***\n"
)
SET(${PROJECT_NAME}_ENABLE_MixedLanguage OFF)
SET(${PROJECT_NAME}_ENABLE_MixedLang OFF)
ENDIF()

ENDMACRO()
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TRIBITS_PACKAGE( MixedLanguage ENABLE_SHADOWING_WARNINGS CLEANED )
TRIBITS_PACKAGE( MixedLang ENABLE_SHADOWING_WARNINGS CLEANED )

TRIBITS_ADD_DEBUG_OPTION()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <algorithm>
#include <numeric>

#include "MixedLanguage_config.h"
#include "MixedLang_config.h"
#include "Ray_Tracer.hh"

//---------------------------------------------------------------------------//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# A) Forward declare the package so that certain options are also defined for
# subpackages
#
TRIBITS_PACKAGE_DECL(PackageWithSubpackages)
TRIBITS_PACKAGE_DECL(WithSubpackages)

#
# B) Define the common options for the package first so they can be used by
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

#include "SimpleCxx_HelloWorld.hpp"

std::string PackageWithSubpackages::getA() {
std::string WithSubpackages::getA() {
return std::string("A");
}

std::string PackageWithSubpackages::depsA() {
std::string WithSubpackages::depsA() {
return SimpleCxx::deps();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <string>

namespace PackageWithSubpackages {
namespace WithSubpackages {

// return a string containing "A"
std::string getA();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# A) Define the subpackage
#
TRIBITS_SUBPACKAGE(SubpackageA)
TRIBITS_SUBPACKAGE(A)

#
# B) Set up subpackage-specific options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "A.hpp"

using namespace PackageWithSubpackages;
using namespace WithSubpackages;

int main() {
std::string label_A = getA();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TRIBITS_SUBPACKAGE(SubpackageB)
TRIBITS_SUBPACKAGE(B)

ADD_SUBDIRECTORY(src)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_PACKAGES SimpleCxx
LIB_OPTIONAL_PACKAGES PackageWithSubpackagesSubpackageA
TEST_OPTIONAL_PACKAGES MixedLanguage
LIB_OPTIONAL_PACKAGES WithSubpackagesA
TEST_OPTIONAL_PACKAGES MixedLang
)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#cmakedefine HAVE_PACKAGEWITHSUBPACKAGESSUBPACKAGEB_PACKAGEWITHSUBPACKAGESSUBPACKAGEA
#cmakedefine HAVE_WITHSUBPACKAGESB_WITHSUBPACKAGESA

Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
#include "B.hpp"

#ifdef HAVE_PACKAGEWITHSUBPACKAGESSUBPACKAGEB_PACKAGEWITHSUBPACKAGESSUBPACKAGEA
#ifdef HAVE_WITHSUBPACKAGESB_WITHSUBPACKAGESA
# include "A.hpp"
#endif

#include "SimpleCxx_HelloWorld.hpp"


std::string PackageWithSubpackages::getB() {
std::string WithSubpackages::getB() {
return std::string("B");
}


std::string PackageWithSubpackages::depsB() {
std::string WithSubpackages::depsB() {
std::string B_deps;
#ifdef HAVE_PACKAGEWITHSUBPACKAGESSUBPACKAGEB_PACKAGEWITHSUBPACKAGESSUBPACKAGEA
#ifdef HAVE_WITHSUBPACKAGESB_WITHSUBPACKAGESA
B_deps += (std::string("A ") + depsA() + std::string(" "));
#endif
B_deps += SimpleCxx::deps();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#ifndef PACKAGEWITHSUBPACKAGES_B_HPP_
#define PACKAGEWITHSUBPACKAGES_B_HPP_

#include "PackageWithSubpackagesSubpackageB_config.h"
#include "WithSubpackagesB_config.h"

#include <string>

namespace PackageWithSubpackages {
namespace WithSubpackages {

// return a string containing "B"
std::string getB();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ADD_SUBDIRECTORY(testlib)
#

SET(EXPECTED_B_DEPS)
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_PackageWithSubpackagesSubpackageA)
IF(${PACKAGE_NAME}_ENABLE_PackageWithSubpackagesSubpackageA)
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_WithSubpackagesA)
IF(${PACKAGE_NAME}_ENABLE_WithSubpackagesA)
SET(EXPECTED_B_DEPS "${EXPECTED_B_DEPS} A no_deps")
ENDIF()
SET(EXPECTED_B_DEPS "${EXPECTED_B_DEPS} no_deps")
Expand All @@ -34,8 +34,8 @@ TRIBITS_ADD_ADVANCED_TEST( test_of_b
# Define an test involving the optional dependent MixedLang package
#

ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_MixedLanguage)
IF (${PACKAGE_NAME}_ENABLE_MixedLanguage)
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_MixedLang)
IF (${PACKAGE_NAME}_ENABLE_MixedLang)

INCLUDE(${CMAKE_CURRENT_LIST_DIR}/ShowLibErrors.cmake)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

int main()
{
std::cout << PackageWithSubpackages::b_mixed_lang() << "\n";
std::cout << WithSubpackages::b_mixed_lang() << "\n";
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "B.hpp"

int main() {
using namespace PackageWithSubpackages;
using namespace WithSubpackages;
std::string label_B = getB();
std::string deps_B = depsB();
std::cout << "B label is: " << label_B << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# MixedLang package
#

ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_MixedLanguage)
IF (${PACKAGE_NAME}_ENABLE_MixedLanguage)
ASSERT_DEFINED(${PACKAGE_NAME}_ENABLE_MixedLang)
IF (${PACKAGE_NAME}_ENABLE_MixedLang)

INCLUDE(${CMAKE_CURRENT_LIST_DIR}/ShowLibErrors.cmake)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "B.hpp"
#include "MixedLang.hpp"

std::string PackageWithSubpackages::b_mixed_lang()
std::string WithSubpackages::b_mixed_lang()
{
return getB()+" "+tribits_mixed::mixedLang();
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string>

namespace PackageWithSubpackages {
namespace WithSubpackages {

std::string b_mixed_lang();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
#include "A.hpp"
#include "B.hpp"

std::string PackageWithSubpackages::getC()
std::string WithSubpackages::getC()
{
return std::string("C");
}

std::string PackageWithSubpackages::depsC()
std::string WithSubpackages::depsC()
{
return std::string("B ") + depsB();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <string>

namespace PackageWithSubpackages {
namespace WithSubpackages {

std::string getC();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TRIBITS_SUBPACKAGE(SubpackageC)
TRIBITS_SUBPACKAGE(C)

TRIBITS_ADD_EXECUTABLE( c_util
NOEXEPREFIX NOEXESUFFIX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ int main()
{
std::cout
<< "Called c_util: "
<< PackageWithSubpackages::depsB() << " "
<< PackageWithSubpackages::depsA()
<< WithSubpackages::depsB() << " "
<< WithSubpackages::depsA()
<< "\n";
return 0;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_PACKAGES PackageWithSubpackagesSubpackageA
PackageWithSubpackagesSubpackageB
LIB_REQUIRED_PACKAGES WithSubpackagesA
WithSubpackagesB
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ TRIBITS_ADD_ADVANCED_TEST( test_of_c
# Define a test-only lib and two tests that use it.
#

ASSERT_DEFINED(PackageWithSubpackagesSubpackageB_ENABLE_MixedLanguage)
IF (PackageWithSubpackagesSubpackageB_ENABLE_MixedLanguage)
ASSERT_DEFINED(WithSubpackagesB_ENABLE_MixedLang)
IF (WithSubpackagesB_ENABLE_MixedLang)

TRIBITS_ADD_LIBRARY( c_b_mixed_lang
TESTONLY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "C.hpp"
#include "b_mixed_lang.hpp"

std::string PackageWithSubpackages::c_b_mixed_lang()
std::string WithSubpackages::c_b_mixed_lang()
{
return (depsC()+" "+b_mixed_lang());
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <string>

namespace PackageWithSubpackages {
namespace WithSubpackages {

std::string c_b_mixed_lang();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "B.hpp"
#include "C.hpp"

using namespace PackageWithSubpackages;
using namespace WithSubpackages;

int main() {
std::string label_A = getA();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

int main()
{
std::cout << PackageWithSubpackages::c_b_mixed_lang() << "\n";
std::cout << WithSubpackages::c_b_mixed_lang() << "\n";
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
SUBPACKAGES_DIRS_CLASSIFICATIONS_OPTREQS
SubpackageA A PT REQUIRED
SubpackageB B ST OPTIONAL
SubpackageC C ST OPTIONAL
A a PT REQUIRED
B b ST OPTIONAL
C c ST OPTIONAL
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_PACKAGES PackageWithSubpackagesSubpackageA
LIB_OPTIONAL_PACKAGES MixedLanguage
LIB_REQUIRED_PACKAGES WithSubpackagesA
LIB_OPTIONAL_PACKAGES MixedLang
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
std::string ExternalProj::external_func()
{
return std::string("external_func ")
+ PackageWithSubpackages::getA()
+ WithSubpackages::getA()
+ " "
+ PackageWithSubpackages::depsA();
+ WithSubpackages::depsA();
}
Loading

0 comments on commit bfa3094

Please sign in to comment.