Commit c33bbce9 authored by Osborn, Joseph Daniel's avatar Osborn, Joseph Daniel
Browse files

adding basic implementation of llvm-config style python script

parent 588c3639
......@@ -177,6 +177,12 @@ if(PYTHON_INCLUDE_DIR)
add_subdirectory(python)
endif()
# Gets the include directory properties
get_property(INC_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
configure_file(${CMAKE_SOURCE_DIR}/scripts/exatn-config.in
${CMAKE_BINARY_DIR}/exatn-config)
configure_file("${CMAKE_SOURCE_DIR}/cmake/exatn-config.cmake.in"
"${CMAKE_BINARY_DIR}/exatn-config.cmake" @ONLY)
install(FILES "${CMAKE_BINARY_DIR}/exatn-config.cmake" DESTINATION .)
install(FILES ${CMAKE_BINARY_DIR}/exatn-config DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
\ No newline at end of file
#!/user/bin/env python3
# This is an llvm-config inspired python script which returns some of the compile
# flags to the user. Running script like:
# $ exatn-config --includes
# prints the include directories used in the build
import argparse, sys, os
def main(argv=None):
# Print out libraries that are used in CMake
if '--libs' in sys.argv[1:]:
print("Base libraries can be found in @CMAKE_INSTALL_PREFIX@/lib")
mpiLibs = '@MPI_CXX_LIBRARIES@'
mpiLibs = mpiLibs.split(';')
print('The MPI libraries are')
for string in mpiLibs:
print(string + ', ')
sys.argv.remove('--libs')
# Print out the linker flags used in CMake
if '--ldflags' in sys.argv[1:]:
mpiCxxLinkFlags = '@MPI_CXX_LINK_FLAGS@'
mpiFortranLinkFlags = '@MPI_FORTRAN_LINK_FLAGS@'
openMP = '@OpenMP_CXX_FLAGS@'
print("Linker flags for MPI are: " + mpiCxxLinkFlags + ' ' + mpiFortranLinkFlags + ' ' + openMP)
sys.argv.remove('--ldflags')
# Print out the include directories from CMake
if '--includes' in sys.argv[1:]:
baseIncludes = ['@CMAKE_INSTALL_PREFIX@/include/exatn']
cmakeIncludes = '@INC_DIRS@'
cmakeIncludes = cmakeIncludes.split(';')
print("The include directories are:")
print(baseIncludes + cmakeIncludes)
sys.argv.remove('--includes')
#Print out the CXX flags from CMake
if '--cxxflags' in sys.argv[1:]:
print('CXX compiler used is: @CMAKE_CXX_COMPILER@')
print('The CXX flags used in compilation are: @CMAKE_CXX_FLAGS@')
if __name__ == "__main__":
sys.exit(main())
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment