-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
67 lines (54 loc) · 2.14 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
cmake_minimum_required(VERSION 3.2)
option(TINY_UI_SAMPLES "The build will create the samples." ON)
PROJECT(tiny_ui)
set(CMAKE_CXX_STANDARD 17)
SET( TUI_VERSION_MAJOR 0 )
SET( TUI_VERSION_MINOR 0 )
SET( TUI_VERSION_PATCH 1 )
SET( TUI_VERSION ${TUI_VERSION_MAJOR}.${TUI_VERSION_MINOR}.${TUI_VERSION_PATCH} )
SET( PROJECT_VERSION "${OSRE_VERSION}" )
# Cache these to allow the user to override them manually.
SET( LIB_INSTALL_DIR "lib" CACHE PATH "Path the built library files are installed to." )
SET( BIN_INSTALL_DIR "bin" CACHE PATH "Path the tool executables are installed to." )
# Set the default build output folders
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib )
SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin )
INCLUDE_DIRECTORIES( BEFORE
${CMAKE_HOME_DIRECTORY}/src
${CMAKE_HOME_DIRECTORY}/contrib/stb_image
)
find_package(SDL2 CONFIG REQUIRED)
find_package(SDL2_image CONFIG REQUIRED)
find_package(SDL2_ttf CONFIG REQUIRED)
SET(CMAKE_CXX_FLAGS "${}")
SET(tinyui_backends_src
src/backends/sdl2_renderer.cpp
src/backends/sdl2_renderer.h
src/backends/sdl2_iodevice.h
src/backends/sdl2_iodevice.cpp
)
SET(tinyui_contrib_stb_image_src
)
SOURCE_GROUP( Backends FILES ${tinyui_backends_src} )
ADD_LIBRARY(tiny_ui
src/tinyui.h
src/tinyui.cpp
src/widgets.cpp
src/widgets.h
${tinyui_backends_src}
)
target_link_libraries(tiny_ui PRIVATE
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
$<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>)
if( TINY_UI_SAMPLES)
ADD_EXECUTABLE(tiny_ui_sample
samples/main.cpp
)
target_link_libraries(tiny_ui_sample
tiny_ui
$<IF:$<TARGET_EXISTS:SDL2::SDL2>,SDL2::SDL2,SDL2::SDL2-static>
$<IF:$<TARGET_EXISTS:SDL2_image::SDL2_image>,SDL2_image::SDL2_image,SDL2_image::SDL2_image-static>
$<IF:$<TARGET_EXISTS:SDL2_ttf::SDL2_ttf>,SDL2_ttf::SDL2_ttf,SDL2_ttf::SDL2_ttf-static>)
endif()