forked from ruslo/hunter
-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use only some examples to use config from boost
- Loading branch information
Showing
47 changed files
with
335 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2013, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(Boost_DEBUG ON CACHE BOOLEAN "") | ||
set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(download-boost) | ||
|
||
hunter_add_package(Boost COMPONENTS chrono) | ||
find_package(Boost CONFIG REQUIRED chrono) | ||
|
||
add_executable(foo foo.cpp) | ||
target_link_libraries( | ||
foo | ||
PUBLIC | ||
Boost::chrono | ||
) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#include <boost/chrono/system_clocks.hpp> | ||
|
||
int main() { | ||
boost::chrono::system_clock::now(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Copyright (c) 2013-2015, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(Boost_DEBUG ON CACHE BOOLEAN "") | ||
set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(download-boost) | ||
|
||
# download boost | ||
hunter_add_package(Boost COMPONENTS filesystem) | ||
|
||
# now boost can be used | ||
find_package(Boost CONFIG REQUIRED filesystem) | ||
|
||
if(ANDROID) | ||
string(COMPARE EQUAL "${CMAKE_ANDROID_NDK}" "" is_empty) | ||
if(is_empty) | ||
message(FATAL_ERROR "CMAKE_ANDROID_NDK is empty") | ||
endif() | ||
add_library( | ||
foo | ||
SHARED | ||
foo_android.cpp | ||
"${CMAKE_ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c" | ||
) | ||
else() | ||
add_executable(foo foo.cpp) | ||
endif() | ||
|
||
target_link_libraries( | ||
foo | ||
Boost::filesystem | ||
) | ||
|
||
if(ANDROID) | ||
target_link_libraries(foo log android) | ||
target_include_directories( | ||
foo PUBLIC "${CMAKE_ANDROID_NDK}/sources/android/native_app_glue" | ||
) | ||
|
||
if(NOT "$ENV{TRAVIS}") | ||
# Travis CI failed builds: | ||
# * https://travis-ci.org/ingenue/hunter/jobs/106905844 | ||
# * https://travis-ci.org/ingenue/hunter/jobs/106905851 | ||
hunter_add_package(Android-Apk) | ||
list(APPEND CMAKE_MODULE_PATH "${ANDROID-APK_ROOT}") | ||
include(AndroidApk) | ||
|
||
hunter_add_package(Android-SDK) | ||
message("Path to `android`: ${ANDROID-SDK_ROOT}/android-sdk/tools/android") | ||
message("Path to `emulator`: ${ANDROID-SDK_ROOT}/android-sdk/tools/emulator") | ||
message("Path to `adb`: ${ANDROID-SDK_ROOT}/android-sdk/platform-tools/adb") | ||
|
||
android_create_apk( | ||
BASE_TARGET foo | ||
LAUNCH_TARGET foo-launch | ||
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/apk" | ||
) | ||
endif() | ||
endif() |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#include <boost/filesystem.hpp> | ||
#include <iostream> // std::cout | ||
|
||
int main() { | ||
namespace fs = boost::filesystem; | ||
std::cout << "Current path: " << fs::current_path() << std::endl; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) 2015, Ruslan Baratov | ||
// All rights reserved. | ||
|
||
#include <boost/filesystem.hpp> | ||
|
||
#include <android_native_app_glue.h> | ||
#include <android/log.h> | ||
|
||
void android_main(struct android_app* state) { | ||
app_dummy(); // Make sure glue isn't stripped | ||
|
||
namespace fs = boost::filesystem; | ||
|
||
__android_log_print( | ||
ANDROID_LOG_INFO, | ||
"BoostFilesystemExample", | ||
fs::current_path().c_str() | ||
); | ||
|
||
ANativeActivity_finish(state->activity); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright (c) 2015, Aaditya Kalsi | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(Boost_DEBUG ON CACHE BOOLEAN "") | ||
set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(boost_iostreams) | ||
|
||
hunter_add_package(Boost COMPONENTS iostreams serialization) | ||
# If you use boost/iostreams/filter/gzip.hpp then you should add ZLIB | ||
find_package(ZLIB CONFIG REQUIRED) | ||
# If you use boost/iostreams/filter/bzip2.hpp then you should add BZip2 | ||
find_package(BZip2 CONFIG REQUIRED) | ||
find_package(Boost CONFIG REQUIRED iostreams serialization) | ||
|
||
add_executable(foo foo.cpp) | ||
target_link_libraries(foo PUBLIC Boost::iostreams Boost::serialization ZLIB::zlib BZip2::bz2) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2015, David Hirvonen | ||
// All rights reserved. | ||
|
||
#include <boost/archive/binary_oarchive.hpp> | ||
#include <boost/archive/binary_iarchive.hpp> | ||
|
||
#include <boost/iostreams/filtering_stream.hpp> | ||
#include <boost/iostreams/filtering_streambuf.hpp> | ||
#include <boost/iostreams/filter/gzip.hpp> | ||
#include <boost/iostreams/filter/bzip2.hpp> | ||
#include <boost/iostreams/copy.hpp> | ||
|
||
#include <iostream> | ||
#include <fstream> | ||
|
||
struct Record | ||
{ | ||
Record() {} | ||
Record(int age, const std::string &name) : age(age), name(name) {} | ||
|
||
int age; | ||
std::string name; | ||
|
||
// Boost serialization: | ||
//friend class boost::serialization::access; | ||
template<class Archive> void serialize(Archive & ar, const unsigned int version) | ||
{ | ||
ar & age; | ||
ar & name; | ||
} | ||
}; | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
std::string filename = "/tmp/record.dat"; | ||
|
||
typedef boost::iostreams::zlib_compressor Compressor; | ||
typedef boost::iostreams::zlib_decompressor Decompressor; | ||
|
||
{ // Dump the record: | ||
Record record(1, "kermit"); | ||
std::ofstream ofs(filename, std::ios_base::out | std::ios_base::binary); | ||
if(ofs) | ||
{ | ||
boost::iostreams::filtering_stream<boost::iostreams::output> buffer; | ||
buffer.push(Compressor()); | ||
buffer.push(ofs); | ||
boost::archive::binary_oarchive oa(buffer); | ||
oa << record; | ||
} | ||
} | ||
|
||
{ // Load the record | ||
Record record; | ||
std::ifstream ifs(filename, std::ios_base::in | std::ios_base::binary); | ||
if(ifs) | ||
{ | ||
boost::iostreams::filtering_streambuf<boost::iostreams::input> buffer; | ||
buffer.push(Decompressor()); | ||
buffer.push(ifs); | ||
boost::archive::binary_iarchive ia(buffer); // (ifs); | ||
ia >> record; | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright (c) 2013-2017, Ruslan Baratov | ||
# All rights reserved. | ||
|
||
cmake_minimum_required(VERSION 3.0) | ||
|
||
set(Boost_DEBUG ON CACHE BOOLEAN "") | ||
set(TESTING_CONFIG_OPT FILEPATH ${CMAKE_CURRENT_LIST_DIR}/config.cmake) | ||
|
||
# Emulate HunterGate: | ||
# * https://github.com/hunter-packages/gate | ||
include("../common.cmake") | ||
|
||
project(download-boost) | ||
|
||
hunter_add_package(Boost COMPONENTS log) | ||
find_package(Boost CONFIG REQUIRED log) | ||
|
||
add_executable(foo foo.cpp) | ||
target_link_libraries(foo PUBLIC Boost::log) |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <boost/log/trivial.hpp> | ||
|
||
int main() { | ||
BOOST_LOG_TRIVIAL(trace) << "A trace severity message"; | ||
BOOST_LOG_TRIVIAL(debug) << "A debug severity message"; | ||
BOOST_LOG_TRIVIAL(info) << "An informational severity message"; | ||
BOOST_LOG_TRIVIAL(warning) << "A warning severity message"; | ||
BOOST_LOG_TRIVIAL(error) << "An error severity message"; | ||
BOOST_LOG_TRIVIAL(fatal) << "A fatal severity message"; | ||
|
||
return 0; | ||
} |
Oops, something went wrong.