Skip to content

Commit e94defa

Browse files
committed
Fix: avoid need to edit FindXsd.cmake on Ubuntu 14.04 and Debian 7.
1 parent 7621d40 commit e94defa

3 files changed

Lines changed: 40 additions & 31 deletions

File tree

CMakeLists.txt

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,33 @@ set( BUILD_MOD ON )
1919
set( BUILD_DOCUMENTATION ON )
2020
set( INCLUDE_ALE ON )
2121

22+
# ------------------- Detect the system -----------------------
23+
24+
if( APPLE )
25+
set( SYSTEM_NAME "Mac" )
26+
elseif( UNIX )
27+
set( SYSTEM_NAME "Linux" )
28+
execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE LSB_ID)
29+
execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE LSB_RELEASE)
30+
if( LSB_ID AND LSB_RELEASE )
31+
string(STRIP "${LSB_ID}" LSB_ID)
32+
string(STRIP "${LSB_RELEASE}" LSB_RELEASE)
33+
set( SYSTEM_NAME "${SYSTEM_NAME}-${LSB_ID}-${LSB_RELEASE}")
34+
elseif( EXISTS "/etc/debian_version")
35+
file( READ /etc/debian_version DEBIAN_VERSION )
36+
set( SYSTEM_NAME "${SYSTEM_NAME}-${DEBIAN_VERSION}")
37+
elseif( EXISTS "/etc/redhat-release")
38+
set( SYSTEM_NAME "${SYSTEM_NAME}-Redhat")
39+
endif()
40+
elseif( WIN32)
41+
set( SYSTEM_NAME "Windows" )
42+
endif()
43+
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
44+
set( SYSTEM_NAME "${SYSTEM_NAME}-64bit" )
45+
else()
46+
set( SYSTEM_NAME "${SYSTEM_NAME}-32bit" )
47+
endif()
48+
2249
# -------------------- Find packages --------------------------
2350
set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
2451

@@ -161,34 +188,10 @@ if( ALE_FOUND )
161188
endif()
162189

163190
# -------------------- Package ------------------------------------
164-
165-
if( APPLE )
166-
set( CPACK_SYSTEM_NAME "Mac" )
167-
elseif( UNIX )
168-
set( CPACK_SYSTEM_NAME "Linux" )
169-
execute_process(COMMAND lsb_release -is OUTPUT_VARIABLE LSB_ID)
170-
execute_process(COMMAND lsb_release -rs OUTPUT_VARIABLE LSB_RELEASE)
171-
if( LSB_ID AND LSB_RELEASE )
172-
string(STRIP "${LSB_ID}" LSB_ID)
173-
string(STRIP "${LSB_RELEASE}" LSB_RELEASE)
174-
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-${LSB_ID}-${LSB_RELEASE}")
175-
elseif( EXISTS "/etc/debian_version")
176-
file( READ /etc/debian_version DEBIAN_VERSION )
177-
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-${DEBIAN_VERSION}")
178-
elseif( EXISTS "/etc/redhat-release")
179-
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-Redhat")
180-
endif()
181-
elseif( WIN32)
182-
set( CPACK_SYSTEM_NAME "Windows" )
183-
endif()
184-
if( CMAKE_SIZEOF_VOID_P EQUAL 8 )
185-
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-64bit" )
186-
else()
187-
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}-32bit" )
188-
endif()
189191
if( INCLUDE_ALE AND ALE_FOUND )
190-
set( CPACK_SYSTEM_NAME "${CPACK_SYSTEM_NAME}_withALE" )
192+
set( SYSTEM_NAME "${SYSTEM_NAME}_withALE" )
191193
endif()
194+
set( CPACK_SYSTEM_NAME ${SYSTEM_NAME} )
192195
set( CPACK_PACKAGE_VERSION "${MALMO_VERSION}" )
193196
set( CPACK_GENERATOR "ZIP" )
194197
set( CPACK_SOURCE_GENERATOR "ZIP" )

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,12 +194,11 @@ Project Malmo is a platform for Artificial Intelligence experimentation and rese
194194
3. `cd ~/MalmoPlatform`
195195
4. `mkdir build`
196196
5. `cd build`
197-
6. On Debian 7 and Ubuntu 14.04 only: edit ~/MalmoPlatform/cmake/FindXSD.cmake and add 'xsd' to `FIND_PROGRAM(XSD_EXECUTABLE NAMES` on line 31.
198-
7. For a Debug build: `cmake -DCMAKE_BUILD_TYPE=Debug ..`
197+
6. For a Debug build: `cmake -DCMAKE_BUILD_TYPE=Debug ..`
199198
On Debian 7 only: `cmake -DBoost_INCLUDE_DIR=/home/$USER/boost/boost_1_60_0/include -DCMAKE_BUILD_TYPE=Debug ..`
200-
8. For a Release build: `cmake -DCMAKE_BUILD_TYPE=Release ..`
199+
7. For a Release build: `cmake -DCMAKE_BUILD_TYPE=Release ..`
201200
On Debian 7 only: `cmake -DBoost_INCLUDE_DIR=/home/$USER/boost/boost_1_60_0/include -DCMAKE_BUILD_TYPE=Release ..`
202-
9. `make`
201+
8. `make`
203202

204203
10. Test Malmo:
205204
1. After building: `ctest`

cmake/FindXsd.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,17 @@ list(APPEND _XSD_SEARCHES _XSD_SEARCH_NORMAL)
2525
set(XSD_NAMES xsdcxx xsd xerces-c xerces-c_3)
2626
set(XSD_NAMES_DEBUG xerces-cD xerces-c_3D)
2727

28+
# Malmo-specific thing: on some platforms we need to manually install CodeSynthesis XSD and so the standard
29+
# exectable name is 'xsd' instead of 'xsdcxx'. On others, 'xsd' matches an executable in Mono
30+
# and so we have to avoid that.
31+
if( ( ${SYSTEM_NAME} MATCHES "^Linux-Ubuntu-14.04.*$" ) OR ( ${SYSTEM_NAME} MATCHES "^Linux-Debian-7\\..*$" ) )
32+
set( EXTRA_XSD_EXECUTABLE_NAMES "xsd" )
33+
endif()
34+
2835
# Try each search configuration.
2936
foreach(search ${_XSD_SEARCHES})
3037
find_path(XSD_INCLUDE_DIR NAMES xercesc ${${search}} PATH_SUFFIXES include)
31-
FIND_PROGRAM(XSD_EXECUTABLE NAMES xsdcxx xsd.exe ${${search}} PATH_SUFFIXES bin)
38+
FIND_PROGRAM(XSD_EXECUTABLE NAMES ${EXTRA_XSD_EXECUTABLE_NAMES} xsdcxx xsd.exe ${${search}} PATH_SUFFIXES bin)
3239
endforeach()
3340

3441
# Allow XSD_LIBRARY to be set manually, as the location of the xsd library

0 commit comments

Comments
 (0)