stamen

Stamen - static menu generator
git clone git://git.dimitrijedobrota.com/stamen.git
Log | Files | Refs | README | LICENSE

commit 5604c9ae94f857927595cd9dd3a0ac980720cc68
parent 075d692948c0933690afdb61764047bf3e00466f
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date:   Wed, 28 Feb 2024 19:47:53 +0000

Little fix-up

* Update README.md
* Update LICENCE.md
* Fix cmake output location
* stamen-generate better help message

Diffstat:
MLICENSE.md | 2+-
MREADME.md | 2+-
Mdemo/CMakeLists.txt | 59+++++++++++++++++++++--------------------------------------
Msrc/generate.cpp | 2+-
4 files changed, 24 insertions(+), 41 deletions(-)

diff --git a/LICENSE.md b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Dimitrije Dobrota +Copyright (c) 2023-2024 Dimitrije Dobrota Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md @@ -71,7 +71,7 @@ reference to another panel or any other function (from now on referred to as ### Usage -Please reference demo folder for relevant usage example. +> Please reference demo folder for relevant usage example. There are a few things needed before you begin. diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt @@ -1,70 +1,53 @@ -add_executable(demo - main.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/demo_menu.cpp -) +set(GENERATE_OUT "${CMAKE_BINARY_DIR}/bin") -target_link_libraries(demo - stamen -) +configure_file(demo_menu.conf ${GENERATE_OUT}/demo_menu.conf COPYONLY) add_custom_command( - OUTPUT demo_menu.hpp demo_menu.cpp - COMMAND ${CMAKE_BINARY_DIR}/bin/stamen-generate ${CMAKE_CURRENT_SOURCE_DIR}/demo_menu.conf + OUTPUT ${GENERATE_OUT}/demo_menu.hpp ${GENERATE_OUT}/demo_menu.cpp + COMMAND ${GENERATE_OUT}/stamen-generate ${GENERATE_OUT}/demo_menu.conf DEPENDS demo_menu.conf stamen-generate COMMENT "Generating menu files" ) -add_custom_target(GenerateMenu - DEPENDS demo_menu.hpp demo_menu.cpp - COMMENT "Check if re-generation of menu files is required" +add_executable(demo + main.cpp + ${GENERATE_OUT}/demo_menu.cpp ) -add_dependencies(demo GenerateMenu) +target_link_libraries(demo stamen) +target_include_directories(demo PRIVATE ${GENERATE_OUT} ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(demo PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" + RUNTIME_OUTPUT_DIRECTORY "${GENERATE_OUT}" ) -configure_file(demo_menu.conf ${CMAKE_BINARY_DIR}/bin/demo_menu.conf COPYONLY) -add_executable(cdemo - main.c - ${CMAKE_CURRENT_SOURCE_DIR}/demo_menu.c -) - -target_link_libraries(cdemo - stamen -) add_custom_command( - OUTPUT demo_menu.h demo_menu.c - COMMAND ${CMAKE_BINARY_DIR}/bin/stamen-generate ${CMAKE_CURRENT_SOURCE_DIR}/demo_menu.conf c + OUTPUT ${GENERATE_OUT}/demo_menu.h ${GENERATE_OUT}/demo_menu.c + COMMAND ${GENERATE_OUT}/stamen-generate ${GENERATE_OUT}/demo_menu.conf c DEPENDS demo_menu.conf stamen-generate - COMMENT "Generating menu files" + COMMENT "Generating cmenu files" ) -add_custom_target(GenerateMenuC - DEPENDS demo_menu.h demo_menu.c - COMMENT "Check if re-generation of menu files is required" +add_executable(cdemo + main.c + ${GENERATE_OUT}/demo_menu.c ) -add_dependencies(cdemo GenerateMenuC) +target_link_libraries(cdemo stamen) +target_include_directories(cdemo PRIVATE ${GENERATE_OUT} ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(cdemo PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR} - RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" -) - -add_executable(dynamic - dynamic.cpp + RUNTIME_OUTPUT_DIRECTORY "${GENERATE_OUT}" ) -target_link_libraries(dynamic - stamen -) +add_executable(dynamic dynamic.cpp) +target_link_libraries(dynamic stamen) set_target_properties(dynamic PROPERTIES VERSION ${PROJECT_VERSION} diff --git a/src/generate.cpp b/src/generate.cpp @@ -49,7 +49,7 @@ int main(const int argc, const char *argv[]) { const auto args = std::span(argv, size_t(argc)); if (argc != 2 && argc != 3) { - std::cout << "please enter exaclty one config file" << std::endl; + std::cout << argv[0] << " config_file [c/cpp]" << std::endl; return 1; }