Skip to content

Commit

Permalink
switch default build type for git/svn clones to release with debug info
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Dec 24, 2021
1 parent 55b1fe4 commit 9d0046f
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 53 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project
cmake_minimum_required(VERSION 3.16 FATAL_ERROR) # 3.1 is ok, but is 3.16 needed for proper version string
project(nchat VERSION 2.25 LANGUAGES CXX)
project(nchat VERSION 2.26 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
include(CheckCXXSourceCompiles)
set(NCHAT_PROJECT_VERSION ${PROJECT_VERSION})
Expand All @@ -15,7 +15,7 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
# Build type
set(DEFAULT_BUILD_TYPE "Release")
if((EXISTS "${CMAKE_SOURCE_DIR}/.svn") OR (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
set(DEFAULT_BUILD_TYPE "Debug")
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Using build type '${DEFAULT_BUILD_TYPE}' (default).")
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ build by default (3.5GB using g++, and 1.5 GB for clang++). It is possible to ad
Telegram client library source code so that it requires less RAM (but takes longer time).
Doing so reduces the memory requirement to around 1GB under g++ and 0.5GB for clang++. Also, it
is recommended to build nchat in release mode (which is default if downloading zip/tar release
package - but with a git/svn clone it defaults to debug mode), to minimize memory usage.
package - but with a git/svn clone it defaults to release with debug symbols), to minimize
memory usage.

Steps to build nchat on a low memory system:

**Source**
Expand Down
12 changes: 0 additions & 12 deletions lib/duchat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

# Build type
set(DEFAULT_BUILD_TYPE "Release")
if((EXISTS "${CMAKE_SOURCE_DIR}/.svn") OR (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
set(DEFAULT_BUILD_TYPE "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Using build type '${DEFAULT_BUILD_TYPE}' (default).")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
else()
message(STATUS "Using build type '${CMAKE_BUILD_TYPE}'.")
endif()

# Library
add_library(duchat SHARED
src/duchat.cpp
Expand Down
12 changes: 0 additions & 12 deletions lib/ncutil/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

# Build type
set(DEFAULT_BUILD_TYPE "Release")
if((EXISTS "${CMAKE_SOURCE_DIR}/.svn") OR (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
set(DEFAULT_BUILD_TYPE "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Using build type '${DEFAULT_BUILD_TYPE}' (default).")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
else()
message(STATUS "Using build type '${CMAKE_BUILD_TYPE}'.")
endif()

# Dependencies
find_library(MAGIC_LIBRARY magic)
find_path(MAGIC_INCLUDE_DIR magic.h
Expand Down
12 changes: 0 additions & 12 deletions lib/tgchat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

# Build type
set(DEFAULT_BUILD_TYPE "Release")
if((EXISTS "${CMAKE_SOURCE_DIR}/.svn") OR (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
set(DEFAULT_BUILD_TYPE "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Using build type '${DEFAULT_BUILD_TYPE}' (default).")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
else()
message(STATUS "Using build type '${CMAKE_BUILD_TYPE}'.")
endif()

# Compiler specifics
set(ATOMIC_TEST_SOURCE
"
Expand Down
12 changes: 0 additions & 12 deletions lib/wachat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,6 @@ if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()

# Build type
set(DEFAULT_BUILD_TYPE "Release")
if((EXISTS "${CMAKE_SOURCE_DIR}/.svn") OR (EXISTS "${CMAKE_SOURCE_DIR}/.git"))
set(DEFAULT_BUILD_TYPE "Debug")
endif()
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Using build type '${DEFAULT_BUILD_TYPE}' (default).")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}")
else()
message(STATUS "Using build type '${CMAKE_BUILD_TYPE}'.")
endif()

# Library
add_library(wachat SHARED
src/wachat.cpp
Expand Down
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ if [[ "${DEBUG}" == "1" ]]; then

CMAKEARGS="-DHAS_WHATSAPP=ON -DHAS_DUMMY=ON"

mkdir -p build && cd build && cmake -DCMAKE_BUILD_TYPE=Debug ${CMAKEARGS} .. && make -s ${MAKEARGS} && cd .. || exiterr "debug build failed, exiting."
mkdir -p dbgbuild && cd dbgbuild && cmake -DCMAKE_BUILD_TYPE=Debug ${CMAKEARGS} .. && make -s ${MAKEARGS} && cd .. || exiterr "debug build failed, exiting."
fi

# tests
Expand Down
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "December 2021" "nchat v2.25" "User Commands"
.TH NCHAT "1" "December 2021" "nchat v2.26" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down

0 comments on commit 9d0046f

Please sign in to comment.