-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathCMakeLists.txt
109 lines (94 loc) · 3.44 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
cmake_minimum_required(VERSION 3.1)
project(corto)
option(BUILD_CORTO_CODEC_UNITY "Build the unity codec shared library of corto" ON)
option(BUILD_CORTO_EXE "Build the command line binary of corto" ON)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
SET(CORTO_SOURCE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src)
SET(CORTO_HEADER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include/corto)
SET(LIB_HEADERS
${CORTO_HEADER_PATH}/bitstream.h
${CORTO_HEADER_PATH}/color_attribute.h
${CORTO_HEADER_PATH}/corto.h
${CORTO_HEADER_PATH}/cstream.h
${CORTO_HEADER_PATH}/decoder.h
${CORTO_HEADER_PATH}/encoder.h
${CORTO_HEADER_PATH}/index_attribute.h
${CORTO_HEADER_PATH}/normal_attribute.h
${CORTO_HEADER_PATH}/point.h
${CORTO_HEADER_PATH}/tunstall.h
${CORTO_HEADER_PATH}/vertex_attribute.h
${CORTO_HEADER_PATH}/zpoint.h
${CORTO_SOURCE_PATH}/corto_codec.h)
SET(LIB_SOURCES
${CORTO_SOURCE_PATH}/bitstream.cpp
${CORTO_SOURCE_PATH}/color_attribute.cpp
${CORTO_SOURCE_PATH}/cstream.cpp
${CORTO_SOURCE_PATH}/decoder.cpp
${CORTO_SOURCE_PATH}/encoder.cpp
${CORTO_SOURCE_PATH}/normal_attribute.cpp
${CORTO_SOURCE_PATH}/tunstall.cpp
${CORTO_SOURCE_PATH}/corto_codec.cpp)
SET(EXE_SOURCE
${CORTO_SOURCE_PATH}/main.cpp
${CORTO_SOURCE_PATH}/meshloader.cpp
${CORTO_SOURCE_PATH}/tinyply.cpp)
SET(EXE_HEADERS
${CORTO_SOURCE_PATH}/meshloader.h
${CORTO_SOURCE_PATH}/tinyply.h
${CORTO_SOURCE_PATH}/objload.h)
SET(CORTO_DEFINITIONS "")
if(MSVC)
add_compile_options(/nologo /W3 -D_CRT_SECURE_NO_DEPRECATE)
else()
add_compile_options(-Wall -pedantic)
endif()
ADD_LIBRARY(corto STATIC ${LIB_SOURCES} ${LIB_HEADERS})
target_include_directories(corto PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(corto PRIVATE ${CORTO_HEADER_PATH})
set_target_properties (corto PROPERTIES DEBUG_POSTFIX "d")
INSTALL(TARGETS corto
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
INSTALL(FILES
${CORTO_HEADER_PATH}/bitstream.h
${CORTO_HEADER_PATH}/color_attribute.h
${CORTO_HEADER_PATH}/corto.h
${CORTO_HEADER_PATH}/cstream.h
${CORTO_HEADER_PATH}/decoder.h
${CORTO_HEADER_PATH}/encoder.h
${CORTO_HEADER_PATH}/index_attribute.h
${CORTO_HEADER_PATH}/normal_attribute.h
${CORTO_HEADER_PATH}/point.h
${CORTO_HEADER_PATH}/tunstall.h
${CORTO_HEADER_PATH}/vertex_attribute.h
${CORTO_HEADER_PATH}/zpoint.h
DESTINATION include/corto)
if (BUILD_CORTO_CODEC_UNITY)
ADD_LIBRARY(cortocodec_unity SHARED ${LIB_SOURCES} ${LIB_HEADERS})
target_include_directories(cortocodec_unity PUBLIC ${CORTO_HEADER_PATH})
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
# G++
target_compile_options(cortocodec_unity PRIVATE -Wall -Wextra)
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC")
# MSVC
target_compile_options(cortocodec_unity PRIVATE /EHsc /MTd /W2 /c)
# Set the DLLEXPORT variable to export symbols
target_compile_definitions(cortocodec_unity PRIVATE WIN_EXPORT)
endif()
endif()
if (BUILD_CORTO_EXE)
ADD_EXECUTABLE(cortoexe ${EXE_SOURCE} ${EXE_HEADERS})
target_include_directories(cortoexe PUBLIC ${CORTO_HEADER_PATH})
target_link_libraries(cortoexe PUBLIC corto)
set_target_properties(cortoexe PROPERTIES OUTPUT_NAME "corto")
INSTALL(TARGETS cortoexe
RUNTIME DESTINATION bin
BUNDLE DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif()