Skip to content

Commit

Permalink
Merge pull request #1 from gonuke/fix_CI
Browse files Browse the repository at this point in the history
a little cleanup
  • Loading branch information
bam241 authored Feb 17, 2018
2 parents 9a57dcf + 439acb5 commit 7d830a6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 39 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
22 changes: 2 additions & 20 deletions cmake/DownloadAndExtract.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

46 changes: 27 additions & 19 deletions cmake/PyneMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7d830a6

Please sign in to comment.