Skip to content

Commit 2b0ddd0

Browse files
authored
Merge pull request #2152 from NatLabRockies/ortools_cmake_debug_build
Fix debug build for Windows and ortools per email 3/16/2026
2 parents dd43e4f + 8b1cedb commit 2b0ddd0

15 files changed

Lines changed: 117 additions & 13 deletions

CMakeLists.txt

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,41 @@ if (UNIX)
145145
find_package(wxWidgets QUIET REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base )
146146
endif()
147147
else()
148+
# set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
149+
# find_package(wxWidgets QUIET REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base scintilla)
150+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Debug and Release Builds Configured" FORCE)
151+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
152+
# for linking to Release build of ortools
153+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
154+
# Get the current debug flags and remove the /D_DEBUG option.
155+
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
156+
# following does not force release libraries for wxWidgets using find_package
157+
#set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG RELEASE)
158+
148159
set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
149-
find_package(wxWidgets QUIET REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base scintilla)
160+
find_package(wxWidgets QUIET REQUIRED xrc webview stc richtext ribbon propgrid aui gl html qa adv core xml net base scintilla)
161+
162+
# message("All wxWidgets: " ${wxWidgets_LIBRARIES})
163+
set(FOUND "false")
164+
foreach(lib ${wxWidgets_LIBRARIES})
165+
string(FIND ${lib} "optimized" INDEX)
166+
string(FIND ${lib} "debug" INDEX2)
167+
string(FIND ${lib} "wxWidgets" INDEX3)
168+
if (INDEX GREATER_EQUAL 0) # skip once
169+
set(FOUND "true")
170+
continue()
171+
elseif((INDEX2 LESS 0) AND (INDEX3 LESS 0))
172+
set(FOUND "true")
173+
endif()
174+
if (${FOUND} STREQUAL "true")
175+
set(FOUND "false")
176+
message("lib: ${lib}")
177+
list(APPEND WX_LIBS_LIST ${lib})
178+
endif()
179+
endforeach()
180+
181+
list(JOIN WX_LIBS_LIST ";" wxWidgets_LIBRARIES)
182+
# message("Link Libraries for wxWidgets: ${wxWidgets_LIBRARIES}")
150183
endif()
151184

152185
if (wxWidgets_FOUND)

api/api_autogen/CMakeLists.txt

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,42 @@ if (UNIX)
7070
find_package(wxWidgets QUIET REQUIRED xrc stc richtext ribbon propgrid aui gl html qa adv core xml net base)
7171
endif ()
7272
else()
73+
# set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
74+
# find_package(wxWidgets QUIET COMPONENTS qa webview aui richtext html propgrid adv net stc core base scintilla REQUIRED)
75+
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Debug and Release Builds Configured" FORCE)
76+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++20")
77+
# for linking to Release build of ortools
78+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
79+
# Get the current debug flags and remove the /D_DEBUG option.
80+
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
81+
# following does not force release libraries for wxWidgets using find_package
82+
#set(CMAKE_MAP_IMPORTED_CONFIG_DEBUG RELEASE)
83+
7384
set(wxWidgets_ROOT_DIR $ENV{WXMSW3})
74-
find_package(wxWidgets QUIET COMPONENTS qa webview aui richtext html propgrid adv net stc core base scintilla REQUIRED)
85+
find_package(wxWidgets QUIET REQUIRED xrc webview stc richtext ribbon propgrid aui gl html qa adv core xml net base scintilla)
86+
87+
# message("All wxWidgets: " ${wxWidgets_LIBRARIES})
88+
set(FOUND "false")
89+
foreach(lib ${wxWidgets_LIBRARIES})
90+
string(FIND ${lib} "optimized" INDEX)
91+
string(FIND ${lib} "debug" INDEX2)
92+
string(FIND ${lib} "wxWidgets" INDEX3)
93+
if (INDEX GREATER_EQUAL 0) # skip once
94+
set(FOUND "true")
95+
continue()
96+
elseif((INDEX2 LESS 0) AND (INDEX3 LESS 0))
97+
set(FOUND "true")
98+
endif()
99+
if (${FOUND} STREQUAL "true")
100+
set(FOUND "false")
101+
message("lib: ${lib}")
102+
list(APPEND WX_LIBS_LIST ${lib})
103+
endif()
104+
endforeach()
105+
106+
list(JOIN WX_LIBS_LIST ";" wxWidgets_LIBRARIES)
107+
# message("Link Libraries for wxWidgets: ${wxWidgets_LIBRARIES}")
108+
75109
endif()
76110

77111
include(${wxWidgets_USE_FILE})

api/api_autogen/library/defaults/HostDeveloper_CustomGenerationBatteryHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,8 @@
271271
[0] ],
272272
"nm_dollars_applied_ym": [
273273
[0] ],
274-
"utility_bill_w_sys": [0]
274+
"utility_bill_w_sys": [0],
275+
"utility_bill_wo_sys": [0]
275276
},
276277
"SystemOutput": {
277278
"degradation": [0.000000],

api/api_autogen/library/defaults/HostDeveloper_CustomGenerationPVWattsWindFuelCellBatteryHybridHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@
259259
[0] ],
260260
"nm_dollars_applied_ym": [
261261
[0] ],
262-
"utility_bill_w_sys": [0]
262+
"utility_bill_w_sys": [0],
263+
"utility_bill_wo_sys": [0]
263264
},
264265
"SystemOutput": {
265266
"gen": [0],

api/api_autogen/library/defaults/HostDeveloper_CustomGenerationProfileHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,8 @@
264264
[0] ],
265265
"nm_dollars_applied_ym": [
266266
[0] ],
267-
"utility_bill_w_sys": [0]
267+
"utility_bill_w_sys": [0],
268+
"utility_bill_wo_sys": [0]
268269
},
269270
"SystemOutput": {
270271
"degradation": [0.000000],

api/api_autogen/library/defaults/HostDeveloper_FlatPlatePVHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@
262262
[0] ],
263263
"nm_dollars_applied_ym": [
264264
[0] ],
265-
"utility_bill_w_sys": [0]
265+
"utility_bill_w_sys": [0],
266+
"utility_bill_wo_sys": [0]
266267
},
267268
"SystemOutput": {
268269
"degradation": [0.000000],

api/api_autogen/library/defaults/HostDeveloper_PVBatteryHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@
269269
[0] ],
270270
"nm_dollars_applied_ym": [
271271
[0] ],
272-
"utility_bill_w_sys": [0]
272+
"utility_bill_w_sys": [0],
273+
"utility_bill_wo_sys": [0]
273274
},
274275
"SystemOutput": {
275276
"degradation": [0.000000],

api/api_autogen/library/defaults/HostDeveloper_PVWattsBatteryHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@
262262
[0] ],
263263
"nm_dollars_applied_ym": [
264264
[0] ],
265-
"utility_bill_w_sys": [0]
265+
"utility_bill_w_sys": [0],
266+
"utility_bill_wo_sys": [0]
266267
},
267268
"SystemOutput": {
268269
"degradation": [0.000000],

api/api_autogen/library/defaults/HostDeveloper_PVWattsHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@
262262
[0] ],
263263
"nm_dollars_applied_ym": [
264264
[0] ],
265-
"utility_bill_w_sys": [0]
265+
"utility_bill_w_sys": [0],
266+
"utility_bill_wo_sys": [0]
266267
},
267268
"SystemOutput": {
268269
"degradation": [0.500000],

api/api_autogen/library/defaults/HostDeveloper_PVWattsWindBatteryHybridHostDeveloper.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,8 @@
259259
[0] ],
260260
"nm_dollars_applied_ym": [
261261
[0] ],
262-
"utility_bill_w_sys": [0]
262+
"utility_bill_w_sys": [0],
263+
"utility_bill_wo_sys": [0]
263264
},
264265
"SystemOutput": {
265266
"gen": [0],

0 commit comments

Comments
 (0)