Commit 5fc09673 authored by Martin Beseda's avatar Martin Beseda

[ENH] [WIP] PIC code is now enforced by '-fPIC' flag only on Linux OSs. Added...

[ENH] [WIP] PIC code is now enforced by '-fPIC' flag only on Linux OSs. Added 'architecture' and 'toolset' flags to 'b2' Boost compilation script.
parent b0fc50d6
......@@ -48,6 +48,7 @@ ELSE()
ADD_COMPILE_DEFINITIONS(BOOST_TEST_DYN_LINK)
ENDIF()
ADD_COMPILE_DEFINITIONS(ARMA_DONT_USE_WRAPPER)
ADD_COMPILE_DEFINITIONS(BOOST_LIB_DIAGNOSTIC)
#------------#
# Build type #
......@@ -81,14 +82,25 @@ ENDIF()
# Setting C++ compiler flags #
#--------------------------------#
SET(CMAKE_CXX_STANDARD 17)
SET(BOOST_TOOLSET "")
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -xHost")
SET(BOOST_TOOLSET --toolset=intel)
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0 /bigobj")
ADD_COMPILE_OPTIONS("/D _SCL_SECURE_NO_WARNINGS")
ADD_COMPILE_OPTIONS("/D _CRT_SECURE_NO_WARNINGS")
if("${MSVC_TOOLSET_VERSION}" STREQUAL "140")
SET(BOOST_TOOLSET --toolset=msvc-14.0)
elseif("${MSVC_TOOLSET_VERSION}" STREQUAL "141")
SET(BOOST_TOOLSET --toolset=msvc-15.0)
else()
SET(BOOST_TOOLSET --toolset=msvc)
endif()
ELSEIF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MINGW")
SET(BOOST_TOOLSET --toolset=gcc)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mbig-obj")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
......
......@@ -70,8 +70,13 @@ IF(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
SET(VARIANT debug)
ENDIF()
set(PIC_CODE "")
if(NOT WIN32)
set(PIC_CODE cxxflags=-fPIC)
endif()
EXECUTE_PROCESS(
COMMAND ${B2_CMD} -q cxxflags=-fPIC --layout=system variant=${VARIANT} link=${DEPENDENCIES_LINK_TYPE} address-model=64 --with-system --with-serialization --with-random
COMMAND ${B2_CMD} -q ${PIC_CODE} ${BOOST_TOOLSET} --layout=system variant=${VARIANT} link=${DEPENDENCIES_LINK_TYPE} address-model=64 architecture=x86--with-system --with-serialization --with-random
WORKING_DIRECTORY ${BOOST_LOCAL_PATH}
RESULT_VARIABLE rv
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment