2010-02-11 96 views
0

我從來沒有編譯過使用CMake的程序。我已經下載了最新的Allegro SVN並嘗試多次編譯它,但沒有運氣。我看了整個互聯網,並沒有發現任何有用的東西。我選擇了爲Visual Studio 9 2008進行編譯。我不知道我必須在哪裏鏈接源代碼和構建版本。 Allegro文件很混亂。我不知道這是否有用,但我也掌握了lib文件。如果有人知道我應該如何鏈接這些文件來正確編譯,我會很高興。如何使用CMake 2.8編譯Allegro 4.9.14

這裏是CMakeCash.Text內容:

# This is the CMakeCache file. 
# For build in directory: c:/lib/Allegro4.9 
# You can edit this file to change values found and used by cmake. 
# If you do not want to change any of the values, simply exit the editor. 
# If you do want to change a value, simply edit, save, and exit the editor. 
# The syntax for the file is as follows: 
# KEY:TYPE=VALUE 
# KEY is the name of a variable in the cache. 
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. 
# VALUE is the current value for the KEY. 

######################## 
# EXTERNAL cache entries 
######################## 


######################## 
# INTERNAL cache entries 
######################## 

//This is the directory where this CMakeCache.txt was created 
CMAKE_CACHEFILE_DIR:INTERNAL=c:/lib/Allegro4.9 
//Major version of cmake used to create the current loaded cache 
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2 
//Minor version of cmake used to create the current loaded cache 
CMAKE_CACHE_MINOR_VERSION:INTERNAL=8 
//Patch version of cmake used to create the current loaded cache 
CMAKE_CACHE_PATCH_VERSION:INTERNAL=0 

而且,這裏是事件列表,錯誤勢必會發現裏面:

Check for working C compiler: cl 
Check for working C compiler: cl -- works 
Detecting C compiler ABI info 
Detecting C compiler ABI info - done 
Check for working CXX compiler: cl 
Check for working CXX compiler: cl -- works 
Detecting CXX compiler ABI info 
Detecting CXX compiler ABI info - done 
Guessed MSVC directory: cl 
Allowing MSVC to use SSE instructions 
Check if the system is big endian 
Searching 16 bit integer 
Looking for sys/types.h 
Looking for sys/types.h - found 
Looking for stdint.h 
Looking for stdint.h - not found 
Looking for stddef.h 
Looking for stddef.h - found 
Check size of unsigned short 
Check size of unsigned short - done 
Using unsigned short 
Check if the system is big endian - little endian 
Looking for include files ALLEGRO_HAVE_DIRENT_H 
Looking for include files ALLEGRO_HAVE_DIRENT_H - not found. 
Looking for include files ALLEGRO_HAVE_INTTYPES_H 
Looking for include files ALLEGRO_HAVE_INTTYPES_H - not found. 
Looking for include files ALLEGRO_HAVE_LINUX_JOYSTICK_H 
Looking for include files ALLEGRO_HAVE_LINUX_JOYSTICK_H - not found. 
Looking for include files ALLEGRO_HAVE_STDBOOL_H 
Looking for include files ALLEGRO_HAVE_STDBOOL_H - not found. 
Looking for include files ALLEGRO_HAVE_STDINT_H 
Looking for include files ALLEGRO_HAVE_STDINT_H - not found. 
Looking for include files ALLEGRO_HAVE_SYS_IO_H 
Looking for include files ALLEGRO_HAVE_SYS_IO_H - not found. 
Looking for include files ALLEGRO_HAVE_SYS_STAT_H 
Looking for include files ALLEGRO_HAVE_SYS_STAT_H - found 
Looking for include files ALLEGRO_HAVE_SYS_TIME_H 
Looking for include files ALLEGRO_HAVE_SYS_TIME_H - not found. 
Looking for include files ALLEGRO_HAVE_TIME_H 
Looking for include files ALLEGRO_HAVE_TIME_H - found 
Looking for include files ALLEGRO_HAVE_SYS_UTSNAME_H 
Looking for include files ALLEGRO_HAVE_SYS_UTSNAME_H - not found. 
Looking for include files ALLEGRO_HAVE_SYS_TYPES_H 
Looking for include files ALLEGRO_HAVE_SYS_TYPES_H - found 
Looking for include files ALLEGRO_HAVE_SOUNDCARD_H 
Looking for include files ALLEGRO_HAVE_SOUNDCARD_H - not found. 
Looking for include files ALLEGRO_HAVE_SYS_SOUNDCARD_H 
Looking for include files ALLEGRO_HAVE_SYS_SOUNDCARD_H - not found. 
Looking for include files ALLEGRO_HAVE_MACHINE_SOUNDCARD_H 
Looking for include files ALLEGRO_HAVE_MACHINE_SOUNDCARD_H - not found. 
Looking for include files ALLEGRO_HAVE_LINUX_SOUNDCARD_H 
Looking for include files ALLEGRO_HAVE_LINUX_SOUNDCARD_H - not found. 
Looking for include files ALLEGRO_HAVE_OSATOMIC_H 
Looking for include files ALLEGRO_HAVE_OSATOMIC_H - not found. 
Looking for getexecname 
Looking for getexecname - not found 
Looking for mkstemp 
Looking for mkstemp - not found 
Looking for mmap 
Looking for mmap - not found 
Looking for mprotect 
Looking for mprotect - not found 
Looking for sched_yield 
Looking for sched_yield - not found 
Looking for stricmp 
Looking for stricmp - found 
Looking for strlwr 
Looking for strlwr - found 
Looking for strupr 
Looking for strupr - found 
Looking for sysconf 
Looking for sysconf - not found 
Looking for fseeko 
Looking for fseeko - not found 
Looking for ftello 
Looking for ftello - not found 
Check size of _Bool 
Check size of _Bool - failed 
Performing Test ALLEGRO_HAVE_PROCFS_ARGCV 
Performing Test ALLEGRO_HAVE_PROCFS_ARGCV - Failed 
Performing Test ALLEGRO_HAVE_SV_PROCFS_H 
Performing Test ALLEGRO_HAVE_SV_PROCFS_H - Failed 
Performing Test ALLEGRO_HAVE_VA_COPY 
Performing Test ALLEGRO_HAVE_VA_COPY - Failed 
Check if constructors are supported - no 
Could NOT find DINPUT (missing: DINPUT_INCLUDE_DIR DINPUT_LIBRARY) 
CMake Error at CMakeLists.txt:565 (message): 
    Windows port requires DirectInput (not found). 


Configuring incomplete, errors occurred! 
+0

你可以發佈你的cmakecache.txt嗎?也可能是構建錯誤 – 2010-02-11 02:43:36

+0

I稱爲allegro開發人員,看看他們是否可以幫助... 我使用4.3.x版本我自己和該版本不使用CMake所以我不能幫你 – speeder 2010-02-11 02:54:31

+0

哇,它的工作,Tomasu和Trentg出現:) – speeder 2010-02-11 03:22:26

回答

1

如果cmake的失敗,它應該告訴你出了什麼問題,即:如果你缺少必需的依賴關係。

如果cmake本身沒有失敗,請發佈您從cmake和/或編譯器看到的實際錯誤。

編輯:

你去那裏,你的錯誤:

找不到DINPUT(丟失:DINPUT_INCLUDE_DIR DINPUT_LIBRARY) CMake的錯誤在的CMakeLists.txt:565(消息): Windows移植需要的DirectInput(未找到)。

這是一個常見問題,並在新版本中修復。 4.9.14是古老的。請升級到最新版本,甚至直接從SVN升級。

+0

我剛剛更新了CMakeCache和構建事件。錯誤應該在那裏。 – user258916 2010-02-11 02:59:28

+0

而且我更新了我的答案;) – Tomasu 2010-02-11 03:00:44

+0

真的嗎? 4.9.14如何能夠變老?它只是最近的版本。那麼,我不妨試試更穩定的舊版本。這可能是解決方案。 – user258916 2010-02-11 03:01:51

1

首先,從MSVC命令提示符運行cmake,而不是常規命令提示符。然後將INCLUDE和LIB環境變量設置爲指向您的directx安裝。例如:

將納入= C:\ Program Files文件\微軟的DirectX SDK(2009年8月)\包含 設置LIB = C:\ Program Files文件\微軟的DirectX SDK(2009年8月)\ LIB \ X86

注意缺少引號(「)。不要使用引號,然後刪除CMakeCache.txt並再次運行cmake,它應該找到directx。

+0

你是什麼意思的MSVC命令提示符? – user258916 2010-02-11 03:11:11

+0

好吧,現在我明白你的意思了。另外,我現在正在下載Microsoft DirectX SDK(2009年8月),我將安裝它並嘗試顯示的命令。感謝大家的幫助! – user258916 2010-02-11 03:50:28