You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

prebuild.cmake 2.2 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ##
  2. ## Author: Hank Anderson <hank@statease.com>
  3. ## Copyright: (c) Stat-Ease, Inc.
  4. ## Created: 12/29/14
  5. ## Last Modified: 12/29/14
  6. ## Description: Ported from OpenBLAS/Makefile.prebuild
  7. ## This is triggered by system.cmake and runs before any of the code is built.
  8. ## Creates config.h and Makefile.conf by first running the c_check perl script (which creates those files).
  9. ## Next it runs f_check and appends some fortran information to the files.
  10. ## Finally it runs getarch and getarch_2nd for even more environment information.
  11. # CPUIDEMU = ../../cpuid/table.o
  12. if (DEFINED CPUIDEMU)
  13. set(EXFLAGS "-DCPUIDEMU -DVENDOR=99")
  14. endif ()
  15. if (DEFINED TARGET_CORE)
  16. # set the C flags for just this file
  17. set_source_files_properties(getarch_2nd.c PROPERTIES COMPILE_FLAGS "-DBUILD_KERNEL")
  18. set(TARGET_MAKE "Makefile_kernel.conf")
  19. set(TARGET_CONF "config_kernel.h")
  20. else()
  21. set(TARGET_MAKE "Makefile.conf")
  22. set(TARGET_CONF "config.h")
  23. endif ()
  24. include("${CMAKE_SOURCE_DIR}/cmake/c_check.cmake")
  25. include("${CMAKE_SOURCE_DIR}/cmake/f_check.cmake")
  26. # compile getarch
  27. # TODO: need to use execute_process here, or compilation won't happen until later - maybe make temporary CMakeLists.txt file using file() ?
  28. #add_executable(getarch getarch.c cpuid.S ${CPUIDEMU}
  29. # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
  30. #
  31. ## run getarch, which appends even more to the TARGET files
  32. #message(STATUS "Running getarch")
  33. #execute_process(COMMAND getarch 0 >> ${TARGET_MAKE}
  34. # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
  35. #execute_process(COMMAND getarch 1 >> ${TARGET_CONF}
  36. # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
  37. #
  38. ## config.h is ready for getarch_2nd now, so compile that
  39. #set(GETARCH2_SOURCES getarch_2nd.c config.h)
  40. #add_executable(getarch_2nd getarch_2nd.c config.h)
  41. #
  42. ## finally run getarch_2nd, appending yet more to the TARGET files
  43. #message(STATUS "Running getarch_2nd")
  44. #execute_process(COMMAND getarch_2nd 0 >> ${TARGET_MAKE}
  45. # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
  46. #execute_process(COMMAND getarch_2nd 1 >> ${TARGET_CONF}
  47. # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
  48. # TODO: need to read in the vars from Makefile.conf/Makefile_kernel.conf