cleanup cmake build & dependency situation

This commit is contained in:
Michael Tesch 2019-01-30 16:43:32 +01:00
parent 40eb92fc2b
commit ab219147b1
13 changed files with 384 additions and 310 deletions

View File

@ -22,8 +22,8 @@ jobs: # a collection of steps
- run:
name: Build OpenVnmrJ
command: |
./build.sh -v -sdl2 -gl3
cd Build && make
make sdl2
make glfw
- run:
name: Build Failed
when: on_fail

View File

@ -1,20 +1,17 @@
project(TurboBadger CXX)
cmake_minimum_required(VERSION 3.1)
include(CheckCXXCompilerFlag)
set(CMAKE_CXX_STANDARD 14)
project (TurboBadger CXX)
cmake_minimum_required (VERSION 3.1)
include (CheckCXXCompilerFlag)
set (CMAKE_CXX_STANDARD 14)
option(TB_GET_GLFW "Download and build GLFW as an external project." OFF)
option(TB_GET_SDL2 "Download and build SDL2 as an external project." OFF)
option(TB_BUILD_DEMO_GLFW "Build the Demo application. Depends on glfw." OFF)
option(TB_BUILD_DEMO_SDL2 "Build the Demo application. Depends on SDL2." OFF)
option(TB_DEMO_IN_SRC "Build the demo application in the source directory." ON)
option (TB_BUILD_DEMO_GLFW "Build the Demo application. Depends on glfw." OFF)
option (TB_BUILD_DEMO_SDL2 "Build the Demo application. Depends on SDL2." OFF)
option (TB_BUILD_GLFW "Download and build the GLFW library." OFF)
option (TB_BUILD_SDL2 "Download and build the SDL2 library." OFF)
option (TB_DEBUG_POSTFIX "Add _d postfix for debug builds." OFF)
option (TB_GENERATE_CONFIG "Generate the tb_config.h file from provided parameters in cmake." ON)
option(TB_DEBUG_POSTFIX "Add _d postfix for debug builds." OFF)
option(TB_GENERATE_CONFIG "Generate the tb_config.h file from provided parameters in cmake." ON)
set (CMAKE_BUILD_TYPE "Debug" CACHE STRING "Set build type")
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "RelWithDebInfo")
set (CMAKE_BUILD_TYPE "Release" CACHE STRING "Set build type")
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "RelWithDebInfo")
# Which types to generate for for Xcode and VS, default to Release
if (XCODE OR MSVS)
@ -22,198 +19,272 @@ if (XCODE OR MSVS)
endif (XCODE OR MSVS)
# Configure file options
option(TB_FONT_RENDERER_TBBF "Enable to support TBBF fonts (Turbo Badger Bitmap Fonts)" ON)
option(TB_FONT_RENDERER_FREETYPE "Enable FreeType TB Font. Requires FreeType" OFF)
option(TB_FONT_RENDERER_STB "Enable to support truetype fonts using stb_truetype.h WARNING VERY UNSAFE" OFF)
option(TB_IMAGE_LOADER_STB "Enable to support image loading using stb_image.c" OFF)
option(TB_RENDERER_BATCHER "Enable to get TBRendererBatcher" ON)
option(TB_RENDERER_STUB "Enable stub renderer." OFF)
option(TB_RENDERER_GL "Enable renderer using OpenGL. This renderer depends on TB_RENDERER_BATCHER." OFF)
option(TB_RENDERER_GLES_1 "Enable renderer using OpenGL ES1. This renderer depends on TB_RENDERER_GL." OFF)
option(TB_RENDERER_GLES_2 "Enable renderer using OpenGL ES2. This renderer depends on TB_RENDERER_GL." OFF)
option(TB_RENDERER_GL3 "Enable renderer using OpenGL 3.2. This renderer depends on TB_RENDERER_GL." OFF)
option(TB_IMAGE "Enable support for TBImage, TBImageManager, TBImageWidget." ON)
option (TB_FONT_RENDERER_TBBF "Enable to support TBBF fonts (Turbo Badger Bitmap Fonts)" ON)
option (TB_FONT_RENDERER_FREETYPE "Enable FreeType TB Font. Requires FreeType" OFF)
option (TB_FONT_RENDERER_STB "Enable to support truetype fonts using stb_truetype.h WARNING VERY UNSAFE" OFF)
option (TB_IMAGE_LOADER_STB "Enable to support image loading using stb_image.c" OFF)
option (TB_RENDERER_BATCHER "Enable to get TBRendererBatcher" ON)
option (TB_RENDERER_GL "Enable renderer using OpenGL. This renderer depends on TB_RENDERER_BATCHER." OFF)
option (TB_RENDERER_GLES_1 "Enable renderer using OpenGL ES1. This renderer depends on TB_RENDERER_GL." OFF)
option (TB_RENDERER_GLES_2 "Enable renderer using OpenGL ES2. This renderer depends on TB_RENDERER_GL." OFF)
option (TB_RENDERER_GL3 "Enable renderer using OpenGL 3.2. This renderer depends on TB_RENDERER_GL." OFF)
option (TB_RENDERER_SDL2 "Enable pure SDL2 renderer." OFF)
option (TB_IMAGE "Enable support for TBImage, TBImageManager, TBImageWidget." ON)
# Needs further work
#option(TB_FILE_POSIX "" ON)
#option(TB_SYSTEM "" OFF)
#option(TB_TARGET "" OFF)
include(CMakeDependentOption)
# could try to auto-detect these
cmake_dependent_option(TB_SYSTEM_LINUX "Set System to Linux" OFF
"NOT TB_SYSTEM_WINDOWS;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_MACOSX" OFF)
cmake_dependent_option(TB_SYSTEM_ANDROID "Set System to Android" OFF
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_WINDOWS;NOT TB_SYSTEM_MACOSX" OFF)
cmake_dependent_option(TB_SYSTEM_WINDOWS "Set System to Windows" OFF
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_MACOSX" OFF)
cmake_dependent_option(TB_SYSTEM_MACOSX "Set System to MacOSX" OFF
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_WINDOWS" OFF)
cmake_dependent_option(TB_CLIPBOARD_DUMMY "Clipboard Dummy" OFF
"NOT TB_CLIPBOARD_GLFW; NOT TB_CLIPBOARD_WINDOWS; NOT TB_CLIPBOARD_SDL2" OFF)
cmake_dependent_option(TB_CLIPBOARD_GLFW "Clipboard GLFW" OFF
"NOT TB_CLIPBOARD_DUMMY; NOT TB_CLIPBOARD_WINDOWS; NOT TB_CLIPBOARD_SDL2" OFF)
cmake_dependent_option(TB_CLIPBOARD_WINDOWS "Clipboard WINDOWS" OFF
"NOT TB_CLIPBOARD_GLFW; NOT TB_CLIPBOARD_DUMMY; NOT TB_CLIPBOARD_SDL2" OFF)
cmake_dependent_option(TB_CLIPBOARD_SDL2 "Clipboard SDL2" OFF
"NOT TB_CLIPBOARD_GLFW; NOT TB_CLIPBOARD_WINDOWS; NOT TB_CLIPBOARD_DUMMY" OFF)
# Needs further work option (TB_FILE_POSIX "" ON) option (TB_SYSTEM "" OFF) option (TB_TARGET "" OFF)
include (CMakeDependentOption)
# Runtime/subsystem configurations
if(TB_BUILD_DEMO_GLFW)
set(TB_CLIPBOARD_GLFW ON)
set(TB_IMAGE_LOADER_STB ON)
if(TB_BUILD_DEMO_SDL2)
message(FATAL_ERROR "Can not specify both TB_BUILD_DEMO_GLFW and TB_BUILD_DEMO_SDL")
endif(TB_BUILD_DEMO_SDL2)
elseif(TB_BUILD_DEMO_SDL2)
set(TB_CLIPBOARD_SDL2 ON)
set(TB_SYSTEM_SDL ON)
set(TB_IMAGE_LOADER_STB ON)
endif(TB_BUILD_DEMO_GLFW)
if (TB_BUILD_DEMO_GLFW)
set (TB_BUILD_GLFW ON)
set (TB_CLIPBOARD_GLFW ON)
set (TB_IMAGE_LOADER_STB ON)
if (TB_BUILD_DEMO_SDL2)
message (FATAL_ERROR "Can not specify both TB_BUILD_DEMO_GLFW and TB_BUILD_DEMO_SDL2")
endif (TB_BUILD_DEMO_SDL2)
elseif (TB_BUILD_DEMO_SDL2)
if (NOT EMSCRIPTEN)
set (TB_BUILD_SDL2 ON)
endif (NOT EMSCRIPTEN)
set (TB_CLIPBOARD_SDL2 ON)
set (TB_SYSTEM_SDL2 ON)
set (TB_IMAGE_LOADER_STB ON)
endif (TB_BUILD_DEMO_GLFW)
# could try to auto-detect these
cmake_dependent_option (TB_SYSTEM_LINUX "Set System to Linux" ON
"NOT TB_SYSTEM_WINDOWS;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_MACOSX;NOT TB_SYSTEM_SDL2" OFF)
cmake_dependent_option (TB_SYSTEM_ANDROID "Set System to Android" ON
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_WINDOWS;NOT TB_SYSTEM_MACOSX;NOT TB_SYSTEM_SDL2" OFF)
cmake_dependent_option (TB_SYSTEM_WINDOWS "Set System to Windows" ON
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_MACOSX;NOT TB_SYSTEM_SDL2" OFF)
cmake_dependent_option (TB_SYSTEM_MACOSX "Set System to MacOSX" ON
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_WINDOWS;NOT TB_SYSTEM_SDL2" OFF)
cmake_dependent_option (TB_SYSTEM_SDL2 "Set System to SDL2" ON
"NOT TB_SYSTEM_LINUX;NOT TB_SYSTEM_ANDROID;NOT TB_SYSTEM_WINDOWS;NOT TB_SYSTEM_MACOSX" OFF)
cmake_dependent_option (TB_CLIPBOARD_DUMMY "Clipboard Dummy" ON
"NOT TB_CLIPBOARD_GLFW; NOT TB_CLIPBOARD_WINDOWS; NOT TB_CLIPBOARD_SDL2" OFF)
cmake_dependent_option (TB_CLIPBOARD_GLFW "Clipboard GLFW" ON
"NOT TB_CLIPBOARD_DUMMY; NOT TB_CLIPBOARD_WINDOWS; NOT TB_CLIPBOARD_SDL2" OFF)
cmake_dependent_option (TB_CLIPBOARD_WINDOWS "Clipboard WINDOWS" ON
"NOT TB_CLIPBOARD_GLFW; NOT TB_CLIPBOARD_DUMMY; NOT TB_CLIPBOARD_SDL2" OFF)
cmake_dependent_option (TB_CLIPBOARD_SDL2 "Clipboard SDL2" ON
"NOT TB_CLIPBOARD_GLFW; NOT TB_CLIPBOARD_WINDOWS; NOT TB_CLIPBOARD_DUMMY" OFF)
# System defaults
if(TB_SYSTEM_ANDROID)
set(TB_SYSTEM_CONFIG "#define TB_SYSTEM_ANDROID")
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_DUMMY")
endif()
if(TB_SYSTEM_LINUX)
set(TB_FILE_CONFIG "#define TB_FILE_POSIX")
set(TB_SYSTEM_CONFIG "#define TB_SYSTEM_LINUX")
set(TB_TARGET_CONFIG "#define TB_TARGET_LINUX")
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_GLFW")
endif()
if(TB_SYSTEM_MACOSX)
set(TB_FILE_CONFIG "#define TB_FILE_POSIX")
set(TB_SYSTEM_CONFIG "#define TB_SYSTEM_LINUX")
set(TB_TARGET_CONFIG "#define TB_TARGET_MACOSX")
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_GLFW")
endif()
if(TB_SYSTEM_WINDOWS)
set(TB_FILE_CONFIG "#define TB_FILE_POSIX")
set(TB_SYSTEM_CONFIG "#define TB_SYSTEM_WINDOWS")
set(TB_TARGET_CONFIG "#define TB_TARGET_WINDOWS")
endif()
if(TB_SYSTEM_SDL)
set(TB_FILE_CONFIG "#define TB_FILE_POSIX")
set(TB_SYSTEM_CONFIG "#define TB_SYSTEM_SDL")
set(TB_TARGET_CONFIG "#define TB_TARGET_CUSTOM")
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_SDL2")
endif()
if (TB_SYSTEM_ANDROID)
set (TB_SYSTEM_CONFIG "#define TB_SYSTEM_ANDROID")
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_DUMMY")
endif ()
if (TB_SYSTEM_LINUX)
set (TB_FILE_CONFIG "#define TB_FILE_POSIX")
set (TB_SYSTEM_CONFIG "#define TB_SYSTEM_LINUX")
set (TB_TARGET_CONFIG "#define TB_TARGET_LINUX")
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_GLFW")
endif ()
if (TB_SYSTEM_MACOSX)
set (TB_FILE_CONFIG "#define TB_FILE_POSIX")
set (TB_SYSTEM_CONFIG "#define TB_SYSTEM_LINUX")
set (TB_TARGET_CONFIG "#define TB_TARGET_MACOSX")
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_GLFW")
endif ()
if (TB_SYSTEM_WINDOWS)
set (TB_FILE_CONFIG "#define TB_FILE_POSIX")
set (TB_SYSTEM_CONFIG "#define TB_SYSTEM_WINDOWS")
set (TB_TARGET_CONFIG "#define TB_TARGET_WINDOWS")
endif ()
if (TB_SYSTEM_SDL2)
set (TB_FILE_CONFIG "#define TB_FILE_POSIX")
set (TB_SYSTEM_CONFIG "#define TB_SYSTEM_SDL2")
set (TB_TARGET_CONFIG "#define TB_TARGET_CUSTOM")
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_SDL2")
endif ()
# Clipboard
if(TB_CLIPBOARD_DUMMY)
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_DUMMY")
endif()
if(TB_CLIPBOARD_GLFW)
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_GLFW")
endif()
if(TB_CLIPBOARD_WINDOWS)
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_WINDOWS")
endif()
if(TB_CLIPBOARD_SDL2)
set(TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_SDL2")
endif()
if (TB_CLIPBOARD_DUMMY)
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_DUMMY")
endif ()
if (TB_CLIPBOARD_GLFW)
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_GLFW")
endif ()
if (TB_CLIPBOARD_WINDOWS)
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_WINDOWS")
endif ()
if (TB_CLIPBOARD_SDL2)
set (TB_CLIPBOARD_CONFIG "#define TB_CLIPBOARD_SDL2")
endif ()
if(TB_FILE_POSIX)
set(TB_FILE_CONFIG "#define TB_FILE_POSIX")
endif()
if(TB_DEBUG_POSTFIX)
set(CMAKE_DEBUG_POSTFIX _d)
endif()
if(TB_FONT_RENDERER_TBBF)
set(TB_FONT_RENDERER_TBBF_CONFIG "#define TB_FONT_RENDERER_TBBF")
endif()
if(TB_FONT_RENDERER_FREETYPE)
set(TB_FONT_RENDERER_FREETYPE_CONFIG "#define TB_FONT_RENDERER_FREETYPE")
find_package(FreeType REQUIRED)
endif()
if(TB_FONT_RENDERER_STB)
set(TB_FONT_RENDERER_STB_CONFIG "#define TB_FONT_RENDERER_STB")
endif()
if(TB_IMAGE_LOADER_STB)
set(TB_IMAGE_LOADER_STB_CONFIG "#define TB_IMAGE_LOADER_STB")
endif()
if(TB_RENDERER_BATCHER)
set(TB_RENDERER_BATCHER_CONFIG "#define TB_RENDERER_BATCHER")
endif()
if(TB_RENDERER_STUB)
set(TB_RENDERER_STUB_CONFIG "#define TB_RENDERER_STUB")
endif()
if(TB_RENDERER_GL)
set(TB_RENDERER_GL_CONFIG "#define TB_RENDERER_GL")
endif()
if(TB_RENDERER_GLES_1)
set(TB_RENDERER_GLES_1_CONFIG "#define TB_RENDERER_GLES_1")
endif()
if(TB_RENDERER_GLES_2)
set(TB_RENDERER_GLES_2_CONFIG "#define TB_RENDERER_GLES_2")
endif()
if(TB_RENDERER_GL3)
set(TB_RENDERER_GL3_CONFIG "#define TB_RENDERER_GL3")
endif()
if(TB_IMAGE)
set(TB_IMAGE_CONFIG "#define TB_IMAGE")
endif()
if (TB_FILE_POSIX)
set (TB_FILE_CONFIG "#define TB_FILE_POSIX")
endif ()
if (TB_DEBUG_POSTFIX)
set (CMAKE_DEBUG_POSTFIX _d)
endif ()
if (TB_FONT_RENDERER_TBBF)
set (TB_FONT_RENDERER_TBBF_CONFIG "#define TB_FONT_RENDERER_TBBF")
endif ()
if (TB_FONT_RENDERER_FREETYPE)
set (TB_FONT_RENDERER_FREETYPE_CONFIG "#define TB_FONT_RENDERER_FREETYPE")
find_package (FreeType REQUIRED)
endif ()
if (TB_FONT_RENDERER_STB)
set (TB_FONT_RENDERER_STB_CONFIG "#define TB_FONT_RENDERER_STB")
endif ()
if (TB_IMAGE_LOADER_STB)
set (TB_IMAGE_LOADER_STB_CONFIG "#define TB_IMAGE_LOADER_STB")
endif ()
if (TB_RENDERER_BATCHER)
set (TB_RENDERER_BATCHER_CONFIG "#define TB_RENDERER_BATCHER")
endif ()
if (TB_RENDERER_STUB)
set (TB_RENDERER_STUB_CONFIG "#define TB_RENDERER_STUB")
endif ()
if (TB_RENDERER_GL)
set (TB_RENDERER_GL_CONFIG "#define TB_RENDERER_GL")
endif ()
if (TB_RENDERER_GLES_1)
set (TB_RENDERER_GLES_1_CONFIG "#define TB_RENDERER_GLES_1")
endif ()
if (TB_RENDERER_GLES_2)
set (TB_RENDERER_GLES_2_CONFIG "#define TB_RENDERER_GLES_2")
endif ()
if (TB_RENDERER_GL3)
set (TB_RENDERER_GL3_CONFIG "#define TB_RENDERER_GL3")
endif ()
if (TB_IMAGE)
set (TB_IMAGE_CONFIG "#define TB_IMAGE")
endif ()
configure_file(tb_config.h.in src/tb/tb_config.h)
if (TB_GENERATE_CONFIG)
configure_file (tb_config.h.in src/tb/tb_config.h)
endif (TB_GENERATE_CONFIG)
if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-exceptions -fno-rtti -Wall -Wextra -Wno-unused-parameter")
endif()
if (${CMAKE_CXX_COMPILER_ID} MATCHES "GNU" OR ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -fno-exceptions -fno-rtti -Wall -Wextra -Wno-unused-parameter")
endif ()
if(APPLE)
add_definitions(-DMACOSX)
endif(APPLE)
if (APPLE)
add_definitions (-DMACOSX)
endif (APPLE)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
# Remove exception handling
STRING(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Remove rtti
STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
endif(MSVC)
if (MSVC)
add_definitions (-D_CRT_SECURE_NO_WARNINGS)
add_definitions (-D_CRT_NONSTDC_NO_DEPRECATE)
# Remove exception handling
string (REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
# Remove rtti
string (REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
endif (MSVC)
if(EMSCRIPTEN)
set(CMAKE_EXECUTABLE_SUFFIX ".html")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -Oz") # optional
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FULL_ES2=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EVAL_CTORS=1")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
elseif(TB_BUILD_DEMO_SDL2)
include(FindPkgConfig)
pkg_search_module(SDL2 REQUIRED sdl2)
set(SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIRS}")
include_directories(${SDL2_INCLUDE_DIRS})
link_directories(${SDL2_LIBRARY_DIRS})
endif(EMSCRIPTEN)
if (EMSCRIPTEN)
set (CMAKE_EXECUTABLE_SUFFIX ".html")
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -Oz") # optional
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 ")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_SDL=2")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s FULL_ES2=1")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s EVAL_CTORS=1")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s NO_EXIT_RUNTIME=1")
set (TB_SYSTEM_SDL2 ON)
endif (EMSCRIPTEN)
#
# Look for libraries
if (TB_CLIPBOARD_GLFW)
if (NOT TB_BUILD_GLFW)
# Add glfw and gl libs on MacOSX
if (APPLE)
find_library (GLFW_LIBRARIES glfw)
set (EXTRA_LIBS ${EXTRA_LIBS} ${GLFW_LIBRARIES})
find_path (GLFW_INCLUDE_DIRS GLFW/glfw3.h)
else (APPLE)
find_library (GLFW_LIBRARIES glfw)
endif (APPLE)
endif (NOT TB_BUILD_GLFW)
endif (TB_CLIPBOARD_GLFW)
if (TB_SYSTEM_SDL2)
if (NOT TB_BUILD_SDL2 AND NOT EMSCRIPTEN)
include (FindPkgConfig)
pkg_search_module (SDL2 REQUIRED sdl2)
set (SDL2_INCLUDE_DIRS "${SDL2_INCLUDE_DIRS}")
include_directories (${SDL2_INCLUDE_DIRS})
link_directories (${SDL2_LIBRARY_DIRS})
if (APPLE)
find_library (SDL2_LIBRARIES SDL2)
find_path (SDL2_INCLUDE_DIRS SDL.h)
set (EXTRA_LIBS ${EXTRA_LIBS} ${SDL2_LIBRARIES})
else (APPLE)
find_library (SDL2_LIBRARIES SDL2)
find_path (SDL2_INCLUDE_DIRS "SDL2/SDL.h" PATH_SUFFIXES "" "SDL2")
endif (APPLE)
endif (NOT TB_BUILD_SDL2 AND NOT EMSCRIPTEN)
endif (TB_SYSTEM_SDL2)
if (TB_RENDERER_GL)
find_package (OpenGL REQUIRED)
set (EXTRA_LIBS ${EXTRA_LIBS} ${OPENGL_LIBRARY})
endif (TB_RENDERER_GL)
#
# Add thirdparty dependencies
#
file (MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/thirdparty")
# Generator name
if (NOT "${CMAKE_EXTRA_GENERATOR}" STREQUAL "")
set (GENERATOR_STRING "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else ()
set (GENERATOR_STRING "${CMAKE_GENERATOR}")
endif ()
# Configure the thirdparty build directory
execute_process (
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/thirdparty"
COMMAND ${CMAKE_COMMAND} -G${GENERATOR_STRING} -DANDROID=${ANDROID} -DCMAKE_CONFIGURATION_TYPES=${CMAKE_CONFIGURATION_TYPES} -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM} -DTB_BUILD_GLFW=${TB_BUILD_GLFW} -DTB_BUILD_SDL2=${TB_BUILD_SDL2} ${CMAKE_SOURCE_DIR}/thirdparty
RESULT_VARIABLE THIRDPARTY_CONFIG_RESULT
)
if (THIRDPARTY_CONFIG_RESULT)
message (FATAL_ERROR "Configuring dependencies failed: ${THIRDPARTY_CONFIG_RESULT}")
endif ()
# Build the thirdparty directory
execute_process (
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/thirdparty"
COMMAND "${CMAKE_COMMAND}" --build .
RESULT_VARIABLE THIRDPARTY_BUILD_RESULT
)
if (THIRDPARTY_BUILD_RESULT)
message (FATAL_ERROR "Building dependencies failed: ${THIRDPARTY_BUILD_RESULT}")
endif ()
# Include the now-built thirdparty dependencies
add_subdirectory (thirdparty)
# Add TurboBadgerLib project
include_directories("${PROJECT_BINARY_DIR}/src/tb")
include_directories("${PROJECT_SOURCE_DIR}/src/tb")
add_subdirectory(src/tb)
include_directories ("${PROJECT_BINARY_DIR}/src/tb")
include_directories ("${PROJECT_SOURCE_DIR}/src/tb")
add_subdirectory (src/tb)
# Add Demo project
if(TB_BUILD_DEMO_GLFW OR TB_BUILD_DEMO_SDL2)
add_subdirectory(Demo)
endif(TB_BUILD_DEMO_GLFW OR TB_BUILD_DEMO_SDL2)
if (TB_BUILD_DEMO_GLFW OR TB_BUILD_DEMO_SDL2)
add_subdirectory (Demo)
endif (TB_BUILD_DEMO_GLFW OR TB_BUILD_DEMO_SDL2)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/tb
DESTINATION include
PATTERN "*.cpp" EXCLUDE
PATTERN "*.mm" EXCLUDE
PATTERN "*.txt" EXCLUDE
PATTERN "test files" EXCLUDE
PATTERN "*.h"
)
install (
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/tb
DESTINATION include
PATTERN "*.cpp" EXCLUDE
PATTERN "*.mm" EXCLUDE
PATTERN "*.txt" EXCLUDE
PATTERN "test files" EXCLUDE
PATTERN "*.h"
)
# Generate Doxygen documentation
configure_file(${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
add_custom_target(doc
configure_file (${CMAKE_SOURCE_DIR}/doc/Doxyfile.in ${CMAKE_BINARY_DIR}/doc/Doxyfile)
add_custom_target (doc
COMMAND doxygen ${CMAKE_BINARY_DIR}/doc/Doxyfile
# COMMAND open doc/html/index.html
)
# COMMAND open doc/html/index.html
)

View File

@ -15,26 +15,6 @@ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
include (ExternalProject)
if (TB_GET_GLFW)
ExternalProject_Add (GLFWEXT
PREFIX GLFWEXT
GIT_REPOSITORY "https://github.com/glfw/glfw.git"
GIT_TAG "3.2.1"
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON
)
ExternalProject_Get_Property (GLFWEXT source_dir)
set (GLFW_SRC_DIR "${source_dir}")
set (GLFW_INCLUDE_DIRS "${source_dir}/include")
else (TB_GET_GLFW)
set (GLFW_SRC_DIR "thirdparty/glfw/")
set (GLFW_INCLUDE_DIRS "thirdparty/glfw/include/")
endif (TB_GET_GLFW)
if(TB_BUILD_DEMO_GLFW)
if(CMAKE_SYSTEM MATCHES "Windows")
add_definitions(-DGLFW_EXPOSE_NATIVE_WIN32)
@ -51,30 +31,6 @@ if(TB_BUILD_DEMO_GLFW)
./platform/glfw_extra_linux.cpp
./platform/Application.cpp)
include_directories(".")
if (NOT TB_GET_GLFW)
# Add glfw and gl libs on MacOSX
if(APPLE)
find_library(GLFW_LIBRARIES glfw )
find_library(OPENGL_LIBRARY OpenGL )
set(EXTRA_LIBS ${EXTRA_LIBS} ${OPENGL_LIBRARY} ${GLFW_LIBRARIES})
find_path(GLFW_INCLUDE_DIRS GLFW/glfw3.h)
endif(APPLE)
endif (NOT TB_GET_GLFW)
if(NOT GLFW_LIBRARIES)
# Configure glfw
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "just want glfw library" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "just want glfw library" FORCE)
set(GLFW_CLIENT_LIBRARY opengl CACHE STRING "client to use for glfw" FOR) # glesv1, glesv2
set(GLFW_INSTALL OFF CACHE BOOL "just want glfw library" FORCE)
#set(GLFW_USE_OPTIMUS_HPG ON "just want glfw library")
add_subdirectory(${GLFW_SRC_DIR})
set(EXTRA_LIBS ${EXTRA_LIBS} glfw ${GLFW_LIBRARIES})
endif(NOT GLFW_LIBRARIES)
target_include_directories(TurboBadgerLib PUBLIC ${GLFW_INCLUDE_DIRS})
include_directories(${GLFW_INCLUDE_DIRS})
# Platform specific
@ -89,40 +45,10 @@ if(TB_BUILD_DEMO_GLFW)
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endif(TB_BUILD_DEMO_GLFW)
if (TB_GET_SDL2)
set (SDL_VERSION 2.0.8)
set (SDL_VERSION_HASH 3800d705cef742c6a634f202c37f263f)
set (SDL_VERSION 2.0.5)
set (SDL_VERSION_HASH d4055424d556b4a908aa76fad63abd3c)
message ("Building SDL2 Locally")
set (SDL2_configure_args --disable-shared )
# --disable-loadso --disable-cpuinfo --disable-atomic --disable-sdl-dlopen
if (APPLE)
message ("Wouldn't you rather build the Framework?")
set (SDL2_configure_args ${SDL2_configure_args} --without-x)
set (SDL2_configure_args ${SDL2_configure_args} "CFLAGS=-mmacosx-version-min=10.9")
endif ()
ExternalProject_Add (SDL2EXT
URL https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz
URL_HASH "MD5=${SDL_VERSION_HASH}"
PREFIX SDL2
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${SDL2_configure_args} --prefix=<INSTALL_DIR>
INSTALL_COMMAND make install
)
ExternalProject_Get_Property (SDL2EXT INSTALL_DIR)
set (SDL2_INSTALL_DIR ${INSTALL_DIR})
add_library (SDL2_LIBRARY STATIC IMPORTED GLOBAL)
set_property (TARGET SDL2_LIBRARY PROPERTY IMPORTED_LOCATION ${SDL2_INSTALL_DIR}/lib/libSDL2.a)
set (SDL2_LIBRARIES dl SDL2_LIBRARY dl pthread) # ${SDL2_LIBRARIES}
set (SDL2_INCLUDE_DIRS "${SDL2_INSTALL_DIR}/include/SDL2")
set (SDL2_INSTALL_DIR ${INSTALL_DIR})
endif(TB_GET_SDL2)
if(TB_BUILD_DEMO_SDL2)
# Add sources
set(LOCAL_SRCS "")
aux_source_directory(./demo01 LOCAL_SRCS)
set(LOCAL_SRCS ${LOCAL_SRCS}
@ -140,20 +66,8 @@ if(TB_BUILD_DEMO_SDL2)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file ${CMAKE_SOURCE_DIR}/src/tb/tests/test_tb_parser_included.tb.txt@/")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --preload-file ${CMAKE_SOURCE_DIR}/src/tb/tests/test_tb_parser_definitions.tb.txt@/")
elseif(NOT TB_GET_SDL2 AND NOT EMSCRIPTEN)
if(APPLE)
find_package(OpenGL REQUIRED)
find_library(SDL2_LIBRARIES SDL2)
find_path(SDL2_INCLUDE_DIRS SDL.h)
set(EXTRA_LIBS ${EXTRA_LIBS} ${OPENGL_LIBRARY} ${SDL2_LIBRARIES} )
else(APPLE)
find_library(OPENGL_LIBRARY GL PATHS "/usr/lib64/nvidia" )
find_library(SDL2_LIBRARIES SDL2 HINTS "$ENV{HOME}/local/lib")
find_path(SDL2_INCLUDE_DIRS "SDL2/SDL.h"
HINTS "$ENV{HOME}/local/include/"
PATH_SUFFIXES "" "SDL2")
set(EXTRA_LIBS ${EXTRA_LIBS} ${OPENGL_LIBRARY} ${SDL2_LIBRARIES} )
endif (APPLE)
include_directories(${SDL2_INCLUDE_DIRS})
set (EXTRA_LIBS ${EXTRA_LIBS} ${OPENGL_LIBRARY} ${SDL2_LIBRARIES} )
include_directories (${SDL2_INCLUDE_DIRS})
endif(EMSCRIPTEN)
# Platform specific
@ -169,13 +83,13 @@ if(TB_BUILD_DEMO_SDL2)
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
if(EMSCRIPTEN)
add_custom_command(TARGET TurboBadgerDemoSDL
if (EMSCRIPTEN)
add_custom_command (TARGET TurboBadgerDemoSDL
PRE_LINK
COMMAND rm -rf /tmp/resources /tmp/demo01
COMMAND rsync -av --exclude='*.psd' ${CMAKE_SOURCE_DIR}/resources /tmp/
COMMAND rsync -av --include='*/' --include='*.txt' --include='*.png' --exclude='*' ${CMAKE_CURRENT_SOURCE_DIR}/demo01 /tmp )
endif(EMSCRIPTEN)
COMMAND rsync -a --exclude='*.psd' ${CMAKE_SOURCE_DIR}/resources /tmp/
COMMAND rsync -a --include='*/' --include='*.txt' --include='*.png' --exclude='*' ${CMAKE_CURRENT_SOURCE_DIR}/demo01 /tmp )
endif (EMSCRIPTEN)
endif(TB_BUILD_DEMO_SDL2)
endif (TB_BUILD_DEMO_SDL2)

View File

@ -11,7 +11,7 @@ bool port_main(int argc, char* argv[])
#ifdef TB_CLIPBOARD_GLFW
AppBackendGLFW *backend = new AppBackendGLFW();
#endif
#ifdef TB_SYSTEM_SDL
#ifdef TB_SYSTEM_SDL2
AppBackendSDL2 *backend = new AppBackendSDL2();
#endif

View File

@ -1,7 +1,7 @@
// -*- Mode: C++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-
#include "Application.h"
#ifdef TB_SYSTEM_SDL
#ifdef TB_SYSTEM_SDL2
#include "tb_widgets.h"
#include "renderers/tb_renderer_gl.h"

View File

@ -1,11 +1,16 @@
all: glfw sdl2 em
glfw:
[ -d BuildGLFW ] || ./build.sh -glfw -gl
cd BuildGLFW && $(MAKE)
sdl:
cd BuildSDL && $(MAKE)
sdl2:
[ -d BuildSDL2 ] || ./build.sh -sdl2 -gl3
cd BuildSDL2 && $(MAKE)
em:
[ -d BuildEmsc ] || ./build.sh -em -gles2
cd BuildEmsc && $(MAKE)
xc:
@ -14,6 +19,9 @@ xc:
ios:
cd Build-iOS && xcrun xcodebuild -project "turbobadger.xcodeproj" -target turbobadger
%:
cd Build && $(MAKE) $@
and:
cd DemoAndroid && ninja
#%:
# cd Build && $(MAKE) $@
#

View File

@ -27,11 +27,11 @@ usage:
-o [dir] change build directory
-gl build for open gl
-gl3 build for open gl3 (use with -sdl)
-gles2 build for open gles2 (use with -sdl)
-gl3 build for open gl3 (use with -sdl2)
-gles2 build for open gles2 (use with -sdl2)
-em build for emscripten
-sdl build for sdl
-sdl2 build for sdl2
-glfw build for glfw
-v be more verbose
@ -59,7 +59,7 @@ while [ $# -gt 0 ]; do
BUILD_DIR="BuildEmsc"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_BUILD_DEMO_SDL2=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_BUILD_DEMO_GLFW=OFF"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_SYSTEM_SDL=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_SYSTEM_SDL2=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_SYSTEM_LINUX=ON"
source ${HOME}/local/emsdk/emsdk_env.sh
#${EMSCRIPTEN}/emcc --clear-cache --clear-ports
@ -67,11 +67,11 @@ while [ $# -gt 0 ]; do
#CMAKE_FLAGS="${CMAKE_FLAGS} -G Unix Makefiles"
;;
-sdl*)
BUILD_DIR="BuildSDL"
BUILD_DIR="BuildSDL2"
#CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_GET_SDL2=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_BUILD_DEMO_SDL2=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_BUILD_DEMO_GLFW=OFF"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_SYSTEM_SDL=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_SYSTEM_SDL2=ON"
CMAKE_FLAGS="${CMAKE_FLAGS} -DTB_SYSTEM_LINUX=ON"
;;
-glfw)

View File

@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required (VERSION 2.8)
set (LOCAL_SRCS
tb_bitmap_fragment.cpp
@ -70,15 +70,18 @@ set (LOCAL_SRCS
utf8/utf8.cpp
)
if(TB_BUILD_DEMO_GLFW OR TB_BUILD_DEMO_SDL2)
file(GLOB SRCS tests/*.cpp)
set(LOCAL_SRCS ${LOCAL_SRCS} ${SRCS})
endif()
if (TB_BUILD_DEMO_GLFW OR TB_BUILD_DEMO_SDL2)
file (GLOB SRCS tests/*.cpp)
set (LOCAL_SRCS ${LOCAL_SRCS} ${SRCS})
endif ()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_property(SOURCE tb_image_loader_stb.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function")
set_property (SOURCE tb_image_loader_stb.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-unused-function")
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_library(TurboBadgerLib STATIC ${LOCAL_SRCS})
add_library (TurboBadgerLib STATIC ${LOCAL_SRCS})
target_include_directories (TurboBadgerLib PUBLIC ${GLFW_INCLUDE_DIRS})
target_include_directories (TurboBadgerLib PUBLIC ${SDL2_INCLUDE_DIRS})
if (NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
install (TARGETS TurboBadgerLib

View File

@ -58,7 +58,7 @@ int TBSystem::GetDPI()
return 96;
}
#ifndef TB_SYSTEM_SDL
#ifndef TB_SYSTEM_SDL2
const char * TBSystem::GetRoot()
{
return "./";

View File

@ -6,7 +6,7 @@
#include "tb_system.h"
#include <iostream>
#ifdef TB_SYSTEM_SDL
#ifdef TB_SYSTEM_SDL2
#include "tb_msg.h"
#include "tb_types.h"
@ -228,4 +228,4 @@ const char * TBSystem::GetRoot()
} // namespace tb
#endif // TB_SYSTEM_SDL
#endif // TB_SYSTEM_SDL2

View File

@ -75,7 +75,6 @@ void TBTabContainer::SetAxis(AXIS axis)
void TBTabContainer::SetValue(long index)
{
TBDebugPrint("Tab old: %d, active: %ld\n", m_current_page, index);
if (index == m_current_page)
return;
m_current_page = index;

View File

@ -122,7 +122,7 @@ ${TB_SYSTEM_CONFIG}
//#define TB_SYSTEM_LINUX
//#define TB_SYSTEM_WINDOWS
//#define TB_SYSTEM_ANDROID
//#define TB_SYSTEM_SDL
//#define TB_SYSTEM_SDL2
/** Defines for additional platform specific issues. */
${TB_TARGET_CONFIG}

79
thirdparty/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,79 @@
#
# CMake file for turbobadger dependencies
#
cmake_minimum_required (VERSION 2.8)
project (turbobadger_thirdparty NONE)
include (ExternalProject)
option (CMAKE_BUILD_TYPE "build type." "")
set (TB_THIRDPARTY_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
get_directory_property (hasParent PARENT_DIRECTORY)
# quiet warning messages
message ("${CMAKE_CONFIGURATION_TYPES} ${ANDROID}")
if (TB_BUILD_GLFW)
# Download glfw
ExternalProject_Add (GLFWEXT
PREFIX GLFWEXT
GIT_REPOSITORY "https://github.com/glfw/glfw.git"
GIT_TAG "3.2.1"
GIT_SHALLOW 1
UPDATE_COMMAND ""
PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
LOG_DOWNLOAD ON)
ExternalProject_Get_Property (GLFWEXT source_dir)
ExternalProject_Get_Property (GLFWEXT binary_dir)
if (hasParent)
set (GLFW_SRC_DIR "${source_dir}")
set (GLFW_INCLUDE_DIRS "${source_dir}/include")
# Configure glfw & add_subdirectory()
set (GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set (GLFW_BUILD_TESTS OFF CACHE BOOL "just want glfw library" FORCE)
set (GLFW_BUILD_EXAMPLES OFF CACHE BOOL "just want glfw library" FORCE)
set (GLFW_CLIENT_LIBRARY opengl CACHE STRING "client to use for glfw" FOR) # glesv1, glesv2
set (GLFW_INSTALL OFF CACHE BOOL "just want glfw library" FORCE)
# set (GLFW_USE_OPTIMUS_HPG ON "just want glfw library")
add_subdirectory (${GLFW_SRC_DIR} ${binary_dir})
set (EXTRA_LIBS ${EXTRA_LIBS} glfw ${GLFW_LIBRARIES} PARENT_SCOPE)
endif (hasParent)
endif (TB_BUILD_GLFW)
if (TB_BUILD_SDL2)
set (SDL_VERSION 2.0.8)
set (SDL_VERSION_HASH 3800d705cef742c6a634f202c37f263f)
set (SDL_VERSION 2.0.5)
set (SDL_VERSION_HASH d4055424d556b4a908aa76fad63abd3c)
set (SDL2_configure_args --disable-shared)
# --disable-loadso --disable-cpuinfo --disable-atomic --disable-sdl-dlopen
if (APPLE)
message ("Wouldn't you rather build the Framework?")
set (SDL2_configure_args ${SDL2_configure_args} --without-x)
set (SDL2_configure_args ${SDL2_configure_args} "CFLAGS=-mmacosx-version-min=10.9")
endif ()
ExternalProject_Add (SDL2EXT
PREFIX SDL2EXT
URL https://www.libsdl.org/release/SDL2-${SDL_VERSION}.tar.gz
URL_HASH "MD5=${SDL_VERSION_HASH}"
DOWNLOAD_DIR "$ENV{HOME}/Downloads"
CONFIGURE_COMMAND <SOURCE_DIR>/configure ${SDL2_configure_args} --prefix=<INSTALL_DIR>
INSTALL_COMMAND make install)
ExternalProject_Get_Property (SDL2EXT INSTALL_DIR)
set (SDL2_INSTALL_DIR ${INSTALL_DIR})
add_library (SDL2_LIBRARY STATIC IMPORTED GLOBAL)
set_property (TARGET SDL2_LIBRARY PROPERTY IMPORTED_LOCATION ${SDL2_INSTALL_DIR}/lib/libSDL2.a)
if (hasParent)
set (SDL2_LIBRARIES dl SDL2_LIBRARY dl pthread PARENT_SCOPE)
set (SDL2_INCLUDE_DIRS "${SDL2_INSTALL_DIR}/include/SDL2" PARENT_SCOPE)
set (SDL2_INSTALL_DIR ${INSTALL_DIR} PARENT_SCOPE)
endif (hasParent)
endif (TB_BUILD_SDL2)