-
Notifications
You must be signed in to change notification settings - Fork 26
/
CMakeLists.txt
157 lines (117 loc) · 4.91 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
get_filename_component(SAMPLE_PROJECT "${CMAKE_CURRENT_SOURCE_DIR}" NAME)
project(${SAMPLE_PROJECT} LANGUAGES C CXX)
MESSAGE( STATUS "Location: " ${CMAKE_CURRENT_SOURCE_DIR} )
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Export compilation data-base
# Target for fetching packages
add_custom_target(fetch_packages)
include(FindPackageHandleStandardArgs)
include(${CMAKE_CURRENT_SOURCE_DIR}/shared.cmake)
find_path(LIBOAUTH_INCLUDE_DIR oauth.h
PATH_SUFFIXES liboauth)
find_library(LIBOAUTH_LIBRARY NAMES oauth)
set(LIBOAUTH_LIBRARIES ${LIBOAUTH_LIBRARY})
set(LIBOAUTH_INCLUDE_DIRS ${LIBOAUTH_INCLUDE_DIR})
find_package_handle_standard_args(liboauth DEFAULT_MSG
LIBOAUTH_LIBRARY LIBOAUTH_INCLUDE_DIR)
mark_as_advanced(LIBOAUTH INCLUDE_DIR LIBOAUTH_LIBRARY)
MESSAGE( STATUS "LIBOAUTH_INCLUDE_DIRS: " ${LIBOAUTH_INCLUDE_DIRS} )
find_package(CURL REQUIRED)
MESSAGE( STATUS "CURL_INCLUDE_DIRS: " ${CURL_INCLUDE_DIRS} )
find_package(OpenGL REQUIRED)
MESSAGE( STATUS "OPENGL_INCLUDE_DIR: " ${OPENGL_INCLUDE_DIR} )
MESSAGE( STATUS "OPENGL_LIBRARIES: " ${OPENGL_LIBRARIES} )
find_package(GLEW REQUIRED)
MESSAGE( STATUS "GLEW_INCLUDE_DIRS: " ${GLEW_INCLUDE_DIRS} )
MESSAGE( STATUS "GLEW_LIBRARIES: " ${GLEW_LIBRARIES} )
if (GLEW_FOUND AND GLEW_CONFIG)
if (NOT DEFINED GLEW_INCLUDE_DIRS OR NOT DEFINED GLEW_LIBRARIES)
MESSAGE( FATAL_ERROR "found a bad GLEW_CONFIG: " ${GLEW_CONFIG} )
endif()
endif()
find_package(SDL2 REQUIRED)
string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
MESSAGE( STATUS "SDL2_INCLUDE_DIRS: " ${SDL2_INCLUDE_DIRS} )
MESSAGE( STATUS "SDL2_LIBRARIES: " ${SDL2_LIBRARIES} )
find_package(SDL2_mixer REQUIRED)
#string(STRIP ${SDLMIXER_LIBRARIES} SDLMIXER_LIBRARIES)
MESSAGE( STATUS "SDLMIXER_INCLUDE_DIR: " ${SDLMIXER_INCLUDE_DIR} )
find_package(range-v3 REQUIRED)
MESSAGE( STATUS "range-v3_INCLUDE_DIRS: " ${range-v3_INCLUDE_DIR} )
find_package(rxcpp REQUIRED)
MESSAGE( STATUS "rxcpp_INCLUDE_DIRS: " ${rxcpp_INCLUDE_DIR} )
find_package(jsoncpp REQUIRED)
MESSAGE( STATUS "jsoncpp_INCLUDE_DIR: " ${jsoncpp_INCLUDE_DIR} )
# define the sources
set(SAMPLE_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui_draw.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui_demo.cpp
${CMAKE_CURRENT_SOURCE_DIR}/imgui/imgui_impl_sdl_gl3.cpp
)
# define the resources
set(SAMPLE_RESOURCES
${CMAKE_CURRENT_SOURCE_DIR}/imgui.ini
${CMAKE_CURRENT_SOURCE_DIR}/NotoMono-Regular.ttf
${CMAKE_CURRENT_SOURCE_DIR}/NotoSansSymbols-Regular.ttf
${CMAKE_CURRENT_SOURCE_DIR}/dot.wav
)
add_executable(${SAMPLE_PROJECT} ${SAMPLE_SOURCES} ${SAMPLE_RESOURCES})
target_compile_options(${SAMPLE_PROJECT} PUBLIC ${SHARED_COMPILE_OPTIONS})
target_compile_features(${SAMPLE_PROJECT} PUBLIC ${SHARED_COMPILE_FEATURES})
target_include_directories(${SAMPLE_PROJECT} PUBLIC
${rxcpp_INCLUDE_DIR}
${range-v3_INCLUDE_DIR}
${LIBOAUTH_INCLUDE_DIRS}
${CURL_INCLUDE_DIRS}
${OPENGL_INCLUDE_DIR}
${SDL2_INCLUDE_DIRS}
${SDLMIXER_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${jsoncpp_INCLUDE_DIR})
target_link_libraries(${SAMPLE_PROJECT}
${CMAKE_THREAD_LIBS_INIT}
${LIBOAUTH_LIBRARY}
${CURL_LIBRARIES}
${OPENGL_LIBRARIES}
${SDL2_LIBRARIES}
${SDLMIXER_LIBRARY}
${GLEW_LIBRARIES})
set_target_properties(${SAMPLE_PROJECT} PROPERTIES MACOSX_BUNDLE TRUE)
set_target_properties(${SAMPLE_PROJECT} PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME TwitterAnalysis)
set_target_properties(${SAMPLE_PROJECT} PROPERTIES MACOSX_BUNDLE_COPYRIGHT "Copyright 2017 Kirk Shoop")
set_source_files_properties(${SAMPLE_RESOURCES} PROPERTIES
HEADER_FILE_ONLY ON
MACOSX_PACKAGE_LOCATION Resources)
# set(Boost_USE_STATIC_LIBS OFF)
# set(Boost_USE_MULTITHREADED ON)
# set(Boost_USE_STATIC_RUNTIME OFF)
# find_package(Boost COMPONENTS thread)
# MESSAGE( STATUS "Boost_VERSION: " ${Boost_VERSION} )
# set(FUTURE_PROJECT
# future)
# add_executable(${FUTURE_PROJECT} future.cpp ${SAMPLE_RESOURCES})
# target_compile_options(${FUTURE_PROJECT} PUBLIC ${SHARED_COMPILE_OPTIONS})
# target_compile_features(${FUTURE_PROJECT} PUBLIC ${SHARED_COMPILE_FEATURES})
# target_compile_definitions(${FUTURE_PROJECT} PUBLIC
# BOOST_THREAD_VERSION=4
# BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION=1)
# target_include_directories(${FUTURE_PROJECT} SYSTEM PUBLIC
# ${Boost_INCLUDE_DIRS}
# ${range-v3_INCLUDE_DIR}
# ${LIBOAUTH_INCLUDE_DIRS}
# ${CURL_INCLUDE_DIRS}
# ${jsoncpp_INCLUDE_DIR})
# target_link_libraries(${FUTURE_PROJECT}
# ${Boost_LIBRARIES}
# ${CMAKE_THREAD_LIBS_INIT}
# ${LIBOAUTH_LIBRARY}
# ${CURL_LIBRARIES})
# configure unit tests via CTest
enable_testing()
set(CTEST_CONFIGURATION_TYPE "${JOB_BUILD_CONFIGURATION}")
add_test(NAME RunTests
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}"
COMMAND ${SAMPLE_PROJECT} ${TEST_ARGS})