From: Rafael Gaitán Linares Date: Mon, 7 Dec 2009 00:51:15 +0000 (+0100) Subject: added CMake support and build on mac (but not running :O) X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=118c742fb5e7f57bbad9299fa5f95e62e051f9cd;p=fov120.git added CMake support and build on mac (but not running :O) --- diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..81d9f0d --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,59 @@ +project(fov120) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) + +IF(COMMAND CMAKE_POLICY) + cmake_policy(SET CMP0003 NEW) +ENDIF(COMMAND CMAKE_POLICY) + + +SET(FOV120_MAJOR_VERSION 0) +SET(FOV120_MINOR_VERSION 1) +SET(FOV120_PATCH_VERSION 0) + +SET(VERSION ${FOV120_MAJOR_VERSION}.${FOV120_MINOR_VERSION}.${FOV120_PATCH_VERSION}) + + +SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}") + +INCLUDE(Macros) + +CONFIGURE_DEFAULTS() + +FIND_PACKAGE(OpenGL) +FIND_PACKAGE(SDL) + +link_directories(${LIBRARY_OUTPUT_PATH}) + +############ +set(DEMO_NAME fov120) +FILE(GLOB HEADERS "*.h*") +FILE(GLOB SOURCES "*.c*") + +include_directories( + ${CMAKE_SOURCE_DIR} + ${OPENGL_INCLUDE_DIRS} + ${SDL_INCLUDE_DIR} +) + +SET(LIBRARIES + ${SDL_LIBRARIES} + ${OPENGL_LIBRARIES} +) + +SETUP_DEMO_LAUNCHER(${DEMO_NAME}) +############# + +SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "fov120 4k") +SET(CPACK_PACKAGE_VENDOR "gatitos-necrostudios-tlotb") +#SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.txt") +#SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.txt") +SET(CPACK_PACKAGE_INSTALL_DIRECTORY "CMake ${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}") +SET(CPACK_PACKAGE_EXECUTABLES "fov120" "fov120 4k") + +INCLUDE(CPack) + + +CONFIGURE_END() + + diff --git a/CMakeModules/Macros.cmake b/CMakeModules/Macros.cmake new file mode 100644 index 0000000..dbc026f --- /dev/null +++ b/CMakeModules/Macros.cmake @@ -0,0 +1,497 @@ +MACRO(CONFIGURE_DEFAULTS) + # This is for an advanced option to give aggressive warnings + # under different compilers. If yours is not implemented, this option + # will not be made available. + IF(CMAKE_COMPILER_IS_GNUCXX) + # To be complete, we might also do GNUCC flags, + # but everything here is C++ code. + # -Wshadow and -Woverloaded-virtual are also interesting flags, but OSG + # returns too many hits. + # FYI, if we do implement GNUCC, then -Wmissing-prototypes in another + # interesting C-specific flag. + # Also, there is a bug in gcc 4.0. Under C++, -pedantic will create + # errors instead of warnings for certain issues, including superfluous + # semicolons and commas, and the use of long long. -fpermissive seems + # to be the workaround. + SET(AGGRESSIVE_WARNING_FLAGS "-Wall -Wparentheses -Wformat=2 -Wno-long-long -Wno-import -pedantic -Wreturn-type -Wmissing-braces -Wunknown-pragmas -Wunused -fpermissive") + ELSE(CMAKE_COMPILER_IS_GNUCXX) + IF(MSVC) + # FIXME: What are good aggressive warning flags for Visual Studio? + # And do we need to further subcase this for different versions of VS? + # CMake variables: MSVC60, MSVC70, MSVC71, MSVC80, CMAKE_COMPILER_2005 + SET(AGGRESSIVE_WARNING_FLAGS "/Wall /W4") + + + ELSE(MSVC) + # CMake lacks an elseif, so other non-gcc, non-VS compilers need + # to be listed below. If unhandled, OSG_AGGRESSIVE_WARNING_FLAGS should + # remain unset. + ENDIF(MSVC) + ENDIF(CMAKE_COMPILER_IS_GNUCXX) + + # This part is for the CMake menu option to toggle the warnings on/off. + # This will only be made available if we set values for OSG_AGGRESSIVE_WARNING_FLAGS. + IF(AGGRESSIVE_WARNING_FLAGS) + OPTION(USE_AGGRESSIVE_WARNINGS "Enable to activate aggressive warnings" OFF) + MARK_AS_ADVANCED(USE_AGGRESSIVE_WARNINGS) + + IF(USE_AGGRESSIVE_WARNINGS) + IF(NOT "${OLD_CMAKE_CXX_FLAGS_WAS_SET}") + SET(OLD_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}" CACHE INTERNAL "Old CXX flags") + SET(OLD_CMAKE_CXX_FLAGS_WAS_SET 1 CACHE INTERNAL "Old CXX flags was set") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${AGGRESSIVE_WARNING_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE) + ENDIF(NOT "${OLD_CMAKE_CXX_FLAGS_WAS_SET}") + ELSE(USE_AGGRESSIVE_WARNINGS) + # FIXME: This will lose any changes made after OLD_CMAKE_CXX_FLAGS was + # set. The better way would be to parse the string and remove each + # option explicitly. + IF("${OLD_CMAKE_CXX_FLAGS_WAS_SET}") + SET(CMAKE_CXX_FLAGS "${OLD_CMAKE_CXX_FLAGS}" CACHE STRING "Flags used by the compiler during all build types." FORCE) + SET(OLD_CMAKE_CXX_FLAGS_WAS_SET 0 CACHE INTERNAL "Old CXX flags was set") + ENDIF("${OLD_CMAKE_CXX_FLAGS_WAS_SET}") + ENDIF(USE_AGGRESSIVE_WARNINGS) + ENDIF(AGGRESSIVE_WARNING_FLAGS) + + # Set defaults for Universal Binaries. We want 32-bit Intel/PPC on 10.4 + # and 32/64-bit Intel/PPC on >= 10.5. Anything <= 10.3 doesn't support. + IF(APPLE) + SET(CMAKE_INSTALL_NAME_DIR "@executable_path/../Frameworks") + + # These are just defaults/recommendations, but how we want to build + # out of the box. But the user needs to be able to change these options. + # So we must only set the values the first time CMake is run, or we + # will overwrite any changes the user sets. + # FORCE is used because the options are not reflected in the UI otherwise. + # Seems like a good place to add version specific compiler flags too. + IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE) + # This is really fragile, but CMake doesn't provide the OS system + # version information we need. (Darwin versions can be changed + # independently of OS X versions.) + # It does look like CMake handles the CMAKE_OSX_SYSROOT automatically. + IF(EXISTS /Developer/SDKs/MacOSX10.5.sdk) + #SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;ppc64;x86_64" CACHE STRING "Build architectures for OSX") + SET(CMAKE_OSX_ARCHITECTURES "i386" CACHE STRING "Build architectures for OSX") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.5 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) + ELSE(EXISTS /Developer/SDKs/MacOSX10.5.sdk) + IF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) + SET(CMAKE_OSX_ARCHITECTURES "ppc;i386" CACHE STRING "Build architectures for OSX" FORCE) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.4 -ftree-vectorize -fvisibility-inlines-hidden" CACHE STRING "Flags used by the compiler during all build types." FORCE) + ELSE(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) + # No Universal Binary support + # Should break down further to set the -mmacosx-version-min, + # but the SDK detection is too unreliable here. + ENDIF(EXISTS /Developer/SDKs/MacOSX10.4u.sdk) + ENDIF(EXISTS /Developer/SDKs/MacOSX10.5.sdk) + ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE) + ENDIF(APPLE) + + SET(OUTPUT_BINDIR ${CMAKE_BINARY_DIR}/bin) + MAKE_DIRECTORY(${OUTPUT_BINDIR}) + + SET(OUTPUT_LIBDIR ${CMAKE_BINARY_DIR}/lib) + MAKE_DIRECTORY(${OUTPUT_LIBDIR}) + IF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4) + # If CMake >= 2.6.0 + SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR}) + SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_BINDIR}) + IF(WIN32) + SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_BINDIR}) + ELSE(WIN32) + SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_LIBDIR}) + ENDIF(WIN32) + ELSE(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4) + SET(EXECUTABLE_OUTPUT_PATH ${OUTPUT_BINDIR}) + SET(LIBRARY_OUTPUT_PATH ${OUTPUT_LIBDIR}) + ENDIF(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION GREATER 4) + +ENDMACRO(CONFIGURE_DEFAULTS) + +MACRO(CONFIGURE_END) + # This needs to be run very last so other parts of the scripts can take + # advantage of this. + IF(NOT CONFIG_HAS_BEEN_RUN_BEFORE) + SET(CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before") + ENDIF(NOT CONFIG_HAS_BEEN_RUN_BEFORE) +ENDMACRO(CONFIGURE_END) + +MACRO(SETUP_CORELIB CORELIB_NAME) + + ADD_LIBRARY(${CORELIB_NAME} + SHARED + ${HEADERS} + ${SOURCES} + ) + + TARGET_LINK_LIBRARIES(${CORELIB_NAME} ${LIBRARIES}) + + IF(LIBRARIES_OPTIMIZED) + FOREACH(LIBOPT ${LIBRARIES_OPTIMIZED}) + TARGET_LINK_LIBRARIES(${CORELIB_NAME} optimized ${LIBOPT}) + ENDFOREACH(LIBOPT) + ENDIF(LIBRARIES_OPTIMIZED) + + IF(LIBRARIES_DEBUG) + FOREACH(LIBDEBUG ${LIBRARIES_DEBUG}) + TARGET_LINK_LIBRARIES(${CORELIB_NAME} debug ${LIBDEBUG}) + ENDFOREACH(LIBDEBUG) + ENDIF(LIBRARIES_DEBUG) + + SET_TARGET_PROPERTIES(${CORELIB_NAME} + PROPERTIES + PROJECT_LABEL "Core ${CORELIB_NAME}" + ) + + IF(WIN32) + INSTALL(TARGETS ${CORELIB_NAME} + RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + ) + ELSE(WIN32) + INSTALL(TARGETS ${CORELIB_NAME} + LIBRARY DESTINATION lib + ) + ENDIF(WIN32) + + IF(UNIX AND NOT APPLE) + SET_TARGET_PROPERTIES ( ${LIB_NAME} PROPERTIES LINK_FLAGS "-Wl,-E") + ENDIF(UNIX AND NOT APPLE) + +ENDMACRO(SETUP_CORELIB) + + +MACRO(SETUP_DEMO_LAUNCHER DEMO_NAME) + + IF(IS_APPLICATION) + IF(APPLE) + # SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${CRSFX_MAJOR_VERSION}.${CRSFX_MINOR_VERSION}.${CRSFXCRSFX_PATCH_VERSION}") + # Short Version is the "marketing version". It is the version + # the user sees in an information panel. + SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${CRSFX_MAJOR_VERSION}.${CRSFX_MINOR_VERSION}.${CRSFX_PATCH_VERSION}") + # Bundle version is the version the OS looks at. + SET(MACOSX_BUNDLE_BUNDLE_VERSION "${CRSFX_MAJOR_VERSION}.${CRSFX_MINOR_VERSION}.${CRSFX_PATCH_VERSION}") + SET(MACOSX_BUNDLE_GUI_IDENTIFIER "Mirage Technologies ${DEMO_NAME}" ) + SET(MACOSX_BUNDLE_BUNDLE_NAME "${DEMO_NAME}" ) + # SET(MACOSX_BUNDLE_ICON_FILE "myicon.icns") + # SET(MACOSX_BUNDLE_COPYRIGHT "") + # SET(MACOSX_BUNDLE_INFO_STRING "Info string, localized?") + SET(PLATFORM_SPECIFIC_CONTROL MACOSX_BUNDLE) + ENDIF(APPLE) + + IF(WIN32) + IF (REQUIRE_WINMAIN_FLAG) + SET(PLATFORM_SPECIFIC_CONTROL WIN32) + ENDIF(REQUIRE_WINMAIN_FLAG) + ENDIF(WIN32) + + ADD_EXECUTABLE(${DEMO_NAME} ${PLATFORM_SPECIFIC_CONTROL} ${SOURCES} ${HEADERS}) + IF(APPLE) + SETUP_BUNDLE_DEPENDENCIES(${DEMO_NAME}) + ENDIF(APPLE) + ELSE(IS_APPLICATION) + ADD_EXECUTABLE(${DEMO_NAME} ${SOURCES} ${HEADERS}) + ENDIF(IS_APPLICATION) + + TARGET_LINK_LIBRARIES(${DEMO_NAME} ${LIBRARIES}) + IF(LIBRARIES_OPTIMIZED) + FOREACH(LIBOPT ${LIBRARIES_OPTIMIZED}) + TARGET_LINK_LIBRARIES(${DEMO_NAME} optimized ${LIBOPT}) + ENDFOREACH(LIBOPT) + ENDIF(LIBRARIES_OPTIMIZED) + + IF(LIBRARIES_DEBUG) + FOREACH(LIBDEBUG ${LIBRARIES_DEBUG}) + TARGET_LINK_LIBRARIES(${DEMO_NAME} debug ${LIBDEBUG}) + ENDFOREACH(LIBDEBUG) + ENDIF(LIBRARIES_DEBUG) + + SET_TARGET_PROPERTIES(${DEMO_NAME} PROPERTIES PROJECT_LABEL "Demo ${DEMO_NAME}") + + IF(APPLE) + INSTALL(TARGETS ${DEMO_NAME} + RUNTIME DESTINATION bin + BUNDLE DESTINATION bin + ) + ELSE(APPLE) + INSTALL(TARGETS ${DEMO_NAME} + RUNTIME DESTINATION bin + COMPONENT DESTINATION bin + ) + ENDIF(APPLE) + + #SETUP_DEMO_RESOURCES(${DEMO_NAME}) + +ENDMACRO(SETUP_DEMO_LAUNCHER) + +MACRO(SETUP_BUNDLE_DEPENDENCIES TARGET_NAME) + IF(DEPENDENCY_FILES) + IF(APPLE AND IS_APPLICATION) + INSTALL(PROGRAMS ${DEPENDENCY_FILES} + DESTINATION bin/${TARGET_NAME}.app/Contents/Frameworks + ) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(DEPENDENCY_FILES) + + IF(LIBRARIES) + IF(APPLE AND IS_APPLICATION) + FOREACH(TARGET ${LIBRARIES}) + GET_TARGET_PROPERTY(TARGET_LOC ${TARGET} LOCATION) + INSTALL(PROGRAMS ${TARGET_LOC} + DESTINATION bin/${TARGET_NAME}.app/Contents/Frameworks) + ENDFOREACH(TARGET) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(LIBRARIES) + + IF(DEPENDENCY_DIRS) + IF(APPLE AND IS_APPLICATION) + INSTALL(DIRECTORY ${DEPENDENCY_DIRS} + DESTINATION bin/${TARGET_NAME}.app/Contents/Frameworks + PATTERN ".svn" EXCLUDE) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(DEPENDENCY_DIRS) + + IF(RESOURCE_FILES) + IF(APPLE AND IS_APPLICATION) + INSTALL(FILES ${RESOURCE_FILES} + DESTINATION bin/${DEMO_NAME}.app/Contents/Resources + ) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(RESOURCE_FILES) + + IF(RESOURCE_DIRS) + IF(APPLE AND IS_APPLICATION) + INSTALL(DIRECTORY ${RESOURCE_DIRS} + DESTINATION bin/${DEMO_NAME}.app/Contents/Resources + PATTERN ".svn" EXCLUDE + ) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(RESOURCE_DIRS) + +ENDMACRO(SETUP_BUNDLE_DEPENDENCIES TARGET_NAME) + +MACRO(SETUP_DEPENDENCIES) + IF(DEPENDENCY_FILES) + IF(WIN32) + INSTALL(PROGRAMS ${DEPENDENCY_FILES} + DESTINATION bin + ) + ELSE(WIN32) + INSTALL(PROGRAMS ${DEPENDENCY_FILES} + DESTINATION lib + ) + ENDIF(WIN32) + ENDIF(DEPENDENCY_FILES) + + IF(DEPENDENCY_DIRS) + IF(WIN32) + INSTALL(DIRECTORY ${DEPENDENCY_DIRS} + DESTINATION bin + PATTERN ".svn" EXCLUDE + PATTERN ".cache" EXCLUDE) + ELSE(WIN32) + INSTALL(DIRECTORY ${DEPENDENCY_DIRS} + DESTINATION lib + PATTERN ".svn" EXCLUDE + PATTERN ".cache" EXCLUDE) + ENDIF(WIN32) + ENDIF(DEPENDENCY_DIRS) + + IF(RESOURCE_FILES) + INSTALL(FILES ${RESOURCE_FILES} + DESTINATION share/${CMAKE_PROJECT_NAME}/resources + ) + ENDIF(RESOURCE_FILES) + + IF(RESOURCE_DIRS) + INSTALL(DIRECTORY ${RESOURCE_DIRS} + DESTINATION share/${CMAKE_PROJECT_NAME}/resources + PATTERN ".svn" EXCLUDE + ) + ENDIF(RESOURCE_DIRS) + + IF(SCRIPT_FILES) + INSTALL(PROGRAMS ${SCRIPT_FILES} + DESTINATION . + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + ENDIF(SCRIPT_FILES) +ENDMACRO(SETUP_DEPENDENCIES) + +MACRO(SETUP_DEMO_RESOURCES DEMO_NAME) + IF(RESOURCE_FILES) + IF(APPLE AND IS_APPLICATION) + INSTALL(FILES ${RESOURCE_FILES} + DESTINATION bin/${DEMO_NAME}.app/Contents/Resources/${DEMO_NAME} + ) + ELSE(APPLE AND IS_APPLICATION) + INSTALL(FILES ${RESOURCE_FILES} + DESTINATION share/${CMAKE_PROJECT_NAME}/${DEMO_NAME} + ) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(RESOURCE_FILES) + + IF(RESOURCE_DIRS) + IF(APPLE AND IS_APPLICATION) + INSTALL(DIRECTORY ${RESOURCE_DIRS} + DESTINATION bin/${DEMO_NAME}.app/Contents/Resources/${DEMO_NAME} + PATTERN ".svn" EXCLUDE + ) + ELSE(APPLE AND IS_APPLICATION) + INSTALL(DIRECTORY ${RESOURCE_DIRS} + DESTINATION share/${CMAKE_PROJECT_NAME}/${DEMO_NAME} + PATTERN ".svn" EXCLUDE + ) + ENDIF(APPLE AND IS_APPLICATION) + ENDIF(RESOURCE_DIRS) + + IF(SCRIPT_FILES) + INSTALL(PROGRAMS ${SCRIPT_FILES} + DESTINATION . + PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) + ENDIF(SCRIPT_FILES) +ENDMACRO(SETUP_DEMO_RESOURCES) + +MACRO(FIND_OSGPLUGIN_LIBRARY MYOSGPLUGIN MYOSGPLUGINNAME) + + FIND_LIBRARY(${MYOSGPLUGIN} + NAMES osgdb_${MYOSGPLUGINNAME} + PATHS + $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} + $ENV{OSGDIR}/lib + $ENV{OSGDIR} + $ENV{OSG_ROOT}/lib + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib + /usr/freeware/lib64 + $ENV{OSG_DIR}/lib/osgPlugins-${OSGVERSION} + $ENV{OSG_DIR}/bin/osgPlugins-${OSGVERSION} + ) + + FIND_LIBRARY(${MYOSGPLUGIN}_DEBUG + NAMES osgdb_${MYOSGPLUGINNAME}d + PATHS + $ENV{OSG_DIR}/lib + $ENV{OSG_DIR} + $ENV{OSGDIR}/lib + $ENV{OSGDIR} + $ENV{OSG_ROOT}/lib + ~/Library/Frameworks + /Library/Frameworks + /usr/local/lib + /usr/lib + /sw/lib + /opt/local/lib + /opt/csw/lib + /opt/lib + [HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session\ Manager\\Environment;OSG_ROOT]/lib + /usr/freeware/lib64 + $ENV{OSG_DIR}/lib/osgPlugins-${OSGVERSION} + $ENV{OSG_DIR}/bin/osgPlugins-${OSGVERSION} + ) + + IF(NOT ${MYOSGPLUGIN}_DEBUG) + SET(${MYOSGPLUGIN}_DEBUG ${${MYOSGPLUGIN}} CACHE FILEPATH "Forced version" FORCE) + ENDIF(NOT ${MYOSGPLUGIN}_DEBUG) + +ENDMACRO(FIND_OSGPLUGIN_LIBRARY MYOSGPLUGIN MYOSGPLUGINNAME) + +MACRO(BUILD_JAVA_SWIG LIB_NAME) + SWIG_ADD_MODULE(${LIB_NAME} java + ${SOURCES} + ) + SWIG_LINK_LIBRARIES(${LIB_NAME} + ${LIBRARIES} + ) + + IF(UNIX) + SET_TARGET_PROPERTIES(${LIB_NAME} + PROPERTIES + PREFIX lib) + IF(APPLE) + SET_TARGET_PROPERTIES(${LIB_NAME} + PROPERTIES + SUFFIX .jnilib) + ENDIF(APPLE) + ENDIF(UNIX) + IF(WIN32) + INSTALL(TARGETS ${LIB_NAME} + RUNTIME DESTINATION share/crsFX/java + LIBRARY DESTINATION share/crsFX/java + ) + ELSE(WIN32) + INSTALL(TARGETS ${LIB_NAME} + LIBRARY DESTINATION share/crsFX/java + ) + ENDIF(WIN32) + + INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/wrapper/java/${BIND_PROJECT}/ + DESTINATION share/crsFX/java/src/main/java/${INSTALL_DESTINATION} + FILES_MATCHING PATTERN "*.java" + PATTERN "CMakeFiles" EXCLUDE + ) + + INSTALL(FILES ${CMAKE_SOURCE_DIR}/scripts/pom.xml + DESTINATION share/crsFX/java + ) +ENDMACRO(BUILD_JAVA_SWIG) + +MACRO(BUILD_PYTHON_SWIG LIB_NAME) + SWIG_ADD_MODULE(${LIB_NAME} python + ${SOURCES} + ) + SWIG_LINK_LIBRARIES(${LIB_NAME} + ${LIBRARIES} + ) + IF(WIN32) + INSTALL(TARGETS _${LIB_NAME} + RUNTIME DESTINATION share/crsFX/python + LIBRARY DESTINATION share/crsFX/python + ) + ELSE(WIN32) + INSTALL(TARGETS _${LIB_NAME} + LIBRARY DESTINATION share/crsFX/python + ) + ENDIF(WIN32) + + INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/wrapper/python/ + DESTINATION share/crsFX/python + FILES_MATCHING PATTERN "*.py" + PATTERN "CMakeFiles" EXCLUDE + ) +ENDMACRO(BUILD_PYTHON_SWIG) + +MACRO(BUILD_LUA_SWIG LIB_NAME) + SWIG_ADD_MODULE(${LIB_NAME} lua + ${SOURCES} + ) + + SWIG_LINK_LIBRARIES(${LIB_NAME} + ${LIBRARIES} + ) + IF(WIN32) + INSTALL(TARGETS ${LIB_NAME} + RUNTIME DESTINATION share/crsFX/lua + LIBRARY DESTINATION share/crsFX/lua + ) + ELSE(WIN32) + INSTALL(TARGETS ${LIB_NAME} + LIBRARY DESTINATION share/crsFX/lua + ) + ENDIF(WIN32) + + INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/src/wrapper/lua/ + DESTINATION share/crsFX/lua + FILES_MATCHING PATTERN "*.lua" + PATTERN "CMakeFiles" EXCLUDE + ) +ENDMACRO(BUILD_LUA_SWIG) + + diff --git a/dl_init.h b/dl_init.h index d21895a..7bd4a46 100644 --- a/dl_init.h +++ b/dl_init.h @@ -2,7 +2,11 @@ #define DL_INIT_H #include "SDL.h" -#include +#if __APPLE__ + #include +#else + #include +#endif #include typedef struct diff --git a/main.c b/main.c index d168967..12cafac 100644 --- a/main.c +++ b/main.c @@ -1,8 +1,14 @@ #include #define GL_GLEXT_PROTOTYPES -#include -#include -#include +#if __APPLE__ + #include + #include + #include +#else + #include + #include + #include +#endif #include #include @@ -75,9 +81,11 @@ void initModels() float n=.3; int i=0; int j = 0; - for(int iu=0;iu<50;iu++) + int iu = 0; + for(iu=0;iu<50;iu++) { - for(int iv= 0; iv < 100; iv++)//-180;v<180;v+=360/100.0) + int iv=0; + for(iv= 0; iv < 100; iv++)//-180;v<180;v+=360/100.0) { float u = -90 + 180 * (float)iu / 49; float v = -180 + 360 * (float)iv / 99; @@ -170,7 +178,8 @@ void drawScene() gluLookAt( pos[0], pos[1], pos[2], tar[0], tar[1], tar[2], 0.0f, 1.0f, 0.0f ); glShadeModel(GL_SMOOTH); glBegin(GL_TRIANGLES); - for(int i=0;i<99*99/*VERTEX_SIZE*/;i++) + int i=0; + for(i=0;i<99*99/*VERTEX_SIZE*/;i++) { //glVertex3f(vertices[i].x,vertices[i].y,vertices[i].z); //if(i%2) glColor3f(1, 1, 1);