From 439acb5096d05a653396ecf3313e337aebefe2b1 Mon Sep 17 00:00:00 2001 From: "Paul P.H. Wilson" Date: Fri, 16 Feb 2018 20:20:24 -0600 Subject: [PATCH] a little cleanup --- CMakeLists.txt | 1 + cmake/DownloadAndExtract.cmake | 22 ++-------------- cmake/PyneMacros.cmake | 46 ++++++++++++++++++++-------------- 3 files changed, 30 insertions(+), 39 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index feb02a9bea..fb55c135ca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ project(pyne) include(PyneMacros) pyne_print_logo() # Beware of dragons pyne_set_platform() +pyne_set_asm_platform() pyne_set_build_spatial_solver() pyne_set_build_type() pyne_set_fast_compile() diff --git a/cmake/DownloadAndExtract.cmake b/cmake/DownloadAndExtract.cmake index c5aa14013d..ce8e8ae57a 100644 --- a/cmake/DownloadAndExtract.cmake +++ b/cmake/DownloadAndExtract.cmake @@ -26,31 +26,13 @@ endmacro() macro(download_platform _base_url _base_name _ext_src _ext_plat) - # first set OS - if (WIN32) - set(_plat "win") - elseif(APPLE) - set(_plat "apple") - else() - set(_plat "linux") - endif() - # next set compiler - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(_plat "${_plat}-gnu") - elseif (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR - ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")) - set(_plat "${_plat}-clang") - else() - set(_plat "${_plat}-NOTFOUND") - endif() - # first download the src file set(_url "${_base_url}/${_base_name}.tar.gz") set(_checkfile "${_base_name}${_ext_src}") download_and_extract("${_url}" "${_checkfile}") # now download the platform specific file - set(_url "${_base_url}/${_base_name}-${_plat}.tar.gz") - set(_checkfile "${_base_name}-${_plat}${_ext_plat}") + set(_url "${_base_url}/${_base_name}-${PYNE_ASM_PLATFORM}.tar.gz") + set(_checkfile "${_base_name}-${PYNE_ASM_PLATFORM}${_ext_plat}") download_and_extract("${_url}" "${_checkfile}") endmacro() diff --git a/cmake/PyneMacros.cmake b/cmake/PyneMacros.cmake index b3591b1f25..94147a8858 100644 --- a/cmake/PyneMacros.cmake +++ b/cmake/PyneMacros.cmake @@ -18,6 +18,28 @@ macro(pyne_set_platform) message("-- Pyne platform defined as: ${PYNE_PLATFORM}") endmacro() +macro(pyne_set_asm_platform) + # first set OS + if (WIN32) + set(_plat "win") + elseif(APPLE) + set(_plat "apple") + else() + set(_plat "linux") + endif() + # next set compiler + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + set(_plat "${_plat}-gnu") + elseif (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR + ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")) + set(_plat "${_plat}-clang") + else() + set(_plat "${_plat}-NOTFOUND") + endif() + set(PYNE_ASM_PLATFORM "${_plat}") +endmacro() + + # Fortran settings # FFLAGS depend on the compiler macro(pyne_setup_fortran) @@ -191,27 +213,13 @@ endmacro() # fast compile with assembly, if available. macro(fast_compile _srcname _gnuflags _clangflags _otherflags) - # first set OS - if (WIN32) - set(_plat "win") - elseif(APPLE) - set(_plat "apple") - else() - set(_plat "linux") - endif() - # next set compiler - if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - set(_plat "${_plat}-gnu") - elseif (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") OR - ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")) - set(_plat "${_plat}-clang") - else() - set(_plat "${_plat}-NOTFOUND") - endif() - get_filename_component(_base "${_srcname}" NAME_WE) # get the base name, without the extension # get the assembly file name - set(_asmname "${_base}-${_plat}.s") + if (PYNE_ASM_PLATFORM) + set(_asmname "${_base}-${PYNE_ASM_PLATFORM}.s") + else() + set(_asmname "${_base}-NOTFOUND") + endif() # pick the filename to compile, either source or assembly if(NOT PYNE_FAST_COMPILE)