Skip to content

Commit 7a86708

Browse files
committed
Fix open_blas.config which was never working out-of-source. Remove need for gen_config_h.exe. If OpenMP is requested, do not silently ignore when it isn't available.
1 parent a1b87ea commit 7a86708

File tree

3 files changed

+16
-34
lines changed

3 files changed

+16
-34
lines changed

CMakeLists.txt

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -199,18 +199,21 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
199199
install(TARGETS ${OpenBLAS_LIBNAME}
200200
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
201201
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
202-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
203-
204-
# Install include files
205-
set (GENCONFIG_BIN ${CMAKE_BINARY_DIR}/gen_config_h${CMAKE_EXECUTABLE_SUFFIX})
206-
207-
execute_process(COMMAND ${GENCONFIG_BIN}
208-
${CMAKE_CURRENT_SOURCE_DIR}/config.h
209-
${CMAKE_CURRENT_SOURCE_DIR}/openblas_config_template.h
210-
OUTPUT_VARIABLE OPENBLAS_CONFIG_H_CONTENTS)
211-
212-
file(WRITE ${CMAKE_BINARY_DIR}/openblas_config.tmp "${OPENBLAS_CONFIG_H_CONTENTS}")
213-
configure_file(${CMAKE_BINARY_DIR}/openblas_config.tmp ${CMAKE_BINARY_DIR}/openblas_config.h COPYONLY)
202+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
203+
204+
set(OPENBLAS_TMP ${CMAKE_BINARY_DIR}/openblas_config.tmp)
205+
file(WRITE ${OPENBLAS_TMP} "#ifndef OPENBLAS_CONFIG_H\n")
206+
file(APPEND ${OPENBLAS_TMP} "#define OPENBLAS_CONFIG_H\n")
207+
file(STRINGS ${PROJECT_BINARY_DIR}/config.h __lines)
208+
foreach(line ${__lines})
209+
string(REPLACE "#define " "" line ${line})
210+
file(APPEND ${OPENBLAS_TMP} "#define OPENBLAS_${line}\n")
211+
endforeach()
212+
file(APPEND ${OPENBLAS_TMP} "#define OPENBLAS_VERSION \"OpenBLAS ${OpenBLAS_VERSION}\"\n")
213+
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/openblas_config_template.h __template)
214+
file(APPEND ${OPENBLAS_TMP} "${__template}")
215+
file(APPEND ${OPENBLAS_TMP} "#endif /* OPENBLAS_CONFIG_H */\n")
216+
configure_file(${OPENBLAS_TMP} ${CMAKE_BINARY_DIR}/openblas_config.h COPYONLY)
214217

215218
install (FILES ${CMAKE_BINARY_DIR}/openblas_config.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
216219

cmake/arch.cmake

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,10 @@ endif ()
3535
if (USE_OPENMP)
3636
# USE_SIMPLE_THREADED_LEVEL3 = 1
3737
# NO_AFFINITY = 1
38-
find_package(OpenMP)
38+
find_package(OpenMP REQUIRED)
3939
if (OpenMP_FOUND)
4040
set(CCOMMON_OPT "${CCOMMON_OPT} ${OpenMP_C_FLAGS} -DUSE_OPENMP")
4141
set(FCOMMON_OPT "${FCOMMON_OPT} ${OpenMP_Fortran_FLAGS}")
42-
elseif (UNIX)
43-
set(USE_OPENMP 0)
4442
endif()
4543
endif ()
4644

cmake/prebuild.cmake

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -241,23 +241,4 @@ else(NOT CMAKE_CROSSCOMPILING)
241241

242242
ParseGetArchVars(${GETARCH2_MAKE_OUT})
243243

244-
# compile get_config_h
245-
set(GEN_CONFIG_H_DIR "${PROJECT_BINARY_DIR}/genconfig_h_build")
246-
set(GEN_CONFIG_H_BIN "gen_config_h${CMAKE_EXECUTABLE_SUFFIX}")
247-
set(GEN_CONFIG_H_FLAGS "-DVERSION=\"${OpenBLAS_VERSION}\"")
248-
file(MAKE_DIRECTORY ${GEN_CONFIG_H_DIR})
249-
250-
if (NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
251-
try_compile(GEN_CONFIG_H_RESULT ${GEN_CONFIG_H_DIR}
252-
SOURCES ${PROJECT_SOURCE_DIR}/gen_config_h.c
253-
COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} ${GEN_CONFIG_H_FLAGS} -I${PROJECT_SOURCE_DIR}
254-
OUTPUT_VARIABLE GEN_CONFIG_H_LOG
255-
COPY_FILE ${PROJECT_BINARY_DIR}/${GEN_CONFIG_H_BIN}
256-
)
257-
258-
if (NOT ${GEN_CONFIG_H_RESULT})
259-
MESSAGE(FATAL_ERROR "Compiling gen_config_h failed ${GEN_CONFIG_H_LOG}")
260-
endif ()
261-
endif ()
262-
263244
endif()

0 commit comments

Comments
 (0)