(Fix): Working cmake!!!!

This commit is contained in:
illyum 2024-08-15 20:44:16 -06:00
parent adf62d4c81
commit c91bc60cb9
4 changed files with 53 additions and 17 deletions

View File

@ -1,28 +1,47 @@
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.24)
# Set the project name
project(RaylibDmx) project(RaylibDmx)
# Set the C++ standard set(CMAKE_CXX_STANDARD 26)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Include FetchContent module # nvim/fleet users (ONLY WORKS WITH MINGW/NINJA BUILDERS)
include(FetchContent) set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include(FetchContent)
# Dependencies
## - Raylib
## - rlImGui
#### - ImGui
# Use FetchContent to download and build raylib
# This is a faster alternative to using a git repo, since this just downloads the source
# while the git repo pull takes a lot longer. Not sure why, other repos don't seem to have this issue
# If you would like to use git instead, use this:
# - - - - - - - - - - - - - - - - - - - - - - - -
#FetchContent_Declare(
# raylib
# GIT_REPOSITORY "https://github.com/raysan5/raylib.git"
# GIT_TAG "master"
# GIT_SHALLOW TRUE
# GIT_PROGRESS TRUE
#)
# - - - - - - - - - - - - - - - - - - - - - - - -
# Download and configure raylib
FetchContent_Declare( FetchContent_Declare(
raylib raylib
GIT_REPOSITORY https://github.com/raysan5/raylib.git GIT_REPOSITORY https://github.com/raysan5/raylib.git
GIT_TAG 4.5.0 # or the latest version you want to use GIT_SHALLOW TRUE
GIT_TAG 4.5.0
) )
FetchContent_MakeAvailable(raylib) FetchContent_MakeAvailable(raylib)
# Download and configure ImGui
FetchContent_Declare( FetchContent_Declare(
imgui imgui
GIT_REPOSITORY https://github.com/ocornut/imgui.git GIT_REPOSITORY https://github.com/ocornut/imgui.git
GIT_TAG v1.89.2 # or the latest version you want to use GIT_SHALLOW TRUE
GIT_TAG v1.91.0
) )
FetchContent_MakeAvailable(imgui) FetchContent_MakeAvailable(imgui)
@ -36,30 +55,28 @@ add_library(ImGui STATIC
) )
target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR}) target_include_directories(ImGui PUBLIC ${imgui_SOURCE_DIR})
# Download and configure rlImGui (raylib backend for ImGui) # configure rlImGui (raylib backend for ImGui)
FetchContent_Declare( FetchContent_Declare(
rlimgui rlimgui
GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git GIT_REPOSITORY https://github.com/raylib-extras/rlImGui.git
GIT_TAG main # Use the correct branch name GIT_SHALLOW TRUE
GIT_TAG main
) )
FetchContent_MakeAvailable(rlimgui) FetchContent_MakeAvailable(rlimgui)
# Add executable target with the source files
file(GLOB_RECURSE SOURCES "src/*.cpp") file(GLOB_RECURSE SOURCES "src/*.cpp")
add_executable(${PROJECT_NAME} ${SOURCES}) add_executable(${PROJECT_NAME} ${SOURCES})
# Link raylib to your project
target_link_libraries(${PROJECT_NAME} raylib) target_link_libraries(${PROJECT_NAME} raylib)
# Add rlImGui to the project
set(RLIMGUI_SOURCES set(RLIMGUI_SOURCES
${rlimgui_SOURCE_DIR}/rlImGui.cpp ${rlimgui_SOURCE_DIR}/rlImGui.cpp
) )
# Create the rlImGui library # Create rlImGui lib
add_library(rlImGui STATIC ${RLIMGUI_SOURCES}) add_library(rlImGui STATIC ${RLIMGUI_SOURCES})
target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_DIR}) target_include_directories(rlImGui PUBLIC ${rlimgui_SOURCE_DIR} ${imgui_SOURCE_DIR})
target_link_libraries(rlImGui raylib ImGui) target_link_libraries(rlImGui raylib ImGui)
# Link ImGui and rlImGui to your project # Link ImGui and rlImGui
target_link_libraries(${PROJECT_NAME} ImGui rlImGui) target_link_libraries(${PROJECT_NAME} ImGui rlImGui)

3
src/dmx.cpp Normal file
View File

@ -0,0 +1,3 @@
//
// Created by illyum on 8/15/2024.
//

8
src/dmx.h Normal file
View File

@ -0,0 +1,8 @@
//
// Created by illyum on 8/15/2024.
//
#ifndef RAYLIBDMX_DMX_H
#define RAYLIBDMX_DMX_H
#endif //RAYLIBDMX_DMX_H

8
src/winapi_wrapper.h Normal file
View File

@ -0,0 +1,8 @@
//
// Created by illyum on 8/15/2024.
//
#ifndef RAYLIBDMX_WINAPI_WRAPPER_H
#define RAYLIBDMX_WINAPI_WRAPPER_H
#endif //RAYLIBDMX_WINAPI_WRAPPER_H