aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Gary Wang <wzc782970009@gmail.com> 2019-06-15 15:21:32 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2019-06-15 20:58:10 +0800
commit591c44b9a1a6e0a803b6d8af9e35aa8552b421c0 (patch)
tree8d422a4888c4371b0960bcdd5665d99b6f43b27a
parent747c0db7910414d2797e38b5a00efbdb0c5ee6a1 (diff)
downloadSMELT-591c44b9a1a6e0a803b6d8af9e35aa8552b421c0.tar.xz
DevIL support
-rw-r--r--CMakeLists.txt5
-rw-r--r--examples/CMakeLists.txt32
-rw-r--r--extensions/CMakeLists.txt7
-rw-r--r--smelt/glfw/CMakeLists.txt23
4 files changed, 60 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 44cd5b6..6b54346 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,6 +4,8 @@ cmake_minimum_required(VERSION 3.11)
option (BUILD_DUMB "Disable sound support" OFF)
option (BUILD_EXTENSIONS "Build extensions" ON)
+option (USE_CXIMAGE "Use CxImage instead of DevIL" OFF)
+option (BUILD_EXAMPLE "Build example" ON)
add_subdirectory(smelt/glfw)
@@ -11,3 +13,6 @@ if (BUILD_EXTENSIONS)
add_subdirectory(extensions)
endif ()
+if (BUILD_EXAMPLE)
+ add_subdirectory(examples)
+endif ()
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
new file mode 100644
index 0000000..4b1defa
--- /dev/null
+++ b/examples/CMakeLists.txt
@@ -0,0 +1,32 @@
+option (USE_CXIMAGE "Use CxImage instead of DevIL" OFF)
+
+find_package(glfw3 3.2 REQUIRED)
+find_package(GLEW REQUIRED)
+find_package(OpenAL REQUIRED)
+find_package(Freetype REQUIRED)
+
+if (NOT USE_CXIMAGE)
+ find_package(DevIL REQUIRED)
+endif ()
+
+add_executable(example
+ smelt_test.cpp)
+
+include_directories(
+ ${GLFW_INCLUDE_DIRS}
+ ${GLEW_INCLUDE_DIRS}
+ ${FREETYPE_INCLUDE_DIRS}
+)
+
+target_link_libraries(example
+ glfw
+ ${GLEW_LIBRARIES}
+ ${OpenAL_LIBRARIES}
+ ${FREETYPE_LIBRARIES}
+ smelt smeltext
+)
+
+get_cmake_property(__cmake_debug_var VARIABLES)
+foreach (__var ${__cmake_debug_var})
+ message(STATUS ">>> ${__var}=${${__var}}")
+endforeach ()
diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt
index 2c265ad..8bc51e8 100644
--- a/extensions/CMakeLists.txt
+++ b/extensions/CMakeLists.txt
@@ -1,10 +1,11 @@
find_package(Freetype REQUIRED)
-file (GLOB SMELTTEXT_CPP_FILES "*.cpp")
+file (GLOB SMELTEXT_CPP_FILES "*.cpp")
include_directories(
${FREETYPE_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR}/../include
)
-add_library(smelttext STATIC ${SMELTTEXT_CPP_FILES})
+add_library(smeltext STATIC ${SMELTEXT_CPP_FILES})
+
+target_link_libraries(smeltext smelt)
diff --git a/smelt/glfw/CMakeLists.txt b/smelt/glfw/CMakeLists.txt
index 6785ca1..73c2130 100644
--- a/smelt/glfw/CMakeLists.txt
+++ b/smelt/glfw/CMakeLists.txt
@@ -1,10 +1,13 @@
-option(BUILD_DUMB "Disable sound support" OFF)
+option (BUILD_DUMB "Disable sound support" OFF)
+option (USE_CXIMAGE "Use CxImage instead of DevIL" OFF)
-find_package(PkgConfig REQUIRED)
+find_package(glfw3 REQUIRED)
find_package(GLEW REQUIRED)
find_package(OpenAL REQUIRED)
-pkg_search_module(GLFW REQUIRED glfw3)
+if (NOT USE_CXIMAGE)
+ find_package(DevIL REQUIRED)
+endif ()
set (SMELT_GLFW_CPP_FILES
gfx_glfw.cpp
@@ -14,12 +17,15 @@ set (SMELT_GLFW_CPP_FILES
)
include_directories(
- ${GLFW_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS}
)
add_library(smelt STATIC ${SMELT_GLFW_CPP_FILES})
+target_include_directories(smelt PUBLIC ../../include)
+
+target_link_libraries(smelt glfw)
+
if (BUILD_DUMB)
message (STATUS "")
message (STATUS "BUILD_DUMB build option enabled")
@@ -28,3 +34,12 @@ if (BUILD_DUMB)
ENABLE_DUMB
)
endif ()
+
+if (USE_CXIMAGE)
+ message (STATUS "")
+ message (STATUS "USE_CXIMAGE build option enabled")
+ message (STATUS "")
+ target_compile_definitions(smelt PRIVATE
+ USE_CXIMAGE
+ )
+endif ()