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

Tribits snapshot #317

Merged
merged 37 commits into from
Jul 19, 2022
Merged

Tribits snapshot #317

merged 37 commits into from
Jul 19, 2022

Conversation

gsjaardema
Copy link
Member

No description provided.

gsjaardema and others added 25 commits June 14, 2022 13:26
Origin repo remote tracking branch: 'origin/master'
Origin repo remote repo URL: 'origin = https://github.com/gsjaardema/TriBITs'

At commit:

commit e82c4544fbd50769b85bab45cb98ef009ca4643c
Author:  Roscoe A. Bartlett <rabartl@sandia.gov>
Date:    Fri Jun 10 11:08:38 2022 -0600
Summary: Remove internal quotes for git log --pretty=format:<fmnt> strings (#485)
This reverts commit 4d57c91.
Did not fix any of the issues on the CI Build.
@gsjaardema gsjaardema marked this pull request as draft June 17, 2022 13:21
@bartlettroscoe
Copy link
Contributor

Hello @gsjaardema, is this PR pretty well validated for the TriBITS update?

Origin repo remote tracking branch: 'origin/master'
Origin repo remote repo URL: 'origin = https://github.com/gsjaardema/TriBITs'
Git describe: tribits_start-2941-gd1fcd5a9

At commit:

commit 13c342de0cfdda8822c22c47763d4b3dd08571f0
Author:  Roscoe A. Bartlett <rabartl@sandia.gov>
Date:    Tue Jun 28 08:19:35 2022 -0600
Summary: Remove assert for TPL_<tplName>_LIBRARIES (#299)
@gsjaardema
Copy link
Member Author

@bartlettroscoe Yes, it is ready to go at any time...

Origin repo remote tracking branch: 'origin/master'
Origin repo remote repo URL: 'origin = https://github.com/gsjaardema/TriBITs'
Git describe: tribits_start-2946-g974f565d

At commit:

commit b87c0e113847d05ecdc16defcfa247ba4f0c2dca
Author:  Roscoe A. Bartlett <rabartl@sandia.gov>
Date:    Tue Jun 28 14:21:40 2022 -0600
Summary: Only allow files without 'lib' to have '.framework' on APPLE (#299)
@bartlettroscoe
Copy link
Contributor

@gsjaardema, regarding the GTest-related configure failure shown here showing:

Processing enabled TPL: GTest (enabled explicitly, disable with -DTPL_ENABLE_GTest=OFF)
-- Using FIND_PACKAGE(GTest ...) ...
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- GTest_LIBRARY_NAMES='gtest'
-- TPL_GTest_LIBRARIES='/home/runner/environments/gnu-V110-4.9.0-4.3.0/lib/libgtest.so.1.11.0'
-- TPL_GTest_INCLUDE_DIRS='/home/runner/environments/gnu-V110-4.9.0-4.3.0/include'
CMake Error at build/external_packages/GTest/GTestConfig.cmake:10 (add_library):
  add_library cannot create imported target "GTest::gtest" because another
  target with the same name already exists.
Call Stack (most recent call first):
  cmake/tribits/core/package_arch/TribitsTplFindIncludeDirsAndLibraries.cmake:700 (include)
  cmake/TPLs/FindTPLGTest.cmake:82 (tribits_tpl_find_include_dirs_and_libraries)
  cmake/tribits/core/package_arch/TribitsProcessEnabledTpl.cmake:99 (include)
  cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake:1445 (tribits_process_enabled_tpl)

the problem is the the file cmake/TPLs/FindTPLGTest.cmake and the lines:

tribits_tpl_allow_pre_find_package(GTest GTest_ALLOW_PREFIND)
if (GTest_ALLOW_PREFIND)
message("-- Using FIND_PACKAGE(GTest ...) ...")
find_package(GTest CONFIG)
if (GTest_FOUND)
get_target_property(GTest_INCLUDE_DIRS GTest::gtest INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(GTest_CONFIGURATION GTest::gtest IMPORTED_CONFIGURATIONS)
get_target_property(GTest_LIBRARIES GTest::gtest IMPORTED_LOCATION_${GTest_CONFIGURATION})
# Tell TriBITS that we found GTest and there no need to look any further!
set(TPL_GTest_INCLUDE_DIRS ${GTest_INCLUDE_DIRS} CACHE PATH "...")
set(TPL_GTest_LIBRARIES ${GTest_LIBRARIES} CACHE FILEPATH "...")
set(TPL_GTest_LIBRARY_DIRS ${GTest_LIBRARY_DIRS} CACHE PATH "...")
endif()
endif()
# Third, call `tribits_tpl_find_include_dirs_and_libraries()`
tribits_tpl_find_include_dirs_and_libraries( GTest
REQUIRED_HEADERS ${REQUIRED_HEADERS}
REQUIRED_LIBS_NAMES ${REQUIRED_LIBS_NAMES}
)

This will result in a new GTest::gtest imported target getting created in the tribits_tpl_find_include_dirs_and_libraries( GTest ... ) call.

I have exactly the same situation with the new example TriBITS TPLs Tpl1, Tpl2, Tpl3 and Tpl4 shown here:

I have prototyped how to handle this in:

Let me refactor that code into a reusable TriBITS function tribits_external_package_create_imported_all_libs_target_and_package_config_wrapper_file() and updated instructions at:

Then can you review the updated instructions and example and provide feedback?

Another question, are you okay with always having your FindTPLGTest.cmake file call find_package(GTest) instead of allowing the user manually to specify the vars TPL_GTest_INCLUDE_DIRS and TPL _GTest_LIBRARY_DIRS? If so, I think we can avoid needing to call the functions tribits_tpl_allow_pre_find_package() and tribits_tpl_find_include_dirs_and_libraries() at all and can instead compress these types of FindTPL<tplName>.cmake files down to two lines. For example, for GTest, FindTPLGTest.cmake would be:

find_package(GTest REQUIRED)
tribits_external_package_create_imported_all_libs_target_and_package_config_wrapper_file(GTest
  GTest::gtest)

That might break backward compatibility for users that are currently setting TPL_GTest_INCLUDE_DIRS and TPL _GTest_LIBRARY_DIRS but it would make files like FindTPLGTest.cmake much simpler and easier to maintain.

@gsjaardema
Copy link
Member Author

@bartlettroscoe For the GTest case, I am fine with not allowing users to specify TPL_GTest_INCLUDE_DIRS and TPL_GTest_LIBRARY_DIRS

@bartlettroscoe
Copy link
Contributor

@gsjaardema, I know why the last TriBITS snapshot broke this TriBITS FindTPLGTest.cmake code. The issue is that the prior TriBITS implementation of tribits_tpl_find_include_dirs_and_libraries() was extracting the name gtest.so.1.11 to use for the IMPORTED target GTest::gtest.so.1.11 generated from the library file name libgtest.so.1.11.0. The recent TriBITS commit TriBITSPub/TriBITS@b019512 (rightly) changed this logic to instead extract the name gtest to use for the IMPORTED target GTest::gtest. But since the find_package(GTest) command is already creating the target GTest::gtest, hence the conflict.

I will provide a smooth way to fix this as per above.

…nd_config_file() (TriBITSPub/TriBITS#299)

This uses the new function
tribits_external_package_create_imported_all_libs_target_and_config_file()
added in the TriBITS PR TriBITSPub/TriBITS#493 to work correctly with new
TriBITS.
@bartlettroscoe
Copy link
Contributor

@gsjaardema, please see the PR #322 I just posted against this topic branch tribits-snapshot and the comment about what needs to be done before we can merge PR #322 to this branch.

@bartlettroscoe
Copy link
Contributor

Hello @gsjaardema, now that I have merged TriBITSPub/TriBITS#493, can you please update the TriBITS snaphshot in this branch and then merge PR #322 to this topic branch? That should fix the GTest issue discussed above.

Origin repo remote tracking branch: 'origin/master'
Origin repo remote repo URL: 'origin = https://github.com/gsjaardema/TriBITs'
Git describe: tribits_start-2955-gf36aad60

At commit:

commit c81102e2dd516b16ef9674a1efa480909da5ede9
Author:  Roscoe A. Bartlett <rabartl@sandia.gov>
Date:    Mon Jul 11 19:30:52 2022 -0600
Summary: Add/update documentation for TriBITS TPLs (#299)
GTest: Use tribits_external_package_create_imported_all_libs_target_and_config_file() (TriBITSPub/TriBITS#299)
@gsjaardema
Copy link
Member Author

@bartlettroscoe Is this PR then ready to merge, or should I still hold off.

@bartlettroscoe
Copy link
Contributor

@bartlettroscoe Is this PR then ready to merge, or should I still hold off.

@gsjaardema, you should wait until after I merge trilinos/Trilinos#10614. Otherwise, your seacas 'master' branch will be incompatible with the Trilinos 'develop' branch.

Origin repo remote tracking branch: 'origin/master'
Origin repo remote repo URL: 'origin = https://github.com/gsjaardema/TriBITs'
Git describe: tribits_start-2973-g143f49f0

At commit:

commit 416434082cd200b8c3300db45c231e7aaa9d0635
Author:  Roscoe A. Bartlett <rabartl@sandia.gov>
Date:    Mon Jul 18 11:41:39 2022 -0600
Summary: Convert rest of upper-case to lower-case CMake command calls (#480)
@gsjaardema gsjaardema self-assigned this Jul 19, 2022
@gsjaardema gsjaardema marked this pull request as ready for review July 19, 2022 15:37
@gsjaardema gsjaardema merged commit c93e3b0 into master Jul 19, 2022
@gsjaardema gsjaardema deleted the tribits-snapshot branch July 19, 2022 16:24
@github-actions github-actions bot locked and limited conversation to collaborators Jul 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants