Closed kronocharia closed 9 years ago
Try including the 64 bit opencl library (opencl.lib) as an additional dependency in xcode or a separate make file
How do I do that? / what goes into the makefile to do that.
Xcode sorts itself out, its great it knows how to build and run it, but I dont know how to tell it to run multiple mains, how are you doing that in VS?
I added it as an additional dependency to the linker in VS. This was found in "Project Properties"
As for the multiple mains, I just excluded all of the files I didn't want building. I think I'm going to have to create separate projects within my VS solution for each of the mains if I want VS to sort itself out and build.
As for the makefile, I'm not sure how you would write it for cmake, but for nmake, I was able to build it by doing the following:
LDLIBS = OpenCL.lib
INC_DIR = .\opencl_sdk\include
CPPFLAGS = $(CPPFLAGS) /I$(INC_DIR)
bin\test_opencl.exe : src/test_opencl.cpp
-mkdir bin
$(CPP) $(CPPFLAGS) $** /Fe$@ /link $(LDFLAGS) $(LDLIBS)
But in order to do the stuff, run by piping each executable into each other, there's no way of doing that in the debugger is there =/
Hmm. I have't thought that far yet.
Working from me from the command line for the following:
# Makefile for posix and gcc
# Note on old compilers *cough* DoC *cough* you might need -std=c++0x instead
CPPFLAGS = -I include -Wall -std=c++11 -framework OpenCL
LDFLAGS =
# -lm to bring in unix math library, -ltbb to bring in tbb
LDLIBS = -lm
# Turn on optimisations
CPPFLAGS += -O2
bin/test_opencl : src/test_opencl.cpp
-mkdir -p bin
$(CXX) $(CPPFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
all : bin/test_opencl
is this what you mean?
@darioml that works for test_opencl.cpp
but not for the other files if rules are added to make those. I get the following error with step_world.cpp
for example:
c++ -I include -Wall -std=c++11 -framework OpenCL -O2 src/step_world.cpp -o bin/step_world -lm Undefined symbols for architecture x86_64: "hpce::LoadWorld(std::__1::basic_istream<char, std::__1::char_traits<char> >&)", referenced from: _main in step_world-b80129.o "hpce::SaveWorld(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, hpce::world_t const&, bool)", referenced from: _main in step_world-b80129.o "hpce::StepWorld(hpce::world_t&, float, unsigned int)", referenced from: _main in step_world-b80129.o ld: symbol(s) not found for architecture x86_64
Update:
Modifying the rules for step_world.cpp
etc from this:
bin/step_world : src/step_world.cpp
to:
bin/step_world : src/step_world.cpp src/heat.cpp
results in successful compilation.
Has anyone had any success building the src/test_opencl.cpp thing in the command line?
If I dumped the code inside an Xcode project and tweak the header to just "cl.hpp" it builds and runs, but I can't make it do it from the command line without getting a bunch of Undefined symbols for architecture x86_64: errors.