-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
48 lines (39 loc) · 1.83 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
# CMakeLists.txt
# Always set the cmake min version.
cmake_minimum_required(VERSION 3.2)
set (PROJ_NAME "XAtlas_wrap")
set (PROJECT_VERSION "1.0")
set (CMAKE_CXX_STANDARD 11)
# Set the variable PROJ_NAME to whatever your library's name is, PROJECT_VERSION should be a version string like "0.1"
project(${PROJ_NAME} VERSION ${PROJECT_VERSION} LANGUAGES CXX)
# To build shared libraries in Windows, we set CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS to TRUE.
# See https://cmake.org/cmake/help/v3.4/variable/CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS.html
# See https://blog.kitware.com/create-dlls-on-windows-without-declspec-using-new-cmake-export-all-feature/
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
# Create our library target
add_library(${PROJ_NAME} SHARED)
# This will name your output .so files "libsomething.1.0" which is pretty useful
set_target_properties(${PROJ_NAME}
PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION}
)
target_sources(${PROJ_NAME}
PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/XAtlas/xatlas.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/XAtlas/XAtlas_wrap.cxx
)
# Let's set compiler-specific flags
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# G++
target_compile_options(${PROJ_NAME} PRIVATE -Wall -Wextra)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# MSVC
target_compile_options(${PROJ_NAME} PRIVATE /EHsc /MTd /W2 /c)
# Set the DLLEXPORT variable to export symbols
target_compile_definitions(${PROJ_NAME} PRIVATE WIN_EXPORT)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
message(STATUS "Setting Clang flags")
# Activate all clang warnings except those that don't really affect much
target_compile_options(${PROJ_NAME} PRIVATE -Weverything -Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-newline-eof -Wno-padded -Wno-exit-time-destructors -Wno-global-constructors -Wno-constant-conversion)
endif()