Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove get_version.sh #344

Merged
merged 2 commits into from
Feb 6, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Remove get_version.sh
  • Loading branch information
an-tao committed Feb 6, 2020
commit 02ac7af742bc34ae7d684685303dffd9521769da
21 changes: 7 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(DROGON_MINOR_VERSION 0)
set(DROGON_PATCH_VERSION 0)
set(DROGON_VERSION
${DROGON_MAJOR_VERSION}.${DROGON_MINOR_VERSION}.${DROGON_PATCH_VERSION})
set(PRE_RELEASE_STRING "beta13")
set(DROGON_VERSION_STRING "${DROGON_VERSION}.beta13")

# Offer the user the choice of overriding the installation directories
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
Expand Down Expand Up @@ -268,17 +268,12 @@ if(BUILD_ORM)
endif()
endif()

add_custom_target(makeVersion)
add_custom_command(TARGET makeVersion
COMMAND ${PROJECT_SOURCE_DIR}/get_version.sh
ARGS
${PROJECT_SOURCE_DIR}/lib/inc/drogon/version.h
${DROGON_MAJOR_VERSION}
${DROGON_MINOR_VERSION}
${DROGON_PATCH_VERSION}
${PRE_RELEASE_STRING}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
VERBATIM)
execute_process(COMMAND "git" rev-parse HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_SHA1
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/version.h.in"
"${PROJECT_SOURCE_DIR}/lib/inc/drogon/version.h" @ONLY)

if(BUILD_EXAMPLES)
add_subdirectory(examples)
Expand Down Expand Up @@ -316,8 +311,6 @@ set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD_REQUIRED ON)
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF)
set_target_properties(${PROJECT_NAME} PROPERTIES EXPORT_NAME Drogon)

add_dependencies(${PROJECT_NAME} makeVersion)

if(PostgreSQL_FOUND OR MYSQL_FOUND OR SQLITE3_FOUND)
if(PostgreSQL_FOUND)
option(USE_POSTGRESQL "Enable PostgreSQL" ON)
Expand Down
5 changes: 5 additions & 0 deletions cmake/templates/version.h.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#define MAJOR @DROGON_MAJOR_VERSION@
#define MINOR @DROGON_MINOR_VERSION@
#define PATCH @DROGON_PATCH_VERSION@
#define DROGON_VERSION "@DROGON_VERSION_STRING@"
#define DROGON_VERSION_SHA1 "@GIT_SHA1@"
1 change: 0 additions & 1 deletion drogon_ctl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ target_link_libraries(drogon_ctl PRIVATE ${PROJECT_NAME})
target_include_directories(drogon_ctl PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_dependencies(drogon_ctl
trantor
makeVersion
_drogon_ctl)
if(WIN32)
target_link_libraries(drogon_ctl PRIVATE ws2_32 Rpcrt4)
Expand Down
6 changes: 3 additions & 3 deletions drogon_ctl/version.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ void version::handleCommand(std::vector<std::string> &parameters)
{
std::cout << banner << std::endl;
std::cout << "A utility for drogon" << std::endl;
std::cout << "Version:" << VERSION << std::endl;
std::cout << "Git commit:" << VERSION_MD5 << std::endl;
std::cout << "Compile config:" << COMPILATION_FLAGS << " " << INCLUDING_DIRS
std::cout << "Version: " << DROGON_VERSION << std::endl;
std::cout << "Git commit: " << DROGON_VERSION_SHA1 << std::endl;
std::cout << "Compile config: " << COMPILATION_FLAGS << " " << INCLUDING_DIRS
<< std::endl;
}
24 changes: 0 additions & 24 deletions get_version.sh

This file was deleted.

4 changes: 2 additions & 2 deletions lib/src/HttpAppFrameworkImpl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ namespace drogon
{
std::string getVersion()
{
return VERSION;
return DROGON_VERSION;
}
std::string getGitCommit()
{
return VERSION_MD5;
return DROGON_VERSION_SHA1;
}
} // namespace drogon
static void godaemon(void)
Expand Down