Skip to content

Cmake install and scripts #53

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

Closed
wants to merge 11 commits into from

Conversation

marvin2k
Copy link

@marvin2k marvin2k commented Feb 3, 2017

Thanks for this nice tool, worked better than I expected ;-) This PR might not be finished or polished, but might be helpful to others. It allows to

  • Install the data-folder, generator and indexer programs, as well as providing a new FindWoboq.cmake
  • Edited README for the linux installation procedure to do out-of-source builds. They are much inferior.
  • Disabled strict-aliasing, as gcc6 will emit many warnings due to type-pruning in llvm headers. Can't change these. Better safe than sorry.

If FindWoboq.cmake is findable in $CMAKE_MODULE_PATH, there is a new function CreateBrowsableDocumentation(TARGET $trgt). It will create targets like woboq-$trgt, woboq and woboq-serve. So adding the following to a CMakeLists:

# of course, provide the correct installation location
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/opt/woboq.install/share/woboq/cmake")
find_package(Woboq REQUIRED)
CreateBrowsableDocumentation(TARGETS subtarget1 subtarget2 maintarget)

Then, after recreating the build-folder, start a python simple http server:

make -C build woboq-serve

And open the stuff in the browser:

xdg-open http://localhost:8000

Works for me ;-) The indexer seems a bit buggy or wrongly used be me -- css is broken in some locations?

Sidenote: Generated files located inside the build-folder (Qt...) are missing if the build folder is not inside the src-folder. See ProjectManager::projectForFile. This is inconvenient in a CI-environment for example.

who builds in-source anyways?

Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
provides functions to add targets for scanning:

add the following to a CMakeLists:
	set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "/opt/woboq.install/share/woboq/cmake")
	find_package(Woboq REQUIRED)
	CreateBrowsableDocumentation(TARGETS subtarget1 subtarget2 maintarget)

then, after recreating the build-folder, call make like so:
	make -C build woboq-serve

and open the stuff in the browser:
	xdg-open http://localhost:8000

Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
@CLAassistant
Copy link

CLAassistant commented Feb 3, 2017

CLA assistant check
All committers have signed the CLA.

- two separate projects, for source and file generated inside the build folder
- fixed data-argument for indexgenerator to be "/data"

Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
even better

Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
Copy link
Contributor

@ogoffart ogoffart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution.
I haven't tought to use cmake this way.

Note that we don't support "incremental" change, so we should make sure the output directory is clean before running the generator.

Other than that i don't know cmake so much so it's hard to review all this code. It seems that it depends on python and on the simple http server, but that's not explicit.
Do the export-compile-command flag gets set on the project's root?

cmake . -DLLVM_CONFIG_EXECUTABLE=/opt/llvm/bin/llvm-config -DCMAKE_BUILD_TYPE=Release
make
mkdir -p build && cd build
cmake .. -DLLVM_CONFIG_EXECUTABLE=llvm-config-3.8 -DCMAKE_INSTALL_PREFIX=$HOME/woboq.install -DCMAKE_BUILD_TYPE=Release
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But the README does not tell to create a build directory.

I personaly use shadow build., but i think in-source builod are simpler to explain. And anybody familiar with cmake knows how to make a shadow build.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure it does, mkdir -p build && cd build? What is a shadow build?

set(outdir ${WOBOQ_OUTDIR})

# this will (?) retrieve where the CMakeLists of this target is located. I
# think this is what the second part of the "-p" switch needs...
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's correct.

# the global build directory. this will pout all generated file into a
# parallel page-tree in the served html.
get_property(blddir TARGET ${trgt} PROPERTY BINARY_DIR)
set(bldprjct ${trgt}/build:${blddir})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But i don't think "build" should be hard-coded here.

Note that because it is a sub directory, it will simply appear in a subdirectory of the project as normal .

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does make sense, instead of hardcoding? Maybe an additional function parameter with a default-argument? Rename to "generated" or "builddirectory"?

…to running

hope this catches everything...

Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
@marvin2k marvin2k force-pushed the cmake_install_and_scripts branch from f504a43 to 3ff9f54 Compare February 14, 2017 10:37
@marvin2k
Copy link
Author

Uh, hadn't realized the incremental aspect. It seems to work, but removing cpp/hpp files might cause problems? Yeah, cleaning the ${srcprjct} and ${bldprojct} prior to running sounds like a good idea

otherwise all this will not work if "data" is somewhere completely else

Signed-off-by: Martin Zenzes <martin.zenzes@dfki.de>
@guruz
Copy link
Contributor

guruz commented Aug 10, 2017

FYI #58 was merged which partly overlaps here

@marvin2k
Copy link
Author

marvin2k commented Aug 10, 2017 via email

@ogoffart ogoffart force-pushed the master branch 2 times, most recently from 1d86342 to 1ba848f Compare January 8, 2018 16:51
@Waqar144
Copy link
Collaborator

Waqar144 commented Nov 7, 2022

too old

@Waqar144 Waqar144 closed this Nov 7, 2022
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

Successfully merging this pull request may close these issues.

5 participants