-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fixed Building on Windows (finally) #132
Conversation
It was an absolute pain in the arse to get this to work correctly... Luckily it should work 100%, though it relies on a path passed in from |
It is now actually possible to compile on Windows using cmake instead of having to rely on an IDE environment. An icon for the test programs was also added to differentiate it from the actual (sh3r.exe) program.
@@ -20,7 +24,7 @@ endif() | |||
|
|||
include(CheckCXXCompilerFlag) | |||
|
|||
if(NOT CMAKE_BUILD_TYPE) | |||
if(NOT CMAKE_BUIiLD_TYPE) |
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.
This change can't be right.
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.
I was definitely using VIM or something when I did this hahaha.
if(WIN32) | ||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") # We're dealing with MinGW etc | ||
set(Boost_USE_STATIC_LIBS ON) | ||
set(BOOST_INCLUDEDIR ${LIB_ROOT_DIR}/boost/boost) |
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.
LIB_ROOT_DIR
should be a documented CMake variable that appears in the configurator (.e.g cmake-gui
or ccmake
).
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.
I've passed it in with -D in the .bat file, does that not create the variable? It needs to be a defined CMake one? I apologise for this, I couldn't find much info on it online.
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.
It'll work, yeah, but when you define it with set
(doc) you can document it and it will show up in the interactive CMake dialogs.
|
||
set(GLEW_LIBRARY ${LIB_ROOT_DIR}/GLEW/lib/libglew.a) | ||
set(SDL2_LIBRARY ${LIB_ROOT_DIR}/SDL2/lib) | ||
set(ZLIB_LIBRARY ${LIB_ROOT_DIR}/zlib/lib/zlib.a) |
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.
Wouldn't it suffice to set GLEW_ROOT_DIR
& friends so that the libraries' CMake-configuration files search the path?
At this point LIB_ROOT_DIR
might become the same as CMAKE_PREFIX_PATH
. Perhaps try setting this to your "lib"-directory on Windows.
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.
At this point LIB_ROOT_DIR might become the same as CMAKE_PREFIX_PATH. Perhaps try setting this to your "lib"-directory on Windows.
I think this might be the correct way to go.
|
||
set(GLEW_LIBRARIES ${LIB_ROOT_DIR}/GLEW/lib/libglew.a) | ||
set(SDL2_INCLUDE_DIRS ${LIB_ROOT_DIR}/SDL2/include/SDL2) # CMake doesn't automatically pass this like the others??? | ||
set(CMAKE_EXE_LINKER_FLAGS "-lmingw32") |
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.
Does GCC on Windows imply MinGW? What about Cygwin?
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.
I assume so, but I'll need to double check. Considering they're both built off of GCC.
set(ZLIB_LIBRARY ${LIB_ROOT_DIR}/zlib/lib/zlib.a) | ||
|
||
set(GLEW_LIBRARIES ${LIB_ROOT_DIR}/GLEW/lib/libglew.a) | ||
set(SDL2_INCLUDE_DIRS ${LIB_ROOT_DIR}/SDL2/include/SDL2) # CMake doesn't automatically pass this like the others??? |
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.
I think you might be referring to the SDL2_INCLUDE_DIR
in your batch file, which might just be missing an S
.
Also I've used tabs in the CMake files. |
Goddamn.. I'll get on this in the next few days. I've got 3 assignments due this week. Kill me. |
This is 110% deprecated now :3 |
It is now actually possible to compile on Windows using cmake instead of having to rely on an IDE environment. An icon for the test programs was also added to differentiate it from the actual (sh3r.exe) program.