summaryrefslogtreecommitdiff
path: root/tools/dyecmd
diff options
context:
space:
mode:
authorYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-05-22 15:53:00 +0200
committerYohann Ferreira <yohann_dot_ferreira_at_orange_dot_fr>2010-05-27 02:21:14 +0200
commit5497d10b008bfed6b1aee8aac23fe640faebf1ad (patch)
treef03cc3d8b9b3b0ed3b34e82958da2d81257fbe05 /tools/dyecmd
parentaa0d2450a8e9188204d088e5c828aa1e636ba463 (diff)
downloadmana-5497d10b008bfed6b1aee8aac23fe640faebf1ad.tar.gz
mana-5497d10b008bfed6b1aee8aac23fe640faebf1ad.tar.bz2
mana-5497d10b008bfed6b1aee8aac23fe640faebf1ad.tar.xz
mana-5497d10b008bfed6b1aee8aac23fe640faebf1ad.zip
Added Cmake compilation files to the dyecmd tool.
Reviewed-by: Jaxad0127
Diffstat (limited to 'tools/dyecmd')
-rw-r--r--tools/dyecmd/CMakeLists.txt28
-rw-r--r--tools/dyecmd/src/CMakeLists.txt59
2 files changed, 87 insertions, 0 deletions
diff --git a/tools/dyecmd/CMakeLists.txt b/tools/dyecmd/CMakeLists.txt
new file mode 100644
index 00000000..48566648
--- /dev/null
+++ b/tools/dyecmd/CMakeLists.txt
@@ -0,0 +1,28 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+PROJECT(MANA_DYECOMMAND)
+
+IF (NOT VERSION)
+ SET(VERSION 1.0.0)
+ENDIF()
+
+STRING(REPLACE "." " " _VERSION ${VERSION})
+SEPARATE_ARGUMENTS(_VERSION)
+LIST(LENGTH _VERSION _LEN)
+IF(NOT (_LEN EQUAL 4 OR _LEN EQUAL 3))
+ MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
+ENDIF()
+
+LIST(GET _VERSION 0 VER_MAJOR)
+LIST(GET _VERSION 1 VER_MINOR)
+LIST(GET _VERSION 2 VER_RELEASE)
+IF(_LEN EQUAL 4)
+ LIST(GET _VERSION 3 VER_BUILD)
+ELSE()
+ SET(VER_BUILD 0)
+ENDIF()
+
+# where to look for cmake modules
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+
+ADD_SUBDIRECTORY(src)
diff --git a/tools/dyecmd/src/CMakeLists.txt b/tools/dyecmd/src/CMakeLists.txt
new file mode 100644
index 00000000..f8e717b7
--- /dev/null
+++ b/tools/dyecmd/src/CMakeLists.txt
@@ -0,0 +1,59 @@
+FIND_PACKAGE(SDL REQUIRED)
+FIND_PACKAGE(SDL_image REQUIRED)
+FIND_PACKAGE(PNG REQUIRED)
+
+IF (CMAKE_COMPILER_IS_GNUCXX)
+ # Help getting compilation warnings
+ SET(CMAKE_CXX_FLAGS "-Wall")
+ IF (WIN32)
+ # This includes enough debug information to get something useful
+ # from Dr. Mingw while keeping binary size down. Almost useless
+ # with gdb, though.
+ SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
+ ENDIF()
+ENDIF()
+
+SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
+SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
+SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
+
+IF (CMAKE_BUILD_TYPE)
+ STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ IF((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR
+ (CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo))
+ SET(FLAGS "${FLAGS} -DDEBUG")
+ ENDIF()
+ENDIF()
+
+INCLUDE_DIRECTORIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}
+ ${SDL_INCLUDE_DIR}
+ ${SDLIMAGE_INCLUDE_DIR}
+ ${PNG_INCLUDE_DIR}
+ )
+
+# Fix some stuff that gets not hidden by mainline modules
+MARK_AS_ADVANCED(SDLIMAGE_INCLUDE_DIR)
+MARK_AS_ADVANCED(SDLIMAGE_LIBRARY)
+MARK_AS_ADVANCED(SDLMAIN_LIBRARY)
+MARK_AS_ADVANCED(SDL_INCLUDE_DIR)
+MARK_AS_ADVANCED(SDL_LIBRARY)
+
+SET(SRCS
+ dye.cpp
+ dye.h
+ dyecmd.cpp
+ imagewriter.cpp
+ imagewriter.h
+ )
+
+SET (PROGRAMS dyecmd)
+
+ADD_EXECUTABLE(dyecmd WIN32 ${SRCS})
+
+TARGET_LINK_LIBRARIES(dyecmd
+ ${SDL_LIBRARY}
+ ${SDLIMAGE_LIBRARY}
+ ${PNG_LIBRARIES})
+
+SET_TARGET_PROPERTIES(dyecmd PROPERTIES COMPILE_FLAGS "${FLAGS}")