Browse Source

CMake: Configure: Use BUILD_<FEATURE> for CMake cache when configuring Panda features.

kestred 12 years ago
parent
commit
ca041ae6d5
1 changed files with 54 additions and 22 deletions
  1. 54 22
      dtool/Configure.cmake

+ 54 - 22
dtool/Configure.cmake

@@ -32,12 +32,23 @@ if(HAVE_EIGEN)
 		set(EIGEN_CFLAGS "-msse2")
 	endif()
 
-	if(NOT DEFINED LINMATH_ALIGN)
+	if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND)
+		unset(BUILD_EIGEN_VECTORIZATION)
+	elseif(CONFIG_DISABLE_EVERYTHING)
+		set(BUILD_EIGEN_VECTORIZATION OFF CACHE BOOL "If on, vectorization is enabled in build.")
+	endif()
+
+	if(NOT DEFINED BUILD_EIGEN_VECTORIZATION)
 		message(STATUS "+   (vectorization enabled in build)")
 	endif()
-	set(LINMATH_ALIGN ON CACHE BOOL "If on, vectorization is enabled in build.")
+
+	set(BUILD_EIGEN_VECTORIZATION ON CACHE BOOL "If on, vectorization is enabled in build.")
+
+	if(BUILD_EIGEN_VECTORIZATION)
+		set(LINMATH_ALIGN TRUE)
+	endif()
 else()
-	unset(LINMATH_ALIGN CACHE)
+	unset(BUILD_EIGEN_VECTORIZATION CACHE)
 endif()
 
 # Find and configure OpenSSL library
@@ -45,13 +56,21 @@ find_package(OpenSSL QUIET COMPONENTS ssl crypto)
 mangle_package(OpenSSL)
 config_package(OPENSSL COMMENT "OpenSSL")
 if(HAVE_OPENSSL)
+	if(CONFIG_ENABLE_EVERYTHING OR CONFIG_ENABLE_FOUND)
+		unset(BUILD_OPENSSL_ERROR_REPORTS)
+	endif()
+
 	if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 4)
-		set(REPORT_OPENSSL_ERRORS ON CACHE BOOL "If on, OpenSSL reports verbose error messages when they occur.")
+		set(BUILD_OPENSSL_ERROR_REPORTS ON CACHE BOOL "If on, OpenSSL reports verbose error messages when they occur.")
 	else()
-		set(REPORT_OPENSSL_ERRORS OFF CACHE BOOL "If on, OpenSSL reports verbose error messages when they occur.")
+		set(BUILD_OPENSSL_ERROR_REPORTS OFF CACHE BOOL "If on, OpenSSL reports verbose error messages when they occur.")
+	endif()
+
+	if(BUILD_OPENSSL_ERROR_REPORTS)
+		set(REPORT_OPENSSL_ERRORS TRUE)
 	endif()
 else()
-	unset(REPORT_OPENSSL_ERRORS CACHE)
+	unset(BUILD_OPENSSL_ERROR_REPORTS CACHE)
 endif()
 
 # Find and configure JPEG library
@@ -137,7 +156,6 @@ endif()
 #find_package(SpeedTree)
 #config_package(SPEEDTREE COMMENT "SpeedTree")
 
-
 # Find and configure WxWidgets
 #find_package(WxWidgets)
 #config_package(WX COMMENT "WxWidgets")
@@ -273,28 +291,36 @@ set(USE_THREADS TRUE CACHE BOOL "If true, compile Panda3D with threading support
 if(USE_THREADS)
 	set(HAVE_THREADS TRUE)
 else()
-	unset(SIMPLE_THREADS CACHE)
-	unset(OS_SIMPLE_THREADS CACHE)
+	unset(BUILD_SIMPLE_THREADS CACHE)
+	unset(BUILD_OS_SIMPLE_THREADS CACHE)
 endif()
 
 # Configure debug threads
 if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 3)
-	set(DEBUG_THREADS ON CACHE BOOL "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)")
+	set(BUILD_DEBUG_THREADS ON CACHE BOOL "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)")
 else()
-	set(DEBUG_THREADS OFF CACHE BOOL "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)")
+	set(BUILD_DEBUG_THREADS OFF CACHE BOOL "If on, enables debugging of thread and sync operations (i.e. mutexes, deadlocks)")
+endif()
+if(BUILD_DEBUG_THREADS)
+	set(DEBUG_THREADS TRUE)
 endif()
 
 # Add advanced threading configuration
 if(HAVE_THREADS)
-	set(SIMPLE_THREADS FALSE CACHE BOOL "If true, compile with simulated threads.")
-	if(SIMPLE_THREADS)
+	set(BUILD_SIMPLE_THREADS FALSE CACHE BOOL "If true, compile with simulated threads.")
+	if(BUILD_SIMPLE_THREADS)
 		message(STATUS "Compilation will include simulated threading support.")
-		set(OS_SIMPLE_THREADS TRUE CACHE BOOL "If true, OS threading constructs will be used to perform context switches.")
+		set(BUILD_OS_SIMPLE_THREADS TRUE CACHE BOOL "If true, OS threading constructs will be used to perform context switches.")
+
+		set(SIMPLE_THREADS TRUE)
+		if(BUILD_OS_SIMPLE_THREADS)
+			set(OS_SIMPLE_THREADS TRUE)
+		endif()
 	else()
-		unset(OS_SIMPLE_THREADS CACHE)
+		unset(BUILD_OS_SIMPLE_THREADS CACHE)
 
-		set(DO_PIPELINING TRUE CACHE BOOL "If true, compile with pipelined rendering.")
-		if(DO_PIPELINING)
+		set(BUILD_PIPELINING TRUE CACHE BOOL "If true, compile with pipelined rendering.")
+		if(BUILD_PIPELINING)
 			message(STATUS "Compilation will include full, pipelined threading support.")
 		else()
 			message(STATUS "Compilation will include nonpipelined threading support.")
@@ -318,24 +344,30 @@ if(NOT WIN32)
 		set(CMAKE_CXX_FLAGS_RELEASE "-pthread")
 		set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-pthread")
 		set(CMAKE_CXX_FLAGS_MINSIZEREL "-pthread")
+
+		mark_as_advanced(PTHREAD_IPATH)
 	endif()
 endif()
 
 
 ### Configure pipelining ###
-if(NOT DEFINED DO_PIPELINING)
+if(NOT DEFINED BUILD_PIPELINING)
 	if(NOT DEFINED OPTIMIZE OR OPTIMIZE LESS 2)
-		set(DO_PIPELINING TRUE CACHE BOOL "If true, compile with pipelined rendering.")
+		set(BUILD_PIPELINING TRUE CACHE BOOL "If true, compile with pipelined rendering.")
 	else()
-		set(DO_PIPELINING FALSE CACHE BOOL "If true, compile with pipelined rendering.")
+		set(BUILD_PIPELINING FALSE CACHE BOOL "If true, compile with pipelined rendering.")
 	endif()
 endif()
+if(BUILD_PIPELINING)
+	set(DO_PIPELINING TRUE)
+endif()
 
 ### Configure OS X options ###
 if(OSX_PLATFORM)
-	set(UNIVERSIAL_BINARIES TRUE CACHE BOOL "If true, compiling will create universal OS X binaries.")
-	if(UNIVERSAL_BINARIES)
+	set(BUILD_UNIVERSIAL_BINARIES TRUE CACHE BOOL "If true, compiling will create universal OS X binaries.")
+	if(BUILD_UNIVERSAL_BINARIES)
 		message(STATUS "Compilation will create universal binaries.")
+		set(UNIVERSAL_BINARIES TRUE)
 	else()
 		message(STATUS "Compilation will not create universal binaries.")
 	endif()