-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Use Debug and Release variables from CMake #3865
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
Conversation
Signed-off-by: Omar Shrit <[email protected]>
Signed-off-by: Omar Shrit <[email protected]>
rcurtin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for taking the time to look into this. I think we should update doc/user/install.md too, which has the CMake options in it:
- We can just remove the
DEBUGoption from that list. - If you wanted, we could remove
PROFILEfrom that list too and mark it deprecated also. (Probably the better way to do this is just to specifycmake -DCMAKE_CXX_FLAGS="-pg" ../, and only hardcore developers are going to be doing that anyway, not users.) - We should add a new option under the 'general configuration' section, maybe at the top, up to you:
| `-DCMAKE_BUILD_TYPE="build type"` | Specify the build configuration: `"Debug"`, `"Release"`, `"RelWithDebInfo"`, `"MinSizeRel"`. See the [CMake documentation](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html#variable:CMAKE_BUILD_TYPE). | `"Release"` |
Another possible discussion point... right now if you don't specify DEBUG, or you set it to OFF, we do a release build. But if you don't specify CMAKE_BUILD_TYPE="Release", then CMake will just compile without optimizations or any special CXXFLAGS.
So, maybe it makes sense to add an extra block of CMake code like:
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif ()
That line of code is actually done first thing in the ensmallen CMake configuration.
Signed-off-by: Omar Shrit <[email protected]>
Signed-off-by: Omar Shrit <[email protected]>
Signed-off-by: Omar Shrit <[email protected]>
rcurtin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I also grepped through the other documentation to see if DEBUG or PROFILE were used in any documentation examples and just found one instance:
cmake -G "Visual Studio 16 2019" -A x64 -DBLAS_LIBRARIES:FILEPATH="C:/mlpack/mlpack/packages/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a" -DLAPACK_LIBRARIES:FILEPATH="C:/mlpack/mlpack/packages/OpenBLAS.0.2.14.1/lib/native/lib/x64/libopenblas.dll.a" -DARMADILLO_INCLUDE_DIR="C:/mlpack/armadillo/include" -DARMADILLO_LIBRARY:FILEPATH="C:/mlpack/armadillo/build/Debug/armadillo.lib" -DDEBUG=OFF -DPROFILE=OFF ..
That's in doc/user/build_windows.md. You could just remove the -DDEBUG=OFF -DPROFILE=OFF since it will now default to a release build.
Might also be a nice thing to put in HISTORY.md too, like Use CMAKE_BUILD_TYPE to specify build type instead of DEBUG and PROFILE options..
Anyway if you can handle those two things (plus my tiny typo comment) before merge I think this is good to go.
CMakeLists.txt
Outdated
| endif() | ||
|
|
||
| if (PROFILE) | ||
| message(WARNING "The PROFILE option is deprecated and will be removed in mlpack 5.0.0; specify -DCMAKE_CXX_FLAG=\"-pg\" instead!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| message(WARNING "The PROFILE option is deprecated and will be removed in mlpack 5.0.0; specify -DCMAKE_CXX_FLAG=\"-pg\" instead!") | |
| message(WARNING "The PROFILE option is deprecated and will be removed in mlpack 5.0.0; specify -DCMAKE_CXX_FLAGS=\"-pg\" instead!") |
Signed-off-by: Omar Shrit <[email protected]>
Signed-off-by: Omar Shrit <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Second approval provided automatically after 24 hours. 👍
No description provided.