Skip to content

Commit

Permalink
Add linux support
Browse files Browse the repository at this point in the history
* Linux support
* EppoEditor and Engine building on linux
* EppoTesting now also building
* Update cmake
* Add .csproj for linux build
* Linux build support
  • Loading branch information
nepp95 authored Dec 26, 2024
1 parent ccc6a75 commit bda2d78
Show file tree
Hide file tree
Showing 27 changed files with 615 additions and 422 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# IDE
.idea
.vs
.vscode
cmake-build-debug
cmake-build-release
build

*.vcxproj*
*.csproj*
*.sln

Makefile
Expand Down
35 changes: 35 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
cmake_minimum_required(VERSION 3.24)
project(EppoEngine)

if(WIN32)
add_compile_definitions(EPPO_PLATFORM_WINDOWS VK_USE_PLATFORM_WIN32_KHR)
elseif(UNIX)
add_compile_definitions(EPPO_PLATFORM_LINUX)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(EPPO_DEBUG)
else()
add_compile_definitions(EPPO_RELEASE)
endif()

# Dependencies
if(DEFINED ENV{VULKAN_SDK})
link_directories(AFTER $ENV{VULKAN_SDK}/lib)
else()
message(FATAL_ERROR "'VULKAN_SDK' not found in environment variables!")
endif()

set(CMAKE_LIBRARY_ARCHIVE_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

add_subdirectory(EppoEngine/Vendor/bullet)
add_subdirectory(EppoEngine/Vendor/glfw)
add_subdirectory(EppoEngine/Vendor/imgui)
add_subdirectory(EppoEngine/Vendor/yaml-cpp)
add_subdirectory(EppoEngine/Vendor/googletest)

add_subdirectory(EppoEngine)
add_subdirectory(EppoEditor)
add_subdirectory(EppoTesting)
30 changes: 30 additions & 0 deletions EppoEditor/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.24)

project(EppoEditor VERSION 1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Sources
file(GLOB_RECURSE SOURCES
"Source/*.cpp"
)

# Includes
set(INCLUDE_DIRS
"Source"
"Vendor/imgui"
${CMAKE_SOURCE_DIR}/EppoEngine/Source
)

add_executable(${PROJECT_NAME} ${SOURCES})

target_compile_options(${PROJECT_NAME} PRIVATE ${mono_CFLAGS})
target_link_options(${PROJECT_NAME} PRIVATE ${mono_LDFLAGS})
target_include_directories(${PROJECT_NAME} PRIVATE ${INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} PRIVATE
EppoEng glfw imgui yaml-cpp
${BULLET_COLLISION_LIBRARY} ${BULLET_DYNAMICS_LIBRARY} ${BULLET_MATH_LIBRARY} ${BULLET_SOFTBODY_LIBRARY}
${mono_LIBRARIES}
${Vulkan_LIBRARY} shaderc_combined spirv-cross-core spirv-cross-glsl
)
2 changes: 1 addition & 1 deletion EppoEditor/Source/EditorLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include "Panel/PropertyPanel.h"
#include "Panel/SceneHierarchyPanel.h"

#include <imgui/imgui.h>
#include <imgui.h>

#include <fstream>

Expand Down
5 changes: 0 additions & 5 deletions EppoEditor/Source/EppoEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

#include "EditorLayer.h"

extern "C" {
_declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;
_declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
}

namespace Eppo
{
class Editor : public Application
Expand Down
2 changes: 1 addition & 1 deletion EppoEditor/Source/Panel/PanelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Eppo
{
struct PanelData
{
Ref<Panel> Panel;
Ref<Eppo::Panel> Panel;
bool IsOpen = false;
};

Expand Down
2 changes: 1 addition & 1 deletion EppoEditor/Source/ThumbnailCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Eppo
struct Thumbnail
{
uint64_t Timestamp;
Ref<Image> Image;
Ref<Eppo::Image> Image;
};

class ThumbnailCache
Expand Down
63 changes: 63 additions & 0 deletions EppoEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
cmake_minimum_required(VERSION 3.24)

project(EppoEng VERSION 1.0 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# Sources
file(GLOB_RECURSE SOURCES
"Source/*.cpp"
"Vendor/stb/stb_image.cpp"
"Vendor/tinygltf/tinygltf.cpp"
"Vendor/volk/volk.cpp"
)

foreach(item IN LISTS SOURCES)
if(WIN32)
if(item MATCHES "Source/Platform/Linux/.*\\.cpp$")
list(REMOVE_ITEM SOURCES ${item})
endif()
elseif(UNIX)
if(item MATCHES "Source/Platform/Windows/.*\\.cpp$")
list(REMOVE_ITEM SOURCES ${item})
endif()
endif()
endforeach()

# Includes
set(INCLUDE_DIRS
"Source"
"Vendor/bullet/include"
"Vendor/bullet/include/bullet"
"Vendor/entt/single_include"
"Vendor/filewatch"
"Vendor/glfw/include"
"Vendor/glm"
"Vendor/imgui"
"Vendor/mono/include"
"Vendor/spdlog/include"
"Vendor/stb"
"Vendor/tinygltf"
"Vendor/tracy/public"
"Vendor/vulkan-memory-allocator"
"Vendor/volk"
"Vendor/yaml-cpp/include"
)

# Externals
include(FindPkgConfig)
set(ENV{PKG_CONFIG_PATH} "/usr/local/bin/lib/pkgconfig")
pkg_search_module(mono REQUIRED mono-2)
find_package(Bullet REQUIRED)
find_package(Vulkan REQUIRED)

add_library(${PROJECT_NAME} STATIC ${SOURCES})

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_definitions(${PROJECT_NAME} PRIVATE TRACY_ENABLE TRACY_ONLY_LOCALHOST)
endif()

target_compile_definitions(${PROJECT_NAME} PRIVATE VK_NO_PROTOTYPES)
target_include_directories(${PROJECT_NAME} PUBLIC ${INCLUDE_DIRS} ${Vulkan_INCLUDE_DIRS} ${BULLET_INCLUDE_DIR})
target_precompile_headers(${PROJECT_NAME} PRIVATE Source/pch.h)
2 changes: 1 addition & 1 deletion EppoEngine/Source/Core/Assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Core/Base.h"

#include <signal.h>
#include <csignal>

#ifdef EPPO_ENABLE_ASSERTS
#if defined(EPPO_PLATFORM_WINDOWS)
Expand Down
Loading

0 comments on commit bda2d78

Please sign in to comment.