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

Complete initial implementation for treating internal packages as external found with find_package() (#63) #560

Merged
merged 49 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
ccb222a
Add printing of <Package>_PACAKGE_BUILD_STATUS (#63)
bartlettroscoe Dec 22, 2022
afcea28
Add documentation for <Package>_SUBPACKAGES varaible (#63)
bartlettroscoe Jan 12, 2023
ee5f2ce
Small doc update (#63)
bartlettroscoe Jan 13, 2023
0fc3973
Change tribits_print_prefix_string_and_list() to pass in list name (#63)
bartlettroscoe Jan 17, 2023
f3f9356
WIP: Add basic logic for setting <Package>_PACKAGE_BUILD_STATUS=EXTER…
bartlettroscoe Jan 24, 2023
09e61e5
WIP: rename some local vars away from UPPPER-CASE (#63)
bartlettroscoe Jan 18, 2023
5648cf7
WIP: Replace bool arg includeEmpty with enum arg enableEmptyStatus (#63)
bartlettroscoe Jan 18, 2023
abd846a
WIP: Small doc and format changes (#63)
bartlettroscoe Jan 18, 2023
cc8d5b7
WIP: Add internalOrExternal arg to tribits_print_packages_list_enable…
bartlettroscoe Jan 19, 2023
f85cc17
WIP: Change name from TribitsGetEnabledSublists.cmake to TribitsPacka…
bartlettroscoe Jan 19, 2023
e30b5bf
WIP: Change printing of package set lists based in INTERNAL/EXTERNAL …
bartlettroscoe Jan 20, 2023
e14b0d2
WIP: Add printing of Final set of [non-]enabled top-level external pa…
bartlettroscoe Jan 20, 2023
864ad9f
Factor out tribits_filter_package_list_from_var() (#63)
bartlettroscoe Jan 20, 2023
7ab3809
MockTrilinos: Set <Project>_TRACE_DEPENDENCY_HANDLING_ONLY=ON (#63)
bartlettroscoe Jan 21, 2023
aaec210
WIP: Adjust processing of internal and external packages (#63)
bartlettroscoe Jan 21, 2023
b9b4567
Finish basic implentation for building against external packages (#63)
bartlettroscoe Jan 24, 2023
33902f7
Process TPLs at base project level, pass info through <Package>Config…
bartlettroscoe Jan 27, 2023
a2790c8
Make WrapExernal work with external TribitsExProj packages (#63)
bartlettroscoe Jan 25, 2023
3065298
Add option <Project>_SKIP_INSTALL_PROJECT_CMAKE_CONFIG_FILES (#63)
bartlettroscoe Jan 25, 2023
aa843a4
WIP: Rename TribitsProcessEnabledTpl.cmake to TribitsProcessEnabledTp…
bartlettroscoe Jan 27, 2023
8e112e0
Add basic special handling for fully TriBITS-compliant external packa…
bartlettroscoe Jan 26, 2023
56b0845
WIP: Add initial failing test case for stagged package installs (#63)
bartlettroscoe Jan 27, 2023
cddd9f1
Initial implementation of pre-building/pre-installing stages of packa…
bartlettroscoe Jan 27, 2023
0c959bb
Revise how internal and external <Package>Config.cmake files are link…
bartlettroscoe Jan 28, 2023
2075dd6
WIP: Improve names of functions and variables (#63)
bartlettroscoe Feb 6, 2023
3b63fbd
WIP: Improve documentation (#63)
bartlettroscoe Feb 6, 2023
3389ceb
WIP: Move functions writing <tplName>Config.cmake files to TribitsExt…
bartlettroscoe Feb 6, 2023
28d1beb
WIP: Rename TribitsExternalPackageFindTplHelpers to TribitsExternalPa…
bartlettroscoe Feb 6, 2023
9a1eba1
WIP: Rename TribitsWriteClientExportFiles.cmake to TribitsInternalPac…
bartlettroscoe Feb 7, 2023
d8d60ae
WIP: Factor out TribitsProjectWriteConfigFile.cmake, reorder funcs (#63)
bartlettroscoe Feb 7, 2023
f14bba2
WIP: Rename func, remove unused funcs (#63)
bartlettroscoe Feb 7, 2023
bdd12c9
WIP: Remove 'Fully' from 'Fully TriBITS-Compliant' (and variations) (…
bartlettroscoe Feb 7, 2023
a2a5b99
Move 'CMake Language Overview and Gotchas' to appendix
bartlettroscoe Feb 9, 2023
61eaf6a
Remove debug print statement that got commited by accident
bartlettroscoe Feb 9, 2023
ba9de28
Adjust logic and printing for setting INTTERNAL packages as EXTERNAL …
bartlettroscoe Feb 18, 2023
80bd994
Update some outputing for TriBITS-compliant external packages (#63)
bartlettroscoe Feb 19, 2023
31de1fe
Add definitions of TriBITS-compliant packages (#63)
bartlettroscoe Feb 20, 2023
652d189
Add links to TriBITS-compliant external package in requirements for F…
bartlettroscoe Feb 20, 2023
8fc1e25
Add build ref item for treating internal packages as external (#634)
bartlettroscoe Feb 21, 2023
2bcc17f
Add CHANGLOG.md entry for -D<Project>_ENABLE_<TplName>=ON (#63, #546)
bartlettroscoe Feb 21, 2023
68c83ef
Add documentation for TriBITS-compliant external packages TRIBITS_PKG…
bartlettroscoe Feb 21, 2023
f8c1ea5
Add CHANGLOG.md entry for supporting pre-installed packages (#63)
bartlettroscoe Feb 21, 2023
f75343e
Merge remote-tracking branch 'github/master' into 63-combined-package…
bartlettroscoe Feb 25, 2023
2de8ca1
Merge branch 'master' into 63-combined-package-data-structures-6
bartlettroscoe Feb 25, 2023
f58975f
Merge remote-tracking branch 'github/master' into 63-combined-package…
bartlettroscoe Feb 28, 2023
90b96ee
Fix some documentation and add new functions to generated docs (#63, …
bartlettroscoe Mar 29, 2023
16b1817
Fix spelling of TribitsCMakeLanguageOverviewAndGotchas.rst (#63, #560)
bartlettroscoe Mar 29, 2023
014a153
Remove unused legacy RELATIVE_PATH code (#63, #560)
bartlettroscoe Mar 29, 2023
ee67e05
Merge remote-tracking branch 'github/master' into 63-combined-package…
bartlettroscoe Mar 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions test/core/ExamplesUnitTests/TribitsExampleProject_Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3279,7 +3279,7 @@ tribits_add_advanced_test( TribitsExampleProject_External_SimpleCxx
-DTribitsExProj_ENABLE_SECONDARY_TESTED_CODE=ON
-DTribitsExProj_ENABLE_ALL_PACKAGES=ON
-DTribitsExProj_ENABLE_TESTS=ON
#-DTribitsExProj_ENABLE_INSTALL_CMAKE_CONFIG_FILES=OFF # Allow WrapExternal enable
-DTribitsExProj_ENABLE_INSTALL_CMAKE_CONFIG_FILES=OFF # Allow WrapExternal enable
-DTPL_ENABLE_SimpleCxx=ON
-DCMAKE_PREFIX_PATH=../install/simple_cxx
-DTPL_ENABLE_MPI=OFF
Expand All @@ -3293,10 +3293,10 @@ tribits_add_advanced_test( TribitsExampleProject_External_SimpleCxx
"Adjust the set of internal and external packages:"
"-- Treating internal package SimpleCxx as EXTERNAL because TPL_ENABLE_SimpleCxx=ON"

"Final set of enabled top-level packages: MixedLang WithSubpackages 2"
"Final set of enabled packages: MixedLang WithSubpackagesA WithSubpackagesB WithSubpackagesC WithSubpackages 5"
"Final set of non-enabled top-level packages: WrapExternal 1"
"Final set of non-enabled packages: WrapExternal 1"
"Final set of enabled top-level packages: MixedLang WithSubpackages WrapExternal 3"
"Final set of enabled packages: MixedLang WithSubpackagesA WithSubpackagesB WithSubpackagesC WithSubpackages WrapExternal 6"
"Final set of non-enabled top-level packages: 0"
"Final set of non-enabled packages: 0"
"Final set of enabled top-level external packages/TPLs: HeaderOnlyTpl SimpleTpl SimpleCxx 3"
"Final set of enabled external packages/TPLs: HeaderOnlyTpl SimpleTpl SimpleCxx 3"
"Final set of non-enabled top-level external packages/TPLs: MPI 1"
Expand Down Expand Up @@ -3330,7 +3330,7 @@ tribits_add_advanced_test( TribitsExampleProject_External_SimpleCxx
SKIP_CLEAN_WORKING_DIRECTORY
CMND ${CMAKE_CTEST_COMMAND}
PASS_REGULAR_EXPRESSION_ALL
"100% tests passed, 0 tests failed out of 7"
"100% tests passed, 0 tests failed out of 8"
ALWAYS_FAIL_ON_NONZERO_RETURN

ADDED_TEST_NAME_OUT TribitsExampleProject_External_SimpleCxx_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@
# provides libraries that need to be cast as TriBITS CMake libraries. To
# make this even more interesting, the external software has dependencies on
# upstream TriBITS packages.
#
# An overview of the basic tasks required are:
#
# a) Enumerate the upstream packages and TPLs needed (this is done in the
# cmake/Dependencies.cmake file).
#
# b) Generate an export makefile for the upstream packages and TPLs
#
# c) Call the configure script for the external package passing the compilers,
# compiler flags, and a pointer to the export makefile (which is just used to
# lift the include dirs and libs).
#
# d) Define library targets for the external project and define a build rule
# for generating those libraries given the list of header and source files in
# the external project.

tribits_package(WrapExternal)

Expand Down Expand Up @@ -66,41 +51,51 @@ endif()

string(TOUPPER "${CMAKE_BUILD_TYPE}" upperBuildType)

set(includeDirsList
-I ${WithSubpackagesA_SOURCE_DIR}
-I ${SimpleCxx_SOURCE_DIR}/src
-I ${SimpleCxx_BINARY_DIR}/src
)
get_target_property(simpleCxx_IncludeDirs
SimpleCxx::simplecxx INTERFACE_INCLUDE_DIRECTORIES)

get_target_property(withSubpackagesA_IncludeDirs
WithSubpackagesA::pws_a INTERFACE_INCLUDE_DIRECTORIES)

set(includeDirsList ${withSubpackagesA_IncludeDirs} ${simpleCxx_IncludeDirs})

if (${PACKAGE_NAME}_ENABLE_MixedLang)
list(PREPEND includeDirsList
-I ${MixedLang_SOURCE_DIR}/src
-I ${MixedLang_BINARY_DIR}/src
)
get_target_property(mixedLang_IncludeDirs
MixedLang::mixedlang INTERFACE_INCLUDE_DIRECTORIES)
list(PREPEND includeDirsList ${mixedLang_IncludeDirs})
endif()
list(JOIN includeDirsList " " includeDirs)
# NOTE: TriBITS export Makefile support used to handle the above stuff
# automatically but that is what you give up when moving to modern CMake.
list(JOIN includeDirsList " -I" includeDirsCompileOptions)
set(includeDirsCompileOptions "-I${includeDirsCompileOptions}")
bartlettroscoe marked this conversation as resolved.
Show resolved Hide resolved

#
# C) Do configuration of the external project
# C) Do configuration of the external project as a build target
#

set(EXTERNAL_FUNC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external_func)
set(EXTERNAL_FUNC_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/external_func)
set(EXTERNAL_FUNC_LIB_FILE ${EXTERNAL_FUNC_BINARY_DIR}/libexternal_func.a)
set(EXTERNAL_FUNC_MAKEFILE ${EXTERNAL_FUNC_BINARY_DIR}/Makefile)

file(MAKE_DIRECTORY ${EXTERNAL_FUNC_BINARY_DIR})

execute_process(
add_custom_command(
OUTPUT ${EXTERNAL_FUNC_MAKEFILE}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt
${EXTERNAL_FUNC_SOURCE_DIR}/configure.py
COMMAND ${PYTHON_EXECUTABLE} ${EXTERNAL_FUNC_SOURCE_DIR}/configure.py
"--cxx=${CMAKE_CXX_COMPILER}"
"--cxx-flags=${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${upperBuildType}}"
"--ar=${CMAKE_AR}"
"--include-dirs=${includeDirs}"
"--include-dirs=${includeDirsCompileOptions}"
"--src-dir=${EXTERNAL_FUNC_SOURCE_DIR}"
"--build-dir=${EXTERNAL_FUNC_BINARY_DIR}"
)

# NOTE: Above, we have to run the configure.py script at build time after
# generation because ${includeDirsCompileOptions} contains generation
# expressions that are evaluated at generation time by the
# add_custom_command() call.

#
# D) Define a custom build rule and target to create external_func library
#
Expand All @@ -109,6 +104,7 @@ add_custom_command(
OUTPUT ${EXTERNAL_FUNC_LIB_FILE}
DEPENDS ${EXTERNAL_FUNC_SOURCE_DIR}/external_func.hpp
${EXTERNAL_FUNC_SOURCE_DIR}/external_func.cpp
${EXTERNAL_FUNC_MAKEFILE}
COMMAND make ${CTEST_BUILD_FLAGS}
WORKING_DIRECTORY ${EXTERNAL_FUNC_BINARY_DIR}
)
Expand Down