-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Xmake support #2782
Comments
try add_rules("mode.debug", "mode.release")
add_requires("catch2 3.x", {system = false})
target("catch2_test")
set_kind("binary")
add_files("src/*.cpp")
add_packages("catch2")
set_languages("c++17") ruki-2:catch2_test ruki$ xmake
checking for platform ... macosx
checking for architecture ... x86_64
checking for Xcode directory ... /Applications/Xcode.app
checking for SDK version of Xcode for macosx (x86_64) ... 14.0
checking for Minimal target version of Xcode for macosx (x86_64) ... 14.0
note: install or modify (m) these packages (pass -y to skip confirm)?
in xmake-repo:
-> catch2 v3.4.0
please input: y (y/n/m)
=> install catch2 v3.4.0 .. ok
[100%]: build ok, spent 0.071s
ruki-2:catch2_test ruki$ xmake run
Randomness seeded to: 3680645800
===============================================================================
All tests passed (4 assertions in 1 test case) |
@waruqi thank you. After some trial and error I got Catch2 working with these settings:
I think it would be great to add a new |
main component always will be enabled for catch2 3.x, you need not configure it. please remove |
My bad, didn't know about this.
Removed. Yes, it works with just |
if you are using brew on macOS, it should work now. add_requires("catch2") $ xrepo update-repo
$ xmake f -c
$ xmake |
I'm running Arch Linux, and it seems that the |
I have improve this package, you can try it again. add_requires("catch2") xrepo update-repo
xmake f -cvD
xmake -rv $ xmake -rv
checking for gcc ... /usr/sbin/gcc
checking for the c++ compiler (cxx) ... gcc
checking for /usr/sbin/gcc ... ok
checking for flags (-fPIC) ... ok
checking for flags (-fvisibility-inlines-hidden) ... ok
checking for flags (-O3) ... ok
checking for flags (-DNDEBUG) ... ok
[ 25%]: cache compiling.release src/main.cpp
/usr/sbin/gcc -c -m64 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -o build/.objs/test/linux/x86_64/release/src/main.cpp.o src/main.cpp
checking for flags (-MMD -MF) ... ok
checking for flags (-fdiagnostics-color=always) ... ok
checking for g++ ... /usr/sbin/g++
checking for the linker (ld) ... g++
checking for /usr/sbin/g++ ... ok
checking for flags (-fPIC) ... ok
[ 50%]: linking.release test
/usr/sbin/g++ -o build/linux/x86_64/release/test build/.objs/test/linux/x86_64/release/src/main.cpp.o -m64 -s -lCatch2Main -lCatch2
[100%]: build ok, spent 1.506s
|
Yes, it seems to be working even without |
I was able to successfully use Catch2
v2
with Xmake by simply adding#define CATCH_CONFIG_MAIN
and#include <catch2/catch.hpp>
to the tests cpp file. However, I couldn't figure out how to make Catch2v3
work with Xmake yet. I getundefined reference to 'main'
.There's a page about Cmake integration but unfortunately there's no page about Xmake integration. It would be very helpful if such a file existed.
I'm guessing I have to link with
Catch2Main
but addingadd_ldflags("-lCatch2Main")
didn't help so I'm currently out of ideas.The text was updated successfully, but these errors were encountered: