ref: f53a8ac74db8f237af281a199da46019636ebcf7
parent: 24462dc49742b08e8f868e0b30dc4fa9efe8cf84
author: Azamat H. Hackimov <azamat.hackimov@gmail.com>
date: Wed Mar 2 17:30:36 EST 2016
Initial allegro4 support
--- a/dumb/cmake/CMakeLists.txt
+++ b/dumb/cmake/CMakeLists.txt
@@ -4,6 +4,7 @@
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake-scripts)
option(BUILD_EXAMPLES "Build example binaries" ON)
+option(BUILD_ALLEGRO4 "Build Allegro4 support" ON)
set(CMAKE_C_FLAGS "-Wall -DDUMB_DECLARE_DEPRECATED -D_USE_SSE -msse -Wno-unused-variable -Wno-unused-but-set-variable")
set(CMAKE_C_FLAGS_DEBUG "-ggdb -DDEBUGMODE=1 -D_DEBUG")
@@ -21,6 +22,12 @@
message(STATUS "Not building examples")
endif()
+if(BUILD_ALLEGRO4)
+ find_package(Allegro4)
+else()
+ message(STATUS "Not building Allegro 4 support")
+endif()
+
SET(SOURCES
../src/core/unload.c
../src/core/rendsig.c
@@ -113,8 +120,30 @@
../include/dumb.h
)
+set(ALLEGRO_SOURCES
+ ../src/allegro/alplay.c
+ ../src/allegro/datitq.c
+ ../src/allegro/dats3m.c
+ ../src/allegro/datxm.c
+ ../src/allegro/datduh.c
+ ../src/allegro/datmod.c
+ ../src/allegro/dats3mq.c
+ ../src/allegro/datxmq.c
+ ../src/allegro/datit.c
+ ../src/allegro/datmodq.c
+ ../src/allegro/datunld.c
+ ../src/allegro/packfile.c
+)
+
add_library(dumb ${SOURCES})
set_target_properties(dumb PROPERTIES DEBUG_POSTFIX d)
+
+set(ALLEGRO4_TARGETS "")
+
+if(BUILD_ALLEGRO4)
+ add_library(aldumb ${ALLEGRO_SOURCES})
+ set(ALLEGRO4_TARGETS ${ALLEGRO_TARGETS} aldumb)
+endif()
set(EXAMPLE_TARGETS "")
--- /dev/null
+++ b/dumb/cmake/cmake-scripts/FindAllegro4.cmake
@@ -1,0 +1,51 @@
+# - Find allegro
+# Find the native ALLEGRO includes and library
+#
+# ALLEGRO_INCLUDE_DIR - where to find allegro.h, etc.
+# ALLEGRO_LIBRARIES - List of libraries when using allegro.
+# ALLEGRO_FOUND - True if allegro found.
+
+
+IF (ALLEGRO_INCLUDE_DIR)
+ # Already in cache, be silent
+ SET(ALLEGRO_FIND_QUIETLY TRUE)
+ENDIF (ALLEGRO_INCLUDE_DIR)
+
+FIND_PATH(ALLEGRO_INCLUDE_DIR allegro.h
+/usr/local/include
+/usr/include
+$ENV{MINGDIR}/include
+)
+
+if(UNIX AND NOT CYGWIN)
+ exec_program(allegro-config ARGS --libs OUTPUT_VARIABLE ALLEGRO_LIBRARY)
+else(UNIX AND NOT CYGWIN)
+ SET(ALLEGRO_NAMES alleg alleglib alleg41 alleg42 allegdll)
+ FIND_LIBRARY(ALLEGRO_LIBRARY
+ NAMES ${ALLEGRO_NAMES}
+ PATHS /usr/lib /usr/local/lib $ENV{MINGDIR}/lib)
+endif(UNIX AND NOT CYGWIN)
+
+IF (ALLEGRO_INCLUDE_DIR AND ALLEGRO_LIBRARY)
+ SET(ALLEGRO_FOUND TRUE)
+ SET( ALLEGRO_LIBRARIES ${ALLEGRO_LIBRARY} )
+ELSE (ALLEGRO_INCLUDE_DIR AND ALLEGRO_LIBRARY)
+ SET(ALLEGRO_FOUND FALSE)
+ SET( ALLEGRO_LIBRARIES )
+ENDIF (ALLEGRO_INCLUDE_DIR AND ALLEGRO_LIBRARY)
+
+IF (ALLEGRO_FOUND)
+ IF (NOT ALLEGRO_FIND_QUIETLY)
+ MESSAGE(STATUS "Found Allegro: ${ALLEGRO_LIBRARY}")
+ ENDIF (NOT ALLEGRO_FIND_QUIETLY)
+ELSE (ALLEGRO_FOUND)
+ IF (ALLEGRO_FIND_REQUIRED)
+ MESSAGE(STATUS "Looked for Allegro libraries named ${ALLEGRO_NAMES}.")
+ MESSAGE(FATAL_ERROR "Could NOT find Allegro library")
+ ENDIF (ALLEGRO_FIND_REQUIRED)
+ENDIF (ALLEGRO_FOUND)
+
+MARK_AS_ADVANCED(
+ALLEGRO_LIBRARY
+ALLEGRO_INCLUDE_DIR
+)
\ No newline at end of file