Skip to content

Commit

Permalink
additional win and mac support
Browse files Browse the repository at this point in the history
  • Loading branch information
ML-Enthusiast committed Jun 21, 2019
1 parent a7c8777 commit ad45169
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 41 deletions.
31 changes: 3 additions & 28 deletions CMake/ITKSetStandardCompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,6 @@ function(check_cxx_compiler_flags cxx_flag_var)
set(${cxx_flag_var} "${local_cxx_flags}" PARENT_SCOPE)
endfunction()

function(check_c_compiler_warning_flags c_flag_var)
set(local_c_flags "")
set(flag_list "${ARGN}")
foreach(flag IN LISTS flag_list)
ITK_CHECK_C_COMPILER_FLAG(${flag} C_HAS_WARNING${flag})
if(${C_HAS_WARNING${flag}})
set(local_c_flags "${local_c_flags} ${flag}")
endif()
endforeach()
set(${c_flag_var} "${local_c_flags}" PARENT_SCOPE)
endfunction()

function(check_cxx_compiler_warning_flags cxx_flag_var)
set(local_cxx_flags "")
set(flag_list "${ARGN}")
foreach(flag IN LISTS flag_list)
ITK_CHECK_CXX_COMPILER_FLAG(${flag} CXX_HAS_WARNING${flag})
if(${CXX_HAS_WARNING${flag}})
set(local_cxx_flags "${local_cxx_flags} ${flag}")
endif()
endforeach()
set(${cxx_flag_var} "${local_cxx_flags}" PARENT_SCOPE)
endfunction()


function(check_compiler_warning_flags c_warning_flags_var cxx_warning_flags_var)
set(${c_warning_flags_var} "" PARENT_SCOPE)
set(${cxx_warning_flags_var} "" PARENT_SCOPE)
Expand Down Expand Up @@ -156,8 +131,8 @@ function(check_compiler_warning_flags c_warning_flags_var cxx_warning_flags_var)
## Clang compiler likes to warn about this feature that is technically only in
## c++0x, but works on many compilers, and if it fails, then alternate methods are used

check_c_compiler_warning_flags(CMAKE_C_WARNING_FLAGS ${c_flags} ${c_and_cxx_flags})
check_cxx_compiler_warning_flags(CMAKE_CXX_WARNING_FLAGS ${c_and_cxx_flags} ${cxx_flags})
check_c_compiler_flags(CMAKE_C_WARNING_FLAGS ${c_flags} ${c_and_cxx_flags})
check_cxx_compiler_flags(CMAKE_CXX_WARNING_FLAGS ${c_and_cxx_flags} ${cxx_flags})

set(${c_warning_flags_var} "${CMAKE_C_WARNING_FLAGS}" PARENT_SCOPE)
set(${cxx_warning_flags_var} "${CMAKE_CXX_WARNING_FLAGS}" PARENT_SCOPE)
Expand Down Expand Up @@ -200,7 +175,7 @@ function(check_compiler_optimization_flags c_optimization_flags_var cxx_optimiza
endif()
set(c_and_cxx_flags ${InstructionSetOptimizationFlags})

check_c_compiler_flags( CMAKE_C_WARNING_FLAGS ${c_and_cxx_flags} ${c_flags})
check_c_compiler_flags(CMAKE_C_WARNING_FLAGS ${c_and_cxx_flags} ${c_flags})
check_cxx_compiler_flags(CMAKE_CXX_WARNING_FLAGS ${c_and_cxx_flags} ${cxx_flags})

set(${c_optimization_flags_var} "${CMAKE_C_WARNING_FLAGS}" PARENT_SCOPE)
Expand Down
63 changes: 50 additions & 13 deletions SuperBuild/External_Boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,49 @@ if(NOT ( DEFINED "USE_SYSTEM_${extProjName}" AND "${USE_SYSTEM_${extProjName}}"
endif()
set(BOOST_SOURCE_DIR ${SOURCE_DOWNLOAD_CACHE}/${proj})

set( Boost_url "http://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz")
set( Boost_md5 fea771fe8176828fabf9c09242ee8c26 )
set( Boost_Bootstrap_Command ./bootstrap.sh )
set( Boost_b2_Command ./b2 )
if(UNIX)
set(Boost_url "http://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz")
set(Boost_md5 fea771fe8176828fabf9c09242ee8c26)
set(Boost_Bootstrap_Command ./bootstrap.sh)
set(Boost_b2_Command ./b2)
else()
if(WIN32)
set(Boost_url "http://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.zip")
set(Boost_md5 a110ebd91a3d2c34c72ace09c92ae50b)
set(Boost_Bootstrap_Command bootstrap.bat)
set(Boost_b2_Command b2.exe)
endif()
endif()

if(MSVC10)
list(APPEND Boost_b2_Command toolset=msvc-10.0)
elseif(MSVC11)
list(APPEND Boost_b2_Command toolset=msvc-11.0)
elseif(MSVC12)
list(APPEND Boost_b2_Command toolset=msvc-12.0)
elseif(MSVC14)
list(APPEND Boost_b2_Command toolset=msvc-14.0)
elseif(XCODE_VERSION)
list(APPEND Boost_b2_Command toolset=clang)
elseif(ENV{CC})
# CMake apprarently puts the full path of the compiler into CC
# The user might specify a non-default gcc compiler through ENV
message(STATUS "ENV{CC}=$ENV{CC}")
get_filename_component( gccToolset "$ENV{CC}" NAME )

# see: https://svn.boost.org/trac/boost/ticket/5917
string(TOLOWER ${gccToolset} gccToolset)
if(gccToolset STREQUAL "cc")
set(gccToolset "gcc")
endif()
list(APPEND Boost_b2_Command toolset=${gccToolset})
endif()

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(Boost_address_model 64)
else()
set(Boost_address_model 32)
endif()
set(Boost_address_model 64)
else()
set(Boost_address_model 32)
endif()

ExternalProject_Add(${proj}
${${proj}_EP_ARGS}
Expand All @@ -63,15 +96,19 @@ endif()
URL_MD5 ${Boost_md5}
UPDATE_COMMAND ""
CONFIGURE_COMMAND ${Boost_Bootstrap_Command} --prefix=${Boost_Install_Dir}/lib
BUILD_COMMAND ${Boost_b2_Command} install -j8 --prefix=${Boost_Install_Dir} --with-thread --with-filesystem --with-system --with-date_time --with-program_options --with-atomic address-model=${Boost_address_model} link=static,shared
BUILD_COMMAND ${Boost_b2_Command} install -j8 --prefix=${Boost_Install_Dir} --with-thread --with-filesystem --with-system --with-date_time --with-program_options --with-atomic address-model=${Boost_address_model} link=static,shared
INSTALL_COMMAND ""
)

set(BOOST_ROOT ${Boost_Install_Dir})
set(BOOST_INCLUDE_DIR ${Boost_Install_Dir}/include)
if(NOT WIN32)
set(BOOST_ROOT ${Boost_Install_Dir})
set(BOOST_INCLUDE_DIR ${Boost_Install_Dir}/include)
else()
set(BOOST_ROOT ${Boost_Install_Dir})
set(Boost_INCLUDE_DIR ${Boost_Install_Dir}/include/boost-1_70)
endif()

set(Boost_LIBRARY_DIR ${Boost_Install_Dir}/lib)
message(STATUS "BOOST_ROOT is " ${BOOST_ROOT})
message(STATUS "Boost_LIBRARY_DIR is " ${Boost_LIBRARY_DIR})

else()
if(${USE_SYSTEM_${extProjName}})
Expand Down

0 comments on commit ad45169

Please sign in to comment.