Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added CMake support #231

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@
.vs/*
V*/
*.user
Makefile.9
Makefile.9
build/
install/
74 changes: 74 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
cmake_minimum_required(VERSION 3.20)
project(PoissonRecon)

option(BUILD_SHARED_LIB "Builds PoissonRecon as a shared library artifact" OFF)
option(BUILD_EXECUTABLE "Builds PoissonRecon as a command-line application" ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

find_package(Threads REQUIRED)

if (MSVC)
string(JOIN " " CMAKE_CXX_FLAGS_RELEASE
${CMAKE_CXX_FLAGS_RELEASE}
-DRELEASE
-DNOMINMAX
-DWIN32_LEAN_AND_MEAN
/bigobj
)
else()
string(JOIN " " CMAKE_CXX_FLAGS_RELEASE
${CMAKE_CXX_FLAGS_RELEASE}
-DRELEASE
-Ofast
-funroll-loops
-ffast-math
-Wno-deprecated
-Wno-invalid-offsetof
-Wno-dangling-else
)
endif()

string(JOIN " " CMAKE_EXE_LINKER_FLAGS_RELEASE
${CMAKE_EXE_LINKER_FLAGS_RELEASE}
${CMAKE_CXX_FLAGS_RELEASE}
)

file(GLOB_RECURSE SRCS_ZLIB "ZLIB/*.c")
add_library(ZLIB STATIC ${SRCS_ZLIB})

file(GLOB_RECURSE SRCS_PNG "PNG/*.c")
add_library(PNG STATIC ${SRCS_PNG})

file(GLOB_RECURSE SRCS_JPEG "JPEG/*.cpp")
add_library(JPEG STATIC ${SRCS_JPEG})

include_directories(${CMAKE_CURRENT_LIST_DIR} JPEG ZLIB PNG)

if (BUILD_SHARED_LIB)
message(STATUS "PoissonRecon: Building shared library")
add_library(PoissonRecon SHARED Src/PoissonRecon.cpp)
target_link_libraries(PoissonRecon PRIVATE PNG ZLIB JPEG Threads::Threads)
target_compile_definitions(PoissonRecon PRIVATE -Dmain=PoissonRecon)
install(
TARGETS PoissonRecon
EXPORT PoissonRecon
INCLUDES DESTINATION include
FRAMEWORK DESTINATION ${CMAKE_INSTALL_PREFIX}
)
install(
EXPORT PoissonRecon
NAMESPACE PoissonRecon::
DESTINATION lib/cmake/PoissonRecon
)
endif()

if (BUILD_EXECUTABLE)
message(STATUS "PoissonRecon: Building executable")
add_executable(PoissonReconApp Src/PoissonRecon.cpp)
target_link_libraries(PoissonReconApp PRIVATE PNG ZLIB JPEG Threads::Threads)
install(TARGETS PoissonReconApp)
endif()
14 changes: 7 additions & 7 deletions PNG/png.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.2.21 October 4, 2007
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/

#define PNG_INTERNAL
#define PNG_NO_EXTERN
#include "png.h"
#include "PNG/png.h"

/* Generate a compiler error if there is an old png.h in the search path. */
/* Generate a compiler error if there is an old PNG/png.h in the search path. */
typedef version_1_2_29 Your_png_h_is_not_version_1_2_29;

/* Version information for C files. This had better match the version
* string defined in png.h. */
* string defined in PNG/png.h. */

#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
Expand Down Expand Up @@ -68,7 +68,7 @@ PNG_CONST int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};

/* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
* it, uncomment it here and in PNG/png.h
PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/

Expand Down Expand Up @@ -702,10 +702,10 @@ png_get_copyright(png_structp png_ptr)
/* The following return the library version as a short string in the
* format 1.0.0 through 99.99.99zz. To get the version of *.h files
* used with your application, print out PNG_LIBPNG_VER_STRING, which
* is defined in png.h.
* is defined in PNG/png.h.
* Note: now there is no difference between png_get_libpng_ver() and
* png_get_header_ver(). Due to the version_nn_nn_nn typedef guard,
* it is guaranteed that png.c uses the correct version of png.h.
* it is guaranteed that png.c uses the correct version of PNG/png.h.
*/
png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
Expand Down
4 changes: 2 additions & 2 deletions PNG/pngerror.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.2.22 [October 13, 2007]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -14,7 +14,7 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static void /* PRIVATE */
Expand Down
4 changes: 2 additions & 2 deletions PNG/pngget.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.2.15 January 5, 2007
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)

Expand Down
10 changes: 5 additions & 5 deletions PNG/pngmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -15,13 +15,13 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)

/* Borland DOS special memory handler */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* if you change this, be sure to change the one in png.h also */
/* if you change this, be sure to change the one in PNG/png.h also */

/* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */
Expand Down Expand Up @@ -95,7 +95,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,

/* Allocate memory. For reasonable files, size should never exceed
* 64K. However, zlib may allocate more then 64K if you don't tell
* it not to. See zconf.h and png.h for more information. zlib does
* it not to. See zconf.h and PNG/png.h for more information. zlib does
* need to allocate exactly 64K, so whatever you call here must
* have the ability to do that.
*
Expand Down Expand Up @@ -421,7 +421,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,

/* Allocate memory. For reasonable files, size should never exceed
64K. However, zlib may allocate more then 64K if you don't tell
it not to. See zconf.h and png.h for more information. zlib does
it not to. See zconf.h and PNG/png.h for more information. zlib does
need to allocate exactly 64K, so whatever you call here must
have the ability to do that. */

Expand Down
6 changes: 3 additions & 3 deletions PNG/pngpread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#ifdef PNG_PROGRESSIVE_READ_SUPPORTED

Expand Down Expand Up @@ -1004,7 +1004,7 @@ png_read_push_finish_row(png_structp png_ptr)
PNG_CONST int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};

/* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h
* it, uncomment it here and in PNG/png.h
PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/
#endif
Expand Down
8 changes: 4 additions & 4 deletions PNG/pngread.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.2.25 [February 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -12,7 +12,7 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED)

Expand Down Expand Up @@ -118,7 +118,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (user_png_ver)
{
png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
"Application was compiled with PNG/png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
Expand Down Expand Up @@ -200,7 +200,7 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
if (user_png_ver)
{
png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
"Application was compiled with PNG/png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
Expand Down
4 changes: 2 additions & 2 deletions PNG/pngrio.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.2.13 November 13, 2006
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2006 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -16,7 +16,7 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED)

Expand Down
6 changes: 3 additions & 3 deletions PNG/pngrtran.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -14,7 +14,7 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED)

Expand Down Expand Up @@ -1067,7 +1067,7 @@ png_init_read_transformations(png_structp png_ptr)
}
else if (png_ptr->trans[i] != 0xff)
{
/* The png_composite() macro is defined in png.h */
/* The png_composite() macro is defined in PNG/png.h */
png_composite(palette[i].red, palette[i].red,
png_ptr->trans[i], back.red);
png_composite(palette[i].green, palette[i].green,
Expand Down
4 changes: 2 additions & 2 deletions PNG/pngrutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngrutil.c - utilities to read a PNG file
*
* Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -12,7 +12,7 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED)

Expand Down
4 changes: 2 additions & 2 deletions PNG/pngset.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.2.27 [April 29, 2008]
* For conditions of distribution and use, see copyright notice in png.h
* For conditions of distribution and use, see copyright notice in PNG/png.h
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
Expand All @@ -14,7 +14,7 @@
*/

#define PNG_INTERNAL
#include "png.h"
#include "PNG/png.h"

#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)

Expand Down
Loading