Skip to content
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

ARX.cmake in "1.0.5.1/artoolkitX.for.Windows.v1.0.zip" contains absolut path to pthreadVC2static.lib, which is not contained #106

Open
Warmyone opened this issue Mar 29, 2020 · 5 comments
Labels
bug Something isn't working

Comments

@Warmyone
Copy link

I downloaded "1.0.5.1/artoolkitX.for.Windows.v1.0.zip" as 1.0.6 does not have a windows download.
Found "ARX.cmake" in a sub dir and therefore wanted to use cmake's find_package:

find_package(ARX CONFIGS ARX.cmake REQUIRED)

Configuring works but if I want to build I get this error:

ninja: error: 'D:/a/1/s/Source/depends/windows/lib/x64/pthreadVC2static.lib', needed by 'bin/***.exe', missing and no known rule to make it

I looked into "ARX.cmake" and found this line.

INTERFACE_LINK_LIBRARIES "opengl32;glu32;OpenGL32;D:/a/1/s/Source/depends/windows/lib/x64/pthreadVC2static.lib" 

When replacing "D:/a/1/s/Source/depends/windows/lib/x64/pthreadVC2static.lib" with "pthreadVC2static.lib" it will build but than fail to link to it. The lib is not contained in the .zip so I cannot do anything about that.

If i run build.sh in the sources the created "ARX.cmake" again contains an absolut path to the location in the source tree. Furthermore all created files are spread throughout the build dir and I cannot find install instructions anywhere which might use relative paths and copy the libs in the right place.

What is the expected way to fix? Or is there an other approach to use the sdk on windows without building it on each system?

@kalwalt
Copy link

kalwalt commented Mar 29, 2020

I Never build artoolkitx under Windows, because I have a Linux machine, for sure it is an error, maybe try to replace that line "D:/a/1/s/Source/depends/windows/lib/x64/pthreadVC2static.lib" with simply pthread. I have no other suggestions...

@Warmyone
Copy link
Author

If I am not mistaking pthread is Linux only. For the msvc on windows you need pthreadVC2. What seems to work is to download it from the sources https://github.com/artoolkitx/artoolkitx/raw/master/Source/depends/windows/lib/x64/pthreadVC2static.lib and exchange D:/a/1/s/Source/depends/windows/lib/x64/pthreadVC2static.lib with a path to the downloaded file. But I guess that is not the intended way to get the sdk for windows.

@kalwalt
Copy link

kalwalt commented Mar 30, 2020

Yes, you are right for sure this is not the intended way... Sorry, i can not help much on this issue! For sure @philip-lamb or @ThorstenBux may help you.

@Warmyone
Copy link
Author

Im not sure if it is helpful for the issue but CMake does have generator-expressions. $<INSTALL_INTERFACE:...> and $<BUILD_INTERFACE:...> could be useful.

Instead of

target_link_libraries(ARX
   PUBLIC ${PTHREAD_LIBRARIES}
...
)

it could be

install(FILES ${PTHREAD_LIBRARIES} DESTINATION ${ARX_INSTALL_LIBRARY_DIR})
target_link_libraries(ARX
   PUBLIC
      $<BUILD_INTERFACE:${PTHREAD_LIBRARIES}>
      $<INSTALL_INTERFACE:%relativePath%>
...
)

The relative path would need to be composed platform dependent, e.g. for windows it would could be ${ARX_INSTALL_LIBRARY_DIR}/pthreadVC2static.lib. Here is a more detailed description of the feature.

@philip-lamb
Copy link
Member

pthreads is used on Windows too via the pthreads-win32 library, which is the one that's being linked here. It's provided in the project (see https://github.com/artoolkitx/artoolkitx/blob/master/Source/depends/windows/lib/x64/pthreadVC2static.lib) but having the full path to that library in the CMake module is obviously a bug.

What I'd suggest as a short-term workaround is to just copy the above library out of artoolkitx into your own link libs folder, and adjust the cmake module path. I'll have to investigate why the full path is being included.

@philip-lamb philip-lamb added the bug Something isn't working label Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants