diff --git a/.gitmodules b/.gitmodules index 5554861..fe2fd35 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "src/3rdparty/dlfcn-win32"] path = src/3rdparty/dlfcn-win32 url = https://gitlab.com/dosowisko.net/dlfcn-win32.git +[submodule "src/3rdparty/allegro5"] + path = src/3rdparty/allegro5 + url = https://gitlab.com/dosowisko.net/allegro5.git diff --git a/cmake/libsuperderpy.cmake b/cmake/libsuperderpy.cmake index 87036c3..bebc180 100644 --- a/cmake/libsuperderpy.cmake +++ b/cmake/libsuperderpy.cmake @@ -9,6 +9,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) if (EXISTS "${CMAKE_SOURCE_DIR}/libsuperderpy") set(LIBSUPERDERPY_DIR "${CMAKE_SOURCE_DIR}/libsuperderpy") + set(LIBSUPERDERPY_BINARY_DIR "${CMAKE_BINARY_DIR}/libsuperderpy") if(NOT DEFINED LIBSUPERDERPY_NO_GAME_GIT_REV) execute_process( @@ -24,6 +25,7 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) else (EXISTS "${CMAKE_SOURCE_DIR}/libsuperderpy") set(LIBSUPERDERPY_DIR ${CMAKE_SOURCE_DIR}) + set(LIBSUPERDERPY_BINARY_DIR ${CMAKE_BINARY_DIR}) endif (EXISTS "${CMAKE_SOURCE_DIR}/libsuperderpy") @@ -288,18 +290,41 @@ if (NOT LIBSUPERDERPY_CONFIG_INCLUDED) add_definitions(-DLIBSUPERDERPY_SINGLE_THREAD) endif() - find_package(Allegro5 REQUIRED) - find_package(Allegro5Font REQUIRED) - find_package(Allegro5TTF REQUIRED) - find_package(Allegro5Primitives REQUIRED) - find_package(Allegro5Audio REQUIRED) - find_package(Allegro5ACodec REQUIRED) - find_package(Allegro5Image REQUIRED) - find_package(Allegro5Color REQUIRED) - find_package(Allegro5Video REQUIRED) - if(APPLE) - find_package(Allegro5Main) - endif(APPLE) + if (LIBSUPERDERPY_EMBEDDED_ALLEGRO) + set(ALLEGRO5_LIBRARIES "allegro") + set(ALLEGRO5_FONT_LIBRARIES "allegro_font") + set(ALLEGRO5_TTF_LIBRARIES "allegro_ttf") + set(ALLEGRO5_PRIMITIVES_LIBRARIES "allegro_primitives") + set(ALLEGRO5_AUDIO_LIBRARIES "allegro_audio") + set(ALLEGRO5_ACODEC_LIBRARIES "allegro_acodec") + set(ALLEGRO5_IMAGE_LIBRARIES "allegro_image") + set(ALLEGRO5_COLOR_LIBRARIES "allegro_color") + set(ALLEGRO5_VIDEO_LIBRARIES "allegro_video") + set(ALLEGRO5_MAIN_LIBRARIES "allegro_main") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/include") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/font") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/ttf") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/primitives") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/audio") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/acodec") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/image") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/color") + include_directories("${LIBSUPERDERPY_DIR}/src/3rdparty/allegro5/addons/video") + include_directories("${LIBSUPERDERPY_BINARY_DIR}/src/3rdparty/allegro5/include") + else (LIBSUPERDERPY_EMBEDDED_ALLEGRO) + find_package(Allegro5 REQUIRED) + find_package(Allegro5Font REQUIRED) + find_package(Allegro5TTF REQUIRED) + find_package(Allegro5Primitives REQUIRED) + find_package(Allegro5Audio REQUIRED) + find_package(Allegro5ACodec REQUIRED) + find_package(Allegro5Image REQUIRED) + find_package(Allegro5Color REQUIRED) + find_package(Allegro5Video REQUIRED) + if(APPLE) + find_package(Allegro5Main) + endif(APPLE) + endif() include_directories(${ALLEGRO5_INCLUDE_DIR} ${ALLEGRO5_FONT_INCLUDE_DIR} ${ALLEGRO5_TTF_INCLUDE_DIR} ${ALLEGRO5_PRIMITIVES_INCLUDE_DIR} ${ALLEGRO5_AUDIO_INCLUDE_DIR} ${ALLEGRO5_ACODEC_INCLUDE_DIR} ${ALLEGRO5_VIDEO_INCLUDE_DIR} ${ALLEGRO5_IMAGE_INCLUDE_DIR} ${ALLEGRO5_COLOR_INCLUDE_DIR}) diff --git a/src/3rdparty/allegro5 b/src/3rdparty/allegro5 new file mode 160000 index 0000000..48262b6 --- /dev/null +++ b/src/3rdparty/allegro5 @@ -0,0 +1 @@ +Subproject commit 48262b6bb6e30a33687c18c761f05633c7255dc9 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 665f68f..6ac554a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -16,6 +16,21 @@ if (EMSCRIPTEN) list(APPEND SRC_LIST emscripten-audio-stream.c) endif() +if (LIBSUPERDERPY_EMBEDDED_ALLEGRO) + set(SHARED OFF) # Allegro doesn't namespace this... + add_subdirectory("3rdparty/allegro5" EXCLUDE_FROM_ALL) + set_property(TARGET "allegro" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_font" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_ttf" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_primitives" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_audio" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_acodec" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_image" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_color" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_video" PROPERTY POSITION_INDEPENDENT_CODE ON) + set_property(TARGET "allegro_main" PROPERTY POSITION_INDEPENDENT_CODE ON) +endif (LIBSUPERDERPY_EMBEDDED_ALLEGRO) + if (LIBSUPERDERPY_IMGUI) set(IMGUI_STATIC ON CACHE STRING "" FORCE) add_subdirectory(3rdparty/cimgui EXCLUDE_FROM_ALL)