Open rdbo opened 10 months ago
Since we are using iteration of files to build them, i think this is good aproach to order and manage them.
Other alternatives;
bsd_
win_
lin_
un_
CMakeLists.txt
if(WIN32)
add_definitions(-DLM_BUILD_TYPE_WIN=1)
endif()
Code:
#ifdef LM_BUILD_TYPE_WIN
// windows code
#endif
@illegal-instruction-co
For (2); Currently those definitions are in the C header files, but they can be passed to CMake also IIRC: Right now it looks like this:
#if LM_OS == LM_OS_WIN
// ...
#endif
But there is an option that forces the operating system (and there are options also for architecture, and everything, really):
#if defined(LM_FORCE_OS_WIN)
# define LM_OS LM_OS_WIN
#elif defined(LM_FORCE_OS_LINUX)
# define LM_OS LM_OS_LINUX
#elif defined(LM_FORCE_OS_BSD)
# define LM_OS LM_OS_BSD
#elif defined(LM_FORCE_OS_ANDROID)
# define LM_OS LM_OS_ANDROID
#endif
Example:
Unix will compile for both Linux and BSD. Linux will compile for Linux (android also, bc android uses Linux)