Skip to content

Commit

Permalink
add cmake build scripts from http://code.google.com/p/android-cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
patmarion committed May 22, 2012
1 parent b961817 commit 4df19bc
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
6 changes: 6 additions & 0 deletions BoostConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(Boost_INCLUDE_DIRS @Boost_INCLUDE_DIRS@)
set(Boost_LIBRARIES @Boost_LIBRARIES@)
link_directories(@Boost_LINK_DIRS@)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} @Boost_C_FLAGS@")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} @Boost_CXX_FLAGS@")
74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 2.8)

project(android-boost)

#find patched boost directory
set(boost_root ${CMAKE_CURRENT_SOURCE_DIR}/boost_1_45_0 CACHE PATH
"Boost 1.45.0 patched for android")

if(NOT EXISTS ${boost_root})
message(FATAL_ERROR
"${boost_root} does not exist!
Please run ${CMAKE_CURRENT_SOURCE_DIR}/get_boost.sh to get a patched copy of
boost 1.45.0
")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNO_BZIP2" )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DNO_BZIP2")

include_directories(${boost_root} )

file(GLOB lib_srcs ${boost_root}/libs/system/src/*.cpp)

add_library( boost_system ${lib_srcs})

file(GLOB lib_srcs ${boost_root}/libs/filesystem/v2/src/*.cpp)

add_library( boost_filesystem ${lib_srcs})

set(lib_dir ${boost_root}/libs/iostreams/src)
set(lib_srcs ${lib_dir}/file_descriptor.cpp ${lib_dir}/gzip.cpp ${lib_dir}/mapped_file.cpp ${lib_dir}/zlib.cpp)


add_library( boost_iostreams ${lib_srcs})

file(GLOB lib_srcs ${boost_root}/libs/program_options/src/*.cpp)

add_library( boost_program_options ${lib_srcs})

file(GLOB lib_srcs ${boost_root}/libs/regex/src/*.cpp)

add_library( boost_regex ${lib_srcs})

file(GLOB lib_srcs ${boost_root}/libs/signals/src/*.cpp)

add_library( boost_signals ${lib_srcs})

file(GLOB lib_srcs ${boost_root}/libs/thread/src/pthread/*.cpp)

add_library( boost_thread ${lib_srcs})

file(GLOB lib_srcs ${boost_root}/libs/date_time/src/gregorian/*.cpp ${boost_root}/libs/date_time/src/posix_time/*.cpp)

add_library( boost_date_time ${lib_srcs})

#target_link_libraries(boost_filesystem boost_system)

set(Boost_INCLUDE_DIRS ${boost_root})
set(Boost_LIBRARIES boost_filesystem boost_system boost_program_options boost_iostreams boost_date_time)
set(Boost_LINK_DIRS ${LIBRARY_OUTPUT_PATH})

configure_file(${CMAKE_SOURCE_DIR}/BoostConfig.cmake.in
${CMAKE_BINARY_DIR}/BoostConfig.cmake @ONLY)

install(DIRECTORY ${boost_root}/boost DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(TARGETS boost_system DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_filesystem DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_program_options DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_iostreams DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_regex DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_signals DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_thread DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
install(TARGETS boost_date_time DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

0 comments on commit 4df19bc

Please sign in to comment.