MattiaMontanari / openGJK

Fast and reliable implementation of the Gilbert-Johnson-Keerthi (GJK) algorithm for C, C#, Go, Matlab and Python
https://www.mattiamontanari.com/opengjk/
GNU General Public License v3.0
135 stars 37 forks source link

Error in build: Invalid numeric armument '/Wunused' #46

Closed ESui2 closed 8 months ago

ESui2 commented 8 months ago

Hi,

I seem to have a similar problem as been stated before. However instead of the /Wunused-macros I solely have a /Wunused invalid argument. I cloned the repository on my windows system and ran CMake in MSVS that returned the following error:

PS C:\Users\user\openGJK\openGJK> cmake --build build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  1>Checking Build System
  Building Custom Rule C:/Users/user/openGJK/CMakeLists.txt
cl : command line error D8021: invalid numeric argument '/Wunused' [C:\Users\user\openGJK\openGJK\build\obj_openGJK.vcxproj]

Full output of all steps are:

PS C:\Users\user\openGJK> cmake -E make_directory build
PS C:\Users\user\openGJK> cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will

CMake Error: The source directory "C:/Users/user/openGJK/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
PS C:\Users\user\openGJK> cmake -E chdir build cmake -DCMAKE_BUILD_TYPE=Release ..

-- Building for: Visual Studio 16 2019
CMake Deprecation Warning at CMakeLists.txt:28 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
-- The C compiler identification is MSVC 19.28.29913.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/VS2019/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Compiler in use: MSVC
CMake Warning (dev) at CMakeLists.txt:58 (elseif):
  Policy CMP0054 is not set: Only interpret if() arguments as variables or
  keywords when unquoted.  Run "cmake --help-policy CMP0054" for policy
  details.  Use the cmake_policy command to set the policy and suppress this
  warning.

  Quoted variables like "MSVC" will no longer be dereferenced when the policy
  is set to NEW.  Since the policy is not set the OLD behavior will be used.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- Version     : 3.0.3
-- Build type  : Release
-- Configuring done (5.0s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/user/openGJK/build
PS C:\Users\user\openGJK\openGJK> cmake --build build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  1>Checking Build System
  Building Custom Rule C:/Users/user/openGJK/CMakeLists.txt
cl : command line error D8021: invalid numeric argument '/Wunused' [C:\Users\user\openGJK\openGJK\build\obj_openGJK.vcxproj]

Does anyone happen to know what the problem could be? Perhaps I missed a step?

MattiaMontanari commented 8 months ago

@ESui2 I created a branch with a quick fix. Can you please test it before I merge it? I don't have MSVS to test it myself.. what CMake version are you using ?

ESui2 commented 8 months ago

Within the examples\c\main.c file the lines "int readinput()" and "int main()" had the word "int" on a separate line, which tripped up the initial parsing of this file on my build. After this and with your branch implementation i got 1 definite error as shown underneath.

I am working with CMake 3.28.1

PS C:\Users\320237572\Documents\openGJK> cmake --build build
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  obj_openGJK.vcxproj -> C:\Users\320237572\Documents\openGJK\build\obj_openGJK.dir\Debug\obj_openGJK.lib
LINK : fatal error LNK1104: cannot open file 'm.lib' [C:\Users\320237572\Documents\openGJK\build\examples\c\example_lib_opengjk_ce.vcxpro
j]
  Auto build dll exports
  opengjk_ce.vcxproj -> C:\Users\320237572\Documents\openGJK\build\Debug\opengjk_ce.dll
MattiaMontanari commented 8 months ago

@ESui2 could you please try again? I don't understand why I left the link to the math library not guarded, but that causes you link error

Please let me know

MattiaMontanari commented 8 months ago

@ESui2 i pushed new charges for you to test, pull the latest version and let me know. Thanks