Skip to content

Commit

Permalink
feat: print hello sdk version
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyoucao577 committed Jul 1, 2021
1 parent d154a44 commit 515ca70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def config_options(self):

def build(self):
cmake = CMake(self)
cmake.definitions["CMAKE_HELLO_SDK_VERSION"] = self.version
cmake.configure(source_folder="src")
cmake.build()

Expand Down
2 changes: 2 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ project(hello CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

add_definitions(-DHELLO_SDK_VERSION="${CMAKE_HELLO_SDK_VERSION}")

add_library(hello hello.cpp)
10 changes: 8 additions & 2 deletions src/hello.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
#include <iostream>
#include "hello.h"

#ifndef HELLO_SDK_VERSION
#define HELLO_SDK_VERSION "unknown"
#endif

void hello(){
std::cout << "hello sdk version: " << HELLO_SDK_VERSION << std::endl;

#ifdef NDEBUG
std::cout << "hello/0.1: Hello World Release!" <<std::endl;
std::cout << "Hello World Release!" <<std::endl;
#else
std::cout << "hello/0.1: Hello World Debug!" <<std::endl;
std::cout << "Hello World Debug!" <<std::endl;
#endif
}

0 comments on commit 515ca70

Please sign in to comment.