Skip to content

Commit

Permalink
[geogram] Update to 1.6.9
Browse files Browse the repository at this point in the history
simogasp committed Oct 29, 2018
1 parent 78287e6 commit 05aca7a
Showing 106 changed files with 23,069 additions and 52,038 deletions.
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -13,7 +13,13 @@ cmake_minimum_required(VERSION 2.8.11)
# but geogram.cmake needs to be included after the project()
# command, since project() resets CFLAGS and CXXFLAGS.

if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/vorpalib)
if("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL "")
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/vorpalib)
project(Vorpaline)
else()
project(Geogram)
endif()
elseif ("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL ON)
project(Vorpaline)
else()
project(Geogram)
@@ -42,7 +48,7 @@ include(cmake/geogram.cmake)

set(VORPALINE_VERSION_MAJOR 1)
set(VORPALINE_VERSION_MINOR 6)
set(VORPALINE_VERSION_PATCH 8)
set(VORPALINE_VERSION_PATCH 9)
set(VORPALINE_VERSION ${VORPALINE_VERSION_MAJOR}.${VORPALINE_VERSION_MINOR}.${VORPALINE_VERSION_PATCH})

set(VORPALINE_INCLUDE_SUBPATH geogram${VORPALINE_VERSION_MAJOR})
15 changes: 12 additions & 3 deletions cmake/geogram.cmake
100755 → 100644
Original file line number Diff line number Diff line change
@@ -26,13 +26,22 @@ if(NOT DEFINED VORPALINE_PLATFORM)
endif()

# Determine whether Geogram is built with Vorpaline
if(IS_DIRECTORY ${GEOGRAM_SOURCE_DIR}/src/lib/vorpalib)
if("$ENV{GEOGRAM_WITH_VORPALINE}" STREQUAL "")
if(IS_DIRECTORY ${GEOGRAM_SOURCE_DIR}/src/lib/vorpalib)
set(GEOGRAM_WITH_VORPALINE ON)
else()
set(GEOGRAM_WITH_VORPALINE OFF)
endif()
else()
# GEOGRAM_WITH_VORPALINE is defined in the environment, used its value
set(GEOGRAM_WITH_VORPALINE $ENV{GEOGRAM_WITH_VORPALINE})
endif()

if ("${GEOGRAM_WITH_VORPALINE}" STREQUAL ON)
message(STATUS "Configuring build for Geogram + Vorpaline")
set(GEOGRAM_WITH_VORPALINE ON)
add_definitions(-DGEOGRAM_WITH_VORPALINE)
else()
message(STATUS "Configuring build for standalone Geogram (without Vorpaline)")
set(GEOGRAM_WITH_VORPALINE OFF)
endif()

if(GEOGRAM_WITH_HLBFGS)
1 change: 0 additions & 1 deletion cmake/platforms/Android-generic/config.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Reset the warning level for third parties
function(vor_reset_warning_level)
endfunction()
84 changes: 84 additions & 0 deletions cmake/platforms/MinGW-x86_64-w64.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
#-------------------------------------------------------------------
# Flags for compiling with Mingw
#-------------------------------------------------------------------

# Shell script extension
set(SHELL_SUFFIX "sh")

# Define the environment for cross compiling to Windows
SET(CMAKE_SYSTEM_NAME Windows) # Target system name
SET(CMAKE_SYSTEM_VERSION 1)

SET(CMAKE_AR "x86_64-w64-mingw32-ar")
SET(CMAKE_RC_COMPILER "x86_64-w64-mingw32-windres")
SET(CMAKE_RANLIB "x86_64-w64-mingw32-ranlib")

# Configure the behaviour of the find commands
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(VORPALINE_ARCH_64 true)

# Link with the loader library
list(APPEND SYSLIBS dl)

# No graphics (yet) for Android
set(GEOGRAM_WITH_GRAPHICS FALSE)

# Warning flags
set(NORMAL_WARNINGS -Wall -Wextra)
set(FULL_WARNINGS
${NORMAL_WARNINGS}
-pedantic
-Wno-long-long
# Detect conversion problems (lot of warnings)
-Wconversion
-Wsign-conversion
-Wdouble-promotion
)

# Compile with full warnings by default
add_definitions(${FULL_WARNINGS})

# Warn about missing virtual destructor (C++ only)
add_flags(CMAKE_CXX_FLAGS -Wnon-virtual-dtor)

# define the windows version
add_flags(CMAKE_CXX_FLAGS -D_WIN32_WINNT=0x601 -DMINGW_HAS_SECURE_API -Wno-unknown-pragmas)
# Activate c++ 2011
add_flags(CMAKE_CXX_FLAGS -std=c++11)

# Additional debug flags
# deactivated for now: I added bound checking in VOR::vector<>.
#add_flags(CMAKE_CXX_FLAGS_DEBUG -D_GLIBCXX_DEBUG)

# Compile and link with pthreads
add_flags(CMAKE_CXX_FLAGS -pthread)
add_flags(CMAKE_C_FLAGS -pthread)

# Reset the warning level for third parties
function(vor_reset_warning_level)
remove_definitions(${FULL_WARNINGS})
add_definitions(${NORMAL_WARNINGS})
endfunction()

if ( APPLE )
string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_C_LINK_FLAGS ${CMAKE_C_LINK_FLAGS} )
string ( REPLACE "-Wl,-search_paths_first" "" CMAKE_CXX_LINK_FLAGS ${CMAKE_CXX_LINK_FLAGS} )
endif ()

macro(vor_add_executable)

if(NOT VORPALINE_BUILD_DYNAMIC)
# Create a statically linked executable
# Link with static libraries
# ... does not work with NDK 10.d
# (causes errors / multiply linked symbols)
# add_flags(CMAKE_CXX_FLAGS -static-libstdc++ -static-libgcc -static)
# add_flags(CMAKE_C_FLAGS -static-libgcc -static)
endif()

add_executable(${ARGN})
endmacro()

3 changes: 3 additions & 0 deletions cmake/platforms/MinGW-x86_64-w64/config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(VORPALINE_WITH_GRAPHICS FALSE)

include(${GEOGRAM_SOURCE_DIR}/cmake/platforms/MinGW-x86_64-w64.cmake)
3 changes: 3 additions & 0 deletions cmake/platforms/MinGW-x86_64-w64/setvars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export AR=x86_64-w64-mingw32-ar
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
3 changes: 3 additions & 0 deletions cmake/platforms/Win64-vs2015/config.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set(VORPALINE_ARCH_64 true)
include(${GEOGRAM_SOURCE_DIR}/cmake/platforms/Windows-vs.cmake)

8 changes: 8 additions & 0 deletions cmake/platforms/Win64-vs2015/setvars.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
:: Get the Visual Studio installation dir
set MSVCDIR=%VS140COMNTOOLS%..\..\VC

:: Configure environment for Visual Studio
call "%MSVCDIR%\VCVARSALL.BAT" x64

:: Set the generator to use
set CMAKE_VS_GENERATOR=Visual Studio 14 2015 Win64
17 changes: 13 additions & 4 deletions configure.bat
100755 → 100644
Original file line number Diff line number Diff line change
@@ -5,6 +5,14 @@
@echo off
setlocal ENABLEDELAYEDEXPANSION

:: Check for options: [ --build_name_suffix suffix ]
set buildNameSuffix=""
if "%1" == "--build_name_suffix" (
set buildNameSuffix=%2
SHIFT & SHIFT
)

:: Read platform
set opsys=%1

:: Checking for CMake
@@ -54,8 +62,8 @@ echo.
echo ============= Creating build system for %opsys% ============
echo.

if not exist build\%opsys% (
mkdir build\%opsys%
if not exist build\%opsys%%buildNameSuffix% (
mkdir build\%opsys%%buildNameSuffix%
)

echo Using cmake generator %CMAKE_VS_GENERATOR%
@@ -68,15 +76,15 @@ if "%CMAKE_VS_GENERATOR_TOOLSET%" neq "" (


::set cmake_debug_options=--trace --debug-output
pushd build\%opsys%
pushd build\%opsys%%buildNameSuffix%
cmake ..\.. %cmake_debug_options% %cmake_generator_options% -DVORPALINE_PLATFORM:STRING=%opsys% || exit /B 1
popd

echo.
echo ============== Vorpaline build configured ==================
echo.
echo To build vorpaline:
echo - go to build/%opsys%
echo - go to build/%opsys%%buildNameSuffix%
echo - run 'cmake --build . --config=Release(or Debug) [--target=target_to_build]'
echo.
echo Note: local configuration can be specified in CMakeOptions.txt
@@ -86,5 +94,6 @@ echo.

:: Clear globals

set buildNameSuffix=
set opsys=
exit /B 0
18 changes: 13 additions & 5 deletions configure.sh
Original file line number Diff line number Diff line change
@@ -20,6 +20,7 @@ fi
# Parse command line arguments

cmake_options=
build_name_suffix=
while [ -n "$1" ]; do
case "$1" in
--debug)
@@ -49,6 +50,10 @@ while [ -n "$1" ]; do
done
exit
;;
--build_name_suffix=*)
build_name_suffix=`echo "$1" | sed 's/--build_name_suffix=\(.*\)$/\1/'`
shift
;;

--help)
cat <<END
@@ -91,6 +96,9 @@ OPTIONS
Builds the project for memory analysis with Allinea's DDT installed in
the specified directory: ddt-root-dir
--build_name_suffix=suffix-dir
Add a suffix to define the build directory
PLATFORM
Build platforms supported by Geogram/Vorpaline: use configure.sh --help-platforms
END
@@ -125,9 +133,9 @@ if [ -z "$os" ]; then
Darwin*)
os=Darwin-clang-dynamic
;;
Linux*aarch64*Android)
os=Android-aarch64-gcc-dynamic
;;
Linux*aarch64*Android)
os=Android-aarch64-gcc-dynamic
;;
*)
echo "Error: OS not supported: $os"
exit 1
@@ -153,7 +161,7 @@ for config in Release Debug; do
echo ============= Creating makefiles for $platform ============
echo

build_dir=build/$platform
build_dir=build/$platform$build_name_suffix
mkdir -p $build_dir
(cd $build_dir; cmake -DCMAKE_BUILD_TYPE:STRING=$config -DVORPALINE_PLATFORM:STRING=$os $cmake_options ../../)
done
@@ -164,7 +172,7 @@ echo

cat << EOF
To build geogram:
- go to build/$os-Release or build/$os-Debug
- go to build/$os-Release$build_name_suffix or build/$os-Debug$build_name_suffix
- run 'make' or 'cmake --build .'
Note: local configuration can be specified in CMakeOptions.txt
Binary file removed src/examples/geogram/compute_RVD/out.meshb
Binary file not shown.
56 changes: 53 additions & 3 deletions src/examples/geogram/simple_raytrace/raytracing.h
Original file line number Diff line number Diff line change
@@ -478,6 +478,10 @@ namespace GEO {
ImGui::PushID(this);
bool result = false;
ImGui::Separator();
if(ImGui::Button("X")) {
to_delete_ = this;
}
ImGui::SameLine();
ImGui::Text("%s", name().c_str());
if(edit_color("Diffuse", material().Kd)) {
result = true;
@@ -493,8 +497,11 @@ namespace GEO {
protected:
std::string name_;
Material material_;
static Object* to_delete_;
};

Object* Object::to_delete_ = nullptr;

/*******************************************************************/

/**
@@ -620,7 +627,7 @@ namespace GEO {

/**
* \brief Light object.
* \detail A Light appears as a colored sphere. The radius does not play
* \details A Light appears as a colored sphere. The radius does not play
* a role in the lighting, this is just a point light.
*/
class Light : public Sphere {
@@ -662,7 +669,11 @@ namespace GEO {
bool draw_gui() override {
ImGui::PushID(this);
bool result = false;
ImGui::Separator();
ImGui::Separator();
if(ImGui::Button("X")) {
to_delete_ = this;
}
ImGui::SameLine();
ImGui::Text("%s", name().c_str());
if(ImGui::Checkbox("##On", &on_)) {
result = true;
@@ -916,6 +927,34 @@ namespace GEO {
*/
virtual bool draw_gui() override {
bool result = false;

for(index_t i=0; i<objects_.size(); ++i) {
if(to_delete_ == objects_[i]) {
delete objects_[i];
objects_.erase(objects_.begin() + std::ptrdiff_t(i));
result = true;
break;
}
}

for(index_t i=0; i<real_objects_.size(); ++i) {
if(to_delete_ == real_objects_[i]) {
real_objects_.erase(
real_objects_.begin() + std::ptrdiff_t(i)
);
break;
}
}

for(index_t i=0; i<lights_.size(); ++i) {
if(to_delete_ == lights_[i]) {
lights_.erase(lights_.begin() + std::ptrdiff_t(i));
break;
}
}

to_delete_ = nullptr;

for(index_t i=0; i<objects_.size(); ++i) {
if(objects_[i]->draw_gui()) {
result = true;
@@ -1048,7 +1087,18 @@ namespace GEO {
p[2] = 1.0-y;
}
}


inline vec3 random_color() {
vec3 result;
while(length2(result) < 0.1) {
result = vec3(
Numeric::random_float64(),
Numeric::random_float64(),
Numeric::random_float64()
);
}
return result;
}
}


8 changes: 4 additions & 4 deletions src/examples/graphics/demo_Delaunay3d/main.cpp
Original file line number Diff line number Diff line change
@@ -279,11 +279,11 @@ namespace {
);

glupBegin(GLUP_SPHERES);
for(index_t i=0; i<points_.size()/3; ++i) {
for(index_t v=0; v<points_.size()/3; ++v) {
glupVertex4d(
points_[3*i],
points_[3*i+1],
points_[3*i+2],
points_[3*v],
points_[3*v+1],
points_[3*v+2],
R
);
}
Loading

0 comments on commit 05aca7a

Please sign in to comment.