forked from karimnaaji/vectiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
63 lines (50 loc) · 2.16 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
cmake_minimum_required(VERSION 2.8.7)
project(vectiler)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
message(STATUS "CXX Flags ${CMAKE_CXX_FLAGS}")
include_directories(${PROJECT_SOURCE_DIR}/src)
file(GLOB_RECURSE C_SOURCES ${PROJECT_SOURCE_DIR}/src/*.c)
file(GLOB_RECURSE VECTILER_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB_RECURSE HEADERS ${PROJECT_SOURCE_DIR}/src/*.h)
set(INCLUDE_DIRS "")
set(LIBS "")
foreach(_headerFile ${HEADERS})
get_filename_component(_dir ${_headerFile} PATH)
list(APPEND INCLUDE_DIRS ${_dir})
endforeach()
list(REMOVE_DUPLICATES INCLUDE_DIRS)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/platform)
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(EXECUTABLE_NAME vectiler)
set(VECTILER_SOURCES ${VECTILER_SOURCES} ${PROJECT_SOURCE_DIR}/platform/windows_httpget.cpp)
else()
set(EXECUTABLE_NAME vectiler.out)
find_package(CURL)
if(CURL_FOUND)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${CURL_INCLUDE_DIR})
set(VECTILER_LIBS ${VECTILER_LIBS} ${CURL_LIBRARIES})
set(VECTILER_SOURCES ${VECTILER_SOURCES} ${PROJECT_SOURCE_DIR}/platform/curl_httpget.cpp)
else()
message(FATAL_ERROR "Could not find the CURL library and development files.")
endif()
endif()
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/3rdparty/glm)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/3rdparty/rapidjson/include)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/3rdparty/earcut.hpp/include)
set(INCLUDE_DIRS ${INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/3rdparty/flag)
include_directories(${INCLUDE_DIRS})
add_library(vectiler_core ${VECTILER_SOURCES})
add_executable(${EXECUTABLE_NAME} ${C_SOURCES})
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_link_libraries(${EXECUTABLE_NAME} ${VECTILER_LIBS} vectiler_core)
else()
target_link_libraries(${EXECUTABLE_NAME} ${VECTILER_LIBS} vectiler_core -lcurl)
endif()
# if (BUILD_TESTS)
# message(STATUS "Build unit tests")
# add_subdirectory(${PROJECT_SOURCE_DIR}/tests)
# endif()