markaren / threepp

C++20 port of three.js (r129)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you make installation procedure more clear?

PaulHaeberli opened this issue · comments

I'm on OSX - this looks like a nice project!

Trying to install, I do this, all fine.

conan remote add ais https://ais.jfrog.io/artifactory/api/conan/ais-conan-local

Then on this step - I am stuck.

Then add a dependency to:
threepp/<version>@ais/stable (stable channel -> releases)
threepp/<version>@ais/testing (development builds -> master)
threepp/<version>@ais/testing-<branch> (development builds -> branches)

I am not familiar enough with conan to do this. Can you make the instructions more
clear? What command do I need to run to do this? Thanks for your help with this.

I see your point, but I'm not sure how to do that in practice.
There are multiple ways of dealing with conan and people have different preferences.
Basically, those familiar with conan would not need any more information.

And naturally, you don't have to use conan in your own project. Build threepp:

cmake . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

and point your build script to the built library and headers files.

My preferred approach would be to copy the approach of threepp itself:

if(CONAN_EXPORTED) # in conan local cache
    # standard conan installation, deps will be defined in conanfile.py
    # and not necessary to call conan again, conan is already running
    include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
    conan_basic_setup(TARGETS)
else()

    include(cmake/conan.cmake)  # <----- NOTICE THIS FILE

    conan_cmake_run(
            REQUIRES
            threepp/0.1.0@ais/testing
            BUILD missing
            SETTINGS build_type=${CMAKE_BUILD_TYPE}
            BASIC_SETUP CMAKE_TARGETS)

endif()

Then link using

target_link_library(mylib PUBLIC|PRIVATE|INTERFACE CONAN_PKG::threepp)

Worth noting, however, is that there is no artifact available through threepp/<version>@ais/stable, because no releases have been made. So you will have to use threepp/<version>@ais/testing (master branch).

I tried installing conan as you instructed and then tried on intel OSX 12.0.1

% cmake . -B build -DCMAKE_BUILD_TYPE=Release

These are the errors. Can you help me build this on OSX?

Very sorry for this distraction.

Paul

Studio-Muji:threepp-master paul$ cmake . -B build -DCMAKE_BUILD_TYPE=Release
Current threepp version: 0.1.0

-- Conan: Automatic detection of conan settings from cmake
-- Conan: build_type was added as an argument. Not using the autodetected one.
-- Conan: Settings= -s;compiler=apple-clang;-s;compiler.version=13.0;-s;compiler.libcxx=libc++;-s;build_type=Release
-- Conan: checking conan executable
-- Conan: Found program /Library/Frameworks/Python.framework/Versions/2.7/bin/conan
-- Conan: Version found Conan version 1.43.0

-- Conan executing: /Library/Frameworks/Python.framework/Versions/2.7/bin/conan install /Users/paul/Desktop/threepp-master/conanfile.py -s compiler=apple-clang -s compiler.version=13.0 -s compiler.libcxx=libc++ -s build_type=Release -g=cmake --build=missing
Auto detecting your dev setup to initialize the default profile (/Users/paul/.conan/profiles/default)
Found clang 6.0
Default settings
os=Macos
os_build=Macos
arch=x86_64
arch_build=x86_64
compiler=clang
compiler.version=6.0
compiler.libcxx=libstdc++
build_type=Release
*** You can change them in /Users/paul/.conan/profiles/default ***
*** Or override with -s compiler='other' -s ...s***

WARN: Remotes registry file missing, creating default one in /Users/paul/.conan/remotes.json
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=apple-clang
compiler.libcxx=libc++
compiler.version=13.0
os=Macos
os_build=Macos
[options]
[build_requires]
[env]

glfw/3.3.4: Not found in local cache, looking in remotes...
glfw/3.3.4: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
glfw/3.3.4: Downloaded recipe revision 0
ERROR: glfw/3.3.4: Cannot load recipe.
Error loading conanfile at '/Users/paul/.conan/data/glfw/3.3.4///export/conanfile.py': Unable to load conanfile in /Users/paul/.conan/data/glfw/3.3.4///export/conanfile.py
File "/Users/paul/.conan/data/glfw/3.3.4///export/conanfile.py", line 60
tools.get(**self.conan_data["sources"][self.version],
^
SyntaxError: invalid syntax

CMake Error at cmake/conan.cmake:522 (message):
Conan install failed='1'
Call Stack (most recent call first):
cmake/conan.cmake:759 (old_conan_cmake_install)
CMakeLists.txt:45 (conan_cmake_run)

-- Configuring incomplete, errors occurred!
See also "/Users/paul/Desktop/threepp-master/build/CMakeFiles/CMakeOutput.log".
See also "/Users/paul/Desktop/threepp-master/build/CMakeFiles/CMakeError.log".

Seems you are using Python2. Conan requires Python3.

Ok - I'll try some other way.

commented

Hello @markaren , I want to run the demo but I'm not familiar with cpp build.
I tried pip install conan then throw these errors:

C:\WWW\lib\threepp_github>pip install conan
ERROR: Exception:
Traceback (most recent call last):
  File "C:\Python310\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
    status = self.run(options, args)
  File "C:\Python310\lib\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
    return func(self, options, args)
  File "C:\Python310\lib\site-packages\pip\_internal\commands\install.py", line 315, in run
    requirement_set = resolver.resolve(
  File "C:\Python310\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 94, in resolve
    result = self._result = resolver.resolve(
  File "C:\Python310\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 472, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "C:\Python310\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "C:\Python310\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
    if not criterion.candidates:
  File "C:\Python310\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
    return bool(self._sequence)
  File "C:\Python310\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 140, in __bool__ 
    return any(self)
  File "C:\Python310\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 128, in <genexpr>
    return (c for c in iterator if id(c) not in self._incompatible_ids)
  File "C:\Python310\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 29, in _iter_built
    for version, func in infos:
  File "C:\Python310\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 272, in iter_index_candidate_infos
    result = self._finder.find_best_candidate(
  File "C:\Python310\lib\site-packages\pip\_internal\index\package_finder.py", line 851, in find_best_candidate
    candidates = self.find_all_candidates(project_name)
  File "C:\Python310\lib\site-packages\pip\_internal\index\package_finder.py", line 798, in find_all_candidates
    page_candidates = list(page_candidates_it)
  File "C:\Python310\lib\site-packages\pip\_internal\index\sources.py", line 134, in page_candidates
    yield from self._candidates_from_page(self._link)
  File "C:\Python310\lib\site-packages\pip\_internal\index\package_finder.py", line 758, in process_project_url
    html_page = self._link_collector.fetch_page(project_url)
  File "C:\Python310\lib\site-packages\pip\_internal\index\collector.py", line 490, in fetch_page
    return _get_html_page(location, session=self.session)
  File "C:\Python310\lib\site-packages\pip\_internal\index\collector.py", line 400, in _get_html_page
    resp = _get_html_response(url, session=session)
  File "C:\Python310\lib\site-packages\pip\_internal\index\collector.py", line 115, in _get_html_response
    resp = session.get(
  File "C:\Python310\lib\site-packages\pip\_vendor\requests\sessions.py", line 555, in get
    return self.request('GET', url, **kwargs)
  File "C:\Python310\lib\site-packages\pip\_internal\network\session.py", line 454, in request
    return super().request(method, url, *args, **kwargs)
  File "C:\Python310\lib\site-packages\pip\_vendor\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python310\lib\site-packages\pip\_vendor\requests\sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python310\lib\site-packages\pip\_vendor\cachecontrol\adapter.py", line 53, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "C:\Python310\lib\site-packages\pip\_vendor\requests\adapters.py", line 439, in send
    resp = conn.urlopen(
  File "C:\Python310\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 696, in urlopen
    self._prepare_proxy(conn)
  File "C:\Python310\lib\site-packages\pip\_vendor\urllib3\connectionpool.py", line 964, in _prepare_proxy
    conn.connect()
  File "C:\Python310\lib\site-packages\pip\_vendor\urllib3\connection.py", line 359, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "C:\Python310\lib\site-packages\pip\_vendor\urllib3\connection.py", line 500, in _connect_tls_proxy
    return ssl_wrap_socket(
  File "C:\Python310\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "C:\Python310\lib\site-packages\pip\_vendor\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "C:\Python310\lib\ssl.py", line 512, in wrap_socket
    return self.sslsocket_class._create(
  File "C:\Python310\lib\ssl.py", line 1027, in _create
    raise ValueError("check_hostname requires server_hostname")
ValueError: check_hostname requires server_hostname
commented

Then I tried cmake . -B build -DCMAKE_BUILD_TYPE=Release, it seems partly ok, generated the build folder, but still report error in the end:
image

Here's the CMakeOutput.log:

The system is: Windows - 10.0.19042 - AMD64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler:  
Build flags: 
Id flags:  

The output was:
0
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.7.0+b89cb5fde
版权所有(C) Microsoft Corporation。保留所有权利。

生成启动时间为 2022/1/13 17:51:54。
节点 1 上的项目“C:\WWW\lib\threepp_github\build\CMakeFiles\3.21.4\CompilerIdC\CompilerIdC.vcxproj”(默认目标)。
PrepareForBuild:
  正在创建目录“Debug\”。
  正在创建目录“Debug\CompilerIdC.tlog\”。
InitializeBuildStatus:
  正在创建“Debug\CompilerIdC.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /Gd /TC /FC /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X64 Debug\CMakeCCompilerId.obj
  CompilerIdC.vcxproj -> C:\WWW\lib\threepp_github\build\CMakeFiles\3.21.4\CompilerIdC\.\CompilerIdC.exe
PostBuildEvent:
  for %%i in (cl.exe) do @echo CMAKE_C_COMPILER=%%~$PATH:i
  :VCEnd
  CMAKE_C_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\cl.exe
FinalizeBuildStatus:
  正在删除文件“Debug\CompilerIdC.tlog\unsuccessfulbuild”。
  正在对“Debug\CompilerIdC.tlog\CompilerIdC.lastbuildstate”执行 Touch 任务。
已完成生成项目“C:\WWW\lib\threepp_github\build\CMakeFiles\3.21.4\CompilerIdC\CompilerIdC.vcxproj”(默认目标)的操作。

已成功生成。
    0 个警告
    0 个错误

已用时间 00:00:02.10


Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.exe"

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "CompilerIdC.vcxproj"

The C compiler identification is MSVC, found in "C:/WWW/lib/threepp_github/build/CMakeFiles/3.21.4/CompilerIdC/CompilerIdC.exe"

Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" succeeded.
Compiler:  
Build flags: 
Id flags:  

The output was:
0
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.7.0+b89cb5fde
版权所有(C) Microsoft Corporation。保留所有权利。

生成启动时间为 2022/1/13 17:51:56。
节点 1 上的项目“C:\WWW\lib\threepp_github\build\CMakeFiles\3.21.4\CompilerIdCXX\CompilerIdCXX.vcxproj”(默认目标)。
PrepareForBuild:
  正在创建目录“Debug\”。
  正在创建目录“Debug\CompilerIdCXX.tlog\”。
InitializeBuildStatus:
  正在创建“Debug\CompilerIdCXX.tlog\unsuccessfulbuild”,因为已指定“AlwaysCreate”。
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\CL.exe /c /nologo /W0 /WX- /diagnostics:column /Od /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"Debug\\" /Fd"Debug\vc142.pdb" /Gd /TP /FC /errorReport:queue CMakeCXXCompilerId.cpp
  CMakeCXXCompilerId.cpp
Link:
  C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdCXX.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdCXX.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X64 Debug\CMakeCXXCompilerId.obj
  CompilerIdCXX.vcxproj -> C:\WWW\lib\threepp_github\build\CMakeFiles\3.21.4\CompilerIdCXX\.\CompilerIdCXX.exe
PostBuildEvent:
  for %%i in (cl.exe) do @echo CMAKE_CXX_COMPILER=%%~$PATH:i
  :VCEnd
  CMAKE_CXX_COMPILER=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\Hostx64\x64\cl.exe
FinalizeBuildStatus:
  正在删除文件“Debug\CompilerIdCXX.tlog\unsuccessfulbuild”。
  正在对“Debug\CompilerIdCXX.tlog\CompilerIdCXX.lastbuildstate”执行 Touch 任务。
已完成生成项目“C:\WWW\lib\threepp_github\build\CMakeFiles\3.21.4\CompilerIdCXX\CompilerIdCXX.vcxproj”(默认目标)的操作。

已成功生成。
    0 个警告
    0 个错误

已用时间 00:00:01.33


Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.exe"

Compilation of the CXX compiler identification source "CMakeCXXCompilerId.cpp" produced "CompilerIdCXX.vcxproj"

The CXX compiler identification is MSVC, found in "C:/WWW/lib/threepp_github/build/CMakeFiles/3.21.4/CompilerIdCXX/CompilerIdCXX.exe"

Detecting C compiler ABI info compiled with the following output:
Change Dir: C:/WWW/lib/threepp_github/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_1258c.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.7.0+b89cb5fde

版权所有(C) Microsoft Corporation。保留所有权利。



  Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x64

  CMakeCCompilerABI.c

  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /Fo"cmTC_1258c.dir\Debug\\" /Fd"cmTC_1258c.dir\Debug\vc142.pdb" /Gd /TC /errorReport:queue "C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCCompilerABI.c"

  cmTC_1258c.vcxproj -> C:\WWW\lib\threepp_github\build\CMakeFiles\CMakeTmp\Debug\cmTC_1258c.exe




Detecting CXX compiler ABI info compiled with the following output:
Change Dir: C:/WWW/lib/threepp_github/build/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe cmTC_d624e.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && 用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.7.0+b89cb5fde

版权所有(C) Microsoft Corporation。保留所有权利。



  Microsoft (R) C/C++ Optimizing Compiler Version 19.27.29112 for x64

  CMakeCXXCompilerABI.cpp

  Copyright (C) Microsoft Corporation.  All rights reserved.

  cl /c /Zi /W3 /WX- /diagnostics:column /Od /Ob0 /D _MBCS /D WIN32 /D _WINDOWS /D "CMAKE_INTDIR=\"Debug\"" /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"cmTC_d624e.dir\Debug\\" /Fd"cmTC_d624e.dir\Debug\vc142.pdb" /Gd /TP /errorReport:queue "C:\Program Files\CMake\share\cmake-3.21\Modules\CMakeCXXCompilerABI.cpp"

  cmTC_d624e.vcxproj -> C:\WWW\lib\threepp_github\build\CMakeFiles\CMakeTmp\Debug\cmTC_d624e.exe

If I keep run cmake --build build, it'll report this error:

C:\WWW\lib\threepp_github>cmake --build build
用于 .NET Framework 的 Microsoft (R) 生成引擎版本 16.7.0+b89cb5fde
版权所有(C) Microsoft Corporation。保留所有权利。

MSBUILD : error MSB1009: 项目文件不存在。
开关:ALL_BUILD.vcxproj

The errors boils down to the failing conan installation, and that error is not related to this project.
Are the servers down? Firewall? Outdated pip? In any case, you would need to look for answers elsewhere.

commented

@markaren Thanks for quick answer! I'll try how to properly install conan.

How about the second question? Is this approach not need conan?

And naturally, you don't have to use conan in your own project. Build threepp:
cmake . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

But I still failed.

threepp will need conan in order to build. Once you have built threepp, you could opt to not use conan in your own project, through manual linking, if that makes sense.