diff --git a/backend/test/cfg/CMakeLists.txt.good b/backend/test/cfg/CMakeLists.txt.good new file mode 100644 index 00000000..6f7abdef --- /dev/null +++ b/backend/test/cfg/CMakeLists.txt.good @@ -0,0 +1,48 @@ +# +# This program file was generated by the chplx compiler. +# The original Chapel program file can be found here: "cfg.chpl" +# +cmake_minimum_required(VERSION 3.19) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Configuration type" FORCE) +endif() +project(cfg) +add_executable(cfg cfg.cpp) +if(NOT APPLE) + set(CMAKE_CXX_STANDARD 20) +endif() +if(NOT WIN32 AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND NOT APPLE) + set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -stdlib=libc++) +endif() +if(NOT Chplx_DIR) + message(FATAL_ERROR "Chplx_DIR variable undefined") +endif() +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +find_package(fmt REQUIRED CONFIG) +find_package(HPX REQUIRED CONFIG) +find_package(Chplx REQUIRED CONFIG) +set(cfg_sources cfg.cpp) +set(cfg_headers cfg.hpp) +if(NOT WIN32 AND ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND APPLE) + find_library(CORE_LIBPATH NAMES CoreFoundation REQUIRED) + target_compile_options(cfg + PUBLIC + -nostdlib + -std=c++20 + -O3 + -stdlib=libc++ + ) + target_link_libraries(cfg PRIVATE ${CORE_LIBPATH}) + target_link_libraries(cfg + PUBLIC + c++ + ) +endif() +target_link_libraries(cfg PUBLIC fmt::fmt-header-only HPX::hpx Chplx::library) +enable_testing() +include(CTest) +add_test( + NAME cfg_test + COMMAND cfg + WORKING_DIRECTORY $ +) diff --git a/backend/test/cfg/cfg.cpp.good b/backend/test/cfg/cfg.cpp.good new file mode 100644 index 00000000..21ca4dc4 --- /dev/null +++ b/backend/test/cfg/cfg.cpp.good @@ -0,0 +1,33 @@ +// This program file was generated by the chplx compiler. +// The original Chapel program file can be found here: cfg.chpl +// +#include + +#include "cfg.hpp" + +// global `config` variables +// +std::int64_t config_a; +std::int64_t config_b = 1; + +int hpx_main(int argc, char * argv[]) { + + #line 1 "../../backend/test/cfg.chpl" + const std::int64_t a = config_a; + #line 2 "../../backend/test/cfg.chpl" + std::int64_t b = config_b; + + return hpx::finalize(); +} + +int main(int argc, char * argv[]) { + hpx::program::options::options::options_description options; + options.add_options() + ("a", + hpx::program_options::value(&config_a), "config var a : std::int64_t") + ("b", + hpx::program_options::value(&config_b), "config var b : std::int64_t"); + hpx::init_params init_args; + init_args.desc_cmdline = options; + return hpx::init(argc, argv, init_args); +} diff --git a/backend/test/cfg/cfg.hpp.good b/backend/test/cfg/cfg.hpp.good new file mode 100644 index 00000000..bbb1b01c --- /dev/null +++ b/backend/test/cfg/cfg.hpp.good @@ -0,0 +1,11 @@ +// This program file was generated by the chplx compiler. +// The original Chapel program file can be found here: "cfg.chpl" +// +#pragma once + +#ifndef __CFG_HPP__ +#define __CFG_HPP__ + +#include + +#endif