Skip to content

Commit

Permalink
Fix/No exit cleanup (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
cursey authored Apr 10, 2024
1 parent 37351a6 commit 9643fef
Show file tree
Hide file tree
Showing 12 changed files with 348 additions and 529 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4.1.1

- name: Configure CMake
run: cmake -S ${{github.workspace}} -B ${{github.workspace}}/build -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
Expand All @@ -25,22 +25,21 @@ jobs:
run: cmake --install ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --prefix ${{github.workspace}}/install

- name: Upload artifacts
uses: actions/upload-artifact@v2.3.1
uses: actions/upload-artifact@v4.3.1
with:
name: REFramework-D2D
path: ${{github.workspace}}/install/bin/*
if-no-files-found: error

- name: Compress artifacts
uses: vimtor/action-zip@v1
uses: vimtor/action-zip@v1.2
with:
files: install/bin/
dest: REFramework-D2D.zip

- name: Release
uses: softprops/action-gh-release@v0.1.14
uses: softprops/action-gh-release@v2.0.4
if: ${{startsWith(github.ref, 'refs/tags/')}}
with:
prerelease: ${{!startsWith(github.ref, 'refs/tags/v') || contains(github.ref, '-pre')}}
files: ${{github.workspace}}/REFramework-D2D.zip

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build/
install/
.vscode/
.vscode/
.vs/
out/
152 changes: 33 additions & 119 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,131 +1,45 @@
# This file is automatically generated from cmake.toml - DO NOT EDIT
# See https://github.com/build-cpp/cmkr for more information

cmake_minimum_required(VERSION 3.15)

if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
endif()

# Regenerate CMakeLists.txt automatically in the root project
set(CMKR_ROOT_PROJECT OFF)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMKR_ROOT_PROJECT ON)

# Bootstrap cmkr
include(cmkr.cmake OPTIONAL RESULT_VARIABLE CMKR_INCLUDE_RESULT)
if(CMKR_INCLUDE_RESULT)
cmkr()
endif()

# Enable folder support
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
endif()

# Create a configure-time dependency on cmake.toml to improve IDE support
if(CMKR_ROOT_PROJECT)
configure_file(cmake.toml cmake.toml COPYONLY)
endif()

cmake_minimum_required(VERSION 3.25)
project(reframework-d2d)

set(VCPKG_TARGET_TRIPLET x64-windows-static)

if(CMKR_ROOT_PROJECT AND NOT CMKR_DISABLE_VCPKG)
include(FetchContent)
message(STATUS "Fetching vcpkg...")
FetchContent_Declare(vcpkg URL "https://github.com/microsoft/vcpkg/archive/refs/tags/2022.06.15.tar.gz")
FetchContent_MakeAvailable(vcpkg)
include("${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake")
endif()

# Packages
find_package(sol2 REQUIRED CONFIG)

find_package(Lua REQUIRED)

find_package(utf8cpp REQUIRED CONFIG)

# Target reframework
set(CMKR_TARGET reframework)
set(reframework_SOURCES "")

set(CMKR_SOURCES ${reframework_SOURCES})
add_library(reframework INTERFACE)

if(reframework_SOURCES)
target_sources(reframework INTERFACE ${reframework_SOURCES})
endif()

target_include_directories(reframework INTERFACE
"deps/reframework/include"
include (cmake/CPM.cmake)

CPMAddPackage("gh:nemtrif/[email protected]")
CPMAddPackage("gh:ThePhD/[email protected]")
CPMAddPackage(
NAME lua
GITHUB_REPOSITORY lua/lua
VERSION 5.4.6
DOWNLOAD_ONLY YES
)

unset(CMKR_TARGET)
unset(CMKR_SOURCES)

# Target reframework-d2d
set(CMKR_TARGET reframework-d2d)
set(reframework-d2d_SOURCES "")

list(APPEND reframework-d2d_SOURCES
"src/D2DFont.cpp"
"src/D2DImage.cpp"
"src/D2DPainter.cpp"
"src/D3D12Renderer.cpp"
"src/DrawList.cpp"
"src/Plugin.cpp"
"src/D2DFont.hpp"
"src/D2DImage.hpp"
"src/D2DPainter.hpp"
"src/D3D12Renderer.hpp"
"src/D3D12Shaders.hpp"
"src/DrawList.hpp"
"src/LruCache.hpp"
)
if (lua_ADDED)
FILE(GLOB lua_sources ${lua_SOURCE_DIR}/*.c)
list(REMOVE_ITEM lua_sources "${lua_SOURCE_DIR}/lua.c" "${lua_SOURCE_DIR}/luac.c" "${lua_SOURCE_DIR}/onelua.c")
add_library(lua STATIC ${lua_sources})

list(APPEND reframework-d2d_SOURCES
cmake.toml
)

set(CMKR_SOURCES ${reframework-d2d_SOURCES})
add_library(reframework-d2d SHARED)

if(reframework-d2d_SOURCES)
target_sources(reframework-d2d PRIVATE ${reframework-d2d_SOURCES})
target_include_directories(lua
PUBLIC
$<BUILD_INTERFACE:${lua_SOURCE_DIR}>
)
endif()

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${reframework-d2d_SOURCES})

target_compile_features(reframework-d2d PUBLIC
cxx_std_20
add_library(reframework-d2d SHARED
src/D2DFont.cpp
src/D2DImage.cpp
src/D2DPainter.cpp
src/D3D12Renderer.cpp
src/DrawList.cpp
src/Plugin.cpp
)

target_include_directories(reframework-d2d PUBLIC
${LUA_INCLUDE_DIR}
target_include_directories(reframework-d2d PRIVATE
src
deps/reframework/include
)

target_link_libraries(reframework-d2d PUBLIC
sol2::sol2
${LUA_LIBRARIES}
utf8cpp
reframework
d2d1
dwrite
d3d11
d3d12
dxgi
d3dcompiler
)

unset(CMKR_TARGET)
unset(CMKR_SOURCES)
target_compile_features(reframework-d2d PRIVATE cxx_std_20)
target_link_libraries(reframework-d2d PRIVATE utf8cpp sol2::sol2 lua d2d1 dwrite d3d11 d3d12 dxgi d3dcompiler)

install(
TARGETS
reframework-d2d
DESTINATION
bin
COMPONENT
reframework-d2d
TARGETS reframework-d2d
DESTINATION bin
COMPONENT reframework-d2d
)
29 changes: 0 additions & 29 deletions cmake.toml

This file was deleted.

24 changes: 24 additions & 0 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# SPDX-License-Identifier: MIT
#
# SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors

set(CPM_DOWNLOAD_VERSION 0.39.0)
set(CPM_HASH_SUM "66639bcac9dd2907b2918de466783554c1334446b9874e90d38e3778d404c2ef")

if(CPM_SOURCE_CACHE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()

# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)

file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
)

include(${CPM_DOWNLOAD_LOCATION})
Loading

0 comments on commit 9643fef

Please sign in to comment.