mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 03:00:46 +03:00
Add rule for release builds
This commit is contained in:
parent
34582543f6
commit
e1f7ef88cd
2 changed files with 39 additions and 4 deletions
|
@ -2,10 +2,6 @@ cmake_minimum_required(VERSION 3.1)
|
|||
|
||||
project(nheko CXX)
|
||||
|
||||
set(nheko_VERSION_MAJOR 0)
|
||||
set(nheko_VERSION_MINOR 1)
|
||||
set(nheko_VERSION_PATCH 0)
|
||||
|
||||
find_package(Qt5Widgets REQUIRED)
|
||||
find_package(Qt5Network REQUIRED)
|
||||
|
||||
|
@ -16,6 +12,41 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING
|
||||
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
|
||||
FORCE)
|
||||
MESSAGE("Setting build type to '${CMAKE_BUILD_TYPE}'")
|
||||
ELSE(NOT CMAKE_BUILD_TYPE)
|
||||
MESSAGE("Build type set to '${CMAKE_BUILD_TYPE}'")
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
|
||||
IF("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
SET(PATCH_OUT "0")
|
||||
ELSE("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
FIND_PROGRAM(GIT git)
|
||||
IF(GIT)
|
||||
EXECUTE_PROCESS(
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND ${GIT} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
SET(PATCH_OUT "0-git${GIT_OUT}")
|
||||
ELSE(GIT)
|
||||
SET(PATCH_OUT "0")
|
||||
ENDIF(GIT)
|
||||
ENDIF("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||
|
||||
SET(PROJECT_VERSION_PATCH ${PATCH_OUT})
|
||||
SET(CPACK_PACKAGE_VERSION_MAJOR "0")
|
||||
SET(CPACK_PACKAGE_VERSION_MINOR "1")
|
||||
SET(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
|
||||
SET(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
|
||||
SET(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR})
|
||||
SET(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})
|
||||
|
||||
MESSAGE(STATUS "Version: ${PROJECT_VERSION}")
|
||||
|
||||
set(CMAKE_CXX_FLAGS
|
||||
"${CMAKE_CXX_FLAGS} \
|
||||
-std=gnu++11 \
|
||||
|
|
4
Makefile
4
Makefile
|
@ -5,6 +5,10 @@ build:
|
|||
@cmake -H. -Bbuild
|
||||
@make -C build
|
||||
|
||||
release:
|
||||
@cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release
|
||||
@make -C build
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
|
|
Loading…
Reference in a new issue