Skip to content
Open

Dev #23

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a49e89d
Add radix prefix
Martin-cg Apr 11, 2025
0e9133e
Enforce C++20
Martin-cg Apr 14, 2025
6c6e56f
Add radix prefix
Martin-cg Apr 14, 2025
6c6cca4
Fix missing #include <string>
Martin-cg Apr 14, 2025
3baa137
Initial commit.
polskus Apr 22, 2025
1119c18
Add OpenGL Shader handling.
polskus May 1, 2025
a29c7a6
Add OpenGL ShaderProgram and Uniform handling.
polskus May 1, 2025
fbb3bd4
Add Shader files to resources.
polskus May 1, 2025
361c30c
Add missing cpp files to CMake.
polskus May 1, 2025
f36ce06
Add Buffer
polskus May 2, 2025
3b02fb1
Commit current WIP state.
polskus May 2, 2025
8723049
Add octree based mesh generation (WIP)
Martin-cg May 2, 2025
1fbd1f9
Add octree based mesh generation (WIP)
Martin-cg May 2, 2025
2a95efc
Merge branch 'structura-fundamentalis' of github.com:AlpineMapsOrg/te…
Martin-cg May 2, 2025
e8e2ee4
work on updated cmake setup (compiles with custom gdal version)
adam-ce May 4, 2025
dd46587
disable unnecessary executable targets, and many gdal features.
adam-ce May 4, 2025
bb1068c
compiles and tests run
adam-ce May 5, 2025
27514c4
clean up / remove FetchContent
adam-ce May 5, 2025
f228c84
clean away tntn
adam-ce May 5, 2025
c524262
further clean up
adam-ce May 5, 2025
3af29b7
include cgal from the repo
adam-ce May 5, 2025
acdcc76
build gdal and proj in the config step
adam-ce May 5, 2025
1f9175c
i'm confused about the quoting. chatgpt and gemini tell to quote, but…
adam-ce May 5, 2025
b90b0de
update cmake scripts
adam-ce May 5, 2025
3425896
create alp_setup_cmake_project and use it for gdal, cgal, boost and o…
adam-ce May 6, 2025
e01efae
Remove out of bounds node access
Martin-cg May 7, 2025
6b23850
Merge remote-tracking branch 'origin/structura-fundamentalis' into st…
Martin-cg May 7, 2025
5bac07d
Make child and children return std::optional
Martin-cg May 7, 2025
3d19a29
Add WIP octree. Needs refactoring.
polskus May 7, 2025
dcaf9f4
add cmake params to the cache version
adam-ce May 7, 2025
543c666
thin down opencv
adam-ce May 7, 2025
eded55f
Fix holes between node meshes
Martin-cg May 7, 2025
ad87ed1
Fix octree id tests
Martin-cg May 7, 2025
1208dc4
Minor refactoring
Martin-cg May 7, 2025
18d18b6
Fix mesh io tests
Martin-cg May 7, 2025
71640af
Merge branch 'dev' into structura-fundamentalis
Martin-cg May 7, 2025
12534a8
update cmake scripts
adam-ce May 8, 2025
2dcacd0
fix opencv linking
adam-ce May 8, 2025
0e711c4
code style for cgal header
adam-ce May 8, 2025
690f826
try fix gdal for martin
adam-ce May 8, 2025
a3e7b36
Merge branch 'dev' into structura-fundamentalis
Martin-cg May 8, 2025
15dca6a
fix opencv setup (build with jpeg and png)
adam-ce May 8, 2025
414a468
build in parallel even with make (hopefully)
adam-ce May 8, 2025
dd7f3ed
Add batch building
Martin-cg May 9, 2025
2dcc556
Handle Window resize.
polskus May 9, 2025
a2f0acf
Add imgui. Add Camera Settings Window.
polskus May 9, 2025
6125e08
Merge branch 'dev' into structura-fundamentalis
Martin-cg May 11, 2025
43ffa4b
Refactoring
Martin-cg May 12, 2025
16d5194
Move octree classes to terrainlib
Martin-cg May 13, 2025
1c1a129
Use short nested namespaces
Martin-cg May 13, 2025
15cdb05
Move project into subfolder in preparation for integration into monor…
polskus May 21, 2025
4e2fb4b
Finish octree storage; Refactoring
Martin-cg May 23, 2025
c5b57e0
Merge remote-tracking branch 'alpenite-browser-single-repo/main' into…
polskus May 21, 2025
cce3037
Fix path to string conversion on windows.
polskus May 23, 2025
5637fba
Integrate browser into monorepo CMake.
polskus May 23, 2025
925e4bf
Remove unneeded submodule.
polskus May 23, 2025
5cef3e3
Merge branch 'dev' into browser
polskus May 23, 2025
3a05b3f
Merge branch 'structura-fundamentalis' of github.com:AlpineMapsOrg/te…
polskus May 23, 2025
c05a901
Fix string related error in string_utils.h
polskus May 23, 2025
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
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*.tif
*.tif.aux.xml
/CMakeLists.txt.user
/3rdparty/*
build/
.vscode
unittest_tiles
/unittests/output
.vs
/extern/*
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 3.21)
project(alpine-terrain-builder)
option(ALP_UNITTESTS "include unit test targets in the buildsystem" ON)

include(cmake/AddRepo.cmake)
include(cmake/SetupCMakeProject.cmake)


add_subdirectory(src)
if (ALP_UNITTESTS)
add_subdirectory(unittests)
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ In order to build, you need to install:
- FreeImage
- tbb (intel threading building blocks)

sudo apt-get install libfmt-dev libglm-dev libgdal-dev catch2 libfreeimage-dev libtbb-dev
sudo apt-get install libcgal-dev libopencv-dev libfmt-dev libglm-dev libgdal-dev catch2 libfreeimage-dev libtbb-dev libcurl4-openssl-dev
(libgmp-dev libmpfr-dev libeigen3-dev)
242 changes: 242 additions & 0 deletions cmake/AddRepo.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
#############################################################################
# AlpineMaps.org
# Copyright (C) 2023 Adam Celarek <family name at cg tuwien ac at>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################################

find_package(Git 2.22 REQUIRED)

# CMake's FetchContent caches information about the downloads / clones in the build dir.
# Therefore it walks over the clones every time we switch the build type (release, debug, webassembly, android etc),
# which takes forever. Moreover, it messes up changes to subprojects. This function, on the other hand, checks whether
# we are on a branch and in that case only issues a warning. Use origin/main or similar, if you want to stay up-to-date
# with upstream.

if(NOT DEFINED _alp_add_repo_check_flag)
set_property(GLOBAL PROPERTY _alp_add_repo_check_flag FALSE)
endif()

function(_alp_git_checkout repo repo_dir commitish)
message(STATUS "[alp/git] ${repo}: Checking out ${commitish}.")
execute_process(
COMMAND ${GIT_EXECUTABLE} checkout --quiet ${commitish}
WORKING_DIRECTORY ${repo_dir}
RESULT_VARIABLE GIT_CHECKOUT_RESULT
ERROR_VARIABLE checkout_output
OUTPUT_VARIABLE checkout_output
)
if (NOT GIT_CHECKOUT_RESULT)
# message(STATUS "[alp/git] In ${repo}, checking out ${commitish} succeeded.")
else()
message(WARNING "[alp/git] ${repo}: Checking out ${commitish} was NOT successful: ${checkout_output}")
endif()

if (EXISTS "${repo_dir}/.gitmodules")
# init/update submodules; for shallow clones this will still be shallow because the super‑project is.
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive ${_ALP_SUBMODULE_UPDATE_ARGS}
WORKING_DIRECTORY ${repo_dir}
RESULT_VARIABLE GIT_SUBMODULE_RESULT
ERROR_VARIABLE checkout_output
OUTPUT_VARIABLE checkout_output
)
if(GIT_SUBMODULE_RESULT EQUAL 0)
# message(STATUS "[alp/git] ${repo}: Submodules updated to match ${commitish}.")
else()
message(WARNING "[alp/git] ${repo}: Submodule update failed after checking out ${commitish}: ${checkout_output}")
endif()
endif()
endfunction()

function(alp_add_git_repository name)
set(options DO_NOT_ADD_SUBPROJECT NOT_SYSTEM DEEP_CLONE PRIVATE_DO_NOT_CHECK_FOR_SCRIPT_UPDATES)
set(oneValueArgs URL COMMITISH DESTINATION_PATH)
set(multiValueArgs )
cmake_parse_arguments(PARSE_ARGV 1 PARAM "${options}" "${oneValueArgs}" "${multiValueArgs}")

# Determine whether we should do a shallow or deep clone/fetch.
if(PARAM_DEEP_CLONE)
# message(STATUS "[alp/git] Cloning ${PARAM_URL} DEEPLY to ${repo_dir}.")
set(_ALP_GIT_CLONE_ARGS)
set(_ALP_SUBMODULE_UPDATE_ARGS)
else()
# message(STATUS "[alp/git] Cloning ${PARAM_URL} SHALLOWY to ${repo_dir}.")
set(_ALP_GIT_CLONE_ARGS --no-checkout --depth 1 --shallow-submodules)
set(_ALP_SUBMODULE_UPDATE_ARGS --depth 1 --recommend-shallow)
endif()

get_property(_check_ran GLOBAL PROPERTY _alp_add_repo_check_flag)
if(NOT PARAM_PRIVATE_DO_NOT_CHECK_FOR_SCRIPT_UPDATES AND NOT _check_ran)
if(NOT COMMAND alp_check_for_script_updates)
include(${CMAKE_CURRENT_FUNCTION_LIST_DIR}/CheckForScriptUpdates.cmake)
endif()
alp_check_for_script_updates(${CMAKE_CURRENT_FUNCTION_LIST_FILE})
set_property(GLOBAL PROPERTY _alp_add_repo_check_flag TRUE)
endif()

if (NOT DEFINED ALP_EXTERN_DIR OR ALP_EXTERN_DIR STREQUAL "")
set(ALP_EXTERN_DIR extern)
endif()

set(repo_dir ${CMAKE_SOURCE_DIR}/${ALP_EXTERN_DIR}/${name})
set(short_repo_dir ${ALP_EXTERN_DIR}/${name})
if (DEFINED PARAM_DESTINATION_PATH AND NOT PARAM_DESTINATION_PATH STREQUAL "")
set(repo_dir ${CMAKE_SOURCE_DIR}/${PARAM_DESTINATION_PATH})
set(short_repo_dir ${PARAM_DESTINATION_PATH})
endif()
file(MAKE_DIRECTORY ${repo_dir})

set(${name}_SOURCE_DIR "${repo_dir}" PARENT_SCOPE)

# Detect if the requested ref looks like a remote branch (e.g. origin/main)
string(REGEX MATCH "^[^/]+/.+" force_fetch "${PARAM_COMMITISH}")

set(force_checkout FALSE)
if(NOT EXISTS "${repo_dir}/.git")
# Do a fresh clone
message(STATUS "[alp/git] ${short_repo_dir}: Cloning ${PARAM_URL} to ${repo_dir}.")
execute_process(
COMMAND ${GIT_EXECUTABLE} clone ${_ALP_GIT_CLONE_ARGS} --recurse-submodules ${PARAM_URL} ${repo_dir}
RESULT_VARIABLE GIT_CLONE_RESULT
ERROR_VARIABLE clone_output
OUTPUT_VARIABLE clone_output
)
if (NOT GIT_CLONE_RESULT EQUAL 0)
message(SEND_ERROR "[alp/git] ${short_repo_dir}: Cloning was NOT successful: ${clone_output}")
endif()
if (NOT PARAM_DEEP_CLONE)
# shallow clone, fetch ref and checkout
set(force_fetch TRUE)
endif()
set(force_checkout TRUE)
endif()

# Check out the correct branch:
# First, see if PARAM_COMMITISH is a valid local ref:
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify ${PARAM_COMMITISH}
WORKING_DIRECTORY ${repo_dir}
OUTPUT_VARIABLE GIT_COMMIT_OUTPUT
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE commit_present_result
ERROR_QUIET
)
if (commit_present_result EQUAL 0 AND NOT force_fetch)
# PARAM_COMMITISH is recognized by Git => no need to fetch
# (could be a tag (lightweight or annotated) or a direct commit SHA).
# if it's an *annotated* tag, rev-parse gives us the tag object's hash, not the commit hash.
# => Force resolve the actual commit object with ^{commit}:
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify ${PARAM_COMMITISH}^{commit}
WORKING_DIRECTORY ${repo_dir}
OUTPUT_VARIABLE GIT_COMMIT_OBJECT
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE commit_object_result
)

if (commit_object_result EQUAL 0)
# Successfully resolved a commit object
set(commitish_hash "${GIT_COMMIT_OBJECT}")
else()
# Fallback if that fails (should rarely happen if it's a proper commit/tag)
set(commitish_hash "${GIT_COMMIT_OUTPUT}")
endif()

# Grab HEAD commit
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --verify HEAD
WORKING_DIRECTORY ${repo_dir}
OUTPUT_VARIABLE git_head_hash
OUTPUT_STRIP_TRAILING_WHITESPACE
)

if (git_head_hash STREQUAL commitish_hash AND NOT force_checkout)
message(STATUS "[alp/git] ${short_repo_dir}: Already at ${PARAM_COMMITISH}. Skipping checkout.")
else()
_alp_git_checkout(${short_repo_dir} ${repo_dir} ${PARAM_COMMITISH})
endif()
else()
# either remote branch or commitish not recognised
message(STATUS "[alp/git] ${short_repo_dir}: Fetching updates.")

if(PARAM_DEEP_CLONE)
# Original deep‑clone logic: fetch everything (incl. all tags) deeply.
# message(STATUS "[alp/git] Deep clone, fetching all.")
execute_process(
COMMAND ${GIT_EXECUTABLE} fetch origin --tags
WORKING_DIRECTORY ${repo_dir}
RESULT_VARIABLE fetch_result
OUTPUT_QUIET
ERROR_QUIET
)
else()
# ── Shallow path ─────────────────────────
# 1. Try to fetch COMMITISH as a tag
# message(STATUS "[alp/git] Shallow clone, trying to fetch tag ${PARAM_COMMITISH}.")
execute_process(
COMMAND ${GIT_EXECUTABLE} fetch origin tag ${PARAM_COMMITISH} --depth 1
WORKING_DIRECTORY ${repo_dir}
RESULT_VARIABLE fetch_result
OUTPUT_QUIET
ERROR_QUIET
)

# 2. If that failed, try it as branch‑name or raw hash
if(NOT fetch_result EQUAL 0)
# message(STATUS "[alp/git] Shallow clone, failed to fetch tag ${PARAM_COMMITISH}. Probably it is a branch or hash. Trying again..")
set(_FETCH_REF "${PARAM_COMMITISH}")
string(REGEX REPLACE "^origin/(.+)" "\\1" _FETCH_REF "${_FETCH_REF}")
execute_process(
COMMAND ${GIT_EXECUTABLE} fetch origin ${_FETCH_REF} --depth 1
WORKING_DIRECTORY ${repo_dir}
RESULT_VARIABLE fetch_result
OUTPUT_QUIET
ERROR_QUIET
)
endif()
endif()

if (fetch_result EQUAL 0)
# message(STATUS "[alp/git] Fetch successful for ${short_repo_dir}.")
execute_process(
COMMAND ${GIT_EXECUTABLE} branch --show-current
WORKING_DIRECTORY ${repo_dir}
OUTPUT_STRIP_TRAILING_WHITESPACE
OUTPUT_VARIABLE current_branch
RESULT_VARIABLE branch_result
)
if (NOT branch_result EQUAL 0)
message(FATAL_ERROR "[alp/git] ${short_repo_dir}: git branch --show-current failed")
endif()

if (current_branch STREQUAL "" OR force_checkout)
# not on a branch. that's what we usually have (detached head state)
_alp_git_checkout(${short_repo_dir} ${repo_dir} ${PARAM_COMMITISH})
else()
message(WARNING "[alp/git] ${short_repo_dir}: On branch ${current_branch}, leaving it there. NOT checking out ${PARAM_COMMITISH}! Use origin/main or similar if you want to stay up‑to‑date with upstream.")
endif()
else()
message(WARNING "[alp/git] ${short_repo_dir}: Unable to fetch updates for; ${PARAM_COMMITISH} not found locally or is a remote branch.")
endif()
endif()

if (NOT PARAM_DO_NOT_ADD_SUBPROJECT)
if (NOT PARAM_NOT_SYSTEM)
add_subdirectory(${repo_dir} ${CMAKE_BINARY_DIR}/alp_external/${name} SYSTEM)
else()
add_subdirectory(${repo_dir} ${CMAKE_BINARY_DIR}/alp_external/${name})
endif()
endif()
endfunction()
76 changes: 76 additions & 0 deletions cmake/CheckForScriptUpdates.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#############################################################################
# AlpineMaps.org
# Copyright (C) 2025 Adam Celarek <family name at cg tuwien ac at>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#############################################################################

include_guard(GLOBAL)


# Function to check if a local CMake script specified by file_path
# differs from the version in the central AlpineMapsOrg/cmake_scripts repository.
#
# Arguments:
# file_path: Path to the CMake script


if(NOT COMMAND alp_add_git_repository)
include(${CMAKE_CURRENT_LIST_DIR}/AddRepo.cmake)
endif()

if(NOT DEFINED _alp_check_for_script_updates_repo_flag)
set_property(GLOBAL PROPERTY _alp_check_for_script_updates_repo_flag FALSE)
endif()

function(alp_check_for_script_updates script_path)
get_filename_component(script_name "${script_path}" NAME)

get_property(_repo_done GLOBAL PROPERTY _alp_check_for_script_updates_repo_flag)
if(_repo_done)
get_property(cmake_scripts_SOURCE_DIR GLOBAL PROPERTY _alp_check_for_script_updates_script_repo)
else()
alp_add_git_repository(cmake_scripts
URL "https://github.com/AlpineMapsOrg/cmake_scripts.git"
COMMITISH origin/main
DO_NOT_ADD_SUBPROJECT PRIVATE_DO_NOT_CHECK_FOR_SCRIPT_UPDATES)
set_property(GLOBAL PROPERTY _alp_check_for_script_updates_repo_flag TRUE)
set_property(GLOBAL PROPERTY _alp_check_for_script_updates_script_repo ${cmake_scripts_SOURCE_DIR})
endif()

set(external_script_path "${cmake_scripts_SOURCE_DIR}/${script_name}")
get_filename_component(absolute_script_path "${script_path}" REALPATH)

if(NOT EXISTS "${absolute_script_path}")
message(WARNING "alp_check_for_cmake_script_updates: Local script '${script_path}' (${absolute_script_path}) does not exist. Cannot compare.")
return()
endif()

if(NOT EXISTS "${external_script_path}")
message(WARNING "alp_check_for_cmake_script_updates: Corresponding external script '${external_script_path}' does not exist in the 'cmake_scripts' repository. Cannot compare.")
return()
endif()

file(READ "${script_path}" local_content)
file(READ "${external_script_path}" external_content)

if(NOT local_content STREQUAL external_content)
message(WARNING "alp_check_for_cmake_script_updates: The local script '${script_path}' has different content compared to the version in the central 'cmake_scripts' repository ('${external_script_path}'). Consider updating the local file or the repository.")
else()
message(STATUS "alp_check_for_cmake_script_updates: Local script '${script_path}' is up-to-date.")
endif()
endfunction()

alp_check_for_script_updates("${CMAKE_CURRENT_LIST_FILE}")

Loading
Loading