commit c607d6aa
Change build system to use new SDL2 config file
Requires a new version of CMake. Build environment changed to Ubuntu 18.04
Changed files
| M | CMakeLists.txt before |
| M | extra/docker/Dockerfile before |
| D | src/cmake/FindSDL2.cmake before |
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2d485c..168981e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,15 +18,20 @@ endif()
find_package(Boost COMPONENTS program_options REQUIRED)
#Setup SDL2
-find_package(SDL2 REQUIRED)
-include_directories(${SDL2_INCLUDE_DIR})
+find_package(SDL2 REQUIRED CONFIG)
+include_directories(${SDL2_INCLUDE_DIRS})
#Setup things that use pkg-config
find_package(PkgConfig REQUIRED)
pkg_search_module(SDL2MIXER REQUIRED SDL2_mixer)
+include_directories(${SDL2MIXER_INCLUDE_DIRS})
pkg_search_module(SDL2IMAGE REQUIRED SDL2_image)
+include_directories(${SDL2IMAGE_INCLUDE_DIRS})
pkg_search_module(SDL2TTF REQUIRED SDL2_ttf)
+include_directories(${SDL2TTF_INCLUDE_DIRS})
pkg_search_module(SDL2GFX REQUIRED SDL2_gfx)
+include_directories(${SDL2GFX_INCLUDE_DIRS})
+
include_directories(SYSTEM "src/Libs/include")
@@ -35,6 +40,6 @@ file(GLOB SOURCES "src/*.cpp" "src/*/*.cpp" "src/*/*/*.cpp" "src/Libs/*.c")
add_executable(saland ${SOURCES})
TARGET_LINK_LIBRARIES( saland ${Boost_LIBRARIES} )
-target_link_libraries( saland ${SDL2_LIBRARY})
+target_link_libraries( saland ${SDL2_LIBRARIES})
target_link_libraries( saland physfs z Box2D)
target_link_libraries( saland ${SDL2MIXER_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2TTF_LIBRARIES} ${SDL2GFX_LIBRARIES})
diff --git a/extra/docker/Dockerfile b/extra/docker/Dockerfile
index 27e1dac..1c2ed12 100644
--- a/extra/docker/Dockerfile
+++ b/extra/docker/Dockerfile
@@ -1,4 +1,4 @@
-FROM ubuntu:16.04
+FROM ubuntu:18.04
RUN apt-get update && apt-get install --no-install-recommends -y build-essential libphysfs-dev libboost-dev cmake libsdl2-dev libsdl2-image-dev \
libsdl2-gfx-dev libsdl2-mixer-dev libsdl2-ttf-dev libboost-program-options-dev libutfcpp-dev libbox2d-dev zip gettext
diff --git a/src/cmake/FindSDL2.cmake b/src/cmake/FindSDL2.cmake
deleted file mode 100644
index 9aedb00..0000000
--- a/src/cmake/FindSDL2.cmake
+++ /dev/null
@@ -1,46 +0,0 @@
-# - Try to find SDL2
-# Once done, this will define
-#
-# SDL2_FOUND - system has SDL2
-# SDL2_INCLUDE_DIRS - the SDL2 include directories
-# SDL2_LIBRARIES - link these to use SDL2
-# SDL2_SDL_LIBRARY - only libSDL2
-# SDL2_SDLmain_LIBRARY - only libSDL2main
-# SDL2_SOURCES - add this in the source file list of your target (hack for OSX)
-#
-# See documentation on how to write CMake scripts at
-# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries
-
-include(LibFindMacros)
-libfind_pkg_detect(SDL2 sdl2 FIND_PATH SDL.h PATH_SUFFIXES SDL2 FIND_LIBRARY SDL2)
-
-# Process others than OSX with native SDL normally
-if(NOT "${SDL2_SDL_LIBRARY}" MATCHES "framework")
- if(MINGW)
- set(MINGW32_LIBRARY mingw32)
- set(SDL2_PROCESS_LIBS ${SDL2_PROCESS_LIBS} MINGW32_LIBRARY)
- endif()
- find_library(SDL2_SDLmain_LIBRARY
- NAMES libSDL2main.a SDL2main
- HINTS ${SDL2_PKGCONF_LIBRARY_DIRS}
- )
- if (SDL2_SDLmain_LIBRARY)
- set(SDL2_PROCESS_LIBS ${SDL2_PROCESS_LIBS} SDL2_SDLmain_LIBRARY)
- endif()
- set(SDL2_PROCESS_LIBS ${SDL2_PROCESS_LIBS} SDL2_SDL_LIBRARY)
-endif()
-
-libfind_process(SDL2)
-
-# Special processing for OSX native SDL
-if("${SDL2_SDL_LIBRARY}" MATCHES "SDL.framework")
- set(SDL2_SOURCES "osx/SDLmain.m")
- set(SDL2_LIBRARIES "-framework SDL2")
-endif()
-
-# All OSX versions need Cocoa
-if(APPLE)
- set(SDL2_LIBRARIES ${SDL2_LIBRARIES} "-framework Cocoa")
-endif(APPLE)
-
-