Jump to content
Visual Boy Advance-M
mnk

SDL frontend: compiling asm hq filters

Recommended Posts

First of all, it seems that cmake 2.6.0 is required to do it,

cause for some reason I was unable to use them, till I upgraded.

Now, a question: why does compiling of c version take a few orders of magnitude more time than the asm version ?

And a minor annoyance:

unless I add '-w-orphan-labels' in CMakeLists.txt, I'm flooded with warnings while I compile those filters.


This is a reply, cause otherwise I'd have to rewrite most of first post.

It looks like it's not only version problem, I have to delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

Also, it looks like a certain block in CMakeLists.txt should actually loke like this:

IF( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-DC_CORE)
ELSE ( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-UC_CORE)
ENDIF( NOT USE_ASM_CORE )

to work correctly.

 

Well, there are actually at least two problems:

the one above is caused by following line:

ADD_DEFINITIONS (-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DBKPT_SUPPORT -DSDL -DUSE_OPENGL -DC_CORE -DSYSCONFDIR='"${SYSCONFDIR}"')

-DC_CORE should be removed

the other is that that quoting of defines in incorrect, cmake_policy( SET CMP0005 NEW ) doesn't work together with current quoting style of CMakeLists.txt.

Share this post


Link to post
Share on other sites

Now, a question: why does compiling of c version take a few orders of magnitude more time than the asm version ?

Possibly because (most modern) C compilers are optimizing (and spend a lot of time generating "best" machine code for your processor), whereas assembler compilers usually aren't (and generate the code the *programmer* (or even coder) thought would be best).

 

It looks like it's not only version problem, I have to delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

 

This is the intended behavior for cmake.

 

Also, it looks like a certain block in CMakeLists.txt should actually loke like this:

IF( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-DC_CORE)
ELSE ( NOT USE_ASM_CORE )
   ADD_DEFINITIONS (-UC_CORE)
ENDIF( NOT USE_ASM_CORE )

to work correctly.

 

You are probably right (there's an unconditional ADD_DEFINITIONS (... -DC_CORE ...)), but I will leave this to somebody who knows.

Share this post


Link to post
Share on other sites

The catch is that I meant:

I have to run cmake, delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

And it should either set that policy to old or require cmake 2.6.0.

Share this post


Link to post
Share on other sites

The catch is that I meant:

I have to run cmake, delete CMakeFiles/CMakeASMCompiler.cmake first time it's generated and rerun cmake to get it to work.

And it should either set that policy to old or require cmake 2.6.0.

 

Without deleting CMakeCache.txt?

Well, that's supposedly to be expected from cmake sometimes ... but I still don't see why, this time.

 

----------

 

How does it fail?

What's in your generated CMakeFiles/CMakeASMCompiler.cmake after the first run and then after the second run?

Share this post


Link to post
Share on other sites

Ooops looks like I broke CMake quite severely.

Thanks for your comments.

Does rev 571 work better ?

Share this post


Link to post
Share on other sites

It does work better, but that asm problem is still there.

The incorrect CMakeFiles/CMakeASMCompiler.cmake:

SET(CMAKE_ASM_COMPILER "/usr/bin/nasm")
SET(CMAKE_ASM_COMPILER_ARG1 "")
SET(CMAKE_AR "/usr/bin/ar")
SET(CMAKE_RANLIB "/usr/bin/ranlib")
SET(CMAKE_LINKER "/usr/bin/ld")
SET(CMAKE_ASM_COMPILER_LOADED 1)
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")

SET(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_ASM_LINKER_PREFERENCE 0)

the correct one:

SET(CMAKE_ASM_COMPILER "/usr/bin/nasm")
SET(CMAKE_ASM_COMPILER_LOADED 1)
SET(CMAKE_ASM_COMPILER_ENV_VAR "ASM")

SET(CMAKE_ASM_SOURCE_FILE_EXTENSIONS nasm;asm;nas)
SET(CMAKE_ASM_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_ASM_LINKER_PREFERENCE None)
IF(UNIX)
       SET(CMAKE_ASM_OUTPUT_EXTENSION .o)
ELSE(UNIX)
       SET(CMAKE_ASM_OUTPUT_EXTENSION .obj)
ENDIF(UNIX)

This looks like a conflict between files in CMakeScripts and those provided by cmake 2.6.0.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×