Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Don't need this variable now.
[simgrid.git] / buildtools / Cmake / CompleteInFiles.cmake
index 4d22b77..a43c745 100644 (file)
@@ -87,14 +87,12 @@ if(enable_lua)
                SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${LUA_INCLUDE_DIR} ")
                foreach(path_lua ${LUA_LIBRARIES})
                string(REGEX REPLACE "liblua.*" "" path_lua_to_use ${path_lua})
-               string(REGEX MATCH "-L${path_lua_to_use}" operation "${CMAKE_EXE_LINKER_FLAGS}")
-               string(REGEX MATCH ".*lua.*" operation2 "${path_lua}")
-               if(NOT operation AND operation2)
+               string(REGEX MATCH ".*lua.*" operation "${path_lua}")
+               if(NOT operation)
                        string(REGEX REPLACE "${path_lua_to_use}" "" liblua ${path_lua})
                        string(REPLACE "lib" "" liblua "${liblua}")
                        string(REGEX REPLACE "[.][^.]*$" "" liblua "${liblua}")                 
-                       SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}-L${path_lua_to_use} ")
-               endif(NOT operation AND operation2)
+               endif(NOT operation)
                endforeach(path_lua ${LUA_LIBRARIES})
        else(LUA51_FOUND)
                message("Lua binding need version 5.1 and cmake version 2.8")
@@ -112,7 +110,6 @@ if(enable_ruby)
                                set(RUBY_LIBRARY_NAME ruby)
                        endif(NOT RUBY_LIBRARY_NAME)
                        string(REGEX REPLACE "/libruby.*$" "" RUBY_LIBRARY ${RUBY_LIBRARY})
-                       SET(CMAKE_EXE_LINKER_FLAGS "-L${RUBY_LIBRARY} ")
                        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${RUBY_CONFIG_INCLUDE_DIR} ") #path to config.h
                        string(COMPARE EQUAL "${RUBY_INCLUDE_DIR}" "${RUBY_CONFIG_INCLUDE_DIR}" operation)
                        if(NOT operation)
@@ -166,11 +163,12 @@ else(NOT enable_gtnets OR enable_supernovae)
                SET(HAVE_GTNETS 0)
        else(COMPILE_GTNETS_VAR)
                SET(HAVE_GTNETS 1)
-               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${GTNETS_CPPFLAGS} ")
-               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${GTNETS_CPPFLAGS} ")
-               string(REGEX MATCH "${GTNETS_LDFLAGS}" operation "${CMAKE_EXE_LINKER_FLAGS}")
+               SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ")
+               SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}${GTNETS_CPPFLAGS} ${GTNETS_LDFLAGS} ")
+               string(REGEX MATCH "${gtnets_path}/lib" operation "$ENV{LD_LIBRARY_PATH}")
                if(NOT operation)
-               SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}${GTNETS_LDFLAGS} ")
+                       message("Don't forget to set LD_LIBRARY_PATH")
+                       message("export LD_LIBRARY_PATH=$ENV{LD_LIBRARY_PATH}:${gtnets_path}/lib")
                endif(NOT operation)
        endif(COMPILE_GTNETS_VAR)
 endif(NOT enable_gtnets OR enable_supernovae)
@@ -183,12 +181,7 @@ mark_as_advanced(HAVE_CGRAPH_H)
 if(HAVE_CGRAPH_LIB AND HAVE_CGRAPH_H)
        string(REGEX REPLACE "/libcgraph.*" "" lib_cgraph ${HAVE_CGRAPH_LIB})
        string(REPLACE "/cgraph.h" "" file_cgraph_h ${HAVE_CGRAPH_H})
-       
-       string(REGEX MATCH "-L${lib_cgraph} " operation "${CMAKE_EXE_LINKER_FLAGS}")
-       if(NOT operation)
-               SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}-L${lib_cgraph} ")
-       endif(NOT operation)
-       
+               
        string(REGEX MATCH "-I${file_cgraph_h} " operation "${CMAKE_C_FLAGS}")
        if(NOT operation)
                SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}-I${file_cgraph_h} ")
@@ -246,13 +239,23 @@ if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
        set(mcsc_flags "-D_XOPEN_SOURCE")
 endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
 
+if(WIN32)
+    if(__VISUALC__)
+       set(mcsc_flags "/D_XBT_WIN32 /I${PROJECT_DIRECTORY}/include/xbt /I${PROJECT_DIRECTORY}/src/xbt")
+       endif(__VISUALC__)
+       if(__GNUC__)
+               set(mcsc_flags "-D_XBT_WIN32 -I${PROJECT_DIRECTORY}/include/xbt -I${PROJECT_DIRECTORY}/src/xbt")
+       endif(__GNUC__)
+endif(WIN32)
+
 try_run(RUN_mcsc_VAR COMPILE_mcsc_VAR
        ${PROJECT_DIRECTORY}
        ${PROJECT_DIRECTORY}/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c
        COMPILE_DEFINITIONS "${mcsc_flags}"
+       OUTPUT_VARIABLE var_compil
        )
-       
-if(EXISTS "${simgrid_BINARY_DIR}/conftestval")
+
+if(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
        file(READ "${simgrid_BINARY_DIR}/conftestval" mcsc)
        STRING(REPLACE "\n" "" mcsc "${mcsc}")
        if(mcsc)
@@ -260,9 +263,9 @@ if(EXISTS "${simgrid_BINARY_DIR}/conftestval")
        elseif(mcsc)
                set(mcsc "no")
        endif(mcsc)
-else(EXISTS "${simgrid_BINARY_DIR}/conftestval")
+else(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
        set(mcsc "no")
-endif(EXISTS "${simgrid_BINARY_DIR}/conftestval")
+endif(EXISTS "${simgrid_BINARY_DIR}/conftestval" AND COMPILE_mcsc_VAR)
 
 if(mcsc MATCHES "no" AND pthread)
        if(HAVE_WINDOWS_H)
@@ -460,9 +463,16 @@ if(HAVE_MAKECONTEXT OR WIN32)
                set(makecontext_CPPFLAGS_2 "-DOSX")
        endif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
        
-       if(WIN32)
-           set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 ${INCLUDES}")
-       endif(WIN32)
+    if(WIN32)
+        if(__VISUALC__)
+            set(makecontext_CPPFLAGS "/DTEST_makecontext")
+           set(makecontext_CPPFLAGS_2 "/D_XBT_WIN32 /I${PROJECT_DIRECTORY}/include/xbt /I${PROJECT_DIRECTORY}/src/xbt")
+       endif(__VISUALC__)
+       if(__GNUC__)
+           set(makecontext_CPPFLAGS "-DTEST_makecontext")
+               set(makecontext_CPPFLAGS_2 "-D_XBT_WIN32 -I${PROJECT_DIRECTORY}/include/xbt -I${PROJECT_DIRECTORY}/src/xbt")
+       endif(__GNUC__)
+    endif(WIN32)
 
        try_run(RUN_makecontext_VAR COMPILE_makecontext_VAR
                ${PROJECT_DIRECTORY}
@@ -477,7 +487,6 @@ if(HAVE_MAKECONTEXT OR WIN32)
        string(REPLACE "," "" makecontext_size "${MAKECONTEXT_SIZE}")   
        set(pth_skaddr_makecontext "#define pth_skaddr_makecontext(skaddr,sksize) (${makecontext_addr})")
        set(pth_sksize_makecontext "#define pth_sksize_makecontext(skaddr,sksize) (${makecontext_size})")
-
 endif(HAVE_MAKECONTEXT OR WIN32)
 
 #--------------------------------------------------------------------------------------------------
@@ -627,8 +636,10 @@ try_run(RUN_RESULT_VAR COMPILE_RESULT_VAR
 
 if(NOT COMPILE_RESULT_VAR)
 SET(need_getline "#define SIMGRID_NEED_GETLINE 1")
+SET(SIMGRID_NEED_GETLINE 1)
 else(NOT COMPILE_RESULT_VAR)
 SET(need_getline "")
+SET(SIMGRID_NEED_GETLINE 0)
 endif(NOT COMPILE_RESULT_VAR)
 
 ### check for a working snprintf
@@ -660,15 +671,19 @@ endif(HAVE_SNPRINTF AND HAVE_VSNPRINTF)
 
 ### check for asprintf function familly
 if(HAVE_ASPRINTF)
-       SET(need_asprintf "")
+       SET(simgrid_need_asprintf "")
+       SET(NEED_ASPRINTF 0)
 else(HAVE_ASPRINTF)
-       SET(need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
+       SET(simgrid_need_asprintf "#define SIMGRID_NEED_ASPRINTF 1")
+       SET(NEED_ASPRINTF 1)
 endif(HAVE_ASPRINTF)
 
 if(HAVE_VASPRINTF)
-       SET(need_vasprintf "")
+       SET(simgrid_need_vasprintf "")
+       SET(NEED_VASPRINTF 0)
 else(HAVE_VASPRINTF)
-       SET(need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
+       SET(simgrid_need_vasprintf "#define SIMGRID_NEED_VASPRINTF 1")
+       SET(NEED_VASPRINTF 1)
 endif(HAVE_VASPRINTF)
 
 ### check for addr2line
@@ -700,6 +715,8 @@ set(CMAKE_LINKARGS "${CMAKE_CURRENT_BINARY_DIR}/lib")
 
 configure_file(${PROJECT_DIRECTORY}/src/smpi/smpicc.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc @ONLY)
 configure_file(${PROJECT_DIRECTORY}/src/smpi/smpirun.in ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun @ONLY)
+configure_file(${PROJECT_DIRECTORY}/examples/smpi/hostfile ${CMAKE_CURRENT_BINARY_DIR}/examples/smpi/hostfile COPYONLY)
+configure_file(${PROJECT_DIRECTORY}/examples/msg/small_platform.xml ${CMAKE_CURRENT_BINARY_DIR}/examples/msg/small_platform.xml COPYONLY)
 
 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpicc" OUTPUT_VARIABLE OKITOKI)
 exec_program("chmod a=rwx ${CMAKE_CURRENT_BINARY_DIR}/bin/smpirun" OUTPUT_VARIABLE OKITOKI)