cmake_minimum_required(VERSION 3.10)
project(MyProject)

# Set the C++ standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# set(CMAKE_VERBOSE_MAKEFILE ON)

add_compile_options(-O2)

add_library(sqlite3
  sqlite3/sqlite3.c
)

target_compile_definitions(sqlite3 PRIVATE
  SQLITE_DQS=0 
  SQLITE_DEFAULT_MEMSTATUS=0 
  SQLITE_DEFAULT_WAL_SYNCHRONOUS=1 
  SQLITE_LIKE_DOESNT_MATCH_BLOBS 
  SQLITE_MAX_EXPR_DEPTH=0 
  SQLITE_OMIT_DECLTYPE 
  SQLITE_OMIT_DEPRECATED 
  SQLITE_OMIT_PROGRESS_CALLBACK 
  SQLITE_OMIT_SHARED_CACHE 
  SQLITE_USE_ALLOCA 
  SQLITE_OMIT_AUTOINIT 
  SQLITE_STRICT_SUBTYPE=1 
  SQLITE_THREADSAFE=2
)

add_library(imgui
  imgui/imgui_demo.cpp
  imgui/imgui_draw.cpp
  imgui/imgui_tables.cpp
  imgui/imgui_widgets.cpp
  imgui/imgui.cpp
  imgui_raylib/rlImGui.cpp
)

target_include_directories(imgui PRIVATE raylib/ imgui/)


add_library(raylib 
  raylib/rcore.c
  raylib/rshapes.c
  raylib/rtextures.c
  raylib/rtext.c
  raylib/utils.c
  raylib/rglfw.c
  raylib/rmodels.c
  raylib/raudio.c
)

target_compile_definitions(raylib PUBLIC
  _GNU_SOURCE 
  PLATFORM_DESKTOP_GLFW 
  GRAPHICS_API_OPENGL_33 
  _GLFW_X11
)

target_include_directories(raylib PRIVATE 
raylib/
raylib/external/glfw/include
)

set(public_headers
  raylib/raylib.h
  raylib/rlgl.h
  raylib/raymath.h

  sqlite3/sqlite3.h

  imgui/imgui.h
  imgui/imconfig.h

  imgui_raylib/rlImGui.h
  imgui_raylib/rlImGuiColors.h
  imgui_raylib/IconsFontAwesome6.h
)

file(COPY ${public_headers} DESTINATION "include")

add_executable(main demo.cpp)
target_link_libraries(main raylib imgui)
target_include_directories(main PRIVATE build/include/)

