Jump to content

Working On Upgrade To Premake4


Yves
 Share

Recommended Posts

Hi Yves, good job on the scripts!

The game was failing at run-time due to the the DELAYLOAD linker directive - it didn't like it. It caused OpenGL to fail on three different machines and on win7 and xp all with current drivers. I commented this out and it works now.

I also commented out the extra_checks flag as it was throwing exceptions about casting down to smaller types all over the place.

I attached a zip file in the same format as your previous one, so it can be installed in the same way, just copy it right over the existing files.

There is no testgen project in the solution right now, but I see the code for it in the premake script. I will take a look at why it is not creating the project for it.

premake4-v2.zip

Link to comment
Share on other sites

  • Replies 108
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Thank you for the feedback and the changes!

There's no testgen project anymore. I'm invoking cxxtestgen from prebuild-commands and/or customized code for creating the projectfiles (look in premake4/src/actions).

EDIT: I've attached the "vanilla"-premake I was using (had to add .txt to be able to upload).

You can check what I've changed by making filediffs if you would like to know the details (e.g. diff -uNB --strip-trailing-cr file_original file_new).

EDIT2: Also look at the know-issues, especially number one in this post.

premake-stable-fc0374a03b17.tar.bz2.txt

Edited by Yves
Link to comment
Share on other sites

I've attached a patch which fixes errors when compiling atlas on osx with the version of wxwidgets provided by macports.

Some functions don't yet support std::wstring as parameters in this version.

I can compile now, but I can't link because a 64bit version of wxwidgets is missing.

It looks like we'll have to add support for wxwidgets 2.9 for getting 64bit support. Simply setting arch=x86 in premake4.lua as a workaround doesn't work either because a lot of dependencies do their own architecture detection.

atlas_patch.txt

Link to comment
Share on other sites

Hi Yves, did you merge my changes for Visual Studio in with your patch?

It's a patch for the c++ sourcecode and isn't related to premake.

Btw: I'll be on holiday the next three weeks starting next tuesday, so I won't be available in this time.

Edited by Yves
Link to comment
Share on other sites

I was referring to your premake patch you attached earlier wink.gif.

Hmm did I post a patch after yours?

Am I getting forgetful or did you mean this post? It's not a patch, just the original version of premake I was using.

The version you can download from the homepage is not the most current stable version and the most current one from bitbucket is newer than the version I was using.

If you check the differences from this version to the one I've customized, you can see what I have changed.

Link to comment
Share on other sites

I committed stuff now. Run update-workspaces-new.bat / update-workspaces-new.sh and otherwise it should be pretty much the same as normal. (One difference is that Unix builds default to release mode now, and you have to run "make config=debug" if you want debug mode). (I'll rename update-workspaces-new back to update-workspaces once it's been tested enough). It seems to work for me on Linux, and with VS2008 on Windows (though I haven't tested Atlas); further testing would be appreciated, particularly on OS X and VS2010.

Link to comment
Share on other sites

Thank you Philip!

I'm glad it's committed now :).

EDIT:

Btw. here are some tickets related to the update:

1. Ticket #404 Makefile build system should have pyrogenesis/test targets depend on Collada

Status: It seems there's still no solution for this, but there's an existing feature-request for premake.

2. Ticket #428 Generated makefiles should not try to run wrong premake

Status: I think this was already fixed in the most recent version of premake3, but definitely now with premake4. Can be closed.

3. Ticket #713 Update premake for Xcode use

Edited by Yves
Link to comment
Share on other sites

I'm exploring the xcode support (on 10.6.6 OS X). Interesting notes so far:

  • It won't compile with PCH enabled because there's a relative path issue - it can't find precompiled.h so the build fails
  • Running update-workspaces-new.sh using the --without-pch option allows the build to continue
  • source/lib/sysdep/arch/x86_64/topology.cpp fails to compile due to std::bitset not being defined. So I included <bitset> instead of <set> and it compiled, hopefully this works on other platforms?
  • There's a lot of annoying Boost warnings like these, but which don't seem to affect the build:
    /opt/local/include/boost/mpl/has_xxx.hpp:344:0 /opt/local/include/boost/mpl/has_xxx.hpp:344:9: warning: "BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION" is not defined
    /opt/local/include/boost/mpl/has_xxx.hpp:357:0 /opt/local/include/boost/mpl/has_xxx.hpp:357:9: warning: "BOOST_MPL_HAS_XXX_NO_WRAPPED_TYPES" is not defined
    /opt/local/include/boost/mpl/has_xxx.hpp:386:0 /opt/local/include/boost/mpl/has_xxx.hpp:386:9: warning: "BOOST_MPL_HAS_XXX_NO_EXPLICIT_TEST_FUNCTION" is not defined
    /opt/local/include/boost/mpl/has_xxx.hpp:459:0 /opt/local/include/boost/mpl/has_xxx.hpp:459:8: warning: "BOOST_MPL_HAS_XXX_NEEDS_TEMPLATE_SFINAE" is not defined
    /opt/local/include/boost/detail/container_fwd.hpp:71:0 /opt/local/include/boost/detail/container_fwd.hpp:71:9: warning: "BOOST_CLANG" is not defined


  • Next I ran into a few problems:
    • I get a fatal error from nasm about unrecognized output format 'macho64', which is strange but led me to this ticket (I'm running the 64-bit kernel)
      PhaseScriptExecution ../../../source/lib/sysdep/arch/amd64/amd64_asm.asm
      cd /Users/ben/0ad/build/workspaces/xcode3
      setenv ACTION build
      setenv ALTERNATE_GROUP staff
      setenv ALTERNATE_MODE u+w,go-w,a+rX
      setenv ALTERNATE_OWNER ben
      setenv ALWAYS_SEARCH_USER_PATHS NO
      setenv APPLE_INTERNAL_DEVELOPER_DIR /AppleInternal/Developer
      setenv APPLE_INTERNAL_DIR /AppleInternal
      setenv APPLE_INTERNAL_DOCUMENTATION_DIR /AppleInternal/Documentation
      setenv APPLE_INTERNAL_LIBRARY_DIR /AppleInternal/Library
      setenv APPLE_INTERNAL_TOOLS /AppleInternal/Developer/Tools
      setenv APPLY_RULES_IN_COPY_FILES NO
      setenv ARCHS x86_64
      setenv ARCHS_STANDARD_32_64_BIT "x86_64 i386"
      setenv ARCHS_STANDARD_32_BIT i386
      setenv ARCHS_STANDARD_64_BIT x86_64
      setenv BUILD_COMPONENTS "headers build"
      setenv BUILD_DIR /Users/ben/0ad/build/workspaces/xcode3/../../../binaries/system
      setenv BUILD_ROOT /Users/ben/0ad/build/workspaces/xcode3/../../../binaries/system
      setenv BUILD_STYLE Release
      setenv BUILD_VARIANTS normal
      setenv BUILT_PRODUCTS_DIR ../../../binaries/system
      setenv CACHE_ROOT /var/folders/Zm/ZmwMaQ8yEtKxnaAD0zWSBE+++TI/-Caches-/com.apple.Xcode.501
      setenv CCHROOT /var/folders/Zm/ZmwMaQ8yEtKxnaAD0zWSBE+++TI/-Caches-/com.apple.Xcode.501
      setenv CHMOD /bin/chmod
      setenv CHOWN /usr/sbin/chown
      setenv CLASS_FILE_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/JavaClasses
      setenv CLEAN_PRECOMPS YES
      setenv CLONE_HEADERS NO
      setenv CODESIGNING_FOLDER_PATH ../../../binaries/system/liblowlevel.a
      setenv CODE_SIGNING_ALLOWED NO
      setenv COMPOSITE_SDK_DIRS /var/folders/Zm/ZmwMaQ8yEtKxnaAD0zWSBE+++TI/-Caches-/com.apple.Xcode.501/CompositeSDKs
      setenv CONFIGURATION Release
      setenv CONFIGURATION_BUILD_DIR ../../../binaries/system
      setenv CONFIGURATION_TEMP_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release
      setenv COPYING_PRESERVES_HFS_DATA NO
      setenv COPY_PHASE_STRIP NO
      setenv COPY_RESOURCES_FROM_STATIC_FRAMEWORKS YES
      setenv CP /bin/cp
      setenv CURRENT_ARCH x86_64
      setenv CURRENT_VARIANT normal
      setenv DEAD_CODE_STRIPPING NO
      setenv DEBUGGING_SYMBOLS YES
      setenv DEBUG_INFORMATION_FORMAT dwarf
      setenv DEPLOYMENT_LOCATION NO
      setenv DEPLOYMENT_POSTPROCESSING NO
      setenv DERIVED_FILES_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/DerivedSources
      setenv DERIVED_FILE_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/DerivedSources
      setenv DERIVED_SOURCES_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/DerivedSources
      setenv DEVELOPER_APPLICATIONS_DIR /Developer/Applications
      setenv DEVELOPER_BIN_DIR /Developer/usr/bin
      setenv DEVELOPER_DIR /Developer
      setenv DEVELOPER_FRAMEWORKS_DIR /Developer/Library/Frameworks
      setenv DEVELOPER_FRAMEWORKS_DIR_QUOTED "\"/Developer/Library/Frameworks\""
      setenv DEVELOPER_LIBRARY_DIR /Developer/Library
      setenv DEVELOPER_SDK_DIR /Developer/SDKs
      setenv DEVELOPER_TOOLS_DIR /Developer/Tools
      setenv DEVELOPER_USR_DIR /Developer/usr
      setenv DEVELOPMENT_LANGUAGE English
      setenv DO_HEADER_SCANNING_IN_JAM NO
      setenv DSTROOT /tmp/lowlevel.dst
      setenv DWARF_DSYM_FILE_NAME liblowlevel.a.dSYM
      setenv DWARF_DSYM_FOLDER_PATH ../../../binaries/system
      setenv ENABLE_HEADER_DEPENDENCIES YES
      setenv ENABLE_OPENMP_SUPPORT NO
      setenv EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS ".svn .git CVS"
      setenv EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES "*.nib *.lproj *.framework *.gch (*) CVS .svn .git *.xcodeproj *.xcode *.pbproj *.pbxproj"
      setenv EXECUTABLE_EXTENSION a
      setenv EXECUTABLE_NAME liblowlevel.a
      setenv EXECUTABLE_PATH liblowlevel.a
      setenv EXECUTABLE_PREFIX lib
      setenv EXECUTABLE_SUFFIX .a
      setenv FILE_LIST /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/Objects/LinkFileList
      setenv FIXED_FILES_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/FixedFiles
      setenv FRAMEWORK_FLAG_PREFIX -framework
      setenv FRAMEWORK_SEARCH_PATHS "\"../../../binaries/system\" "
      setenv FRAMEWORK_VERSION A
      setenv FULL_PRODUCT_NAME liblowlevel.a
      setenv GCC3_VERSION 3.3
      setenv GCC_C_LANGUAGE_STANDARD gnu99
      setenv GCC_DYNAMIC_NO_PIC NO
      setenv GCC_ENABLE_SYMBOL_SEPARATION NO
      setenv GCC_MODEL_TUNING G5
      setenv GCC_OPTIMIZATION_LEVEL 3
      setenv GCC_PFE_FILE_C_DIALECTS "c objective-c c++ objective-c++"
      setenv GCC_PREPROCESSOR_DEFINITIONS "NDEBUG CONFIG_FINAL=1 LIB_STATIC_LINK"
      setenv GCC_SYMBOLS_PRIVATE_EXTERN NO
      setenv GCC_TREAT_WARNINGS_AS_ERRORS NO
      setenv GCC_VERSION 4.2
      setenv GCC_VERSION_IDENTIFIER __2
      setenv GCC_WARN_ABOUT_RETURN_TYPE YES
      setenv GCC_WARN_UNUSED_VARIABLE YES
      setenv GENERATE_MASTER_OBJECT_FILE NO
      setenv GENERATE_PKGINFO_FILE NO
      setenv GENERATE_PROFILING_CODE NO
      setenv GID 20
      setenv GROUP staff
      setenv HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT YES
      setenv HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES YES
      setenv HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS YES
      setenv HEADERMAP_INCLUDES_PROJECT_HEADERS YES
      setenv HEADER_SEARCH_PATHS "\"../../../binaries/system/include\" /usr/X11R6/include/X11 /usr/X11R6/include /usr/include/X11 ../../../source/pch/lowlevel ../../../source ../../../libraries/valgrind/include ../../../libraries/cxxtest/include /opt/local/include"
      setenv ICONV /usr/bin/iconv
      setenv INFOPLIST_EXPAND_BUILD_SETTINGS YES
      setenv INFOPLIST_OUTPUT_FORMAT same-as-input
      setenv INFOPLIST_PREPROCESS NO
      setenv INPUT_FILE_BASE amd64_asm
      setenv INPUT_FILE_DIR /Users/ben/0ad/build/workspaces/xcode3/../../../source/lib/sysdep/arch/amd64
      setenv INPUT_FILE_NAME amd64_asm.asm
      setenv INPUT_FILE_PATH /Users/ben/0ad/build/workspaces/xcode3/../../../source/lib/sysdep/arch/amd64/amd64_asm.asm
      setenv INPUT_FILE_REGION_PATH_COMPONENT
      setenv INPUT_FILE_SUFFIX .asm
      setenv INSTALL_DIR /tmp/lowlevel.dst/usr/local/lib
      setenv INSTALL_GROUP staff
      setenv INSTALL_MODE_FLAG u+w,go-w,a+rX
      setenv INSTALL_OWNER ben
      setenv INSTALL_PATH /usr/local/lib
      setenv INSTALL_ROOT /tmp/lowlevel.dst
      setenv JAVAC_DEFAULT_FLAGS "-J-Xms64m -J-XX:NewSize=4M -J-Dfile.encoding=UTF8"
      setenv JAVA_APP_STUB /System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
      setenv JAVA_ARCHIVE_CLASSES YES
      setenv JAVA_ARCHIVE_TYPE JAR
      setenv JAVA_COMPILER /usr/bin/javac
      setenv JAVA_FRAMEWORK_RESOURCES_DIRS Resources
      setenv JAVA_JAR_FLAGS cv
      setenv JAVA_SOURCE_SUBDIR .
      setenv JAVA_USE_DEPENDENCIES YES
      setenv JAVA_ZIP_FLAGS -urg
      setenv JIKES_DEFAULT_FLAGS "+E +OLDCSO"
      setenv KEEP_PRIVATE_EXTERNS NO
      setenv LD_GENERATE_MAP_FILE NO
      setenv LD_MAP_FILE_PATH /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/lowlevel-LinkMap-normal-x86_64.txt
      setenv LD_OPENMP_FLAGS -fopenmp
      setenv LEX /Developer/usr/bin/lex
      setenv LIBRARY_FLAG_NOSPACE YES
      setenv LIBRARY_FLAG_PREFIX -l
      setenv LIBRARY_SEARCH_PATHS "\"../../../binaries/system\" ../../../binaries/system /usr/X11R6/lib /opt/local/lib"
      setenv LINKER_DISPLAYS_MANGLED_NAMES NO
      setenv LINK_FILE_LIST_normal_x86_64 /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/Objects-normal/x86_64/lowlevel.LinkFileList
      setenv LINK_WITH_STANDARD_LIBRARIES YES
      setenv LOCAL_ADMIN_APPS_DIR /Applications/Utilities
      setenv LOCAL_APPS_DIR /Applications
      setenv LOCAL_DEVELOPER_DIR /Library/Developer
      setenv LOCAL_LIBRARY_DIR /Library
      setenv MACH_O_TYPE staticlib
      setenv MAC_OS_X_PRODUCT_BUILD_VERSION 10J567
      setenv MAC_OS_X_VERSION_ACTUAL 1066
      setenv MAC_OS_X_VERSION_MAJOR 1060
      setenv MAC_OS_X_VERSION_MINOR 0606
      setenv NATIVE_ARCH i386
      setenv NATIVE_ARCH_32_BIT i386
      setenv NATIVE_ARCH_64_BIT x86_64
      setenv NATIVE_ARCH_ACTUAL x86_64
      setenv NO_COMMON YES
      setenv OBJECT_FILE_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/Objects
      setenv OBJECT_FILE_DIR_normal /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/Objects-normal
      setenv OBJROOT /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release
      setenv ONLY_ACTIVE_ARCH NO
      setenv OPTIMIZATION_LEVEL 0
      setenv OS MACOS
      setenv OSAC /usr/bin/osacompile
      setenv OTHER_CFLAGS "-Wno-switch -Wno-reorder -Wno-invalid-offsetof -Wextra -Wno-missing-field-initializers -Wunused-parameter -Wredundant-decls -Wnon-virtual-dtor -Wundef -fstack-protector-all -D_FORTIFY_SOURCE=2 -fstrict-aliasing -fpch-preprocess -msse -fno-omit-frame-pointer -msse2 -fvisibility=hidden -I/opt/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE"
      setenv OTHER_CPLUSPLUSFLAGS "-Wno-switch -Wno-reorder -Wno-invalid-offsetof -Wextra -Wno-missing-field-initializers -Wunused-parameter -Wredundant-decls -Wnon-virtual-dtor -Wundef -fstack-protector-all -D_FORTIFY_SOURCE=2 -fstrict-aliasing -fpch-preprocess -msse -fno-omit-frame-pointer -msse2 -fvisibility=hidden -I/opt/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE"
      setenv OTHER_INPUT_FILE_FLAGS
      setenv PACKAGE_TYPE com.apple.package-type.static-library
      setenv PASCAL_STRINGS YES
      setenv PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES "/usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Developer/Headers /Developer/SDKs /Developer/Platforms"
      setenv PFE_FILE_C_DIALECTS c++
      setenv PKGINFO_FILE_PATH /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/PkgInfo
      setenv PLATFORM_DEVELOPER_APPLICATIONS_DIR /Developer/Applications
      setenv PLATFORM_DEVELOPER_BIN_DIR /Developer/usr/bin
      setenv PLATFORM_DEVELOPER_LIBRARY_DIR /Developer/Library
      setenv PLATFORM_DEVELOPER_SDK_DIR /Developer/SDKs
      setenv PLATFORM_DEVELOPER_TOOLS_DIR /Developer/Tools
      setenv PLATFORM_DEVELOPER_USR_DIR /Developer/usr
      setenv PLATFORM_NAME macosx
      setenv PLATFORM_PRODUCT_BUILD_VERSION 10M2518
      setenv PLIST_FILE_OUTPUT_FORMAT same-as-input
      setenv PREBINDING NO
      setenv PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR YES
      setenv PRECOMP_DESTINATION_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/PrefixHeaders
      setenv PRESERVE_DEAD_CODE_INITS_AND_TERMS NO
      setenv PRIVATE_HEADERS_FOLDER_PATH /usr/local/include
      setenv PRODUCT_NAME lowlevel
      setenv PRODUCT_SETTINGS_PATH
      setenv PRODUCT_TYPE com.apple.product-type.library.static
      setenv PROFILING_CODE NO
      setenv PROJECT lowlevel
      setenv PROJECT_DERIVED_FILE_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/DerivedSources
      setenv PROJECT_DIR /Users/ben/0ad/build/workspaces/xcode3
      setenv PROJECT_FILE_PATH /Users/ben/0ad/build/workspaces/xcode3/lowlevel.xcodeproj
      setenv PROJECT_NAME lowlevel
      setenv PROJECT_TEMP_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build
      setenv PUBLIC_HEADERS_FOLDER_PATH /usr/local/include
      setenv RECURSIVE_SEARCH_PATHS_FOLLOW_SYMLINKS YES
      setenv REMOVE_CVS_FROM_RESOURCES YES
      setenv REMOVE_GIT_FROM_RESOURCES YES
      setenv REMOVE_SVN_FROM_RESOURCES YES
      setenv REZ_COLLECTOR_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/ResourceManagerResources
      setenv REZ_EXECUTABLE YES
      setenv REZ_OBJECTS_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/ResourceManagerResources/Objects
      setenv REZ_SEARCH_PATHS "\"../../../binaries/system\" "
      setenv RUN_CLANG_STATIC_ANALYZER NO
      setenv SCAN_ALL_SOURCE_FILES_FOR_INCLUDES NO
      setenv SCRIPT_INPUT_FILE /Users/ben/0ad/build/workspaces/xcode3/../../../source/lib/sysdep/arch/amd64/amd64_asm.asm
      setenv SCRIPT_OUTPUT_FILE_0 /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/DerivedSources/amd64_asm.o
      setenv SCRIPT_OUTPUT_FILE_COUNT 1
      setenv SDKROOT
      setenv SDK_PRODUCT_BUILD_VERSION 10J567
      setenv SED /usr/bin/sed
      setenv SEPARATE_STRIP YES
      setenv SEPARATE_SYMBOL_EDIT NO
      setenv SET_DIR_MODE_OWNER_GROUP YES
      setenv SET_FILE_MODE_OWNER_GROUP NO
      setenv SHARED_DERIVED_FILE_DIR ../../../binaries/system/DerivedSources
      setenv SHARED_PRECOMPS_DIR /var/folders/Zm/ZmwMaQ8yEtKxnaAD0zWSBE+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders
      setenv SKIP_INSTALL NO
      setenv SOURCE_ROOT /Users/ben/0ad/build/workspaces/xcode3
      setenv SRCROOT /Users/ben/0ad/build/workspaces/xcode3
      setenv STANDARD_C_PLUS_PLUS_LIBRARY_TYPE dynamic
      setenv STRINGS_FILE_OUTPUT_ENCODING UTF-16
      setenv STRIP_INSTALLED_PRODUCT YES
      setenv STRIP_STYLE debugging
      setenv SYMBOL_REPOSITORY_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build/SymbolRepositories
      setenv SYMROOT /Users/ben/0ad/build/workspaces/xcode3/../../../binaries/system
      setenv SYSTEM_ADMIN_APPS_DIR /Applications/Utilities
      setenv SYSTEM_APPS_DIR /Applications
      setenv SYSTEM_CORE_SERVICES_DIR /System/Library/CoreServices
      setenv SYSTEM_DEMOS_DIR /Applications/Extras
      setenv SYSTEM_DEVELOPER_APPS_DIR /Developer/Applications
      setenv SYSTEM_DEVELOPER_BIN_DIR /Developer/usr/bin
      setenv SYSTEM_DEVELOPER_DEMOS_DIR "/Developer/Applications/Utilities/Built Examples"
      setenv SYSTEM_DEVELOPER_DIR /Developer
      setenv SYSTEM_DEVELOPER_DOC_DIR "/Developer/ADC Reference Library"
      setenv SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR "/Developer/Applications/Graphics Tools"
      setenv SYSTEM_DEVELOPER_JAVA_TOOLS_DIR "/Developer/Applications/Java Tools"
      setenv SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR "/Developer/Applications/Performance Tools"
      setenv SYSTEM_DEVELOPER_RELEASENOTES_DIR "/Developer/ADC Reference Library/releasenotes"
      setenv SYSTEM_DEVELOPER_TOOLS /Developer/Tools
      setenv SYSTEM_DEVELOPER_TOOLS_DOC_DIR "/Developer/ADC Reference Library/documentation/DeveloperTools"
      setenv SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR "/Developer/ADC Reference Library/releasenotes/DeveloperTools"
      setenv SYSTEM_DEVELOPER_USR_DIR /Developer/usr
      setenv SYSTEM_DEVELOPER_UTILITIES_DIR /Developer/Applications/Utilities
      setenv SYSTEM_DOCUMENTATION_DIR /Library/Documentation
      setenv SYSTEM_LIBRARY_DIR /System/Library
      setenv TARGETNAME lowlevel
      setenv TARGET_BUILD_DIR ../../../binaries/system
      setenv TARGET_NAME lowlevel
      setenv TARGET_TEMP_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build
      setenv TEMP_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build
      setenv TEMP_FILES_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build
      setenv TEMP_FILE_DIR /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release/lowlevel.build
      setenv TEMP_ROOT /Users/ben/0ad/build/workspaces/xcode3/obj/lowlevel_Release
      setenv UID 501
      setenv UNSTRIPPED_PRODUCT NO
      setenv USER ben
      setenv USER_APPS_DIR /Users/ben/Applications
      setenv USER_LIBRARY_DIR /Users/ben/Library
      setenv USE_DYNAMIC_NO_PIC YES
      setenv USE_HEADERMAP YES
      setenv USE_HEADER_SYMLINKS NO
      setenv VALIDATE_PRODUCT NO
      setenv VALID_ARCHS "i386 ppc ppc64 ppc7400 ppc970 x86_64"
      setenv VERBOSE_PBXCP NO
      setenv VERSION_INFO_BUILDER ben
      setenv VERSION_INFO_FILE lowlevel_vers.c
      setenv VERSION_INFO_STRING "\"@(#)PROGRAM:lowlevel PROJECT:lowlevel-\""
      setenv WARNING_CFLAGS -Wall
      setenv XCODE_APP_SUPPORT_DIR /Developer/Library/Xcode
      setenv XCODE_PRODUCT_BUILD_VERSION 10M2518
      setenv XCODE_VERSION_ACTUAL 0400
      setenv XCODE_VERSION_MAJOR 0400
      setenv XCODE_VERSION_MINOR 0400
      setenv YACC /Developer/usr/bin/yacc
      /bin/sh -c "nasm -D OS_UNIX=1 -i${INPUT_FILE_DIR}/ -f macho64 ${INPUT_FILE_PATH} -o ${DERIVED_FILES_DIR}/${INPUT_FILE_BASE}.o"

      nasm: fatal: unrecognised output format `macho64' - use -hf for a list
      type `nasm -h' for help
      Command /bin/sh failed with exit code 1


    • I tried upgrading nasm through MacPorts but already have the latest port (2.09.09)
    • In the process I upgraded all outdated ports. Boost was upgraded from @1.46.1_0 to @1.47.0_0 but this seems to have broken the build badly (many errors about random::rand48 being re-declared), so I had to revert back to 1.46. Safe to say, 1.47 should not be used until that's fixed. If you upgrade by accident, try "sudo port activate boost @1.46.1_0" or install it as needed.

    [*]And finally a linker error due to the above error in liblowlevel (but why would the build process continue?)

    Ld ../../../binaries/system/pyrogenesis.app/Contents/MacOS/pyrogenesis normal x86_64
    cd /Users/ben/0ad/build/workspaces/xcode3
    /Developer/usr/bin/g++-4.2 -arch x86_64 -L../../../binaries/system -L../../../binaries/system -L/usr/X11R6/lib -L../../../libraries/spidermonkey/lib -L../../../libraries/cxxtest/lib -L../../../libraries/enet/lib -L../../../libraries/valgrind/lib -L../../../libraries/nvtt/lib -L/opt/local/lib -F../../../binaries/system -filelist /Users/ben/0ad/build/workspaces/xcode3/obj/pyrogenesis_Release/pyrogenesis.build/Objects-normal/x86_64/pyrogenesis.LinkFileList -ljpeg -lpng -lz -lmozjs185-ps-release -lvorbisfile -lboost_signals-mt -lboost_filesystem-mt -lboost_system-mt -lenet -lcurl -lnvcore -lnvmath -lnvimage -lnvtt -lpthread -framework OpenGL -L/opt/local/lib -lSDLmain -lSDL -framework Cocoa -L/opt/local/lib -lxml2 -framework OpenAL /Users/ben/0ad/binaries/system/libmocks_real.a /Users/ben/0ad/binaries/system/libnetwork.a /Users/ben/0ad/binaries/system/libsimulation2.a /Users/ben/0ad/binaries/system/libscriptinterface.a /Users/ben/0ad/binaries/system/libengine.a /Users/ben/0ad/binaries/system/libgraphics.a /Users/ben/0ad/binaries/system/libatlas.a /Users/ben/0ad/binaries/system/libgui.a /Users/ben/0ad/binaries/system/liblowlevel.a -o ../../../binaries/system/pyrogenesis.app/Contents/MacOS/pyrogenesis

    i686-apple-darwin10-g++-4.2.1: /Users/ben/0ad/binaries/system/liblowlevel.a: No such file or directory
    Command /Developer/usr/bin/g++-4.2 failed with exit code 1

Link to comment
Share on other sites

source/lib/sysdep/arch/x86_64/topology.cpp fails to compile due to std::bitset not being defined. So I included <bitset> instead of <set> and it compiled, hopefully

hm, Philip had already fixed this one by adding <bitset>.

I think <set> is no longer needed (there's certainly no std::set in there), so replacing <set> should be fine.

Unfortunately I can't help with the nasm problem, except to indicate that we're really close to stomping out the last of the asm.

I've been discussing this with Philip and the best guess at something GCC-palatable is:

#define __cpuid(level, index, a, b, c, d)                      \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (, "=c" (c), "=d" (d) \
: "0" (level), "2" (index))

This would be inserted into static void cpuid #if !HAVE_CPUIDEX, replacing the two asm calls.

level is the initial value of regs->eax, index is regs->ecx, and a,b,c,d are the output values that are to be written to regs->eax,ebx etc.

Would you like to give that a try?

If that compiles despite GCC -fPIC, then we're golden.

Link to comment
Share on other sites

Well this is funny, I ran nasm manually on the command line and then tried building again and it succeeded (using the environment vars from the above error message). I wonder if there's something it doesn't like about the format of that string, maybe extra whitespace somewhere? Or more likely something in the environment that breaks it but what...

hm, Philip had already fixed this one by adding <bitset>.

I think <set> is no longer needed (there's certainly no std::set in there), so replacing <set> should be fine.

Ah you're right, but somehow that wasn't updated even though I have the latest revision O.o

Unfortunately I can't help with the nasm problem, except to indicate that we're really close to stomping out the last of the asm.

I've been discussing this with Philip and the best guess at something GCC-palatable is:

#define __cpuid(level, index, a, b, c, d)                      \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (B), "=c" (c), "=d" (d) \
: "0" (level), "2" (index))

This would be inserted into static void cpuid #if !HAVE_CPUIDEX, replacing the two asm calls.

level is the initial value of regs->eax, index is regs->ecx, and a,b,c,d are the output values that are to be written to regs->eax,ebx etc.

Would you like to give that a try?

If that compiles despite GCC -fPIC, then we're golden.

Umm I'll need a while to digest this, but sure I'll try it :P

Link to comment
Share on other sites

Like this? If so, it did compile.

static void cpuid(x86_x64_CpuidRegs* regs)
{
#if HAVE_CPUIDEX
cassert(sizeof(regs->eax) == sizeof(int));
cassert(sizeof(*regs) == 4*sizeof(int));
__cpuidex((int*)regs, regs->eax, regs->ecx);
#else
#define __cpuid(level, index, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (B), "=c" ©, "=d" (d) \
: "0" (level), "2" (index))
#endif
}

Link to comment
Share on other sites

The nasm-problem is a known issue and should be documented in the build instructions.

XCode ships with an older version of nasm which does not support the macho64 flag.

I've solved it on my system by replacing the nasm-binary of Xcode with a symbolic link to the newer one installed via macports.

I'm not sure if that's a good solution though.

EDIT:

I can't reproduce ticket # 903.

When I change something, it rebuilds the file. Did somebody already fix it?

Ah I see, It's only when running make scriptinterface. It rebuilds properly if you just run make.

Edited by Yves
Link to comment
Share on other sites

Like this? If so, it did compile.

We still need to add the actual macro invocation.

I'd suggest replacing the HAVE_CPUIDEX block with


#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 150030729
// VC10+ and VC9 SP1: __cpuidex is already available
#elif GCC_VERSION
# define __cpuidex(regsArray, level, index)\
__asm__ ("cpuid\n\t"\
: "=a" (regsArray[0]), "=b" (regsArray[1]), "=c" (regsArray[2]), "=d" (regsArray[3])\
: "0" (level), "2" (index))
#else
# error "compiler not supported"
#endif

Now cpuid() can just invoke __cpuidex without the need for any additional #if faff.

Does that work? :) *drumroll*

Link to comment
Share on other sites

Like this?

Not with the capital B and copyright symbol like that :P

I can't reproduce ticket # 903.

When I change something, it rebuilds the file. Did somebody already fix it?

Ah I see, It's only when running make scriptinterface. It rebuilds properly if you just run make.

If I add a #error then run "make -k", it only recompiles (and fails for) mocks_*.cpp and status.cpp, it doesn't try rebuilding the .gch files or anything that depends on them (which it should).

Link to comment
Share on other sites

If I add a #error then run "make -k", it only recompiles (and fails for) mocks_*.cpp and status.cpp, it doesn't try rebuilding the .gch files or anything that depends on them (which it should).

Yes I've found the problem and I'm fixing it.

EDIT:

A patch is attached.

Please test it because I didn't have much time for tests.

It fixes ticket #903 and adds a command to clean-workspaces.sh for cleaning the premake4 environment.

For testing don't forget to run clean-workspaces.sh.

Question: Why do you even have a precompiled.cpp file? Shouldn't precompiled.h be sufficient?

patch_pch_clean-workspaces.txt

Edited by Yves
Link to comment
Share on other sites

I'm exploring the xcode support (on 10.6.6 OS X). Interesting notes so far:

...

  • It won't compile with PCH enabled because there's a relative path issue - it can't find precompiled.h so the build fails

...

Changing the type of pchheader from "string" to "path" in api.lua fixes the problem.

I'm wondering why premake uses "path" for pchsource and "string" for pchheader.

I'm going to integrate this change into the patch from the last post and add it as an attachment to this post.

EDIT: Done, the new patch is up.

patch_pch_clean-workspaces_v2.txt

Edited by Yves
Link to comment
Share on other sites

Why do you even have a precompiled.cpp file? Shouldn't precompiled.h be sufficient?

I think precompiled.cpp is needed when compiling with MSVC (since that's what generates the PCH file), but not needed with GCC (since the PCH is generated directly from the .h), so preferably the .cpp should be ignored when using GCC.

Link to comment
Share on other sites

I think precompiled.cpp is needed when compiling with MSVC (since that's what generates the PCH file), but not needed with GCC (since the PCH is generated directly from the .h), so preferably the .cpp should be ignored when using GCC.

Well then my patch probably won't work on Windows.

Changing pchheader from string to path also made some problems on linux. :(

It looks like there's more testing and more work required...

Link to comment
Share on other sites

Honestly, I find it quite a success that the game could be compiled successfully in XCode with just those two changes: build without PCH and manually run nasm!

The nasm-problem is a known issue and should be documented in the build instructions.

XCode ships with an older version of nasm which does not support the macho64 flag.

I've solved it on my system by replacing the nasm-binary of Xcode with a symbolic link to the newer one installed via macports.

I'm not sure if that's a good solution though

That makes sense because the 64-bit OS X kernel is fairly new, surely they have fixed this for XCode 4? I could buy it from the App Store and see what fun awaits... I wouldn't call replacing XCode's binaries a good solution, maybe there's some setting or path variable we could override to force the newer MacPort nasm, assuming we still need it :P

Link to comment
Share on other sites

Honestly, I find it quite a success that the game could be compiled successfully in XCode with just those two changes: build without PCH and manually run nasm!

Thank you!

I could buy it from the App Store and see what fun awaits...

Would be interesting to know. It only cost about 5$ if I remember correctly.

I would have done it if I had a "real" mac ;).

Ok I hope this is the last and successful try, version 3 of the patch.

It's quickly tested on Linux, Mac and Windows... if I wasn't too tired and made mistakes ;).

Further testing appreciated!

patch_pch_clean-workspaces_v3.txt

Link to comment
Share on other sites

Ok I hope this is the last and successful try, version 3 of the patch.

It's quickly tested on Linux, Mac and Windows... if I wasn't too tired and made mistakes ;).

Further testing appreciated!

Tested your patch on OS X, both gcc and xcode3 projects are working with PCH now :) That leaves the xcode3 test project, which fails to build:


/Users/ben/0ad/build/workspaces/xcode3/obj/test_Release/test.build/Script-9607AE1010C857E500CD1376.sh: line 58: ../../build/bin/cxxtestgen.pl: No such file or directory

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...