~andrew-plumb/kicad/kicad

« back to all changes in this revision

Viewing changes to CMakeModules/download_boost.cmake

  • Committer: Brian Sidebotham
  • Date: 2013-10-07 19:49:44 UTC
  • Revision ID: brian.sidebotham@gmail.com-20131007194944-fuh5vq5ygmnwxugf
* Fix building of Github plugin support for Windows using Mingw-w64
* Pre-built binaries for OpenSSL can be used from the LuaDist project: https://github.com/LuaDist/openssl/releases
* Building of Boost libraries fixed for Mingw-w64 for github plugin

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
 
88
88
    # It will probably be simpler to make this the only path in the future.
89
89
 
90
 
    # (BTW "test" yields "unit_test_framework" when passed to bootstrap.{sh,bat} ).
 
90
    # (BTW "test" yields "unit_test_framework" when passed to bootstrap.sh ).
91
91
    #message( STATUS "BOOST_LIBS_BUILT:${BOOST_LIBS_BUILT}" )
92
 
    string( REPLACE "unit_test_framework" "test" libs_csv "${BOOST_LIBS_BUILT}" )
93
 
    #message( STATUS "REPLACE libs_csv:${libs_csv}" )
94
 
 
95
 
    string( REGEX REPLACE "\\;" "," libs_csv "${libs_csv}" )
96
 
    #message( STATUS "libs_csv:${libs_csv}" )
 
92
    string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" )
 
93
    #message( STATUS "REPLACE libs_csv:${boost_libs_list}" )
97
94
 
98
95
    if( MINGW )
99
 
        set( bootstrap "bootstart.bat mingw" )
 
96
        set( bootstrap bootstrap.bat mingw )
 
97
 
 
98
        foreach( lib ${boost_libs_list} )
 
99
            set( b2_libs ${b2_libs} --with-${lib} )
 
100
        endforeach()
100
101
        unset( PIC_STUFF )
101
102
    else()
102
 
        set( bootstrap bootstrap.sh )
 
103
        string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
 
104
        #message( STATUS "libs_csv:${libs_csv}" )
 
105
 
 
106
        set( bootstrap bootstrap.sh --with-libraries=${libs_csv} )
103
107
        # pass to *both* C and C++ compilers
104
108
        set( PIC_STUFF "cflags=${PIC_FLAG}" )
 
109
        set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
 
110
        unset( b2_libs )
105
111
    endif()
106
112
 
107
113
    ExternalProject_Add( boost
120
126
 
121
127
        BINARY_DIR      "${PREFIX}/src/boost/"
122
128
        CONFIGURE_COMMAND ./${bootstrap}
123
 
                        --with-libraries=${libs_csv}
124
129
 
125
130
        BUILD_COMMAND   ./b2
126
131
                        variant=release
127
132
                        threading=multi
128
133
                        toolset=gcc
129
134
                        ${PIC_STUFF}
 
135
                        ${b2_libs}
130
136
                        #link=static
131
137
                        --prefix=<INSTALL_DIR>
132
138
                        install
134
140
        INSTALL_COMMAND ""
135
141
        )
136
142
 
 
143
    if( MINGW )
 
144
        execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
 
145
            OUTPUT_VARIABLE GCC_VERSION
 
146
            OUTPUT_STRIP_TRAILING_WHITESPACE )
 
147
 
 
148
        string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.[0-9]+.*" "\\1\\2" BOOST_GCC_VERSION ${GCC_VERSION} )
 
149
        #message( STATUS "BOOST_GCC_VERSION: ${BOOST_GCC_VERSION}" )
 
150
 
 
151
        string( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9])" "\\1_\\2" BOOST_LIB_VERSION ${BOOST_RELEASE} )
 
152
        #message( STATUS "BOOST_LIB_VERSION: ${BOOST_LIB_VERSION}" )
 
153
 
 
154
        # adjust the names of the libraries to suit the build. There's no
 
155
        # symbolic links provided on the MinGW build to allow us to use
 
156
        # generic names for the libs
 
157
        foreach( lib ${BOOST_LIBS_BUILT} )
 
158
            set( mingw_boost_libs ${mingw_boost_libs} ${lib}-mgw${BOOST_GCC_VERSION}-mt-${BOOST_LIB_VERSION} )
 
159
        endforeach()
 
160
 
 
161
        set( BOOST_LIBS_BUILT ${mingw_boost_libs} )
 
162
        set( BOOST_INCLUDE "${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION}" )
 
163
        unset( mingw_boost_libs )
 
164
    endif()
 
165
 
137
166
    set( boost_libs "" )
138
167
    set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
139
168
    #message( STATUS "BOOST_ROOT:${BOOST_ROOT}  boost_libs:${boost_libs}" )
140
 
    set( Boost_LIBRARIES    ${boost_libs}           CACHE FILEPATH "Boost libraries directory" )
141
 
    set( Boost_INCLUDE_DIR  "${BOOST_ROOT}/include" CACHE FILEPATH "Boost include directory" )
142
 
 
 
169
    set( Boost_LIBRARIES    ${boost_libs}      CACHE FILEPATH "Boost libraries directory" )
 
170
    set( Boost_INCLUDE_DIR  "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )
 
171
    #message( STATUS "Boost_INCLUDE_DIR: ${Boost_INCLUDE_DIR}" )
143
172
 
144
173
else( BUILD_GITHUB_PLUGIN )
145
174