forked from ct-clmsn/chplx
-
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
ctaylor
committed
May 2, 2023
1 parent
52f6bb8
commit d57361c
Showing
3 changed files
with
92 additions
and
0 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 |
---|---|---|
@@ -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 $<TARGET_FILE_DIR:cfg> | ||
) |
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,33 @@ | ||
// This program file was generated by the chplx compiler. | ||
// The original Chapel program file can be found here: cfg.chpl | ||
// | ||
#include <hpx/hpx_init.hpp> | ||
|
||
#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<std::int64_t>(&config_a), "config var a : std::int64_t") | ||
("b", | ||
hpx::program_options::value<std::int64_t>(&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); | ||
} |
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,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 <chplx.hpp> | ||
|
||
#endif |