aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@iki.fi>2016-09-08 20:00:43 +0300
committerOskari Timperi <oskari.timperi@iki.fi>2016-09-08 20:00:43 +0300
commit764822eb2bb6189d3474e4ed3ad3ef1a7cdd2d3b (patch)
tree3c25d1c2ebe0b76c9a9d228df4b19bfa514ca3f4
downloadrayskeleton-764822eb2bb6189d3474e4ed3ad3ef1a7cdd2d3b.tar.gz
rayskeleton-764822eb2bb6189d3474e4ed3ad3ef1a7cdd2d3b.zip
Initial commit
-rw-r--r--CMakeLists.txt5
-rw-r--r--LICENSE.md17
-rw-r--r--README.md14
-rw-r--r--deps/CMakeLists.txt13
-rw-r--r--src/CMakeLists.txt27
-rw-r--r--src/main.c25
6 files changed, 101 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5426f67
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,5 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
+PROJECT(rayskeleton C)
+
+ADD_SUBDIRECTORY(deps)
+ADD_SUBDIRECTORY(src)
diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000..79de1d9
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,17 @@
+Copyright (c) 2016 Oskari Timperi
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+3. This notice may not be removed or altered from any source distribution.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..6a7b65b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,14 @@
+# rayskeleton
+
+A simple to use and build skeleton project for raylib. Uses CMake.
+
+# building and running in 8 easy steps
+
+ $ git clone git@github.com:oswjk/rayskeleton.git
+ $ cd rayskeleton
+ $ mkdir build
+ $ cd build
+ $ cmake ..
+ $ make raylib
+ $ make
+ $ ./src/rayskeleton
diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt
new file mode 100644
index 0000000..cd6aa62
--- /dev/null
+++ b/deps/CMakeLists.txt
@@ -0,0 +1,13 @@
+INCLUDE(ExternalProject)
+
+SET(INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/dist)
+SET(DEPS_INSTALL_DIR ${INSTALL_DIR} PARENT_SCOPE)
+
+ExternalProject_Add(raylib
+ GIT_REPOSITORY https://github.com/oswjk/raylib.git
+ GIT_TAG cmake
+ EXCLUDE_FROM_ALL 1
+ CMAKE_ARGS
+ -DPLATFORM_TO_USE=PLATFORM_DESKTOP
+ -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}
+)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..1f68a3f
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,27 @@
+SET(SOURCES
+ main.c
+)
+
+ADD_EXECUTABLE(${CMAKE_PROJECT_NAME} ${SOURCES})
+
+TARGET_INCLUDE_DIRECTORIES(${CMAKE_PROJECT_NAME} PUBLIC
+ ${DEPS_INSTALL_DIR}/include
+)
+
+TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME}
+ ${DEPS_INSTALL_DIR}/lib/libraylib.a
+ ${DEPS_INSTALL_DIR}/lib/libglfw3.a
+)
+
+IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} -lm -ldl -lpthread -lX11 -lXrandr
+ -lXinerama -lXi -lXxf86vm -lXcursor)
+ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ TARGET_LINK_LIBRARIES(${CMAKE_PROJECT_NAME} gdi32)
+ENDIF()
+
+IF(CMAKE_COMPILER_IS_GNUCC)
+ TARGET_COMPILE_OPTIONS(${CMAKE_PROJECT_NAME} PRIVATE -Wall -std=c99)
+ELSEIF(MSVC)
+ # TODO: Set these to something that corresponds to the GCC flags?
+ENDIF()
diff --git a/src/main.c b/src/main.c
new file mode 100644
index 0000000..152c290
--- /dev/null
+++ b/src/main.c
@@ -0,0 +1,25 @@
+#include "raylib.h"
+
+#define SCREEN_WIDTH 800
+#define SCREEN_HEIGHT 600
+
+int main(int argc, char **argv)
+{
+ InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "rayskeleton");
+
+ SetTargetFPS(60);
+
+ while (!WindowShouldClose())
+ {
+ BeginDrawing();
+ ClearBackground(WHITE);
+ const char *text = "rayskeleton!";
+ int w = MeasureText(text, 20);
+ DrawText(text, SCREEN_WIDTH/2 - w/2, SCREEN_HEIGHT/2, 20, BLACK);
+ EndDrawing();
+ }
+
+ CloseWindow();
+
+ return 0;
+}