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

How to use? #4

Open
cornytrace opened this issue Feb 15, 2018 · 6 comments
Open

How to use? #4

cornytrace opened this issue Feb 15, 2018 · 6 comments

Comments

@cornytrace
Copy link
Contributor

IDE: MSVC2017
How can CMake automatically find the libraries compiled in this repo?
I have tried setting the CMAKE_PREFIX_PATH to it, but then the bullet debug libraries are not detected.
Furthermore, how do I do a static library link vs a dynamic library link?

@madebr
Copy link
Owner

madebr commented Feb 15, 2018

If something is wrong/missing/unclear, please reply.

Create an experimental build

This will create a build (including vs2017 solution) in the build/experimental subdirectory.
Run these steps only once, since script_expeimental.ctest will clear the experimental subdirectory on every invocation (to ensure a clean start).
The script will automatically fetch the windows dependencies (no need to manually clone the openrw-windows-dependencies repo).
All libraries are linked statically, using the static C runtime (/MT).
The script assumes you have installed Boost 1.65.1 in C:\Libraries\boost_1_65_1

set PLATFORM=win32
set CONFIGURATION=Release
set CMAKE_GENERATOR="Visual Studio 15 2017"
set BOOST_ROOT="C:\Libraries"
set BOOST_VERSION="1.65.1"
set DEP_DIR="C:\dependencies"
set WIN_DEP_NAME="openrw-windows-dependencies"
set WIN_DEP_URL="https://github.com/rwengine/openrw-windows-dependencies"
git clone https://github.com/rwengine/openrw.git
cd openrw
ctest -S cmake/ctest/script_experimental.ctest

Submit your experimental test results to cdash

Run this command as well before running the script_experimental.ctest script.

set SUBMIT=TRUE

The experimental script does currently only support static 3rdparty libs.
You can link to the dynamic libs of this repo by making some changes:

  • cmake/ctest/configure_windows.ctest:
    • remove the -static suffix from TRIPLET
    • set Boost_USE_STATIC_LIBS and Boost_USE_STATIC_RUNTIME to FALSE
  • tests/CMakeLists.txt:
    • remove the if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows") and endif() surrounding target_compile_definitions(rwtests PRIVATE "BOOST_TEST_DYN_LINK").

Do you think the windows build needs dynamic linking?
When setting CONFIGURATION to Release, you can only build in Release mode in vs2017. The same is true for Debug.

@cornytrace
Copy link
Contributor Author

cornytrace commented Feb 15, 2018

A few remarks:
The quotes need to be removed from the set commands in order to work (at least in cmd.exe, don't know about powershell).
BOOST_ROOT should point to the boost folder itself, not the directory where the boost folder is.
Edit: Having that said, I still get errors:

   Each . represents 1024 bytes of output
    ... Size of output: 2K
   Each symbol represents 1024 bytes of output.
   '!' represents an error and '*' a warning.
    ......*.*.....**********.*******..................  Size: 49K
    ...........!......................................  Size: 99K
    ....!.............................................  Size: 149K
    ............! Size of output: 162K
Error(s) when building project
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
Unable to find executable: F:/Projects/openrw/build/experimental/tests/Release/rwtests.exe
CMake Warning at F:/Projects/openrw/cmake/ctest/script_experimental.ctest:60 (message):
  Test failure detected!


CMake Warning at F:/Projects/openrw/cmake/ctest/script_experimental.ctest:62 (message):
  Warning(s) detected


CMake Error at F:/Projects/openrw/cmake/ctest/script_experimental.ctest:67 (message):
  Build failure detected!


CMake Error at F:/Projects/openrw/cmake/ctest/script_experimental.ctest:69 (message):
  Error(s) detected



F:\Projects\openrw>

@cornytrace
Copy link
Contributor Author

Also, if I want to test a new feature in debug, and then test it in release, I have to do this all over again?
Isn't it just a better approach to do all these things in the CMakeLists.txt of openrw itself, and then just having a DEP_DIR variable which, if containing a path, automatically uses the libraries in those folders and sets the appropriate C/CXX flags?

@madebr
Copy link
Owner

madebr commented Feb 15, 2018

First of, thanks for the feedback.
Looking at your submitted test results, it seems you have only installed 64 bit boost.
So execute set PLATFORM=x64 instead of set PLATFORM=Win32

The reason that one cmake configuration invocation does only allow to build either release or debug is that not all find_XXX modules (supplied by cmake) support this (they only look for either the Release or Debug library).

Currently, the experimental script does always build in the experimental subdirectory.
What you can do is modify the experimental script to create a release build and a debug build in different subdirectories. The downside is you'll need to have 2 instances of Visual Studio open.
The FindBoost modules support switching between Release and Debug, so in theory it is possible. (let's call it a todo)

@madebr
Copy link
Owner

madebr commented Feb 21, 2018

Still working on the conan port. There still are some linking problems but I foresee it working in the near future.

Once conan is working, this cmake multi generator will be useful

@madebr
Copy link
Owner

madebr commented Jun 14, 2018

@cornytrace Can you check rwengine/openrw#508?

More specifically, the steps

cd openrw && mkdir -p build\vs_solution && cd build\vs_solution
python ..\..\scripts\conan\create_vs_solution.py

Please tell me if some command is wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants