forked from TriBITSPub/TriBITS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: Beginning of TribitsExampleProject2 (TriBITSPub#299, TriBITSPub#427
- Loading branch information
1 parent
89136bb
commit ea111b2
Showing
13 changed files
with
126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
################################################################################ | ||
# # | ||
# TribitsExampleProject2 # | ||
# # | ||
################################################################################ | ||
|
||
cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR) | ||
include("${CMAKE_CURRENT_SOURCE_DIR}/ProjectName.cmake") | ||
project(${PROJECT_NAME} LANGUAGES NONE) | ||
set(${PROJECT_NAME}_TRIBITS_DIR | ||
"${CMAKE_CURRENT_LIST_DIR}/../.." CACHE STRING | ||
"TriBITS base directory (default assumes in TriBITS source tree)") | ||
include("${${PROJECT_NAME}_TRIBITS_DIR}/TriBITS.cmake") | ||
tribits_project() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tribits_repository_define_packages( | ||
Package1 packages/package1 PT | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
set(PROJECT_NAME TribitsExProj2) | ||
set(${PROJECT_NAME}_ENABLE_INSTALL_CMAKE_CONFIG_FILES_DEFAULT ON) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tribits_repository_define_tpls( | ||
Tpl1 "cmake/tpls/" PT | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
set(${REPOSITORY_NAME}_VERSION 1.1) | ||
set(${REPOSITORY_NAME}_MAJOR_VERSION 01) | ||
set(${REPOSITORY_NAME}_MAJOR_MINOR_VERSION 010100) | ||
set(${REPOSITORY_NAME}_VERSION_STRING "1.1 (Dev)") | ||
set(${REPOSITORY_NAME}_ENABLE_DEVELOPMENT_MODE_DEFAULT ON) # Change to 'OFF' for a release |
29 changes: 29 additions & 0 deletions
29
tribits/examples/TribitsExampleProject2/cmake/tpls/FindTPLTpl1.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
include(TribitsGetImportedLocationProperty) | ||
|
||
set(REQUIRED_HEADERS Tpl1.hpp) | ||
set(REQUIRED_LIBS_NAMES tpl1) | ||
|
||
tribits_tpl_allow_pre_find_package(Tpl1 Tpl1_ALLOW_PREFIND) | ||
|
||
if (Tpl1_ALLOW_PREFIND) | ||
message("-- Using find_package(Tpl1 ...) ...") | ||
find_package(Tpl1) | ||
if (Tpl1_FOUND) | ||
message("-- Found Tpl1_DIR='${Tpl1_DIR}'") | ||
get_target_property(inclDirs tpl1::tpl1 INTERFACE_INCLUDE_DIRECTORIES) | ||
tribits_get_imported_location_property(tpl1::tpl1 libfile) | ||
#print_var(inclDirs) | ||
#print_var(libfile) | ||
set(TPL_Tpl1_INCLUDE_DIRS "${inclDirs}" CACHE PATH "Include dirs for Tpl1") | ||
set(TPL_Tpl1_LIBRARIES "${libfile}" CACHE PATH "Libraries for Tpl1") | ||
# ToDo: Put in a call to find_dependency() in the generated | ||
# Tpl1Config.cmake file and set Tpl1_DIR in that file to the found path so | ||
# it finds the same file. For now, just getting the include directories | ||
# and the library path is enough. | ||
endif() | ||
endif() | ||
|
||
tribits_tpl_find_include_dirs_and_libraries( Tpl1 | ||
REQUIRED_HEADERS ${REQUIRED_HEADERS} | ||
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES} | ||
) |
4 changes: 4 additions & 0 deletions
4
tribits/examples/TribitsExampleProject2/packages/package1/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
tribits_package(Package1) | ||
add_subdirectory(src) | ||
tribits_add_test_directories(test) | ||
tribits_package_postprocess() |
3 changes: 3 additions & 0 deletions
3
tribits/examples/TribitsExampleProject2/packages/package1/cmake/Dependencies.cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tribits_package_define_dependencies( | ||
LIB_REQUIRED_TPLS Tpl1 | ||
) |
22 changes: 22 additions & 0 deletions
22
tribits/examples/TribitsExampleProject2/packages/package1/src/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
set(HEADERS "") | ||
set(SOURCES "") | ||
|
||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) | ||
|
||
append_set(HEADERS | ||
Package1_HelloWorld.hpp | ||
) | ||
append_set(SOURCES | ||
Package1_HelloWorld.cpp | ||
) | ||
|
||
tribits_add_library( | ||
package1 | ||
HEADERS ${HEADERS} | ||
SOURCES ${SOURCES} | ||
) | ||
|
||
tribits_add_executable(package1-helloworld NOEXEPREFIX NOEXESUFFIX | ||
SOURCES Package1_HelloWorld_Prog.cpp | ||
INSTALLABLE | ||
) |
10 changes: 10 additions & 0 deletions
10
tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_HelloWorld.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
#include "Package1_HelloWorld.hpp" | ||
#include "Tpl1.hpp" | ||
|
||
std::string Package1::deps() | ||
{ | ||
std::string deps; | ||
deps = Tpl1::itsme(); | ||
return deps; | ||
} |
16 changes: 16 additions & 0 deletions
16
tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_HelloWorld.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef PACKAGE1_HELLO_WOLRD_HPP | ||
#define PACKAGE1_HELLO_WOLRD_HPP | ||
|
||
|
||
#include <ostream> | ||
|
||
|
||
namespace Package1 { | ||
|
||
/** \brief . */ | ||
std::string deps(); | ||
|
||
} // namespace Package1 | ||
|
||
|
||
#endif // PACKAGE1_HELLO_WOLRD_HPP |
9 changes: 9 additions & 0 deletions
9
tribits/examples/TribitsExampleProject2/packages/package1/src/Package1_HelloWorld_Prog.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#include <iostream> | ||
|
||
#include "Package1_HelloWorld.hpp" | ||
|
||
int main() | ||
{ | ||
std::cout << "Package1 Deps: " << Package1::deps() << "\n"; | ||
return 0; | ||
} |
6 changes: 6 additions & 0 deletions
6
tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tribits_add_test(package1-helloworld NOEXEPREFIX NOEXESUFFIX | ||
NAME HelloWorldProg | ||
DIRECTORY ${PACKAGE_BINARY_DIR}/src | ||
NUM_MPI_PROCS 1 | ||
PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" | ||
) |