Skip to content

Commit

Permalink
use #ifdef instead of #if
Browse files Browse the repository at this point in the history
  • Loading branch information
cochicde committed Jan 21, 2025
1 parent bbada6d commit 8248e8b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
3 changes: 1 addition & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ LIST(LENGTH DEVICE_CLASSES DEVICE_CLASSES_LEN)

IF(${DEVICE_CLASSES_LEN} EQUAL 1)
# only one device present
forte_add_custom_configuration("#define FORTE_MULTIPLE_DEVICES 0")

LIST(GET DEVICE_CLASSES 0 CLASS)
LIST(GET DEVICE_FILENAMES 0 FILENAME)
Expand All @@ -215,7 +214,7 @@ IF(${DEVICE_CLASSES_LEN} EQUAL 1)
SET(SINGLE_DEVICE_CREATE " return (paMGRID.length() != 0) ? std::make_unique<${CLASS}>(paMGRID) : std::make_unique<${CLASS}>(); ")

ELSE()
forte_add_custom_configuration("#define FORTE_MULTIPLE_DEVICES 1")
forte_add_definition("-DFORTE_MULTIPLE_DEVICES")

forte_add_sourcefile_with_path_cpp(${CMAKE_BINARY_DIR}/deviceFactory.cpp) # created file

Expand Down
6 changes: 3 additions & 3 deletions src/arch/utils/mainparam_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include <string.h>
#include <stdlib.h>

#if FORTE_MULTIPLE_DEVICES
#ifdef FORTE_MULTIPLE_DEVICES
#include "deviceFactory.h"
#endif // FORTE_MULTIPLE_DEVICES

Expand All @@ -32,7 +32,7 @@ void listHelp(){
printf("Options:\n");
printf("%-20s Display this information\n", " -h");
printf("%-20s Set the listening IP and port for the incoming connections\n", " -c <IP>:<port>");
#if FORTE_MULTIPLE_DEVICES
#ifdef FORTE_MULTIPLE_DEVICES
printf("%-20s Set the device to be used\n", " -d DEVICE_NAME");
#endif // FORTE_MULTIPLE_DEVICES
#ifdef FORTE_SUPPORT_BOOT_FILE
Expand Down Expand Up @@ -67,7 +67,7 @@ const char *parseCommandLineArguments(int argc, char *arg[]){
case 'c': //! sets the destination for the connection
pIpPort = arg[i + 1];
break;
#if FORTE_MULTIPLE_DEVICES
#ifdef FORTE_MULTIPLE_DEVICES
case 'd': //! sets the device to be used
if(!DeviceFactory::setDeviceToCreate(arg[i + 1])){
printf("The selected device '%s' is not valid. Select one of the following: %s\n", arg[i + 1], DeviceFactory::getAvailableDevices().c_str());
Expand Down
4 changes: 1 addition & 3 deletions src/deviceFactory.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
#ifndef FORTE_DEVICE_FACTORY_H
#define FORTE_DEVICE_FACTORY_H

#include <forte_config.h>

#include <memory>
#include <string>

#if FORTE_MULTIPLE_DEVICES
#ifdef FORTE_MULTIPLE_DEVICES

class CDevice;

Expand Down

0 comments on commit 8248e8b

Please sign in to comment.