Fixed linux compat
This commit is contained in:
parent
dcc5871929
commit
b47c5e27d8
9 changed files with 49 additions and 32 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1 +1,2 @@
|
|||
cmake-build-debug/
|
||||
build
|
||||
7
.idea/encodings.xml
generated
Normal file
7
.idea/encodings.xml
generated
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/assets/shaders/basicFragment.frag" charset="ISO-8859-1" />
|
||||
<file url="file://$PROJECT_DIR$/assets/shaders/basicVertex.vert" charset="ISO-8859-1" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
@ -1,43 +1,51 @@
|
|||
cmake_minimum_required(VERSION 4.1)
|
||||
project(Engine2026)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(Engine2026 LANGUAGES CXX C)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
include_directories(/
|
||||
vendor)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(glfw3 3.3 QUIET)
|
||||
|
||||
add_executable(Engine2026 main.cpp
|
||||
if(NOT glfw3_FOUND)
|
||||
message(STATUS "glfw3 not found via find_package")
|
||||
if(WIN32)
|
||||
set(GLFW_LIB "${CMAKE_CURRENT_SOURCE_DIR}/vendor/glfw/libglfw3.a")
|
||||
else()
|
||||
message(FATAL_ERROR "GLFW not found")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_executable(Engine2026
|
||||
main.cpp
|
||||
engine/shader.h
|
||||
engine/texture.h
|
||||
engine/mesh.h
|
||||
|
||||
vendor/glad/glad.c
|
||||
)
|
||||
|
||||
target_include_directories(Engine2026 PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/vendor")
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/vendor
|
||||
)
|
||||
|
||||
target_link_libraries(Engine2026 PRIVATE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/vendor/glfw/libglfw3.a" # Static MinGW lib - this fixes -lglfw not found
|
||||
if(glfw3_FOUND)
|
||||
target_link_libraries(Engine2026 PRIVATE glfw OpenGL::GL)
|
||||
else()
|
||||
target_link_libraries(Engine2026 PRIVATE
|
||||
${GLFW_LIB}
|
||||
opengl32
|
||||
gdi32
|
||||
user32
|
||||
)
|
||||
)
|
||||
endif()
|
||||
|
||||
# Copy entire folder (textures/, shaders/, models/, etc.)
|
||||
# Copy assets to build dir
|
||||
add_custom_command(
|
||||
TARGET Engine2026 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/assets" # adjust to your folder name
|
||||
"$<TARGET_FILE_DIR:Engine2026>/assets"
|
||||
COMMENT "Copying textures to output directory"
|
||||
)
|
||||
|
||||
# Repeat for other folders, e.g. shaders
|
||||
add_custom_command(
|
||||
TARGET Engine2026 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/assets"
|
||||
"$<TARGET_FILE_DIR:Engine2026>/assets"
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/assets
|
||||
$<TARGET_FILE_DIR:Engine2026>/assets
|
||||
COMMENT "Copying assets to output directory"
|
||||
)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330 core
|
||||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec3 ourColor;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#version 330 core
|
||||
#version 330 core
|
||||
layout (location = 0) in vec3 aPos;
|
||||
layout (location = 1) in vec3 aColor;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
|
|
|||
1
main.cpp
1
main.cpp
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <glad/glad.h>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue