Switch from CPM to VCPKG
This commit is contained in:
@@ -11,18 +11,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if(PROJECT_IS_TOP_LEVEL)
|
||||
include(cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(NAME EnTT URL "https://github.com/skypjack/entt/releases/download/v3.13.2/entt-v3.13.2.tar.gz")
|
||||
CPMAddPackage(NAME nlohmann_json URL "https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz")
|
||||
CPMAddPackage(NAME glfw3 URL "https://github.com/glfw/glfw/releases/download/3.4/glfw-3.4.zip" OPTIONS "GLFW_BUILD_DOCS OFF" "GLFW_INSTALL OFF")
|
||||
CPMAddPackage(NAME fx-gltf URL "https://github.com/jessey-git/fx-gltf/archive/refs/tags/v2.0.0.tar.gz" OPTIONS "FX_GLTF_BUILD_TESTS OFF" "FX_GLTF_INSTALL OFF")
|
||||
CPMAddPackage(NAME glm URL "https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz")
|
||||
CPMAddPackage(NAME spdlog URL "https://github.com/gabime/spdlog/archive/refs/tags/v1.14.1.tar.gz")
|
||||
endif()
|
||||
find_package(EnTT CONFIG REQUIRED)
|
||||
find_package(glm CONFIG REQUIRED)
|
||||
find_package(nlohmann_json CONFIG REQUIRED)
|
||||
find_package(glfw3 REQUIRED)
|
||||
find_package(spdlog REQUIRED)
|
||||
find_package(fx-gltf REQUIRED)
|
||||
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/lib)
|
||||
add_subdirectory(${PROJECT_SOURCE_DIR}/src)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"version": 2,
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 14,
|
||||
"minor": 24,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
@@ -26,17 +26,25 @@
|
||||
"CMAKE_CXX_STANDARD_REQUIRED": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "vcpkg",
|
||||
"hidden": true,
|
||||
"cacheVariables": {
|
||||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
|
||||
"VCPKG_INSTALL_OPTIONS": "--no-print-usage"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "dev",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"inherits": [
|
||||
"std"
|
||||
"std",
|
||||
"vcpkg"
|
||||
],
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always",
|
||||
"GLFW_BUILD_X11": "OFF"
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_CXX_FLAGS": "-Wall -Wextra -Wpedantic -fdiagnostics-color=always"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
CPMAddPackage(NAME argparse URL "https://github.com/p-ranav/argparse/archive/refs/tags/v3.1.tar.gz")
|
||||
find_package(cxxopts CONFIG)
|
||||
|
||||
add_executable(Fall-Fever
|
||||
main.cpp
|
||||
@@ -6,4 +6,4 @@ add_executable(Fall-Fever
|
||||
flycam.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(Fall-Fever PRIVATE fever_core argparse)
|
||||
target_link_libraries(Fall-Fever PRIVATE fever_core cxxopts::cxxopts)
|
||||
|
||||
@@ -2,25 +2,35 @@
|
||||
#include "util/log.h"
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
#include <argparse/argparse.hpp>
|
||||
#include <cxxopts.hpp>
|
||||
#include <iostream>
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
auto main(int argc, char* argv[]) -> int
|
||||
{
|
||||
Log::initialize();
|
||||
|
||||
argparse::ArgumentParser program("Fall-Fever");
|
||||
program.add_argument("model").help("model file to load");
|
||||
cxxopts::Options options("Fall-Fever", "A brief description");
|
||||
|
||||
try {
|
||||
program.parse_args(argc, argv);
|
||||
} catch (std::exception const& err) {
|
||||
std::cerr << err.what() << std::endl;
|
||||
std::cerr << program;
|
||||
return 1;
|
||||
// clang-format off
|
||||
options.add_options()
|
||||
("model", "Model file to load", cxxopts::value<std::string>())
|
||||
("h,help", "Print usage")
|
||||
;
|
||||
// clang-format on
|
||||
|
||||
options.parse_positional({"model"});
|
||||
|
||||
auto result = options.parse(argc, argv);
|
||||
|
||||
if (result.count("help")) {
|
||||
std::cout << options.help() << std::endl;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
auto model = program.get<std::string>("model");
|
||||
std::string model;
|
||||
if (result.count("model"))
|
||||
model = result["model"].as<std::string>();
|
||||
|
||||
// Initialize GLFW
|
||||
if (glfwInit() == 0) {
|
||||
|
||||
1269
cmake/CPM.cmake
1269
cmake/CPM.cmake
File diff suppressed because it is too large
Load Diff
@@ -24,12 +24,11 @@ target_include_directories(fever_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
target_link_libraries(
|
||||
fever_core PUBLIC
|
||||
glad
|
||||
stb
|
||||
glfw
|
||||
EnTT::EnTT
|
||||
pthread
|
||||
spdlog
|
||||
spdlog::spdlog
|
||||
glm::glm
|
||||
fx-gltf::fx-gltf
|
||||
nlohmann_json::nlohmann_json
|
||||
stb
|
||||
)
|
||||
|
||||
22
vcpkg.json
Normal file
22
vcpkg.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"vcpkg-configuration": {
|
||||
"overlay-ports": [
|
||||
"./vcpkg"
|
||||
]
|
||||
},
|
||||
"dependencies": [
|
||||
"cxxopts",
|
||||
"entt",
|
||||
"fmt",
|
||||
{
|
||||
"name": "glfw3",
|
||||
"features": [
|
||||
"wayland"
|
||||
]
|
||||
},
|
||||
"glm",
|
||||
"nlohmann-json",
|
||||
"spdlog",
|
||||
"fx-gltf"
|
||||
]
|
||||
}
|
||||
16
vcpkg/fx-gltf/portfile.cmake
Normal file
16
vcpkg/fx-gltf/portfile.cmake
Normal file
@@ -0,0 +1,16 @@
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO jessey-git/fx-gltf
|
||||
REF v2.0.0
|
||||
SHA512 0731732b5919a55045df2fe06bda6ea2a4d4d889556d738d0ade5acf39341a0748deb13bb130cbd6226146c70c2566ebfa67e6ac398157be00fefcf1f071a9bd
|
||||
HEAD_REF main
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PREFER_NINJA
|
||||
OPTIONS
|
||||
-DFX_GLTF_BUILD_TESTS=OFF
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
7
vcpkg/fx-gltf/vcpkg.json
Normal file
7
vcpkg/fx-gltf/vcpkg.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "fx-gltf",
|
||||
"version": "2.0.0",
|
||||
"description": "A C++ library for loading and saving glTF 2.0 files.",
|
||||
"homepage": "https://github.com/jessey-git/fx-gltf",
|
||||
"dependencies": []
|
||||
}
|
||||
Reference in New Issue
Block a user