added cmakelists file
may switch to cmake since every library i saw used it and this was tested on windows by generating a visual studio solution and it builds and runs both release and debug
This commit is contained in:
102
CMakeLists.txt
Normal file
102
CMakeLists.txt
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
# Require a modern version of CMake
|
||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
# Define the workspace/project
|
||||||
|
project(SakuraVNE LANGUAGES CXX)
|
||||||
|
|
||||||
|
# Enforce C++20 globally
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF) # Disables compiler-specific extensions (like gnu++20)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Output Directory Configuration (Mirrors your Premake setup)
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# This mimics: build/bin/{Config}-{System}-{Architecture}
|
||||||
|
set(OUTPUT_DIR_SUFFIX "$<CONFIG>-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${OUTPUT_DIR_SUFFIX}")
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${OUTPUT_DIR_SUFFIX}")
|
||||||
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/${OUTPUT_DIR_SUFFIX}")
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Dependencies
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# 1. SDL3
|
||||||
|
# Disable tests and examples before adding the subdirectory
|
||||||
|
set(SDL_TESTS OFF CACHE BOOL "Disable SDL3 tests" FORCE)
|
||||||
|
set(SDL_EXAMPLES OFF CACHE BOOL "Disable SDL3 examples" FORCE)
|
||||||
|
add_subdirectory(libs/sdl3)
|
||||||
|
|
||||||
|
# 2. spdlog
|
||||||
|
# Force compiled mode instead of header-only, and disable extras
|
||||||
|
set(SPDLOG_BUILD_COMPILED ON CACHE BOOL "Build spdlog as a compiled library" FORCE)
|
||||||
|
set(SPDLOG_BUILD_EXAMPLE OFF CACHE BOOL "Disable spdlog examples" FORCE)
|
||||||
|
set(SPDLOG_BUILD_TESTS OFF CACHE BOOL "Disable spdlog tests" FORCE)
|
||||||
|
add_subdirectory(libs/spdlog)
|
||||||
|
|
||||||
|
# 3. ImGui & ImGui Node Editor
|
||||||
|
# Assuming you have CMakeLists.txt inside these directories.
|
||||||
|
# If you don't, you would use add_library() to compile their .cpp files manually here.
|
||||||
|
add_subdirectory(libs/imgui)
|
||||||
|
add_subdirectory(libs/imgui-node-editor)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# SakuraVNE Executable Target
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Gather all .cpp and .h files in the src folder
|
||||||
|
file(GLOB_RECURSE SAKURA_SRCS "SakuraVNE/src/*.cpp" "SakuraVNE/src/*.h")
|
||||||
|
|
||||||
|
# Create the ConsoleApp executable
|
||||||
|
add_executable(SakuraVNE ${SAKURA_SRCS})
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Include Directories & Linking
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Tell the compiler where the headers are
|
||||||
|
target_include_directories(SakuraVNE PRIVATE
|
||||||
|
"SakuraVNE/src"
|
||||||
|
"libs/spdlog/include"
|
||||||
|
"libs/imgui"
|
||||||
|
"libs/imgui/misc"
|
||||||
|
"libs/imgui/backends"
|
||||||
|
"libs/imgui-node-editor"
|
||||||
|
"libs/sdl3/include"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link the libraries. CMake handles all the libdirs automatically!
|
||||||
|
target_link_libraries(SakuraVNE PRIVATE
|
||||||
|
ImGui # (Depends on what your ImGui target is actually named)
|
||||||
|
ImGuiNodeEditor # (Depends on what your ImGuiNodeEditor target is actually named)
|
||||||
|
SDL3::SDL3 # The official SDL3 target name
|
||||||
|
spdlog::spdlog # The official spdlog target name
|
||||||
|
)
|
||||||
|
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
# Platform & Configuration Filters
|
||||||
|
# ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Windows-specific settings
|
||||||
|
if(WIN32)
|
||||||
|
target_compile_definitions(SakuraVNE PRIVATE PLATFORM_WINDOWS)
|
||||||
|
|
||||||
|
# Ignore MSVCRT default library
|
||||||
|
target_link_options(SakuraVNE PRIVATE "/NODEFAULTLIB:MSVCRT")
|
||||||
|
|
||||||
|
# Linux-specific settings
|
||||||
|
elseif(UNIX AND NOT APPLE)
|
||||||
|
target_compile_definitions(SakuraVNE PRIVATE PLATFORM_LINUX)
|
||||||
|
|
||||||
|
# Link dl and pthread
|
||||||
|
target_link_libraries(SakuraVNE PRIVATE dl pthread)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Debug vs Release definitions
|
||||||
|
# $<CONFIG:...> is a generator expression that injects the flag based on the active build type
|
||||||
|
target_compile_definitions(SakuraVNE PRIVATE
|
||||||
|
$<$<CONFIG:Debug>:DEBUG>
|
||||||
|
$<$<CONFIG:Release>:RELEASE>
|
||||||
|
)
|
||||||
Submodule libs/imgui updated: 771beef1e2...dca2625a19
Submodule libs/imgui-node-editor updated: 566804348a...15cde1a8fe
Reference in New Issue
Block a user