diff --git a/.gitignore b/.gitignore index a700a49..12a4609 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ build/ concept/ packed/ +vcpkg_installed/ diff --git a/CMakeLists.txt b/CMakeLists.txt index e7e35ec..71e15c1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,16 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.15) +# at least some form of vcpkg detect... +if(WIN32 AND DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE) + set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" + CACHE STRING "Vcpkg toolchain file") +endif() + project(anm2ed C CXX) +find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3-shared) +find_package(GLEW REQUIRED) +find_package(OpenGL REQUIRED) + # Gather project sources file(GLOB SOURCES "include/imgui/imgui.cpp" @@ -12,15 +22,26 @@ file(GLOB SOURCES "include/tinyxml2/tinyxml2.cpp" "include/inih/ini.c" "${PROJECT_SOURCE_DIR}/src/*.cpp" + "${PROJECT_SOURCE_DIR}/src/*.h" ) add_executable(${PROJECT_NAME} ${SOURCES}) target_include_directories(${PROJECT_NAME} PRIVATE include include/imgui include/tinyxml2 include/inih src) - +if (NOT MSVC) set(CMAKE_CXX_FLAGS "-g -O2 -std=c++23 -Wall -Wextra -pedantic -Wno-unused-variable -Wno-unused-parameter -Wno-ignored-qualifiers -Wno-parentheses -Wno-missing-field-initializers -Wno-unused-function -Wno-class-memaccess -Wno-delete-incomplete") +else() +# /std:c++latest is required to make MSVC grant access to all the latest C++ stuff (C++23 is listed as preview even on dev previews of MSVC....) +# /STACK allocation size change is a hack, a proper fix would be to remove all the instances of allocating gigantic objects on the stack :pleading_face: +# /EHsc is probably also a hack, makes compile warnings about std::chrono go away +set(CMAKE_CXX_FLAGS "/std:c++latest /EHsc") +target_link_options(${PROJECT_NAME} PRIVATE "/STACK:0xffffff") +endif() -target_link_libraries(${PROJECT_NAME} PRIVATE m GL GLEW SDL3) +if(NOT MSVC) +target_link_libraries(${PROJECT_NAME} PRIVATE m) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL GLEW::GLEW SDL3::SDL3) message("System: ${CMAKE_SYSTEM_NAME}") message("Project: ${PROJECT_NAME}") diff --git a/src/COMMON.h b/src/COMMON.h index a8cab4e..10b263e 100644 --- a/src/COMMON.h +++ b/src/COMMON.h @@ -26,6 +26,10 @@ #include "STRINGS.h" +#ifndef PATH_MAX +#define PATH_MAX 4096 +#endif + typedef uint8_t u8; typedef uint16_t u16; typedef uint32_t u32; diff --git a/src/state.h b/src/state.h index 1334bb0..3598a13 100644 --- a/src/state.h +++ b/src/state.h @@ -4,7 +4,7 @@ #define WINDOW_WIDTH 1920 #define WINDOW_HEIGHT 1080 -#define WINDOW_FLAGS SDL_WINDOW_RESIZABLE +#define WINDOW_FLAGS SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL #define LINE_WIDTH 2.0f struct State diff --git a/vcpkg-configuration.json b/vcpkg-configuration.json new file mode 100644 index 0000000..0f3f891 --- /dev/null +++ b/vcpkg-configuration.json @@ -0,0 +1,14 @@ +{ + "default-registry": { + "kind": "git", + "baseline": "4f8fe05871555c1798dbcb1957d0d595e94f7b57", + "repository": "https://github.com/microsoft/vcpkg" + }, + "registries": [ + { + "kind": "artifact", + "location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip", + "name": "microsoft" + } + ] +} diff --git a/vcpkg.json b/vcpkg.json new file mode 100644 index 0000000..2b13cf3 --- /dev/null +++ b/vcpkg.json @@ -0,0 +1,6 @@ +{ + "dependencies": [ + "sdl3", + "glew" + ] +}