From 8ede4a8da49a26a89bc6d1f018a4e33103c43c31 Mon Sep 17 00:00:00 2001 From: Hank Anderson Date: Wed, 28 Jan 2015 17:18:26 -0600 Subject: [PATCH] getarch now compiles and sets config.h defines properly. Still isn't parsed into CMake variables, and getarch_2 needs to get the same treatment. --- cmake/prebuild.cmake | 39 +++++++++++++++--------------------- cmake/system.cmake | 2 +- driver/level2/CMakeLists.txt | 4 ++-- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/cmake/prebuild.cmake b/cmake/prebuild.cmake index 76f74e049..ba0e0789e 100644 --- a/cmake/prebuild.cmake +++ b/cmake/prebuild.cmake @@ -68,29 +68,27 @@ include("${CMAKE_SOURCE_DIR}/cmake/f_check.cmake") # compile getarch enable_language(ASM) set(GETARCH_DIR "${PROJECT_BINARY_DIR}/getarch_build") +set(GETARCH_BIN "getarch${CMAKE_EXECUTABLE_SUFFIX}") file(MAKE_DIRECTORY ${GETARCH_DIR}) try_compile(GETARCH_RESULT ${GETARCH_DIR} SOURCES ${CMAKE_SOURCE_DIR}/getarch.c ${CMAKE_SOURCE_DIR}/cpuid.S ${CPUIDEMO} - COMPILE_DEFINITIONS ${EXFLAGS} -I${CMAKE_SOURCE_DIR} + COMPILE_DEFINITIONS ${EXFLAGS} ${GETARCH_FLAGS} -I${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE GETARCH_LOG - ) + COPY_FILE ${GETARCH_BIN} +) -message(STATUS "GETARCH RESULT: ${GETARCH_RESULT}") -message(STATUS "GETARCH LOG: ${GETARCH_LOG}") +message(STATUS "Running getarch") -# TODO: need to append output of getarch binary to TARGET_CONF, use COPY_FILE param (look at try_compile docs) to copy the resulting binary somewhere then run it +# use the cmake binary w/ the -E param to run a shell command in a cross-platform way +execute_process(COMMAND ${GETARCH_BIN} 0 OUTPUT_VARIABLE GETARCH_MAKE_OUT) +execute_process(COMMAND ${GETARCH_BIN} 1 OUTPUT_VARIABLE GETARCH_CONF_OUT) -#add_executable(getarch getarch.c cpuid.S ${CPUIDEMU} -# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) -# -## run getarch, which appends even more to the TARGET files -#message(STATUS "Running getarch") -#execute_process(COMMAND getarch 0 >> ${TARGET_MAKE} -# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) -#execute_process(COMMAND getarch 1 >> ${TARGET_CONF} -# WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) -# -## config.h is ready for getarch_2nd now, so compile that +message(STATUS "GETARCH results:\n${GETARCH_MAKE_OUT}") + +# append config data from getarch even more to the TARGET file +file(APPEND ${TARGET_CONF} ${GETARCH_CONF_OUT}) + +## TODO: config.h is ready for getarch_2nd now, so compile that #set(GETARCH2_SOURCES getarch_2nd.c config.h) #add_executable(getarch_2nd getarch_2nd.c config.h) # @@ -101,13 +99,8 @@ message(STATUS "GETARCH LOG: ${GETARCH_LOG}") #execute_process(COMMAND getarch_2nd 1 >> ${TARGET_CONF} # WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}) -# TODO: need to read in the vars from Makefile.conf/Makefile_kernel.conf - -# temporarily hardcoded to get system.cmake working +# TODO: parse the MAKE variables from getarch/getarch2 (GETARCH_MAKE_OUT) into CMAKE vars +# for now I temporarily hardcoded to get system.cmake working set(NUM_CORES 4) set(CORE "GENERIC") -# TODO: this should be done by getarch! see above -file(APPEND ${TARGET_CONF} - "#define ${CORE}" -) diff --git a/cmake/system.cmake b/cmake/system.cmake index 11f0c5cdd..0753ed028 100644 --- a/cmake/system.cmake +++ b/cmake/system.cmake @@ -109,7 +109,7 @@ else () endif () if (${SMP}) - message("SMP enabled.") + message(STATUS "SMP enabled.") endif () if (NOT DEFINED NEED_PIC) diff --git a/driver/level2/CMakeLists.txt b/driver/level2/CMakeLists.txt index d06d03ccf..990337fe1 100644 --- a/driver/level2/CMakeLists.txt +++ b/driver/level2/CMakeLists.txt @@ -82,7 +82,7 @@ set_target_properties(DBLAS_TU PROPERTIES COMPILE_DEFINITIONS TRANS) set(DBLAS_TARGETS DBLAS_NONE DBLAS_T DBLAS_L DBLAS_U DBLAS_TU) -foreach (${TARGET} ${DBLAS_TARGETS}) - set_target_properties(${TARGET} PROPERTIES COMPILE_DEFINITIONS DOUBLE) +foreach (${DBLAS_TARGET} ${DBLAS_TARGETS}) + set_target_properties(${DBLAS_TARGET} PROPERTIES COMPILE_DEFINITIONS DOUBLE) endforeach ()