-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
80 lines (63 loc) · 2.2 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
cmake_minimum_required(VERSION 3.12)
project(cpptexturepacker)
set(CMAKE_CXX_STANDARD 17)
find_package(Boost REQUIRED COMPONENTS filesystem)
find_package(CImg CONFIG REQUIRED)
find_package(JPEG REQUIRED)
find_package(libpng CONFIG REQUIRED)
find_path(UTFCPP_INCLUDE_DIR utf8/core.h)
find_path(PLIST_INCLUDE_DIR plist/plist.h)
set(plist_names ${PLIST_NAMES} plist plist-static libplist libplist-static)
if(NOT PLIST_LIBRARY)
find_library(PLIST_LIBRARY NAMES ${plist_names})
endif()
unset(plist_names)
if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
set(PNG_LIBRATY png_static)
else()
set(PNG_LIBRATY png)
endif()
include_directories(include/
${Boost_INCLUDE_DIRS}
${CIMG_INCLUDE_DIR}
${JPEG_INCLUDE_DIR}
${PNG_INCLUDE_DIR}
${PUGIXML_INCLUDE_DIR}
${UTFCPP_INCLUDE_DIR}
${PLIST_INCLUDE_DIR}
)
file(GLOB PROJECT_HEADERS include/*.hpp
include/*.h
)
file(GLOB PROJECT_SOURCES src/*.cpp)
file(GLOB PROJECT_CONFIGS CMakeLists.txt
Readme.md
.gitattributes
.gitignore
.gitmodules)
set(PROJECT_TEST_SOURCES ${PROJECT_SOURCES})
list(REMOVE_ITEM PROJECT_TEST_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp)
source_group("include" FILES ${PROJECT_HEADERS})
source_group("src" FILES ${PROJECT_SOURCES})
add_executable(${PROJECT_NAME} ${PROJECT_HEADERS} ${PROJECT_SOURCES})
target_link_libraries(${PROJECT_NAME} ${JPEG_LIBRARIES})
target_link_libraries(${PROJECT_NAME} ${PNG_LIBRATY})
target_link_libraries(${PROJECT_NAME} ${PLIST_LIBRARY})
target_link_libraries(${PROJECT_NAME} Boost::filesystem)
if(NOT WIN32)
target_link_libraries(${PROJECT_NAME} pthread)
endif()
set_target_properties(
${PROJECT_NAME}
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}
)
add_subdirectory(pybind)
get_filename_component(DATA_PATH
data/
ABSOLUTE)
add_compile_definitions(TEST_DATA_PATH="${DATA_PATH}")
# Unit tests
enable_testing()
add_subdirectory(tests)