Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
43daba2
parent 464ffca1e1fbb98107593ee60c43a8449e567eed
rkanavath Jun 11, 2017
f9c5cf0
revert C related INFINITY/NAN changes (this is taken care of in #2681)
neteler Dec 5, 2022
f9b1ba7
Sync to PR Cmake build2 #348 (replaces #348)
neteler Dec 5, 2022
4889de7
CI fix for pylint in gui/wxpython called with wildcard
neteler Dec 5, 2022
9eed8bc
cmake/find_scripts/FindPROJ.cmake: update to PROJ > 4
neteler Dec 5, 2022
67cdeee
cmake/find_scripts/FindPostgreSQL.cmake: update to https://github.com…
neteler Dec 5, 2022
faea30b
various path updates (sync to main)
neteler Dec 5, 2022
7f39bb3
grass7 -> grass8; msg cosmetics
neteler Dec 5, 2022
96862bd
CI: cmake compile script
neteler Dec 6, 2022
d9f674e
fix syntax
neteler Dec 10, 2022
49c5d5b
fix Build step
neteler Dec 10, 2022
b2669e5
Build step debugging
neteler Dec 11, 2022
18bf7f0
Simplify cmake command call
neteler Jan 2, 2023
f76f68f
Remove debugging leftover.
neteler Jan 2, 2023
ba6c07d
make -> cmake
neteler Jan 2, 2023
76576db
update year
neteler Jan 2, 2023
2be2b75
python_bandref -> python_semantic_label
neteler Jan 2, 2023
e8126e7
remove outdated bandref
neteler Jan 2, 2023
52123fe
bandref -> semantic_label
neteler Jan 2, 2023
91461d5
added python/CMakeLists.txt (from https://github.com/OSGeo/grass/pull…
neteler Jan 2, 2023
87ef0aa
add_subdirectory(python)
neteler Jan 2, 2023
aecd006
fix path to grass/script/setup.py
neteler Jan 2, 2023
4b23a6c
remove files deleted in PR #1400
neteler Jan 2, 2023
0a43a1c
Fix missing EOL
neteler Jan 2, 2023
e5becb7
just peek in the folder (by @echoix)
neteler Jan 3, 2023
fd5500d
sync clang-format changes from main
neteler Jan 4, 2023
9565839
apply clang-format
nilason Jan 4, 2023
0afe71f
cmake_minimum_required version 3.11
neteler Jan 4, 2023
617f58d
update to CMake 3.11.4
neteler Jan 4, 2023
a9c23d7
add VERBATIM
neteler Jan 4, 2023
3f1f5a1
pylint: ignore cmakelists.txt
nilason Jan 5, 2023
6301f3e
homogenize ubuntu image name
neteler Jan 4, 2023
d88134e
use of INFINITY and NAN
lbartoletti Jun 5, 2023
8c06b79
Simplify and use PROJ_H_
lbartoletti Jun 3, 2023
6b54a06
CMakeLists.txt: add include_irectories to grass
lbartoletti Jun 3, 2023
1852e08
raster/CMakeLists.txt: fix GDAL_VERSION
lbartoletti Jun 3, 2023
dccaac0
add aprintf.c
lbartoletti Jun 4, 2023
c02053f
v.neighbors requires grass_stats
lbartoletti Jun 4, 2023
b222913
ctypesgen.py: main module is not ctypesgen.py but run.py. fix it.
lbartoletti Jun 4, 2023
062b852
lib/rst: fix build. Remove DEFS POINT2D_C
lbartoletti Jun 5, 2023
075e42e
python: copy grassdb
lbartoletti Jun 5, 2023
555cdb2
propose ccache to speedup build
lbartoletti Jun 5, 2023
754872d
mkhtml.py depends on a sibling python script
aaronsms Jun 5, 2023
9ef6a2b
make libraster libvector link with lapack when it is available
aaronsms Jun 5, 2023
161f1f9
add the 3 missing raster modules
aaronsms Jun 5, 2023
ce13ea1
display: add d.rgb, d.rhumbline, d.text, d.title, d.vect.*
lbartoletti Jun 5, 2023
1541875
raster: enable r3.mapcalc
lbartoletti Jun 5, 2023
2af6d2e
raster: enable r.object.geometry
lbartoletti Jun 6, 2023
1c2b3dd
ps: enable ps.map
lbartoletti Jun 6, 2023
028a323
python/grass: add utils (will be used by g.download.location scripts)
lbartoletti Jun 6, 2023
1edfee8
scripts: add d.background, g.download.location, i.band.library, r.sem…
lbartoletti Jun 6, 2023
6a12d3a
temporal: add t.copy and t.upgrade
lbartoletti Jun 6, 2023
0f90e77
add an optional cmake to use alternate linker
lbartoletti Jun 6, 2023
ce74248
gui/wxpython: copy main_window dir
lbartoletti Jun 6, 2023
31b53b5
init: copy lock, echo, run, clean_temp and winlocale
lbartoletti Jun 6, 2023
3d61178
Fix finding Python3 package
HuidaeCho Apr 18, 2024
0b0cebf
Fix a SQLite warning
HuidaeCho Apr 18, 2024
8f24221
Define global PYTHON_EXECUTABLE
HuidaeCho Apr 18, 2024
8aec114
Shared library versioning and symlinks following a common practice (v…
HuidaeCho Apr 18, 2024
f689903
Rename grass.sh to grass and set 755 permissions
HuidaeCho Apr 18, 2024
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
91 changes: 91 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# inspired by "build GDAL library and to run test with CMake"
# from https://github.com/OSGeo/gdal/blob/master/.github/workflows/cmake_builds.yml

name: Build and test with CMake

on:
push:
paths-ignore:
- 'doc/**'
branches-ignore:
- 'backport**'
pull_request:
paths-ignore:
- 'doc/**'

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

env:
CMAKE_UNITY_BUILD: OFF

permissions:
contents: read # to fetch code (actions/checkout)

jobs:

build-linux-ubuntu-20.04:
runs-on: ubuntu-20.04
env:
CMAKE_OPTIONS: -DPython_LOOKUP_VERSION=3.8 -DUSE_CCACHE=ON
cache-name: cmake-ubuntu-20.04
steps:
- name: Checkout GRASS
uses: actions/checkout@v3
- name: Setup cache
uses: actions/cache@v3
id: cache
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}${{ github.ref_name }}-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-${{ env.cache-name }}-${{ github.base_ref }}
${{ runner.os }}-${{ env.cache-name }}
- name: Install CMake 3.11.4
run: |
cd ${GITHUB_WORKSPACE}
wget https://github.com/Kitware/CMake/releases/download/v3.11.4/cmake-3.11.4-Linux-x86_64.tar.gz
tar xzf cmake-3.11.4-Linux-x86_64.tar.gz
echo "CMAKE_DIR=$GITHUB_WORKSPACE/cmake-3.11.4-Linux-x86_64/bin" >> $GITHUB_ENV
echo "$GITHUB_WORKSPACE/cmake-3.11.4-Linux-x86_64/bin" >> $GITHUB_PATH
- run: |
cmake --version
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntugis/ubuntugis-unstable
sudo apt-get update
sudo apt-get install -y -q build-essential \
flex make bison gcc libgcc1 g++ ccache \
python3 python3-dev \
python3-opengl python3-wxgtk4.0 \
python3-dateutil libgsl-dev python3-numpy \
wx3.0-headers wx-common libwxgtk3.0-gtk3-dev \
libwxbase3.0-dev libbz2-dev zlib1g-dev gettext \
libtiff5-dev libpnglite-dev libcairo2 libcairo2-dev \
sqlite3 libsqlite3-dev \
libpq-dev libreadline6-dev libfreetype6-dev \
libfftw3-3 libfftw3-dev \
libboost-thread-dev libboost-program-options-dev libpdal-dev\
subversion libzstd-dev checkinstall \
libglu1-mesa-dev libxmu-dev \
ghostscript wget -y make ccache g++
sudo apt-get update -y
- name: Configure ccache
run: |
echo CCACHE_BASEDIR=$PWD >> ${GITHUB_ENV}
echo CCACHE_DIR=$PWD/.ccache >> ${GITHUB_ENV}
echo CCACHE_MAXSIZE=250M >> ${GITHUB_ENV}
ccache -z
working-directory: ${{ github.workspace }}
- name: Configure
run: |
mkdir build
cmake ${CMAKE_OPTIONS} -S $GITHUB_WORKSPACE -B $GITHUB_WORKSPACE/build
- name: Build
run: |
cd $GITHUB_WORKSPACE/build
cmake --build . -j$(nproc)
- name: ccache statistics
run: ccache -s

2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
export PYTHONPATH=`grass --config python_path`:$PYTHONPATH
export LD_LIBRARY_PATH=$HOME/install/grass84/lib:$LD_LIBRARY_PATH
cd gui/wxpython
pylint --persistent=no --py-version=${{ matrix.min-python-version }} --jobs=$(nproc) *
pylint --persistent=no --py-version=${{ matrix.min-python-version }} --jobs=$(nproc) --ignore=CMakeLists.txt *

- name: Run Pylint on other files using pytest
run: |
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ OBJ.*
locale/scriptstrings/*
bin.*/*
dist.*/*
.vs/*
CMakeSettings.json
config.log
config.status*
error.log
Expand Down Expand Up @@ -49,3 +51,6 @@ test_keyvalue_result.txt

# ignore paths generated by helper tools
node_modules

# ignore cmake build directory
build
245 changes: 245 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
# AUTHOR(S): Rashad Kanavath <rashad km gmail>
# PURPOSE: GRASS GIS root that adds options to activate/deactivate 3rd party libraries
# COPYRIGHT: (C) 2020-2022 by the GRASS Development Team
# This program is free software under the GPL (>=v2)
# Read the file COPYING that comes with GRASS for details.

cmake_minimum_required(VERSION 3.11)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)

#if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET)
# set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "")
#endif()

project(GRASSGIS)

set(BUILD_SHARED_LIBS ON)
#message(FATAL_ERROR "VCPKG_TARGET_TRIPLET=${VCPKG_TARGET_TRIPLET}")
if(MSVC)
if(BUILD_SHARED_LIBS)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE)
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()

set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/find_scripts;${CMAKE_SOURCE_DIR}/cmake/modules;${CMAKE_MODULE_PATH}")

set(default_option_enabled ON)
if(WIN32)
set(default_option_enabled OFF)
endif()

# Configure CCache if available
if(NOT MSVC)
option(USE_CCACHE "Use ccache" ON)
if (USE_CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
message(STATUS "ccache found")
endif(CCACHE_FOUND)
endif(USE_CCACHE)
endif(NOT MSVC)

if(USE_ALTERNATE_LINKER)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a strong reason for this option? It might be better to leave it for the user to configure custom linker, if they wish (they can always do it themselves).

One main reason is that we want the cmake to be minimal and robust, that can still against compiler API changes, because maintainability is one of important concern.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's optional, but we've added it in GDAL and QGIS.

It can speed up the build.

include("cmake/modules/linker.cmake")
endif()

if(CMAKE_BUILD_TYPE)
set( grass_build_type "${CMAKE_BUILD_TYPE}" )
string( TOLOWER "${grass_build_type}" grass_build_type_lc )
set(find_library_suffix "_RELEASE")
if( grass_build_type_lc STREQUAL "debug" )
set(find_library_suffix "_DEBUG")
endif()
else()
set(find_library_suffix "")
endif()

option(WITH_CAIRO "Build with cairo support ." ON)
option(WITH_X11 "Build with X11 support ." ${default_option_enabled})
option(WITH_OPENGL "Build with opengl support ." ON)
option(WITH_SQLITE "enable sqlite support" ON)
option(WITH_POSTGRES "enable postgres support" ON)
option(WITH_NLS "enable nls support" ${default_option_enabled})
option(WITH_BZLIB "enable bzlib support" ON)
option(WITH_BLAS "enable blas support" ON)
option(WITH_LAPACK "enable lapack support" ON)
option(WITH_LIBLAS "enable libLAS support" OFF)
option(WITH_OPENDWG "enable v.in.dwg" OFF)

option(WITH_PYTHON "Build python bindings" ON)
option(WITH_LARGEFILES "enable largefile support" ${default_option_enabled})
option(WITH_DOCS "Build documentation" ON)
if(APPLE)
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
set(CMAKE_MACOSX_RPATH TRUE)
endif()

set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1")

include(get_host_arch)
get_host_arch(BUILD_ARCH)

include(get_versions)
get_versions("include/VERSION"
GRASS_VERSION_MAJOR
GRASS_VERSION_MINOR
GRASS_VERSION_RELEASE
GRASS_VERSION_DATE)

set(GRASS_VERSION_NUMBER ${GRASS_VERSION_MAJOR}.${GRASS_VERSION_MINOR}.${GRASS_VERSION_RELEASE})
message(STATUS "GRASS_VERSION_NUMBER = '${GRASS_VERSION_NUMBER}'")
set(GRASS_VERSION_UPDATE_PKG "0.2")

include(set_compiler_flags)
set_compiler_flags()

include(repo_status)
repo_status("${CMAKE_CURRENT_LIST_DIR}" GRASS_VERSION_GIT)

enable_testing()

# Setup build locations.
if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif()
if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()
if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
endif()

include(build_module)
include(build_program)
include(build_program_in_subdir)
include(build_library_in_subdir)
include(copy_python_files_in_subdir)
include(build_script_in_subdir)
include(build_gui_in_subdir)
include(check_target)

add_subdirectory(thirdparty)
set(MKHTML_PY ${CMAKE_BINARY_DIR}/utils/mkhtml.py)

set(GISBASE ${CMAKE_BINARY_DIR}/gisbase)
file(TO_NATIVE_PATH "${GISBASE}" GISBASE_NATIVE)
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/bin" BINARY_DIR)
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/lib" LIB_DIR)
file(TO_NATIVE_PATH "${CMAKE_SOURCE_DIR}" MODULE_TOPDIR)
file(TO_NATIVE_PATH "${GISBASE}/scripts" SCRIPTS_DIR)
file(TO_NATIVE_PATH "${GISBASE}/etc/config/rc" GISRC)
file(TO_NATIVE_PATH "${GISBASE}/etc/python" ETC_PYTHON_DIR)
file(TO_NATIVE_PATH "${GISBASE}/gui/wxpython" GUI_WXPYTHON_DIR)
if(WIN32)
set(sep "\;")
set(env_path "")
else()
set(sep ":")
set(env_path ":$ENV{PATH}")
endif()


set(grass_env_command ${CMAKE_COMMAND} -E env
"PATH=${BINARY_DIR}${sep}${SCRIPTS_DIR}${env_path}"
"PYTHONPATH=${ETC_PYTHON_DIR}${sep}${GUI_WXPYTHON_DIR}${sep}$ENV{PYTHONPATH}"
"LD_LIBRARY_PATH=${LIB_DIR}${sep}$ENV{LD_LIBRARY_PATH}"
"GISBASE=${GISBASE_NATIVE}"
"GISRC=${GISRC}"
"LC_ALL=C"
"LANG=C"
"LANGUAGE=C"
"MODULE_TOPDIR=${MODULE_TOPDIR}"
"VERSION_NUMBER=\"${GRASS_VERSION_NUMBER}\""
"VERSION_DATE=\"${GRASS_VERSION_DATE}\"")



set(NO_HTML_DESCR_TARGETS "g.parser;ximgview;test.raster3d.lib")
add_subdirectory(include)

include_directories("${CMAKE_BINARY_DIR}/include")
include_directories(${CMAKE_BINARY_DIR}/include/grass)
if(MSVC)
include_directories("${CMAKE_SOURCE_DIR}/msvc")
endif()

execute_process(
COMMAND ${CMAKE_COMMAND} -E echo "Creating directories in ${GISBASE}"
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/bin/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/scripts/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/demolocation/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/etc/config/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/driver/db/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/utils/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/lib/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/python/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/etc/lister/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/etc/python/grass/lib
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/gui/wxpython/xml/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/gui/icons/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/gui/images/
COMMAND ${CMAKE_COMMAND} -E make_directory ${GISBASE}/docs/html/
)

add_subdirectory(lib)
add_subdirectory(utils)
set(modules_list)


set(ALL_SUBDIRS
general
db
display
imagery
misc
raster
raster3d
scripts
vector
temporal
ps
)

foreach(d ${ALL_SUBDIRS})
add_subdirectory(${d})
endforeach()
add_custom_target(ALL_MODULES
COMMAND ${CMAKE_COMMAND} -E echo "Building all modules"
DEPENDS ${modules_list})

###message(FATAL_ERROR "modules_list=${modules_list}")

if(WITH_PYTHON)
add_subdirectory(gui)
endif()

add_subdirectory(python)

if(WITH_DOCS)
add_subdirectory(doc)
add_subdirectory(man)
endif() # WITH_DOCS


####add_subdirectory(locale)

# TODO: To be discussed
# add_subdirectory(testsuite)
# add_subdirectory(macosx)

if(WITH_X11)
build_program_in_subdir(visualization/ximgview DEPENDS grass_gis X11)
endif()
35 changes: 35 additions & 0 deletions cmake/copy_g_gui_module.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AUTHOR(S): Rashad Kanavath <rashad km gmail>
# PURPOSE: Copy g.gui script plus .bat file if on windows
# COPYRIGHT: (C) 2020 by the GRASS Development Team
# This program is free software under the GPL (>=v2)
# Read the file COPYING that comes with GRASS for details.
# -DSOURCE_DIR
# -DGISBASE
# -DG_NAME
# -DSRC_SCRIPT_FILE
# -DBINARY_DIR

set(SCRIPT_EXT "")
if(WIN32)
set(SCRIPT_EXT ".py")
endif()

if(WIN32)
set(PGM_NAME ${G_NAME})
configure_file(
${SOURCE_DIR}/cmake/windows_launch.bat.in
${GISBASE}/scripts/${G_NAME}.bat @ONLY)
endif(WIN32)

set(TMP_SCRIPT_FILE ${BINARY_DIR}/CMakeFiles/${G_NAME}${SCRIPT_EXT})
configure_file(${SRC_SCRIPT_FILE} ${TMP_SCRIPT_FILE} COPYONLY)
file(
COPY ${TMP_SCRIPT_FILE}
DESTINATION ${GISBASE}/scripts/
FILE_PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)


file(REMOVE ${TMP_SCRIPT_FILE})
Loading