Skip to content

Improve c make building #2

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 10 additions & 14 deletions CBLAS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@ set(LAPACK_INSTALL_EXPORT_NAME cblas-targets)

# Create a header file cblas.h for the routines called in my C programs
include(FortranCInterface)
FortranCInterface_HEADER( ${CMAKE_CURRENT_SOURCE_DIR}/include/cblas_mangling.h
## Ensure that the fortran compiler and c compiler specified are compatible
FortranCInterface_VERIFY()
FortranCInterface_HEADER( ${LAPACK_BINARY_DIR}/include/cblas_mangling.h
MACRO_NAMESPACE "F77_"
SYMBOL_NAMESPACE "F77_" )
if( NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
configure_file( include/lapacke_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h )
endif ()

# Old way to detect mangling
#include(FortranMangling)
#FORTRAN_MANGLING(CDEFS)
#set(CDEFS ${CDEFS} CACHE STRING "Fortran Mangling" FORCE)
#MESSAGE(STATUS "=========")

# --------------------------------------------------
# Compiler Flags
#ADD_DEFINITIONS( "-D${CDEFS}")


include_directories( include )
include_directories( include ${LAPACK_BINARY_DIR}/include )
add_subdirectory(include)
add_subdirectory(src)

Expand All @@ -32,7 +28,7 @@ endforeach()
endmacro()

append_subdir_files(CBLAS_INCLUDE "include")
INSTALL( FILES ${CBLAS_INCLUDE} DESTINATION include )
INSTALL( FILES ${CBLAS_INCLUDE} ${LAPACK_BINARY_DIR}/include/cblas_mangling.h DESTINATION include )

# --------------------------------------------------
if(BUILD_TESTING)
Expand Down
2 changes: 1 addition & 1 deletion CBLAS/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ../make.inc

all:
cd include && cp cblas_mangling_with_flags.h cblas_mangling.h
cd include && cp cblas_mangling_with_flags.h.in cblas_mangling.h
cd src && $(MAKE) all


Expand Down
2 changes: 1 addition & 1 deletion CBLAS/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SET (CBLAS_INCLUDE cblas.h cblas_f77.h cblas_test.h cblas_mangling.h)
SET (CBLAS_INCLUDE cblas.h cblas_f77.h cblas_test.h )

file(COPY ${CBLAS_INCLUDE} DESTINATION ${LAPACK_BINARY_DIR}/include)
29 changes: 13 additions & 16 deletions LAPACKE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ enable_language(C)

set(LAPACK_INSTALL_EXPORT_NAME lapacke-targets)

# Create a header file netlib.h for the routines called in my C programs
# Create a header file lapacke_mangling.h for the routines called in my C programs
include(FortranCInterface)
FortranCInterface_HEADER( ${CMAKE_CURRENT_SOURCE_DIR}/include/lapacke_mangling.h
MACRO_NAMESPACE "LAPACK_"
SYMBOL_NAMESPACE "LAPACK_" )

# Old way to detect mangling
#include(FortranMangling)
#FORTRAN_MANGLING(CDEFS)
#set(CDEFS ${CDEFS} CACHE STRING "Fortran Mangling" FORCE)
#MESSAGE(STATUS "=========")

# --------------------------------------------------
# Compiler Flags
#ADD_DEFINITIONS( "-D${CDEFS}")
## Ensure that the fortran compiler and c compiler specified are compatible
FortranCInterface_VERIFY()
FortranCInterface_HEADER( ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h
MACRO_NAMESPACE "LAPACK_"
SYMBOL_NAMESPACE "LAPACK_" )
if( NOT FortranCInterface_GLOBAL_FOUND OR NOT FortranCInterface_MODULE_FOUND)
message(WARNING "Reverting to pre-defined include/lapacke_mangling.h")
configure_file( include/lapacke_mangling_with_flags.h.in
${LAPACK_BINARY_DIR}/include/lapacke_mangling.h )
endif ()

if (WIN32 AND NOT UNIX)
ADD_DEFINITIONS(-DHAVE_LAPACK_CONFIG_H -DLAPACK_COMPLEX_STRUCTURE)
Expand All @@ -26,7 +23,7 @@ endif (WIN32 AND NOT UNIX)

get_directory_property( DirDefs COMPILE_DEFINITIONS )

include_directories( include )
include_directories( include ${LAPACK_BINARY_DIR}/include )
add_subdirectory(include)
add_subdirectory(src)
add_subdirectory(utils)
Expand Down Expand Up @@ -58,7 +55,7 @@ else (USE_XBLAS)
endif(USE_XBLAS)

lapack_install_library(lapacke)
INSTALL( FILES ${LAPACKE_INCLUDE} DESTINATION include )
INSTALL( FILES ${LAPACKE_INCLUDE} ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h DESTINATION include )
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had missed adding ${LAPACK_BINARY_DIR}/include/lapacke_mangling.h to the installed files in the earlier commit.

This was a problem when using default cmake "find_package(LAPACKE REQUIRED)" from an external package.


if(BUILD_TESTING)
add_subdirectory(example)
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ include ../make.inc
all: lapacke

lapacke:
cd include && cp lapacke_mangling_with_flags.h lapacke_mangling.h
cd include && cp lapacke_mangling_with_flags.h.in lapacke_mangling.h
cd src && $(MAKE)
cd utils && $(MAKE)

Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
SET (LAPACKE_INCLUDE lapacke.h lapacke_config.h lapacke_utils.h lapacke_mangling.h)
SET (LAPACKE_INCLUDE lapacke.h lapacke_config.h lapacke_utils.h )

file(COPY ${LAPACKE_INCLUDE} DESTINATION ${LAPACK_BINARY_DIR}/include)
17 changes: 0 additions & 17 deletions LAPACKE/include/lapacke_mangling_with_flags.h

This file was deleted.