Closed BielBdeLuna closed 3 years ago
found a toolchain for mingw already done in OpenTechEngine and the corresponding sh file, adpated it to the RBdoom3BFG but it didn't quite work:
mingw32.toolchain.cmake:
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-c++)
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
#set(CMAKE_C_LINK_EXECUTABLE x86_64-w64-mingw32-ld)
#set(CMAKE_AR x86_64-w64-mingw32-ar)
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32/)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
#set(OPENAL_INCLUDE_DIR /usr/share/tomcat/.jenkins/workspace/fi.xnet.dhewm3-mingw32-w64/mingw32/openal-soft-1.15.1-x86_64-w64-mingw32/include/)
#set(OPENAL_LIBRARY /usr/share/tomcat/.jenkins/workspace/fi.xnet.dhewm3-mingw32-w64/mingw32/openal-soft-1.15.1-x86_64-w64-mingw32/lib/libOpenAL32.dll.a)
#set(SDL2_INCLUDE_DIR /usr/share/tomcat/.jenkins/workspace/fi.xnet.dhewm3-mingw32-w64/mingw32/SDL2-2.0.3-x86_64-w64-mingw32/include/)
#set(SDL2_LIBRARY /usr/share/tomcat/.jenkins/workspace/fi.xnet.dhewm3-mingw32-w64/mingw32/SDL2-2.0.3-x86_64-w64-mingw32/lib/libSDL2.a)
#set(SDL2DLL_LIBRARY /usr/share/tomcat/.jenkins/workspace/fi.xnet.dhewm3-mingw32-w64/mingw32/SDL2-2.0.3-x86_64-w64-mingw32/lib/libSDL2.dll.a)
#set(SDL2MAIN_LIBRARY -Wl,--whole-archive /usr/share/tomcat/.jenkins/workspace/fi.xnet.dhewm3-mingw32-w64/mingw32/SDL2-2.0.3-x86_64-w64-mingw32/lib/libSDL2main.a -Wl,--no-whole-archive)
and cmake-eclipse-linux-x86_64mingw-release.sh:
cd ..
rm -rf build
mkdir build
cd build
cmake -G "Eclipse CDT4 - Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../neo/mingw32.toolchain.cmake -DBUNDLED_FREETYPE=ON -DBUNDLED_OPENAL=ON ../neo
and got this:
$ ./cmake-eclipse-linux-x86_64mingw-release.sh
-- The C compiler identification is GNU 5.3.1
-- The CXX compiler identification is GNU 5.3.1
-- Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-c++
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_BUILD_TYPE:Debug
CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message):
Could NOT find DirectX (missing: DirectX_XINPUT_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE)
cmake/FindDirectX.cmake:36 (find_package_handle_standard_args)
CMakeLists.txt:90 (find_package)
-- Configuring incomplete, errors occurred!
See also "/usr/local/share/d3bfg/src/RBDOOM-3-BFG/build/CMakeFiles/CMakeOutput.log".
oh snap! I don't have DirectX on Ubuntu! :) any idea how to continue from here?
if you use the mingw64 crosscompiler the directx libraries are there up to dx11 though dx11 might not be fully supported but i suspect its just needed for the sound system so they should be fine. mingw unfortunatly only has a subset of directx unless you get the directx9 development libraries from the allegro site.
PS you need to set the DXSDK_DIR environment variable to point to /mingw32/i686-w64-mingw32 for 32 bit builds and /mingw64/x86_64-w64-mingw32 for 64 bit builds. Layout might be different on linux because the crosscompilers usually are either located in /opt or as a subfolder to /usr so doublecheck paths.
is this DXSDK_DIR specified in the toolchain file?
just export it to point to the correct dir like in my example before running cmake :) eg. export DXSDK_DIR=/opt/mingw32/i686-w64-mingw32 for 32 bit builds or DXSDK_DIR=/opt/mingw64/x86_64-w64-mingw32 for the 64 bit versions. Thats the way the package builder from Msys2 does it, and it should also work for linux as long as those paths exist.
the DXSDK_DIR variable is a leftover from microsofts directx sdk, sadly cmake tends to use that for looking for directx libraries, maybe its time to ask the cmake folks for an update that targets mingw64's own libraries, so we can do away with this crap.
export? when do I export it?
just before calling cmake.
ok, thanks for the info pal!
I don't have a mingw64 directory in /opt/, I have one in /usr/share/mingw-w64/ and within it there is a /include/ directory with some files ( all of them headers, and lots of them make reference to directx d3d ) and other directories. Is this what I have to export maybe?
If there's a subdirectory in the mingw-w64 dir like this mingw-w64/x86_64-w64-mingw32 then yes :) though its a rather unusual place to have a cross compiler. In that case export DXSDK_DIR=/usr/share/mingw-w64/x86_64-w64-mingw32 should do the trick. else look explicitly for the x86_64-w64-mingw32 dir and note which folder it is located in.
32 bit version would be named like this mingw-w64/i686-w64-mingw32 im not sure if your distro uses a multilib compiler though something tells me it does. Could you list the contents of the mingw-w64 directory ? folders only.
the directory itself is called "mingw-w64" it only contains a single directory "include", inside it there are the following directories: "ddk", "gdiplus", "GL", "psdk_inc", "sdks", "sec_api", "sys".
is this it?
Thats the contents normally residing in either i686-w64-mingw32 or x86_64-w64-mingw32 ?!? ok thats one strange setup, but ok then it would be "export DXSDK_DIR=/usr/share/mingw-w64" if you use copy pasta dont include the " around the block. Try with this and let me know if there are any problems.
Btw you say it only has one directory include in it ? thats not right there should also be a lib directory in it or i would suspect your instalation is broken. go here http://packages.ubuntu.com/search?keywords=mingw-w64 and get all the packages listed there for your distro. Yep just checked, the folder /mingw-w64 should contain i686-w64-mingw32 and x86_64-w64-mingw32, you only seem to have have a small part of it, you need atleast the mingw-w64 gcc compiler api and binutils which seem to be missing on your system. I suspect you only have the headers.
MingW is unsupported in this port.
I have to compile for Windows and I'm in Ubuntu, I see there is a bat file with mingw. based on that bat I created a file named "cmake-eclipse-linux-mingw-profile.sh" with this in it:
but apparently there lacks a generator named: "Eclipse CDT4 - MinGW Makefiles" as the console replies this:
is it possible to generate code for Windows from Linux or is it just madness? if it's not madness, what do we have to do in order to compile it?