Skip to content

Commit

Permalink
build(cmake): streamline cmake scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan authored Jun 19, 2024
1 parent d1bba06 commit 560addf
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
2 changes: 0 additions & 2 deletions CMakeInstall.txt.tmpl

This file was deleted.

20 changes: 14 additions & 6 deletions CMakeLists.txt.tmpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
cmake_minimum_required(VERSION 3.12)

include("./CMakeShared.txt")
include(${CMAKE_SOURCE_DIR}/cmake/pr_common.cmake)

set(PROJ_NAME {{ tmplr.module_name }})
set(MODULE_TYPE {{ tmplr.module_type }})

pr_add_library(${PROJ_NAME} SHARED)

pr_add_dependency(${PROJ_NAME} shared TARGET PUBLIC)
if("${MODULE_TYPE}" STREQUAL "client")
pr_add_dependency(${PROJ_NAME} client TARGET PUBLIC)
elif("${MODULE_TYPE}" STREQUAL "server")
pr_add_dependency(${PROJ_NAME} server TARGET PUBLIC)
endif()

project(${PROJ_NAME} CXX)
pr_add_headers(${PROJ_NAME} "include/")
pr_add_sources(${PROJ_NAME} "src/")

link_generic_module_libraries()
register_pragma_module(${PROJ_NAME})
pr_finalize(${PROJ_NAME})
2 changes: 2 additions & 0 deletions Install.cmake.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Install the library
pr_install_targets({{ tmplr.module_name }} INSTALL_DIR "{{ tmplr.install_directory }}")
1 change: 1 addition & 0 deletions template_pragma_module.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "Project Name",
"module_name": "pr_module",
"module_type": "shared",
"install_directory": "modules/",
"release_directory": ""
}

0 comments on commit 560addf

Please sign in to comment.