commit 367f622b786fc68cadcf42e635fcf0ea8f28c032 Author: Will H Date: Wed Mar 6 09:16:29 2024 -0500 Initial commit diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3ca65aa --- /dev/null +++ b/.gitattributes @@ -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 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..788a4c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.idea/ +.vscode/ +.vs/ +_* +CMakeSettings.json \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..6c5644b --- /dev/null +++ b/CMakeLists.txt @@ -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 \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..91da62e --- /dev/null +++ b/LICENSE @@ -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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1848e3a --- /dev/null +++ b/README.md @@ -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/ diff --git a/sources/main.cpp b/sources/main.cpp new file mode 100644 index 0000000..688443d --- /dev/null +++ b/sources/main.cpp @@ -0,0 +1,7 @@ +#include + +int main() +{ + std::cout << "Simple Project Template" << "\n"; + return 0; +} \ No newline at end of file