summaryrefslogtreecommitdiff
path: root/third-party
diff options
context:
space:
mode:
authorJun Zhang <jun@junz.org>2022-01-30 12:30:02 +0800
committerGitHub <noreply@github.com>2022-01-29 21:30:02 -0700
commitcb7af3f4cac90f95926477b4001f9f80037568d5 (patch)
tree022f4700c796a9935acd3ee0d0fd80a812a78464 /third-party
parent99b4763f1028e72bb06d8db6c7e8ace469f8989c (diff)
refactor: adjust the project infra. (#1)
* refactor: adjust the project infra. This patch adds cmake build system to the project, and adjust infrastructure stuff. Signed-off-by: Jun Zhang <jun@junz.org> * fix: remove compiler flags that only exist in GCC. Signed-off-by: Jun Zhang <jun@junz.org>
Diffstat (limited to 'third-party')
-rw-r--r--third-party/sdl2/CMakeLists.txt18
-rw-r--r--third-party/sdl2/CMakeLists.txt.in15
2 files changed, 33 insertions, 0 deletions
diff --git a/third-party/sdl2/CMakeLists.txt b/third-party/sdl2/CMakeLists.txt
new file mode 100644
index 0000000..93022fd
--- /dev/null
+++ b/third-party/sdl2/CMakeLists.txt
@@ -0,0 +1,18 @@
+configure_file(CMakeLists.txt.in sdl2/CMakeLists.txt)
+execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sdl2 )
+if(result)
+ message(FATAL_ERROR "CMake step for sdl2 failed: ${result}")
+endif()
+
+execute_process(COMMAND ${CMAKE_COMMAND} --build .
+ RESULT_VARIABLE result
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sdl2 )
+if(result)
+ message(FATAL_ERROR "Build step for sdl2 failed: ${result}")
+endif()
+
+add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/sdl2-src
+ ${CMAKE_CURRENT_BINARY_DIR}/sdl2-build)
+
diff --git a/third-party/sdl2/CMakeLists.txt.in b/third-party/sdl2/CMakeLists.txt.in
new file mode 100644
index 0000000..2277448
--- /dev/null
+++ b/third-party/sdl2/CMakeLists.txt.in
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.0)
+
+project(sdl2 NONE)
+
+include(ExternalProject)
+
+ExternalProject_Add(sdl2
+ URL https://github.com/libsdl-org/SDL/archive/refs/tags/release-2.0.20.tar.gz
+ SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/sdl2-src"
+ BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/sdl2-build"
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ""
+ TEST_COMMAND ""
+)