From a166190b64a2f39ce6bc66c945fe01edaffcecce Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:21:45 -0700 Subject: [PATCH 01/21] Imported example derived repo from tettigoniidae and adapted to use Nymph via FetchContent instead of as a submodule --- Examples/CppRepo/BUILD_ME.sh | 8 ++ Examples/CppRepo/CMakeLists.txt | 89 +++++++++++++++++++ Examples/CppRepo/Library/CMakeLists.txt | 5 ++ Examples/CppRepo/Library/Data/CMakeLists.txt | 32 +++++++ Examples/CppRepo/Library/Data/DoubleData.cc | 14 +++ Examples/CppRepo/Library/Data/DoubleData.hh | 31 +++++++ Examples/CppRepo/Library/Data/IntData.cc | 14 +++ Examples/CppRepo/Library/Data/IntData.hh | 35 ++++++++ Examples/CppRepo/Library/Processors/Adder.cc | 35 ++++++++ Examples/CppRepo/Library/Processors/Adder.hh | 64 +++++++++++++ .../CppRepo/Library/Processors/CMakeLists.txt | 35 ++++++++ 11 files changed, 362 insertions(+) create mode 100644 Examples/CppRepo/BUILD_ME.sh create mode 100644 Examples/CppRepo/CMakeLists.txt create mode 100644 Examples/CppRepo/Library/CMakeLists.txt create mode 100644 Examples/CppRepo/Library/Data/CMakeLists.txt create mode 100644 Examples/CppRepo/Library/Data/DoubleData.cc create mode 100644 Examples/CppRepo/Library/Data/DoubleData.hh create mode 100644 Examples/CppRepo/Library/Data/IntData.cc create mode 100644 Examples/CppRepo/Library/Data/IntData.hh create mode 100644 Examples/CppRepo/Library/Processors/Adder.cc create mode 100644 Examples/CppRepo/Library/Processors/Adder.hh create mode 100644 Examples/CppRepo/Library/Processors/CMakeLists.txt diff --git a/Examples/CppRepo/BUILD_ME.sh b/Examples/CppRepo/BUILD_ME.sh new file mode 100644 index 0000000..1731a3a --- /dev/null +++ b/Examples/CppRepo/BUILD_ME.sh @@ -0,0 +1,8 @@ +#! /bin/bash + +mkdir build +cd build + +cmake .. + +make -j${NARG} install diff --git a/Examples/CppRepo/CMakeLists.txt b/Examples/CppRepo/CMakeLists.txt new file mode 100644 index 0000000..201d390 --- /dev/null +++ b/Examples/CppRepo/CMakeLists.txt @@ -0,0 +1,89 @@ +# Minimum cmake verison 3.12 required for Scarab +cmake_minimum_required (VERSION 3.12) + +# Define the project +cmake_policy( SET CMP0048 NEW ) # version in project() +project( CppRepo VERSION 0.0.0 ) + +include( FetchContent ) +# Define Nymph as an ExternalProject +# If Nymph is a submodule, then set the SOURCE_DIR option to point to it; also in that case, remove any download specifications +set( Nymph_DIR nymph_src ) +FetchContent_Populate( nymph + SOURCE_DIR ${Nymph_DIR} + GIT_REPOSITORY https://github.com/project8/nymph + GIT_TAG nymph2_2/develop + GIT_SHALLOW TRUE +) +message( "dir: ${Nymph_DIR}") + +# If nymph were a submodule in ${PROJECT_SOURCE_DIR}/nymph, that would be used in place of ${Nymph_DIR} +list( APPEND CMAKE_MODULE_PATH + ${CMAKE_BINARY_DIR}/${Nymph_DIR}/Scarab/cmake + ${CMAKE_BINARY_DIR}/${Nymph_DIR}/cmake +) +include( PackageBuilder ) +include( Nymph ) + +######### +# flags # +######### + +set( CMAKE_CXX_STANDARD 17 ) + + +################ +# dependencies # +################ + +set( PUBLIC_EXT_LIBS ) +set( PRIVATE_EXT_LIBS ) + + + + +##################### +# prepare for build # +##################### + +pbuilder_prepare_project() + + +############## +# submodules # +############## + +# Nymph +pbuilder_add_submodule( Nymph ${CMAKE_BINARY_DIR}/${Nymph_DIR} ) + +pbuilder_use_sm_library( Nymph Nymph ) + +##################### +# build the project # +##################### + +# add include directories +include_directories( BEFORE + Library/Processors + Library/Data +) + +# build this project +add_subdirectory( Library ) + +if( tettigoniidae_ENABLE_EXECUTABLES ) + #add_subdirectory( Executables ) +endif() + +if( tettigoniidae_ENABLE_TESTING ) + #add_subdirectory( Testing ) +endif() + + +################## +# package config # +################## + +#configure_file( ${PROJECT_SOURCE_DIR}/tettigoniidaeConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/tettigoniidaeConfig.cmake @ONLY ) + +#pbuilder_do_package_config() \ No newline at end of file diff --git a/Examples/CppRepo/Library/CMakeLists.txt b/Examples/CppRepo/Library/CMakeLists.txt new file mode 100644 index 0000000..ea7dff2 --- /dev/null +++ b/Examples/CppRepo/Library/CMakeLists.txt @@ -0,0 +1,5 @@ +# CMakeLists for nymph/Examples/CppRepo/Library +# Author: N.S. Oblath + +add_subdirectory( Data ) +add_subdirectory( Processors ) diff --git a/Examples/CppRepo/Library/Data/CMakeLists.txt b/Examples/CppRepo/Library/Data/CMakeLists.txt new file mode 100644 index 0000000..c4f007f --- /dev/null +++ b/Examples/CppRepo/Library/Data/CMakeLists.txt @@ -0,0 +1,32 @@ +# CMakeLists for nymph/Examples/CppRepo/Library/Data +# Author: N.S. Oblath + +include_directories( BEFORE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set( CppRepoData_HEADERFILES + DoubleData.hh + IntData.hh +) + +set( CppRepoData_SOURCEFILES + DoubleData.cc + IntData.cc +) + + +################################################## + +pbuilder_library( + TARGET CppRepoData + SOURCES ${CppRepoData_SOURCEFILES} + PUBLIC_EXTERNAL_LIBRARIES ${PUBLIC_EXT_LIBS} +) + +pbuilder_component_install_and_export( + COMPONENT Library + LIBTARGETS CppRepoData +) + +pbuilder_install_headers( ${CppRepoData_HEADERFILES} ) diff --git a/Examples/CppRepo/Library/Data/DoubleData.cc b/Examples/CppRepo/Library/Data/DoubleData.cc new file mode 100644 index 0000000..493eb78 --- /dev/null +++ b/Examples/CppRepo/Library/Data/DoubleData.cc @@ -0,0 +1,14 @@ + +#include "DoubleData.hh" + +namespace tettigoniidae +{ + DoubleData::DoubleData() : + Nymph::Data(), + fDValue1( 0. ), + fDValue2( 10. ) + {} + + DoubleData::~DoubleData() + {} +} diff --git a/Examples/CppRepo/Library/Data/DoubleData.hh b/Examples/CppRepo/Library/Data/DoubleData.hh new file mode 100644 index 0000000..ee88e02 --- /dev/null +++ b/Examples/CppRepo/Library/Data/DoubleData.hh @@ -0,0 +1,31 @@ +/* + * TestData2.hh + * + * Created on: Jan 6, 2022 + * Author: N.S. Oblath + */ + +#ifndef TTGD_TESTING_TESTDATA2 +#define TTGD_TESTING_TESTDATA2 + +#include "Data.hh" +#include "MemberVariable.hh" + +namespace tettigoniidae +{ + + class DoubleData : public Nymph::Data + { + public: + DoubleData(); + + virtual ~DoubleData(); + + MEMVAR( double, DValue1 ); + MEMVAR( double, DValue2 ); + }; + + +} /* namespace tettigoniidae */ + +#endif /* TTGD_TESTING_TESTDATA2 */ diff --git a/Examples/CppRepo/Library/Data/IntData.cc b/Examples/CppRepo/Library/Data/IntData.cc new file mode 100644 index 0000000..8fef364 --- /dev/null +++ b/Examples/CppRepo/Library/Data/IntData.cc @@ -0,0 +1,14 @@ + +#include "IntData.hh" + +namespace tettigoniidae +{ + IntData::IntData() : + Nymph::Data(), + fIValue1( 0 ), + fIValue2( 5 ) + {} + + IntData::~IntData() + {} +} diff --git a/Examples/CppRepo/Library/Data/IntData.hh b/Examples/CppRepo/Library/Data/IntData.hh new file mode 100644 index 0000000..3cbe8ee --- /dev/null +++ b/Examples/CppRepo/Library/Data/IntData.hh @@ -0,0 +1,35 @@ +/* + * IntData.hh + * + * Created on: Jan 6, 2022 + * Author: N.S. Oblath + */ + +#ifndef TTGD_DATA_INTDATA +#define TTGD_DATA_INTDATA + +#include "Data.hh" +#include "MemberVariable.hh" + +namespace tettigoniidae +{ + + /*! + @class IntData + @author N. S. Oblath + @brief Two integer values + */ + class IntData : public Nymph::Data + { + public: + IntData(); + + virtual ~IntData(); + + MEMVAR( int, IValue1 ); + MEMVAR( int, IValue2 ); + }; + +} /* namespace tettigoniidae */ + +#endif /* TTGD_DATA_INTDATA */ diff --git a/Examples/CppRepo/Library/Processors/Adder.cc b/Examples/CppRepo/Library/Processors/Adder.cc new file mode 100644 index 0000000..9fed0ca --- /dev/null +++ b/Examples/CppRepo/Library/Processors/Adder.cc @@ -0,0 +1,35 @@ + +#include "Adder.hh" + +#include "IntData.hh" + + +REGISTER_PROCESSOR( tettigoniidae, Adder, "adder" ) + +namespace tettigoniidae +{ + Adder::Adder( const std::string& name ) : + Processor( name ), + fIntValue( 0 ), + fIntSignal( "int", this ), + fAddIntSlot( "add-int", this, &Adder::Add, &fIntSignal ) + {} + + Adder::~Adder() + {} + + void Adder::Configure( const scarab::param_node& node ) + { + fIntValue = node.get_value( "int-value", fIntValue ); + + return; + } + + void Adder::Add( IntData& data ) + { + data.SetIValue1( data.GetIValue1() + fIntValue ); + data.SetIValue2( data.GetIValue2() + fIntValue ); + return; + } + +} /* namespace tettigoniidae */ diff --git a/Examples/CppRepo/Library/Processors/Adder.hh b/Examples/CppRepo/Library/Processors/Adder.hh new file mode 100644 index 0000000..93ab1d8 --- /dev/null +++ b/Examples/CppRepo/Library/Processors/Adder.hh @@ -0,0 +1,64 @@ +/*! + * @file Adder.hh + * + * Created on: Nov 25, 2021 + * Author: N.S. Oblath + */ + +#ifndef TTGD_PROCESSORS_ADDER +#define TTGD_PROCESSORS_ADDER + +#include "Processor.hh" +#include "SignalData.hh" +#include "SlotData.hh" + +namespace tettigoniidae +{ + class IntData; + + /*! + @class Adder + @author N. S. Oblath + + @brief Adds a value to data + + @procdetails + Does addition in place + + @proctype adder + + @config + @configparam{int-value,int} Value to add to IntData + + @slots + @slot{add-int,void (DataHandle)} Adds a value to IntData; Requires IntData; Adds no data; Emits signal "int" + + @signals + @signal{int,void (DataHandle)} Emitted after adding to IntData + */ + class Adder : public Nymph::Processor + { + public: + Adder( const std::string& name = "adder" ); + + virtual ~Adder(); + + /// Processor configuration + void Configure( const scarab::param_node& node ); + + MEMVAR( int, IntValue ); + + public: + /// Add an integer to integer data + void Add( IntData& data ); + + public: + Nymph::SignalData fIntSignal; + + Nymph::SlotData< Nymph::In, Nymph::Out<> > fAddIntSlot; + + }; + +} /* namespace tettigoniidae */ + +#endif /* TTGD_PROCESSORS_ADDER */ diff --git a/Examples/CppRepo/Library/Processors/CMakeLists.txt b/Examples/CppRepo/Library/Processors/CMakeLists.txt new file mode 100644 index 0000000..1bd998c --- /dev/null +++ b/Examples/CppRepo/Library/Processors/CMakeLists.txt @@ -0,0 +1,35 @@ +# CMakeLists for nymph/Examples/CppRepo/Library/Processors +# Author: N.S. Oblath + +include_directories( BEFORE + ${CMAKE_CURRENT_SOURCE_DIR} +) + +set( CppRepo_LIBS + CppRepoData +) + +set( CppRepoProcs_HEADERFILES + Adder.hh +) + +set( CppRepoProcs_SOURCEFILES + Adder.cc +) + + +################################################## + +pbuilder_library( + TARGET CppRepoProcs + SOURCES ${CppRepoProcs_SOURCEFILES} + PUBLIC_EXTERNAL_LIBRARIES ${PUBLIC_EXT_LIBS} + PROJECT_LIBRARIES ${CppRepo_LIBS} +) + +pbuilder_component_install_and_export( + COMPONENT Library + LIBTARGETS CppRepoProcs +) + +pbuilder_install_headers( ${CppRepoProcs_HEADERFILES} ) From f89f06307c38300242a9590ada4269baaacea196 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:32:15 -0700 Subject: [PATCH 02/21] Flesh out cmake command in CppRepo and add CppRepo build to build.yaml --- .github/workflows/build.yaml | 8 +++++--- Examples/CppRepo/BUILD_ME.sh | 10 ++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) mode change 100644 => 100755 Examples/CppRepo/BUILD_ME.sh diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4933aa6..10fda12 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -98,8 +98,6 @@ jobs: cmake -DPYBIND11_TEST=FALSE .. make -j${{ env.NARG }} install - - - name: Linux Dependencies if: startsWith(matrix.os, 'ubuntu') # Linux only run: | @@ -118,7 +116,6 @@ jobs: cd ../.. pip install "pybind11[global]" - - name: Configure CMake run: | mkdir -p build @@ -141,6 +138,11 @@ jobs: cd build Testing/RunTests + - name: Build CppRepo Example + run: | + cd Examples/CppRepo + ./BUILD_ME.sh + build_python: name: Build and Test Python diff --git a/Examples/CppRepo/BUILD_ME.sh b/Examples/CppRepo/BUILD_ME.sh old mode 100644 new mode 100755 index 1731a3a..0c2da90 --- a/Examples/CppRepo/BUILD_ME.sh +++ b/Examples/CppRepo/BUILD_ME.sh @@ -3,6 +3,12 @@ mkdir build cd build -cmake .. +cmake -DCMAKE_BUILD_TYPE=${Nymph_BUILD_TYPE:=Debug} \ + -DNymph_BUILD_NYMPH_EXE=${Nymph_BUILD_NYMPH_EXE:=FALSE} \ + -DNymph_ENABLE_EXECUTABLES=${Nymph_ENABLE_EXECUTABLES:=TRUE} \ + -DNymph_ENABLE_PYTHON=${Nymph_ENABLE_PYTHON:=FALSE} \ + -DNymph_ENABLE_TESTING=${Nymph_ENABLE_TESTING:=FALSE} \ + -DNymph_SINGLETHREADED=${Nymph_SINGLETHREADED:=FALSE} \ + .. -make -j${NARG} install +make -j${NARG:=} install From d4bcb6acebf69e9028f620be3847981786e8b356 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:36:37 -0700 Subject: [PATCH 03/21] Remove system from boost components (not required and doesn't work with newest mac runners) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91001eb..278befa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,7 @@ set( PRIVATE_EXT_LIBS ) ####### # Boost (1.46 required for filesystem version 3) -list( APPEND BOOST_COMPONENTS chrono date_time filesystem system thread ) +list( APPEND BOOST_COMPONENTS chrono date_time filesystem thread ) find_package( Boost 1.46.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS} ) list( APPEND PUBLIC_EXT_LIBS Boost::boost Boost::chrono Boost::date_time Boost::thread Boost::filesystem ) # make sure dynamic linking is assumed for all boost libraries From 132d7c7503769c4349faa83417318ad1999496d6 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:42:38 -0700 Subject: [PATCH 04/21] Updated Scarab to v3.13.1 --- Scarab | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Scarab b/Scarab index e5c49f5..b899601 160000 --- a/Scarab +++ b/Scarab @@ -1 +1 @@ -Subproject commit e5c49f58bd38660ecfb13f607e1d0b021d24fc97 +Subproject commit b899601d9c5f6a81734b6bd78f3056a1bf52b708 From eddd2ecf4a7b432a0497cb5543d86d348836d40b Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:43:05 -0700 Subject: [PATCH 05/21] Turn off Nymph testing while building CppRepo --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 10fda12..f037702 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -139,6 +139,8 @@ jobs: Testing/RunTests - name: Build CppRepo Example + env: + - Nymph_ENABLE_TESTING: OFF run: | cd Examples/CppRepo ./BUILD_ME.sh From 0a0c1c0d6d20341fe849ffd6e3d1ac8d14d60387 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:52:17 -0700 Subject: [PATCH 06/21] Test extraction of version --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 278befa..ba98618 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,6 +14,8 @@ file( STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION nymph_version ) cmake_policy( SET CMP0048 NEW ) # version in project() project( Nymph VERSION ${nymph_version} ) +message( STATUS "%%%%%%%% project version: ${Nymph_VERSION}" ) + list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake ) include( PackageBuilder ) From 3e1f705233f2b4122e0fa66338572337fb0d4049 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 15:53:22 -0700 Subject: [PATCH 07/21] Set environment variables correctly --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f037702..a2f1929 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -140,7 +140,7 @@ jobs: - name: Build CppRepo Example env: - - Nymph_ENABLE_TESTING: OFF + Nymph_ENABLE_TESTING: OFF run: | cd Examples/CppRepo ./BUILD_ME.sh From 2448b1b60e2145062e817f43183a2ae9412b8cfb Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 16:05:01 -0700 Subject: [PATCH 08/21] Fix missing VERSION file --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 97d12a5..54a0424 100644 --- a/Dockerfile +++ b/Dockerfile @@ -93,6 +93,7 @@ COPY Testing /tmp_source/Testing COPY CMakeLists.txt /tmp_source/CMakeLists.txt COPY NymphConfig.cmake.in /tmp_source/NymphConfig.cmake.in COPY pyproject.toml /tmp_source/pyproject.toml +COPY VERSION /tmp_source/VERSION #COPY .git /tmp_source/.git # repeat the cmake command to get the change of install prefix to set correctly (a package_builder known issue) From 1b4b2a29fb3bc7e449fc1dbc87a340d753f18ed8 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 16:05:13 -0700 Subject: [PATCH 09/21] Debugging boost components --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba98618..2fef5c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,6 +72,7 @@ set( PRIVATE_EXT_LIBS ) # Boost (1.46 required for filesystem version 3) list( APPEND BOOST_COMPONENTS chrono date_time filesystem thread ) +message( "^^^^^^^ ${BOOST_COMPONENTS}" ) find_package( Boost 1.46.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS} ) list( APPEND PUBLIC_EXT_LIBS Boost::boost Boost::chrono Boost::date_time Boost::thread Boost::filesystem ) # make sure dynamic linking is assumed for all boost libraries From ad1031a54da0939c3afe42fc2b6f3b5af8c705f8 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 16:24:40 -0700 Subject: [PATCH 10/21] Removing debug messages --- CMakeLists.txt | 3 --- 1 file changed, 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2fef5c0..278befa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,8 +14,6 @@ file( STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/VERSION nymph_version ) cmake_policy( SET CMP0048 NEW ) # version in project() project( Nymph VERSION ${nymph_version} ) -message( STATUS "%%%%%%%% project version: ${Nymph_VERSION}" ) - list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/Scarab/cmake ) include( PackageBuilder ) @@ -72,7 +70,6 @@ set( PRIVATE_EXT_LIBS ) # Boost (1.46 required for filesystem version 3) list( APPEND BOOST_COMPONENTS chrono date_time filesystem thread ) -message( "^^^^^^^ ${BOOST_COMPONENTS}" ) find_package( Boost 1.46.0 REQUIRED COMPONENTS ${BOOST_COMPONENTS} ) list( APPEND PUBLIC_EXT_LIBS Boost::boost Boost::chrono Boost::date_time Boost::thread Boost::filesystem ) # make sure dynamic linking is assumed for all boost libraries From 934fde76ad816645dff137d0ad23b64ae6905e84 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 16:25:31 -0700 Subject: [PATCH 11/21] Implement an option for the nymph tag in cpprepo --- .github/workflows/build.yaml | 1 + Examples/CppRepo/BUILD_ME.sh | 1 + Examples/CppRepo/CMakeLists.txt | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a2f1929..4d0ca3a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -141,6 +141,7 @@ jobs: - name: Build CppRepo Example env: Nymph_ENABLE_TESTING: OFF + Nymph_TAG: nymph2_2/cppexample run: | cd Examples/CppRepo ./BUILD_ME.sh diff --git a/Examples/CppRepo/BUILD_ME.sh b/Examples/CppRepo/BUILD_ME.sh index 0c2da90..f0db664 100755 --- a/Examples/CppRepo/BUILD_ME.sh +++ b/Examples/CppRepo/BUILD_ME.sh @@ -9,6 +9,7 @@ cmake -DCMAKE_BUILD_TYPE=${Nymph_BUILD_TYPE:=Debug} \ -DNymph_ENABLE_PYTHON=${Nymph_ENABLE_PYTHON:=FALSE} \ -DNymph_ENABLE_TESTING=${Nymph_ENABLE_TESTING:=FALSE} \ -DNymph_SINGLETHREADED=${Nymph_SINGLETHREADED:=FALSE} \ + -DNymph_TAG=${Nymph_TAG:=nymph2_2/develop} \ .. make -j${NARG:=} install diff --git a/Examples/CppRepo/CMakeLists.txt b/Examples/CppRepo/CMakeLists.txt index 201d390..9d10b8d 100644 --- a/Examples/CppRepo/CMakeLists.txt +++ b/Examples/CppRepo/CMakeLists.txt @@ -6,8 +6,11 @@ cmake_policy( SET CMP0048 NEW ) # version in project() project( CppRepo VERSION 0.0.0 ) include( FetchContent ) -# Define Nymph as an ExternalProject +# Get Nymph with FetchContent # If Nymph is a submodule, then set the SOURCE_DIR option to point to it; also in that case, remove any download specifications +message( STATUS "Getting Nymph" ) +set( Nymph_TAG nymph2_2/develop ) +message( "$$$$$$ tag: ${Nymph_TAG}" ) set( Nymph_DIR nymph_src ) FetchContent_Populate( nymph SOURCE_DIR ${Nymph_DIR} @@ -15,7 +18,6 @@ FetchContent_Populate( nymph GIT_TAG nymph2_2/develop GIT_SHALLOW TRUE ) -message( "dir: ${Nymph_DIR}") # If nymph were a submodule in ${PROJECT_SOURCE_DIR}/nymph, that would be used in place of ${Nymph_DIR} list( APPEND CMAKE_MODULE_PATH From 824bee2f6f186077da6593b6d77b5ff36d82890d Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 16:30:36 -0700 Subject: [PATCH 12/21] Debugging Nymph_TAG option --- Examples/CppRepo/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Examples/CppRepo/CMakeLists.txt b/Examples/CppRepo/CMakeLists.txt index 9d10b8d..9e13dd5 100644 --- a/Examples/CppRepo/CMakeLists.txt +++ b/Examples/CppRepo/CMakeLists.txt @@ -9,13 +9,13 @@ include( FetchContent ) # Get Nymph with FetchContent # If Nymph is a submodule, then set the SOURCE_DIR option to point to it; also in that case, remove any download specifications message( STATUS "Getting Nymph" ) -set( Nymph_TAG nymph2_2/develop ) +option( Nymph_TAG "Version of Nymph to use" nymph2_2/develop ) message( "$$$$$$ tag: ${Nymph_TAG}" ) set( Nymph_DIR nymph_src ) FetchContent_Populate( nymph SOURCE_DIR ${Nymph_DIR} GIT_REPOSITORY https://github.com/project8/nymph - GIT_TAG nymph2_2/develop + GIT_TAG ${Nymph_TAG} GIT_SHALLOW TRUE ) From 2564e8fe697706c71e0685edb4e77caf3c801ae1 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 16:58:48 -0700 Subject: [PATCH 13/21] Adding the cpp build to the python build --- .github/workflows/build.yaml | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4d0ca3a..763b5f0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -195,8 +195,6 @@ jobs: cmake -DPYBIND11_TEST=FALSE .. make -j${{ env.NARG }} install - python -m pip install build - - name: Linux Dependencies if: startsWith(matrix.os, 'ubuntu') # Linux only run: | @@ -212,16 +210,24 @@ jobs: cd build sudo cmake -DPYBIND11_TEST=FALSE .. sudo make -j${{ env.NARG }} install - cd ../.. - - pip install "pybind11[global]" - - python -m pip install build - + - name: Build Nymph/Cpp + run: | + mkdir -p build + cd build + cmake -DCMAKE_BUILD_TYPE=${Nymph_BUILD_TYPE} \ + -DNymph_BUILD_NYMPH_EXE=${Nymph_BUILD_NYMPH_EXE} \ + -DNymph_ENABLE_EXECUTABLES=${Nymph_ENABLE_EXECUTABLES} \ + -DNymph_ENABLE_PYTHON=${Nymph_ENABLE_PYTHON} \ + -DNymph_ENABLE_TESTING=${Nymph_ENABLE_TESTING} \ + -DNymph_SINGLETHREADED=${Nymph_SINGLETHREADED} \ + .. + make -j${{ env.NARG }} install + - name: Install nymph run: | - pip -v install . + source build/bin/add_lib_python_path.sh + pip -v -e install . - name: Run Tests continue-on-error: true From de69c7130c6a7d49517fc0eb8ded3df512dc00ed Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 17:02:28 -0700 Subject: [PATCH 14/21] Fixing pip install flag --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 763b5f0..7f3648d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -227,7 +227,8 @@ jobs: - name: Install nymph run: | source build/bin/add_lib_python_path.sh - pip -v -e install . + env + pip -v install -e . - name: Run Tests continue-on-error: true From c8385ace3c7e37639b688fcc3378049704e64ea3 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 17:07:15 -0700 Subject: [PATCH 15/21] Add tmate for debugging --- .github/workflows/build.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7f3648d..55eb3c4 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -231,8 +231,12 @@ jobs: pip -v install -e . - name: Run Tests - continue-on-error: true run: | cd Testing/Python python -m unittest discover -v +# For debugging + - name: Setup tmate session + if: ${{ ! success() }} + uses: mxschmitt/action-tmate@v3 + From bfacd9794664fb06f9efaaad7f942bc3143d39a8 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 17:18:47 -0700 Subject: [PATCH 16/21] Install nymph bindings in standard python location --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 55eb3c4..4a1a9f8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -221,12 +221,12 @@ jobs: -DNymph_ENABLE_PYTHON=${Nymph_ENABLE_PYTHON} \ -DNymph_ENABLE_TESTING=${Nymph_ENABLE_TESTING} \ -DNymph_SINGLETHREADED=${Nymph_SINGLETHREADED} \ + -DPBUILDER_PY_INSTALL_IN_SITELIB=TRUE .. make -j${{ env.NARG }} install - name: Install nymph run: | - source build/bin/add_lib_python_path.sh env pip -v install -e . From 7e5fe77f7c810b60499e5fa46ea758608aac9a82 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 17:22:45 -0700 Subject: [PATCH 17/21] Fixing missing backslash --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4a1a9f8..abf4d3c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -221,7 +221,7 @@ jobs: -DNymph_ENABLE_PYTHON=${Nymph_ENABLE_PYTHON} \ -DNymph_ENABLE_TESTING=${Nymph_ENABLE_TESTING} \ -DNymph_SINGLETHREADED=${Nymph_SINGLETHREADED} \ - -DPBUILDER_PY_INSTALL_IN_SITELIB=TRUE + -DPBUILDER_PY_INSTALL_IN_SITELIB=TRUE \ .. make -j${{ env.NARG }} install From 7d80f6e6a56c813ab66a58dfa00ac39840d3b81f Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Tue, 9 Sep 2025 17:35:21 -0700 Subject: [PATCH 18/21] Getting the python testing running --- .github/workflows/build.yaml | 6 +++++- Testing/Python/Bindings/testprocessortoolbox.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index abf4d3c..4d2b319 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -232,9 +232,13 @@ jobs: - name: Run Tests run: | - cd Testing/Python + cd Testing/Python/Bindings python -m unittest discover -v +# eventually include these tests +# cd ../nymph +# python -m unittest discover -v + # For debugging - name: Setup tmate session if: ${{ ! success() }} diff --git a/Testing/Python/Bindings/testprocessortoolbox.py b/Testing/Python/Bindings/testprocessortoolbox.py index 20d51a4..c30baf9 100644 --- a/Testing/Python/Bindings/testprocessortoolbox.py +++ b/Testing/Python/Bindings/testprocessortoolbox.py @@ -7,7 +7,7 @@ """ import unittest -import nymph_bindings, _nymph_testing +import nymph_bindings #, _nymph_testing class TestDataMethods(unittest.TestCase): From d2e26fa8bbad27f62e1670446b1380b9461503d1 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Mon, 15 Sep 2025 15:31:01 -0700 Subject: [PATCH 19/21] Added Examples/PyRepo with a simple hello-world function --- Examples/PyRepo/BUILD_ME.sh | 35 +++++++++++++++++++++++++++ Examples/PyRepo/pyproject.toml | 18 ++++++++++++++ Examples/PyRepo/pyrepo/__init__.py | 3 +++ Examples/PyRepo/pyrepo/hello_world.py | 6 +++++ 4 files changed, 62 insertions(+) create mode 100755 Examples/PyRepo/BUILD_ME.sh create mode 100644 Examples/PyRepo/pyproject.toml create mode 100644 Examples/PyRepo/pyrepo/__init__.py create mode 100644 Examples/PyRepo/pyrepo/hello_world.py diff --git a/Examples/PyRepo/BUILD_ME.sh b/Examples/PyRepo/BUILD_ME.sh new file mode 100755 index 0000000..dc0fcf2 --- /dev/null +++ b/Examples/PyRepo/BUILD_ME.sh @@ -0,0 +1,35 @@ +#! /bin/bash + +# This script builds the PyRepo example of a Nymph-based Python-only package. +# We first have to build the C++ Nymph library, and then we can install the Python Nymph package. +# Finally, we install the PyRepo package. + +# This assumes that if the _nymph directory exists, then _nymph has been built and installed +if [[ ! -d _nymph ]]; then + git clone --recurse-submodules -b nymph2_2/develop https://github.com/project8/nymph _nymph + cd _nymph + + mkdir build + cd build + + cmake -DCMAKE_BUILD_TYPE=${Nymph_BUILD_TYPE:=Debug} \ + -DNymph_BUILD_NYMPH_EXE=${Nymph_BUILD_NYMPH_EXE:=TRUE} \ + -DNymph_ENABLE_EXECUTABLES=${Nymph_ENABLE_EXECUTABLES:=TRUE} \ + -DNymph_ENABLE_PYTHON=${Nymph_ENABLE_PYTHON:=TRUE} \ + -DNymph_ENABLE_TESTING=${Nymph_ENABLE_TESTING:=FALSE} \ + -DNymph_SINGLETHREADED=${Nymph_SINGLETHREADED:=FALSE} \ + .. + + make -j${NARG:=} install + source bin/add_lib_python_path.sh + + cd .. + + pip install . + + cd .. +else + source _nymph/build/bin/add_lib_python_path.sh +fi + +pip install -e . diff --git a/Examples/PyRepo/pyproject.toml b/Examples/PyRepo/pyproject.toml new file mode 100644 index 0000000..1724f76 --- /dev/null +++ b/Examples/PyRepo/pyproject.toml @@ -0,0 +1,18 @@ +[build-system] +requires = [ + "setuptools>=42", +] +build-backend = "setuptools.build_meta" + +[project] +name = "PyRepo" +#dependencies = [ +# "nymph_bindings @ file:///src/build-ny22py-debug-docker/lib", +#] +version = "1.0.0" + +[project.scripts] +hello-world = "pyrepo:hello_world" + +#[tool.setuptools.packages.find] +#where = ["Python"] diff --git a/Examples/PyRepo/pyrepo/__init__.py b/Examples/PyRepo/pyrepo/__init__.py new file mode 100644 index 0000000..ddd37b4 --- /dev/null +++ b/Examples/PyRepo/pyrepo/__init__.py @@ -0,0 +1,3 @@ +__all__ = [] + +from .hello_world import hello_world diff --git a/Examples/PyRepo/pyrepo/hello_world.py b/Examples/PyRepo/pyrepo/hello_world.py new file mode 100644 index 0000000..925976c --- /dev/null +++ b/Examples/PyRepo/pyrepo/hello_world.py @@ -0,0 +1,6 @@ + +def hello_world(): + print("Hello, world") + +if __name__ == "__main__": + hello_world() From 6944b50fc5d92b456c20778fc628f2e5b6b55634 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Mon, 15 Sep 2025 15:36:46 -0700 Subject: [PATCH 20/21] Minor updates to example build scripts --- .github/workflows/build.yaml | 13 ++++++++++++- Examples/CppRepo/BUILD_ME.sh | 5 +++++ Examples/PyRepo/BUILD_ME.sh | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4d2b319..008b742 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -225,7 +225,7 @@ jobs: .. make -j${{ env.NARG }} install - - name: Install nymph + - name: Install Nymph/Python run: | env pip -v install -e . @@ -239,6 +239,17 @@ jobs: # cd ../nymph # python -m unittest discover -v + - name: Build PyRepo Example + env: + Nymph_ENABLE_TESTING: OFF + Nymph_ENABLE_PYTHON: ON + Nymph_TAG: nymph2_2/cppexample + run: | + cd Examples/PyRepo + ./BUILD_ME.sh + hello-world + + # For debugging - name: Setup tmate session if: ${{ ! success() }} diff --git a/Examples/CppRepo/BUILD_ME.sh b/Examples/CppRepo/BUILD_ME.sh index f0db664..eae3109 100755 --- a/Examples/CppRepo/BUILD_ME.sh +++ b/Examples/CppRepo/BUILD_ME.sh @@ -1,5 +1,10 @@ #! /bin/bash +# This script builds the CppRepo example of a Nymph-based C++-only package. +# The CMake-based build downloads Nymph using CMake's FetchContent module, +# rather than including it as a submodule. Nymph is built using +# the Scarab/PackageBuilder framework included with Nymph. + mkdir build cd build diff --git a/Examples/PyRepo/BUILD_ME.sh b/Examples/PyRepo/BUILD_ME.sh index dc0fcf2..6682c99 100755 --- a/Examples/PyRepo/BUILD_ME.sh +++ b/Examples/PyRepo/BUILD_ME.sh @@ -6,7 +6,7 @@ # This assumes that if the _nymph directory exists, then _nymph has been built and installed if [[ ! -d _nymph ]]; then - git clone --recurse-submodules -b nymph2_2/develop https://github.com/project8/nymph _nymph + git clone --recurse-submodules -b ${Nymph_TAG:=nymph2_2/develop} https://github.com/project8/nymph _nymph cd _nymph mkdir build From ec66a5f1d0622c671fd315c3a8febec98b747357 Mon Sep 17 00:00:00 2001 From: Noah Oblath Date: Mon, 15 Sep 2025 15:37:06 -0700 Subject: [PATCH 21/21] Add PyRepo egg-info to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index df5fd5c..b0dd6e7 100644 --- a/.gitignore +++ b/.gitignore @@ -45,4 +45,5 @@ build*/ # Python Package dist*/ Python/*.egg-info +Examples/PyRepo/*.egg-info __pycache__