forked from InteractiveComputerGraphics/Discregrid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
executable file
·56 lines (45 loc) · 1.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cmake_minimum_required(VERSION 3.11)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules")
project(Discregrid)
# Visual studio solution directories.
set_property(GLOBAL PROPERTY USE_FOLDERS on)
# 2D SDF generation requires Clipper2 Library by AngusJohnson
option(USE_CLIPPER2 "Use Clipper2 library to enable 2D SDF generation" OFF)
if (USE_CLIPPER2)
# Require C++17 compiler as Clipper2 does
set(CMAKE_CXX_STANDARD 17)
include(FetchContent)
FetchContent_Declare(
clipper2
GIT_REPOSITORY https://github.com/AngusJohnson/Clipper2.git
GIT_TAG 81b01d2acbad7b06fb28df4fbfbd7228519b7905
SOURCE_SUBDIR CPP
)
FetchContent_MakeAvailable(clipper2)
else()
# Require C++11 compiler
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Enable simultaneous compilation of source files.
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250")
endif(MSVC)
OPTION(BUILD_AS_SHARED_LIBS "Build all the libraries as shared" OFF)
if (BUILD_AS_SHARED_LIBS)
set(BUILD_AS_SHARED_LIBS ON)
if(WIN32)
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON CACHE BOOL "Export all symbols")
endif(WIN32)
endif (BUILD_AS_SHARED_LIBS)
set(CMAKE_DEBUG_POSTFIX "_d")
# Put all executables and libraries into a common directory.
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
add_subdirectory(discregrid)
option(BUILD_CMD_EXECUTABLE "Build command line executable" ON)
if(BUILD_CMD_EXECUTABLE)
add_subdirectory(cmd)
endif(BUILD_CMD_EXECUTABLE)