Hi Craig,

You will need to build your test source as an exe and link against you
main artifact ( .lib, or dll, etc)

here is my suggestion

  parent
        win-x86
        win-x86-test
           link against win-x86 and use antrun to invoke the test
        linux-x86
        linux-x86-test
        ....

In the future, the plugin should provide support to merge the test as part
of the main module

-D

On 10/11/06, Pickles, Craig <[EMAIL PROTECTED]> wrote:

I am fairly new to maven and currently using the native-maven-plugin
(http://mojo.codehaus.org/maven-native/native-maven-plugin/)

to build native source files. I am wondering what the next step should  be
to run CPPUnit tests from Maven?



Looking at the CPPUnit cookbook, the easiest solution would be to package
the compiled source as an exe and run it, however I am open to

suggestion and any help would be appreciated.





The pom files used are as follows:



<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>



<modelVersion>4.0.0</modelVersion>



<groupId>native.test</groupId>

<name>native</name>

<artifactId>native-parent</artifactId>

<packaging>pom</packaging>



<!-- these should be deleted when using a parent pom-->

<version>1.0-SNAPSHOT</version>



<build>

   <pluginManagement>

     <plugins>

       <plugin>



         <!-- configure the Mojo native plugin -->

         <groupId>org.codehaus.mojo</groupId>

         <artifactId>native-maven-plugin</artifactId>

         <version>1.0-alpha-2-SNAPSHOT</version>

         <extensions>true</extensions>



         <!-- Make child POMs inherit this configuration -->

         <inherited>true</inherited>



         <configuration>



           <!-- All compiler flags are determined by the profile -->

           <compilerProvider>${compiler.provider}</compilerProvider>

           <envFactoryName>${env.factory.name}</envFactoryName>

           <compilerStartOptions>

             <compilerStartOption>${compiler.options
}</compilerStartOption>

           </compilerStartOptions>

           <linkerExecutable>${linker.executable}</linkerExecutable>

           <linkerStartOptions>

             <!--main concept sdk should be a dependency-->

             <linkerStartOption>

               ${linker.options}

             </linkerStartOption>

           </linkerStartOptions>



           <!-- Define the sources for the library build -->

           <sources>



             <!-- source files -->

             <source>

               <directory>../src/main/native/</directory>

               <includes>

                  <include>**/*.cpp</include>

               </includes>

             </source>



             <!-- test files-->

             <source>

               <directory>../src/test</directory>

   <includes>

                  <include>**/*Test.cpp</include>

               </includes>

             </source>

           </sources>

         </configuration>

       </plugin>



     </plugins>

   </pluginManagement>

</build>



<profiles>

   <!-- Default profile for Windows: MSVC compiler -->

   <profile>

     <id>win32-msvc</id>

     <activation>

       <os>

         <family>windows</family>

       </os>

     </activation>

     <modules>

       <module>win32-msvc</module>

     </modules>

   </profile>

</profiles>



<!-- Repos for using the mojo native plugin -->

<repositories>

   <repository>

     <id>Maven Snapshots</id>

     <url>http://snapshots.maven.codehaus.org/maven2/</url>

     <snapshots>

       <enabled>true</enabled>

     </snapshots>

     <releases>

       <enabled>true</enabled>

     </releases>

   </repository>

</repositories>

<pluginRepositories>

   <pluginRepository>

     <id>Codehaus Snapshots</id>

     <url>http://snapshots.maven.codehaus.org/maven2</url>

     <snapshots>

       <enabled>true</enabled>

     </snapshots>

     <releases>

       <enabled>true</enabled>

     </releases>

   </pluginRepository>

</pluginRepositories>

</project>





The MSVC module pom:



<project xmlns="http://maven.apache.org/POM/4.0.0";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd";>



<modelVersion>4.0.0</modelVersion>



<parent>

   <groupId>native.test</groupId>

   <artifactId>native-parent</artifactId>

   <version>1.0-SNAPSHOT</version>

   <relativePath>../pom.xml</relativePath>

</parent>



<artifactId>native-child</artifactId>

<name>Native MSVC</name>

<packaging>${packaging.type}</packaging>



<build>

   <finalName>${artifactId}</finalName>

   <plugins>

     <plugin>



       <!-- configure the Mojo native plugin -->

       <groupId>org.codehaus.mojo</groupId>

       <artifactId>native-maven-plugin</artifactId>

       <version>1.0-alpha-2-SNAPSHOT</version>

       <extensions>true</extensions>



       <configuration>

         <!-- All compiler flags are determined by the profile -->

         <compilerProvider>msvc</compilerProvider>


<env.factory.name>org.codehaus.mojo.natives.msvc.MSVC2005x86EnvFactory
</env.
factory.name>

         <compilerStartOptions>

           <compilerStartOption>${compiler.options}</compilerStartOption>

         </compilerStartOptions>

         <linkerExecutable>dll</linkerExecutable>

         <linkerStartOptions>

           <linkerStartOption></linkerStartOption>

         </linkerStartOptions>

       </configuration>



     </plugin>

   </plugins>

</build>



<profiles>

   <profile>

     <id>release</id>

     <activation>

       <property>

         <name>debug</name>

       </property>

     </activation>



     <properties>

       <compiler.options>/O2 /FD /EHsc /MT /nologo /c /TP
/errorReport:prompt</compiler.options>

     </properties>

   </profile>



   <profile>

     <id>debug</id>

       <activation>

         <activeByDefault>true</activeByDefault>

       </activation>



       <properties>

       <compiler.options>/O2 /I /D /FD /EHsc /MD /nologo /c /TP
/errorReport:prompt</compiler.options>

     </properties>



   </profile>

</profiles>



</project>




DISCLAIMER:---------------------------------------------------------------------------
This Email may contain confidential and/or privileged information and is
intended
solely for the addressee(s) named. If you have received this information
in error, or
are advised that you have been posted this Email by accident, please
notify the
sender by return Email, do not redistribute it, delete the Email and keep
no copies.

--------------------------------------------------------------------------------------


Reply via email to