Simple cross-platform open source weather by city application. Hunter package manager usage example.
- CMake
- with modules:
- Sugar - tools, wrappers, workarounds, ...
- Polly - toolchain files
- Hunter - package manager
- CMake version 3.0 (more)
HUNTER_ROOTenvironment variable (more)- Python 3 (For
XcodeandVisual Studiobased projects) POLLY_ROOTenvironment variable (for toolchain-based builds, more)
Note that a lot of time (> 1 hour) and space (> 1 GB) may be required for build, so be patient and consider test this tiny-project before run.
Download and unpack current release archive and cd to unpacked directory. Unix-style:
> wget https://github.com/ruslo/weather/archive/v1.2.0.tar.gz > tar xf v1.2.0.tar.gz > cd weather-1.2.0 - Run cmd and check cmake version,
HUNTER_ROOTenvironment, python 3:
> where cmake \path\to\cmake > cmake --version cmake version 3.0.0 > where python \path\to\python.exe > python --version Python 3.x.x > echo %HUNTER_ROOT% \path\to\hunter\root - Start build:
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -G"Visual Studio 12 2013 Win64" > cmake --build _builds --config Release - Test it:
> _builds\Release\weather-cli.exe Madrid > result.txt # open result.txt with utf-8 friendly text editor (notepad fits fine) - Not working (
g++-4.8.3don't havestd::to_stringwhich is used by CppNetlib.URI)
- Check cmake version,
HUNTER_ROOTandPOLLY_ROOTenvironment variables:
> which cmake /path/to/cmake > cmake --version cmake version 3.0.0 > echo $HUNTER_ROOT /path/to/hunter/root/ > echo $POLLY_ROOT /path/to/toolchains - Pick toolchain with
c++11support, for example gcc (gcc -std=c++11):
> ls $POLLY_ROOT/gcc.cmake /path/to/toolchains/gcc.cmake - Start build:
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -DCMAKE_TOOLCHAIN_FILE=$POLLY_ROOT/gcc.cmake > cmake --build _builds - Test it:
> ./_builds/weather-cli Madrid City: Madrid Success... longitude: -3.7 latitude: 40.42 temperature: 17.17 temperature(human): +17.2 ℃ description: sky is clear icon: 02d Done - Check cmake version, python 3,
HUNTER_ROOTandPOLLY_ROOTenvironment variables:
> which cmake /path/to/cmake > cmake --version cmake version 3.0.0 > which python3 /path/to/python3 > echo $HUNTER_ROOT /path/to/hunter/root/ > echo $POLLY_ROOT /path/to/toolchains - Check xcode toolchain and start build:
> ls $POLLY_ROOT/xcode.cmake /path/to/toolchains/xcode.cmake > cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -DCMAKE_TOOLCHAIN_FILE=$POLLY_ROOT/xcode.cmake -GXcode > cmake --build _builds --config Release - Test it:
> ./_builds/Release/weather-cli Madrid City: Madrid Success... longitude: -3.7 latitude: 40.42 temperature: 21.69 temperature(human): +21.7 ℃ description: Sky is Clear icon: 01d Done - Check cmake version,
HUNTER_ROOTandPOLLY_ROOTenvironment variables:
> which cmake /path/to/cmake > cmake --version cmake version 3.0.0 > echo $HUNTER_ROOT /path/to/hunter/root/ > echo $POLLY_ROOT /path/to/toolchains - Pick toolchain with
c++11support, for example libcxx (clang -std=c++11 -stdlib=libc++):
> ls $POLLY_ROOT/libcxx.cmake /path/to/toolchains/libcxx.cmake - Start build:
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -DCMAKE_TOOLCHAIN_FILE=$POLLY_ROOT/libcxx.cmake > cmake --build _builds - Test it:
> ./_builds/weather-cli Madrid City: Madrid Success... longitude: -3.7 latitude: 40.42 temperature: 17.71 temperature(human): +17.7 ℃ description: Sky is Clear icon: 01d Done - Build patched cmake and add it to the
PATH:
> CMAKE_VERSION="3.0.0-ios-universal" > wget "https://github.com/ruslo/CMake/archive/v${CMAKE_VERSION}.tar.gz" > tar xf "v${CMAKE_VERSION}.tar.gz" > cd "CMake-${CMAKE_VERSION}" > cmake -H. -B_builds -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="`pwd`/_install" -DCMAKE_USE_SYSTEM_CURL=YES > cmake --build _builds --target install > export PATH="`pwd`/_install/bin:${PATH}" > cd .. - Check cmake version, python 3,
HUNTER_ROOTandPOLLY_ROOTenvironment variables:
> which cmake /path/to/patched/cmake/version/_install/bin/cmake > cmake --version cmake version 3.0.0 > which python3 /path/to/python3 > echo $HUNTER_ROOT /path/to/hunter/root/ > echo $POLLY_ROOT /path/to/toolchains - Check ios toolchain and install dependencies:
> ls $POLLY_ROOT/ios.cmake /path/to/toolchains/ios.cmake > cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON -DCMAKE_TOOLCHAIN_FILE=$POLLY_ROOT/ios.cmake -GXcode - Open project in
Xcodeand build/run on target you need:
> open _builds/Weather.xcodeproj