How to create your own executable using the ACDK libraries.
Content of this chapter: |
minacdksample.cpp
#include <acdk.h> #include <acdk/lang/System.h> using namespace acdk::lang; // minimal example, which just says hello class MiniAcdkSample { public: static int acdkmain(RStringArray args) { System::out->println("Hello from miniacdksample"); return 0; } }; int main(int argc, char* argv[], char** envptr) { return acdk::lang::System::main(MiniAcdkSample::acdkmain, argc, argv, envptr); } |
Makefile
for unix/gcc:
# where is your ACDK installed ACDKHOME=/artefaktur/acdk CCOMPILER=g++ -Wall -Wno-unused -g -D_REENTRANT -I . -I $(ACDKHOME)/include # system libraries. These are needed by ACDK at least SYSLIBRARIES=-lpthread -lm -ldl ACDKLIBS=-lacdk_core # all libs together LIBS = $(SYSLIBRARIES) -Wl,-Bdynamic -L$(ACDKHOME)/bin $(ACDKLIBS) # want maybe to debug SYSLDFLAGS=-g OBJECTS = minacdksample.o # builds the executable itself # don't forget to export LD_LIBRARY_PATH=/artefaktur/acdk/bin before execute the binary minacdksample: $(OBJECTS) g++ $(SYSLDFLAGS) $(OBJECTS) -o minacdksample $(LIBS) %.o: %.cpp $(CCOMPILER) -c $< -o $@ clean: rm *.o minacdksample |
build.csf
in our directory:
/* Just execute acdkmake in this directory */ // needed for base definitions #include "amake_config.csf" // Create a standard ACDK console executable minacdksample = new acdk.make.AcdkExeTask("minacdksample"); // add a single source. This also excepts pattern // like "src/acdk/bla/*.cpp" // or "src/acdk/blub/**/*.cpp" minacdksample.addSource("minacdksample.cpp"); // this uses acdk_core library minacdksample.addAcdkLib("acdk_core"); // make a project default = new acdk.make.AcdkProjectTask("default"); default.addSubTask("minacdksample"); |