Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use #if defined instead of #if and turn off -Werror for debug builds #68

Merged
merged 3 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions src/utils/CMakeLists.txt
cameronrutherford marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,24 @@ exago_add_library(
)

# Going to have this target supply/propogate compiler flags and see if that
# works -Wpedantic for CUDA compile options added a significant amount of new
# errors, so leaving out for now
set(CUDA_COMPILE_OPTIONS
"$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CONFIG:DEBUG>>:SHELL:--compiler-options -Werror,-Wall,-Wextra>"
)
set(CXX_COMPILE_OPTIONS
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:-Werror;-Wall;-Wextra;-Wpedantic>"
)
# works. -Wpedantic for CUDA compile options added a significant amount of new
# errors, so leaving out for now. -Werror is problematic on MacOS
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang")
set(CUDA_COMPILE_OPTIONS
"$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CONFIG:DEBUG>>:SHELL:--compiler-options -Wall,-Wextra>"
)
set(CXX_COMPILE_OPTIONS
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:-Wall;-Wextra;-Wpedantic>"
)
else()
set(CUDA_COMPILE_OPTIONS
"$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CONFIG:DEBUG>>:SHELL:--compiler-options -Werror,-Wall,-Wextra>"
)
set(CXX_COMPILE_OPTIONS
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:DEBUG>>:-Werror;-Wall;-Wextra;-Wpedantic>"
)
endif()

if(EXAGO_BUILD_SHARED)
target_compile_options(
UTILS_shared PUBLIC ${CUDA_COMPILE_OPTIONS} ${CXX_COMPILE_OPTIONS}
Expand Down
8 changes: 4 additions & 4 deletions src/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
#include <sys/utsname.h>
#include <version.h>
#include <utils.h>
#if (EXAGO_ENABLE_IPOPT || EXAGO_ENABLE_HIOP)
#if defined EXAGO_ENABLE_IPOPT || defined EXAGO_ENABLE_HIOP
#include <opflow.h>
#endif

#if (EXAGO_ENABLE_IPOPT)
#if defined EXAGO_ENABLE_IPOPT
#include <sopflow.h>
#include <scopflow.h>
#endif
Expand Down Expand Up @@ -373,7 +373,7 @@ template <typename T> static inline void print(T const &opt) {
// See comment at ExaGODefaultOptions
// print(O::network);

#if (EXAGO_ENABLE_IPOPT || EXAGO_ENABLE_HIOP)
#if defined EXAGO_ENABLE_IPOPT || defined EXAGO_ENABLE_HIOP
if (appname == "opflow") {
print(OPFLOWOptions::model);
print(OPFLOWOptions::solver);
Expand Down Expand Up @@ -408,7 +408,7 @@ template <typename T> static inline void print(T const &opt) {
// fprintf(stderr, "\n");
} else if (appname == "pflow") {
/* pflow application driver does not take any additional arguments */
#if (EXAGO_ENABLE_IPOPT)
#if defined EXAGO_ENABLE_IPOPT
} else if (appname == "sopflow") {
print(SOPFLOWOptions::sopflow_model);
print(SOPFLOWOptions::sopflow_solver);
Expand Down
Loading