diff --git a/CMake/FindGMP.cmake b/CMake/FindGMP.cmake new file mode 100644 index 0000000..1f02739 --- /dev/null +++ b/CMake/FindGMP.cmake @@ -0,0 +1,21 @@ +# Try to find the GNU Multiple Precision Arithmetic Library (GMP) +# See http://gmplib.org/ + +if (GMP_INCLUDES AND GMP_LIBRARIES) + set(GMP_FIND_QUIETLY TRUE) +endif (GMP_INCLUDES AND GMP_LIBRARIES) + +find_path(GMP_INCLUDES + NAMES + gmp.h + PATHS + $ENV{GMPDIR} + ${INCLUDE_INSTALL_DIR} +) + +find_library(GMP_LIBRARIES gmp PATHS $ENV{GMPDIR} ${LIB_INSTALL_DIR}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GMP DEFAULT_MSG + GMP_INCLUDES GMP_LIBRARIES) +mark_as_advanced(GMP_INCLUDES GMP_LIBRARIES) diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ad99287 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cork) +SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +add_library(cork STATIC + src/file_formats/files.cpp + src/file_formats/ifs.cpp + src/file_formats/off.cpp + src/isct/empty3d.cpp + src/isct/quantization.cpp + src/isct/triangle.c + src/util/log.cpp + src/util/timer.cpp + src/cork.cpp) +add_executable(cork-bin src/main.cpp) +set(INCLUDEDIRS + src/mesh + src/accel/ + src/file_formats/ + src/isct/ + src/math/ + src/mesh/ + src/rawmesh/ + src/util/ +) +target_include_directories(cork PRIVATE ${INCLUDEDIRS}) +target_include_directories(cork-bin PRIVATE ${INCLUDEDIRS}) +SET_TARGET_PROPERTIES(cork-bin PROPERTIES OUTPUT_NAME cork) +find_package(GMP REQUIRED) +target_link_libraries(cork-bin PRIVATE cork gmp) +target_compile_definitions(cork PRIVATE + -DNO_TIMER -DREDUCED -DCDT_ONLY -DTRILIBRARY -DANSI_DECLARATORS ) diff --git a/README.md b/README.md index 49a6755..ec5c495 100644 --- a/README.md +++ b/README.md @@ -10,45 +10,55 @@ Cork is designed with the philosophy that you, the user, don't know and don't ca Cork was developed by Gilbert Bernstein, a computer scientist who has worked on robust geometric intersections in various projects since 2007. He's reasonably confident he knows what he's doing. =D +**_Obsolete:_** +> Installation +> ============ +> +> Dependencies (Mac/Linux) +> ------------ +> +> In order to build Cork on Mac or Linux, you will need Clang 3.1+ and GMP (GNU Multi-Precision arithmetic library). Eventually, Cork will support GCC. If you would like more information, or have special system requirements, please e-mail me: I'm much more likely to extend support to a platform if I receive requests. +> +> Mac +> --- +> +> On OS X 10.8, Clang 3.1+ is the default compiler. If you are using the Homebrew package manager, I recommend installing GMP that way. +> +> Linux +> ----- +> +> Clang/LLVM 3.1 and GMP can be installed via your package manager. +> +> +> Mac/Linux +> ---- +> +> To build the project, type +> +> make +> +> that's it. +> +> +> If the build system is unable to find your GMP installation, please edit the paths in file makeConstants. In general, the project uses a basic makefile. In the event that you have to do something more complicated to get the library to compile, or if you are unable to get it to compile, please e-mail me or open an issue on GitHub. Doing so is much more effective than cursing at your computer, and will save other users trouble in the future. +> +> +> Windows +> ---- +> +> Cork uses C++11, so you will need the most recent compiler; Visual Studio 2012 or higher please. You will also need to install the MPIR arithmetic library into your Visual Studio environment. +> +> Once this is done, you can use the solution and project files in the /win/ subdirectory to build the demo program. The solution/project is not currently configured to build a DLL. Please bug me if this is an issue for you. + Installation ============ -Dependencies (Mac/Linux) ------------- - -In order to build Cork on Mac or Linux, you will need Clang 3.1+ and GMP (GNU Multi-Precision arithmetic library). Eventually, Cork will support GCC. If you would like more information, or have special system requirements, please e-mail me: I'm much more likely to extend support to a platform if I receive requests. - -Mac ---- - -On OS X 10.8, Clang 3.1+ is the default compiler. If you are using the Homebrew package manager, I recommend installing GMP that way. - -Linux ------ - -Clang/LLVM 3.1 and GMP can be installed via your package manager. - - -Mac/Linux ----- - -To build the project, type +Build the library and executable using cmake. For example + mkdir build + cmake .. make -that's it. - - -If the build system is unable to find your GMP installation, please edit the paths in file makeConstants. In general, the project uses a basic makefile. In the event that you have to do something more complicated to get the library to compile, or if you are unable to get it to compile, please e-mail me or open an issue on GitHub. Doing so is much more effective than cursing at your computer, and will save other users trouble in the future. - - -Windows ----- - -Cork uses C++11, so you will need the most recent compiler; Visual Studio 2012 or higher please. You will also need to install the MPIR arithmetic library into your Visual Studio environment. - -Once this is done, you can use the solution and project files in the /win/ subdirectory to build the demo program. The solution/project is not currently configured to build a DLL. Please bug me if this is an issue for you. - Licensing =========