Building on Cygwin : too many (wrong) rules for library detection

Hi,
I am trying to port OpenCascade on Cygwin to build also KiCad, but I found extremely frustrating
that the current OCCT-7_9_3 cmake scripts are making the work cumbersome due too many
wrong expectations on how 3rd party library are called and the absence of a clear way to state
how they are called on the specific platform.
I seldom see such overcomplicate cmake scripts trying to cover all possible corner cases,
while making impossible (or very hard) to clearly set the proper configuration.

To clarify:
- CYGWIN is a UNIX not a WIN32 platform
- libraries end in "dll" and shared import libraries in "dll.a" as everything run on top of Windows
- shared libs reside on /usr/bin as
/usr/bin/cygfreetype-6.dll
/usr/bin/libtcl8.6.dll
/usr/bin/libtk8.6.dll
- import libraries resides on /usr/lib as
/usr/lib/libfreetype.dll.a
/usr/lib/libtcl8.6.dll.a
/usr/lib/libtk8.6.dll.a

Have you any suggestion how I should invoke CMAKE to pass these settings ?

Dmitrii Pasukhin's picture

Hello, there is no possibility to invoke it automatically. You need manually provide all missed variables, when you check GUI version of CMake.

Best regards, Dmitrii.

gkv311 n's picture

Something like this is supposed to work when auto-detection logic fails:

cmake -S c:/occt-770.git ^
 -D 3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="/usr/include" ^
 -D 3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="/usr/include" ^
 -D 3RDPARTY_FREETYPE_LIBRARY_DIR:PATH="/usr/lib" ^
 -D 3RDPARTY_FREETYPE_LIBRARY:PATH="/usr/lib/libfreetype.dll.a" ^
 -D 3RDPARTY_FREETYPE_DLL_DIR:PATH="/usr/bin" ^
 -D 3RDPARTY_FREETYPE_DLL:PATH="/usr/bin/cygfreetype-6.dll" ^
 -D 3RDPARTY_TCL_INCLUDE_DIR:FILEPATH="/usr/include" ^
 -D 3RDPARTY_TCL_LIBRARY_DIR:PATH="/usr/lib" ^
 -D 3RDPARTY_TCL_LIBRARY:PATH="/usr/lib/libtcl8.6.dll.a" ^
 -D 3RDPARTY_TCL_DLL_DIR:PATH="/usr/bin" ^
 -D 3RDPARTY_TCL_DLL:PATH="/usr/bin/libtcl8.6.dll" ^
 -D 3RDPARTY_TK_INCLUDE_DIR:FILEPATH="/usr/include" ^
 -D 3RDPARTY_TK_LIBRARY_DIR:PATH="/usr/lib" ^
 -D 3RDPARTY_TK_LIBRARY:PATH="/usr/lib/libtk8.6.dll.a" ^
 -D 3RDPARTY_TK_DLL_DIR:PATH="/usr/bin" ^
 -D 3RDPARTY_TK_DLL:PATH="/usr/bin/libtk8.6.dll"

Note that you may disable 3rd-parties (USE_FREETYPE=OFF, USE_TK=OFF or BUILD_MODULE_Draw=OFF to disable Draw Harness and Tcl dependency).

gkv311 n's picture

Note that in case of MSYS2, it provides a dedicated build/installation package for CMake - like mingw-w64-x86_64-make. When using this CMake inside MSYS2 environment (instead of the build downloaded from official site), it helps finding standard packages within MSYS2 setup (specific to each flavor like UCRT64, MINGW64, etc.) - like it does on Linux. In this case, OCCT CMake scripts are able to find FreeType location without manually provided paths.

I don't know much about Cygwin, but I guess it may provide similar solution.