Initial commit
This commit is contained in:
9
.gitattributes
vendored
Normal file
9
.gitattributes
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# Asset files should be treated by git as binary
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.ttf binary
|
||||||
|
*.mp3 binary
|
||||||
|
*.wav binary
|
||||||
|
*.raw binary
|
||||||
|
*.obj binary
|
||||||
|
*.gltf binary
|
||||||
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
.idea/
|
||||||
|
.vscode/
|
||||||
|
.vs/
|
||||||
|
_*
|
||||||
|
CMakeSettings.json
|
||||||
74
CMakeLists.txt
Normal file
74
CMakeLists.txt
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||||
|
string(REPLACE " " "_" ProjectId ${ProjectId})
|
||||||
|
project(
|
||||||
|
${ProjectId}
|
||||||
|
VERSION 1.0.0
|
||||||
|
DESCRIPTION ""
|
||||||
|
HOMEPAGE_URL "%%myurl%%"
|
||||||
|
LANGUAGES CXX C)
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20) # Set required C++ Standard
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
|
||||||
|
|
||||||
|
#Output list of dirs (result) from parent dir (curdir)
|
||||||
|
MACRO(SUBDIRLIST result curdir)
|
||||||
|
FILE(GLOB children RELATIVE ${curdir} ${curdir}/*)
|
||||||
|
SET(dirlist "")
|
||||||
|
FOREACH(child ${children})
|
||||||
|
IF(IS_DIRECTORY ${curdir}/${child})
|
||||||
|
LIST(APPEND dirlist ${child})
|
||||||
|
ENDIF()
|
||||||
|
ENDFOREACH()
|
||||||
|
SET(${result} ${dirlist})
|
||||||
|
ENDMACRO()
|
||||||
|
|
||||||
|
#DEFINE EXTERNAL LIBS
|
||||||
|
find_package(raylib QUIET)
|
||||||
|
if (NOT raylib_FOUND)
|
||||||
|
include(FetchContent)
|
||||||
|
FetchContent_Declare(
|
||||||
|
raylib
|
||||||
|
GIT_REPOSITORY https://github.com/raysan5/raylib.git
|
||||||
|
GIT_TAG 5.0
|
||||||
|
GIT_SHALLOW 1
|
||||||
|
GIT_PROGRESS True
|
||||||
|
SOURCE_DIR ${CMAKE_SOURCE_DIR}/_external/raylib
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#FETCH EXTERNAL LIBS
|
||||||
|
FetchContent_MakeAvailable(raylib)
|
||||||
|
|
||||||
|
# DEFINE SOURCES : ./sources/*cpp except ./sources/old/*
|
||||||
|
file(GLOB_RECURSE PROJECT_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_LIST_DIR}/sources/*.cpp") # Define PROJECT_SOURCES as a list of all source files
|
||||||
|
file(GLOB to_remove "${CMAKE_CURRENT_LIST_DIR}/sources/old/*")
|
||||||
|
list(REMOVE_ITEM PROJECT_SOURCES ${to_remove})
|
||||||
|
set(PROJECT_INCLUDE "${CMAKE_CURRENT_LIST_DIR}/sources/") # Define PROJECT_INCLUDE to be the path to the include directory of the project
|
||||||
|
|
||||||
|
|
||||||
|
# ADD EXECUTABLE
|
||||||
|
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_INCLUDE})
|
||||||
|
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
|
||||||
|
|
||||||
|
#INCLUDE EXTERNAL LIBS
|
||||||
|
SUBDIRLIST(EXT_LIBS "${CMAKE_CURRENT_LIST_DIR}/_external/")
|
||||||
|
FOREACH(subdir ${EXT_LIBS})
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/_external/${subdir}/include")
|
||||||
|
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_LIST_DIR}/_external//${subdir}/src")
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE ${subdir})
|
||||||
|
ENDFOREACH()
|
||||||
|
|
||||||
|
# Web Configurations (Raylib)
|
||||||
|
if (${PLATFORM} STREQUAL "Web")
|
||||||
|
# Tell Emscripten to build an example.html file.
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES SUFFIX ".html")
|
||||||
|
|
||||||
|
# Required linker flags for using Raylib with Emscripten
|
||||||
|
target_link_options(${PROJECT_NAME} PRIVATE -sEXPORTED_FUNCTIONS=['_main','_malloc'] -sEXPORTED_RUNTIME_METHODS=ccall -sUSE_GLFW=3)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#SET MACROS
|
||||||
|
target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="${CMAKE_CURRENT_SOURCE_DIR}/assets/") # Set the asset path macro to the absolute path on the dev machine
|
||||||
|
#target_compile_definitions(${PROJECT_NAME} PUBLIC ASSETS_PATH="./assets") # Set the asset path macro in release mode to a relative path that assumes the assets folder is in the same directory as the game executable
|
||||||
16
LICENSE
Normal file
16
LICENSE
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
Copyright (c) 2013-2023 Ramon Santamaria (@raysan5)
|
||||||
|
|
||||||
|
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.
|
||||||
12
README.md
Normal file
12
README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
_build/ - Location for build artifacts (gitignore)
|
||||||
|
_external/ (Compiled/src 3rd party libraries and headers)
|
||||||
|
assets/ - binary assets (textures, audio files, compiled shaders)
|
||||||
|
source/ (Source files for project)
|
||||||
|
.gitattributes
|
||||||
|
.gitignore
|
||||||
|
LICENCE
|
||||||
|
CMakeLists.txt
|
||||||
|
README
|
||||||
|
|
||||||
|
## Asset handling
|
||||||
|
CMAKE implements `ASSETS_PATH` as either a relative or absolute path to assets/
|
||||||
7
sources/main.cpp
Normal file
7
sources/main.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
std::cout << "Simple Project Template" << "\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user