-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
300 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,64 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
project(compute_graph) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
add_library(compute_graph INTERFACE) | ||
project(compute_graph | ||
LANGUAGES CXX | ||
VERSION 0.0.1) | ||
|
||
# low version cmake does not support PROJECT_IS_TOP_LEVEL | ||
if (${CMAKE_VERSION} VERSION_LESS "3.12.0") | ||
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) | ||
set(PROJECT_IS_TOP_LEVEL TRUE) | ||
else() | ||
set(PROJECT_IS_TOP_LEVEL FALSE) | ||
endif () | ||
endif() | ||
|
||
|
||
# ================ options ================ | ||
option(CG_BUILD_EXAMPLES "Build examples" ${PROJECT_IS_TOP_LEVEL}) | ||
|
||
target_include_directories(compute_graph INTERFACE | ||
${CMAKE_CURRENT_LIST_DIR}/compute_graph/include) | ||
|
||
add_executable(compute_graph_exec main.cpp) | ||
target_link_libraries(compute_graph_exec PUBLIC compute_graph) | ||
# ================ target ================ | ||
add_library(compute_graph INTERFACE) | ||
target_include_directories(compute_graph INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/compute_graph/include> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | ||
|
||
if (MSVC) | ||
target_compile_options(compute_graph INTERFACE /Zc:preprocessor) | ||
endif() | ||
|
||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") | ||
target_compile_options(compute_graph_exec PRIVATE | ||
-Wall -Wextra -Weffc++ | ||
-Werror=uninitialized | ||
-Werror=return-type | ||
-Wconversion -Wsign-compare | ||
-Werror=unused-result | ||
-Werror=suggest-override | ||
-Wzero-as-null-pointer-constant | ||
-Wmissing-declarations | ||
-Wold-style-cast -Werror=vla | ||
-Wnon-virtual-dtor) | ||
# ================ examples ================ | ||
if (CG_BUILD_EXAMPLES) | ||
add_subdirectory(examples) | ||
endif() | ||
|
||
if (MSVC) | ||
target_compile_options(compute_graph_exec PRIVATE /W4) | ||
endif() | ||
# ================ install ================ | ||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
set(version_config_file ${CMAKE_CURRENT_BINARY_DIR}/compute_graphConfigVersion.cmake) | ||
set(project_config_file ${CMAKE_CURRENT_BINARY_DIR}/compute_graphConfig.cmake) | ||
|
||
write_basic_package_version_file( | ||
${version_config_file} | ||
VERSION ${PACKAGE_VERSION} | ||
COMPATIBILITY AnyNewerVersion | ||
) | ||
|
||
install(DIRECTORY compute_graph/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(TARGETS compute_graph | ||
EXPORT compute_graphTargets | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) | ||
install(EXPORT compute_graphTargets | ||
FILE compute_graphTargets.cmake | ||
NAMESPACE compute_graph:: | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/compute_graph) | ||
install(FILES ${project_config_file} ${version_config_file} | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/compute_graph) | ||
|
||
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake/compute_graphConfig.cmake.in | ||
${project_config_file} | ||
@ONLY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include("${CMAKE_CURRENT_LIST_DIR}/compute_graphTargets.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// The MIT License (MIT) | ||
// Copyright © 2024 Adversarr | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the “Software”), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in | ||
// all copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
|
||
#pragma once | ||
|
||
#include "socket.hpp" | ||
#include "node.hpp" | ||
#include "graph.hpp" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.