How to build GLUS with MinGW and Sublime Text 3 - c

I am in a similar situation :
Eclipse CPP and GNU following these instructions. But i need to build GLUS with MinGW and sublime text.
I am learning C and OpenGL ,so i lack compilation/dependencies logic.
I would just like to undertsand in a simple way.
how to compile GLUS from those source:
https://github.com/McNopper/OpenGL/tree/master/GLUS/src
Where to install all the files in MinGW folder to setup things correctly.
Glew and Glfw are already configure correctly and works fine.
Thanks for your time.

Well Norbert Nopper kindly answer my question directly. And like the answer mention above. The path to follow to compile GLUS without any ide is by using cmake.
in the GLUS folder, there is a CMake file (https://cmake.org/). With
CMake, you can create the GLUS library without any IDE and for a lot
of platforms – including Windows and MinGW.

Yes cmake is the answer.
You usually create a build directory. Inside your git clone of the repository you do :
mkdir build
cd build
cmake ..
make

Related

Building Anjay tutorial codes

I'm getting some difficulties on building the tutorial codes of Anjay https://github.com/AVSystem/Anjay. the doc wasn't really helpful.
I tried a simple :
cd examples/tutorial/custom-object
cmake . && make
but I'm getting this message :
By not providing "Findanjay.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "anjay", but
CMake did not find one.
Could not find a package configuration file provided by "anjay" with any of
the following names:
anjayConfig.cmake
anjay-config.cmake
Add the installation prefix of "anjay" to CMAKE_PREFIX_PATH or set
"anjay_DIR" to a directory containing one of the above files. If "anjay"
provides a separate development package or SDK, be sure it has been
installed.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.10)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
I would appreciate any suggetions.
Thank you.
I was doing the same thing. The error is because you have not installed anjay libraries on your local system or provide a way for CMake to find it.
I installed it by following steps mentioned in compilation docs
In the root of Anjay directory execute the following:
cmake . && make && sudo make install

Viewing CPython Code in CLion

Sorry for a question that might appear stupid to more experienced developers: I am still a newcomer to C and C++.
I come from Python/Java development land and am trying to get a better insight into C and C++. I installed JetBrains CLion and cloned CPython mercurial repository. However when I started looking at the source code, I realized that Clion was highlighting a lot of constructs that seemed to be working. For instance:
Or
As far as I can see, Clion seems the have problem with the identation style of Python, C code, but once again, I might be wrong.
How Clion configurations can be altered for it to properly parse the CPython code?
CPython uses GNU Autotools for the build, but that toolset is not supported by CLion. See issues CPP-494 and CPP-193. CLion currently supports only one build system - CMake.
You can create your own CMakeLists.txt file and list the sources in there. This will help CLion to understand the structure of the source tree and allow it to find the headers etc:
cmake_minimum_required(VERSION 3.0)
project(cpython)
file(GLOB SOURCE_FILES
Python/*.c
Parser/*.c
Objects/*.c
Modules/*.c)
include_directories(Include)
add_executable(cpython ${SOURCE_FILES})
For the actual build, use standard build tools from command line. Alternatively, custom command can be added to CMakeLists.txt to call make. See add_custom_command for that.
As mentioned in the above answer you need a CMake Project to allow CLion to build Python.
In fact there is already a CMakeList.txt-files for CPython, that is maintained independently from the official sources:
https://github.com/python-cmake-buildsystem/python-cmake-buildsystem
I didn't test it with CLion but it should do the job...

Windows: How to build X264.lib instead of .dll

I downloaded the X264 source and installed mingw.
Step 1:
Executed this in the MINGW bash:
./configure --disable-cli --enable-shared --enable-win32thread -
-extra-ldflags=-Wl,--output-def=libx264.def
and then 'make'
Step 2:
Renamed the libx264-142.dll to libx264.dll and Opened up VS2012 Command Prompt and executed this:
LIB /DEF:libx264.def
which gave me libx264.lib and object libx264.exp
Step 3:
Included the lib file in a VS2012 project which uses the X264 API.
Problem:
When I start the project I get the following error message:
"The program can't start because libx264.dll is missing from your computer"
Question:
Why is it looking for the dll when I'm linking the static library in?
How do I resolve this? I would like to build a static X264 library which I can link in with my project.
EDIT:
I just had to put the dll in the same directory as the project executable.
However - My question still stands: How do I build a static x264 library? So I don't need the dll?
After the latest update of x264 you can build static library usable by MSVS project. For such library compilation you will need:
MSYS and MSVS 2013 Update 2 (express version [for Windows Desktop] would also work if you install Update 2)
run "VS2013 x86 Native Tools Command Prompt" or "VS2013 x64 Native Tools Command Prompt" depending what version (32 or 64-bit) you want to build
change dir to x264 path and run MSYS shell (sh)
from shell run "CC=cl ./configure --disable-cli --enable-static" for x264 configuring
run "make" which should build libx264.lib usable from MSVS
P.S. MSVS builds would be a little bit slower than one build by MinGW
Matthew Oliver has a GIT repository of a patched x264 source tree (https://github.com/ShiftMediaProject/x264) that compiles natively in VS2013 update 2 and later. It requires installing a YASM version for VS.
It worked pretty much straight out of the box for me, though I did have to change the VSYASM parameter "-f Win32" to "-f win32" for a 32bit build
Take a look here: http://siliconandlithium.blogspot.no/2014/03/building-x264-on-windows-with-visual.html
Static lib is not possible in windows as per my knowledge.

Cross compile GTK+ application from Linux to Windows?

How can I cross compile my GTK+ app (written in C) from Linux to Windows? Could I just replace the "gcc" command with "mingw32"?
Fedora has a great mingw32 cross-compiler toolchain which comes with lots of precompiled libraries, including GTK+ and gtkmm. For most applications you just need to install the cross-compiler and the cross-compiled GTK+ libraries:
yum install mingw32-gcc mingw32-gtk2
Once everything needed is installed, compiling your application is just the matter of running "mingw32-configure" followed with "make".
More information at the project page https://fedoraproject.org/wiki/MinGW
You can use mingw-cross-env - all you have to do then is to change your CC/CXX environment path to use the i686-mingw32- prefix and export the mingw-cross-env bin dirs (both) to your PATH variable (or if you are using autotool it's even easier) - see the documentation on the homepage.
There is actually a project called MXE that does exactly this.
Pre-build package
You can download my pre-build binaries if you want.
Build from source
You can also build the code from scratch ideally also applying this PR to update to the latest GTK 3.24 version.
MXE has a easy wrapper (x86_64-w64-mingw32.static-cmake) to cross-build your project towards Windows, while using Linux. Allowing to evenly statically build your project into a single .exe file! Of course shared builds (x86_64-w64-mingw32.shared-cmake) are also supported. The example wrapper scripts are meant for CMake based projects.
Before you can build your project with MXE, you need to build the GTK3 from source-code. (There are some Linux packages available, but mostly out-dated). If you are using C++, you can also build gtkmm3. Since you are in place C, you only need to build gtk3.
git clone https://github.com/mxe/mxe.git
Become root user: su
mv mxe /opt/mxe
cd /opt/mxe
Build the MXE project yourself:
For static builds under Windows 64-bit for GTK3 & Gtkmm3:
sudo make gtk3 gtkmm3 -j 16 MXE_TARGETS='x86_64-w64-mingw32.static' MXE_PLUGIN_DIRS='plugins/gcc12'
For shared build to Windows 64-bit (again GTK3 + Gtkmm3):
sudo make gtk3 gtkmm3 -j 16 MXE_TARGETS='x86_64-w64-mingw32.shared' MXE_PLUGIN_DIRS='plugins/gcc12'
More info see the tutorial steps on MXE.cc.
Once you done the cross-compile environment / MXE build. Now you can use the CMake wrapper scripts I mentioned earlier. Those scripts are located in the /opt/mxe/usr/bin/ directory.
The scripts (like x86_64-w64-mingw32.static-cmake) can now be used to compile your project towards Windows, while using the Linux operating system. The build result would be an Windows .exe.
Disclaimer: I personally created this PR for MXE to update GTK to the latest 3.24.x release.

How to build gnu `libiconv` on & for windows?

I want to build a static library (*.LIB file) GNU libiconv on windows to be used with other libraries in Visual C++. Other libraries I'm using are built with "MultiThreaded DLL" (/MD) Runtime option. So, I need to build libiconv with the same option.
Problem is the libiconv uses GNU build system and I want to compile with /MD option. You can see the source structure of libiconv here:
http://cvs.savannah.gnu.org/viewvc/libiconv/?root=libiconv
Mr. Zlatkovic maintains the windows port of GNU libiconv for libxml2
you can see them here:
ftp://xmlsoft.org/libxml2/win32/iconv-1.9.2.win32.zip
I cannot use his port. I need to build from the latest version of libiconv-1.13. I wonder how this guy has ported it? Can some one please tell me how to build *.lib from this and compile it using MSVC?
EDIT:
Actually, I need to build few more gnu libraries with same settings. So, if I get solution for one library. I can do the same for all others.
I found PARK Youngho's How to Build libiconv with Microsoft Visual Studio over at The Code Project to be complete and clean (for VS2010 and GNU libiconv 1.14).
A little addition to your answer.
I had the same issue and found that the MinGW + MSYS solution was perfect.
Though, I needed to go a little further and generate also the .lib file in order to be able to link with the resulting dll.
This is what I found:
generate a .def file from the dll with dumpbin (a Visual Studio tool).
generate the .lib file from the .def with the lib program (Visual Studio tool too)
This allows you to specify some link flags if appropriate.
Everything detailed here (I'm not the author of this method):
http://wiki.videolan.org/GenerateLibFromDll
I also realized that this lib/dll couple can be linked with both MD and MDd libraries.
Hope that can help people that find this post, like it helped me.
-David
I'm the OP. MSYS is the exact thing what I was looking for.
Just install MinGW & MSYS which contains shell sh.exe & make.exewith which you can configure and generate a Makefile after that you can use make.exe to run it.
Its as simple as that.
compile them using MinGW using Msys for the environment if needed. MinGW's .a files are apparently, according to the mailing list, the same format as .lib files (just do a rename). You might want to check first to see if the iconv static library is included already in the MinGW download / filesystem.
Edit: it's in msys (C:\msys\1.0\lib), along with:
libiconv.a
libiconv.dll.a
libiconv.la
and additionally
libiconv-2.dll (in C:\msys\1.0\local\bin)
Edit: is it in here, the libiconv you need? these versions seem to have MSVC makefiles :) http://www.opensource.apple.com/source/libiconv/

Resources